Skip to content

Commit 7a6848e

Browse files
committed
Update readme instructions
1 parent e7ddec1 commit 7a6848e

File tree

1 file changed

+39
-20
lines changed

1 file changed

+39
-20
lines changed

README.md

Lines changed: 39 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pusher_client = pusher.Pusher(app_id, key, secret, cluster=u'cluster')
8686
|host `String` | **Default:`None`** <br> The host to connect to |
8787
|port `int` | **Default:`None`** <br>Which port to connect to |
8888
|ssl `bool` | **Default:`True`** <br> Use HTTPS |
89-
|encryption_master_key `String` | **Default:`None`** <br> The encryption master key for End-to-end Encryption |
89+
|encryption_master_key_base64 `String` | **Default:`None`** *deprecated* <br> The encryption master key for End-to-end Encryption |
9090
|backend `Object` | an object that responds to the `send_request(request)` method. If none is provided, a `pusher.requests.RequestsBackend` instance is created. |
9191
|json_encoder `Object` | **Default: `None`**<br> Custom JSON encoder. |
9292
|json_decoder `Object` | **Default: `None`**<br> Custom JSON decoder.
@@ -287,32 +287,51 @@ auth = pusher_client.authenticate(
287287

288288
## End to End Encryption (Beta)
289289

290-
This library supports end to end encryption of your private channels. This means that only you and your connected clients will be able to read your messages. Pusher cannot decrypt them. You can enable this feature by following these steps:
290+
This library supports end to end encryption of your private channels. This
291+
means that only you and your connected clients will be able to read your
292+
messages. Pusher cannot decrypt them. You can enable this feature by following
293+
these steps:
291294

292-
1. You should first set up Private channels. This involves [creating an authentication endpoint on your server](https://pusher.com/docs/authenticating_users).
295+
1. You should first set up Private channels. This involves [creating an
296+
authentication endpoint on your
297+
server](https://pusher.com/docs/authenticating_users).
293298

294-
2. Next, Specify your 32 character `encryption_master_key`. This is secret and you should never share this with anyone. Not even Pusher.
299+
2. Next, generate a 32 byte master encryption key, base64 encode it and store
300+
it securely.
295301

296-
```python
302+
This is secret and you should never share this with anyone. Not even Pusher.
297303

298-
import pusher
304+
To generate a suitable key from a secure random source, you could use:
299305

300-
pusher_client = pusher.Pusher(
301-
app_id='yourappid',
302-
key='yourkey',
303-
secret='yoursecret',
304-
encryption_master_key='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
305-
cluster='yourclustername',
306-
ssl=True
307-
)
306+
```bash
307+
openssl rand -base64 32
308+
```
308309

309-
pusher_client.trigger('private-encrypted-my-channel', 'my-event', {
310-
'message': 'hello world'
311-
})
312-
```
313-
3. Channels where you wish to use end to end encryption must be prefixed with `private-encrypted-`.
310+
3. Pass your master key to the SDK constructor
311+
312+
```python
313+
import pusher
314+
315+
pusher_client = pusher.Pusher(
316+
app_id='yourappid',
317+
key='yourkey',
318+
secret='yoursecret',
319+
encryption_master_key_base64='<output from command above>',
320+
cluster='yourclustername',
321+
ssl=True
322+
)
323+
324+
pusher_client.trigger('private-encrypted-my-channel', 'my-event', {
325+
'message': 'hello world'
326+
})
327+
```
328+
329+
4. Channels where you wish to use end to end encryption must be prefixed with
330+
`private-encrypted-`.
314331

315-
4. Subscribe to these channels in your client, and you're done! You can verify it is working by checking out the debug console on the https://dashboard.pusher.com/ and seeing the scrambled ciphertext.
332+
5. Subscribe to these channels in your client, and you're done! You can verify
333+
it is working by checking out the debug console on the
334+
https://dashboard.pusher.com/ and seeing the scrambled ciphertext.
316335

317336
**Important note: This will not encrypt messages on channels that are not prefixed by private-encrypted-.**
318337

0 commit comments

Comments
 (0)