pusher / pusher-http-ruby

Ruby library for Pusher Channels HTTP API
https://pusher.com/channels
MIT License
664 stars 123 forks source link

Authentication for encrypted channels #163

Closed Benjaminpjacobs closed 4 years ago

Benjaminpjacobs commented 4 years ago

The http-ruby gem currently has the ability to transmit encrypted messages but not the ability to authenticate an encrypted channels. These channels subscriptions needs to include a step that generates and packages the shared secret that the client will use to decrypt any future messages on that channel.

This PR adds some simple methods and logic to pass the shared_secret attribute to the frontend in the case that the channel is prefixed with the encrypted keyword.

Only in the instance where the channel name has the private-encrypted prefix will the shared_secret key be generated/included. Additionally in the instance there is no encryption_master_key instance variable but the channel is prefixed with encrypted the gem will return nil for the shared_secret attribute.

Benjaminpjacobs commented 4 years ago

Hey @callum-oakley - not exactly sure who to tag here - but since you were the most recent contributor I was hoping you might be able to take a look at these changes?

callum-oakley commented 4 years ago

@Benjaminpjacobs good catch, can't quite believe I missed this. 🤦

Thanks! I'll cut a new release shortly.

callum-oakley commented 4 years ago

published as 1.4.2