File tree Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Expand file tree Collapse file tree 4 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 1+ ## 0.3.3 (2016-05-17)
2+ bug: force key string encoding to utf8
3+
14## 0.3.2 (2016-04-28)
25bug: fix setup.py issues
36
Original file line number Diff line number Diff line change @@ -68,11 +68,13 @@ def __init__(self, subscription_info):
6868 for k in ['p256dh' , 'auth' ]:
6969 if keys .get (k ) is None :
7070 raise WebPushException ("Missing keys value: %s" , k )
71- receiver_raw = base64 .urlsafe_b64decode (self ._repad (keys ['p256dh' ]))
71+ receiver_raw = base64 .urlsafe_b64decode (
72+ self ._repad (keys ['p256dh' ].encode ('utf8' )))
7273 if len (receiver_raw ) != 65 and receiver_raw [0 ] != "\x04 " :
7374 raise WebPushException ("Invalid p256dh key specified" )
7475 self .receiver_key = receiver_raw
75- self .auth_key = base64 .urlsafe_b64decode (self ._repad (keys ['auth' ]))
76+ self .auth_key = base64 .urlsafe_b64decode (
77+ self ._repad (keys ['auth' ].encode ('utf8' )))
7678
7779 def _repad (self , str ):
7880 """Add base64 padding to the end of a string, if required"""
@@ -96,7 +98,7 @@ def encode(self, data):
9698 server_key_id = base64 .urlsafe_b64encode (server_key .get_pubkey ()[1 :])
9799
98100 # http_ece requires that these both be set BEFORE encrypt or
99- # decrypt is called.
101+ # decrypt is called if you specify the key as "dh" .
100102 http_ece .keys [server_key_id ] = server_key
101103 http_ece .labels [server_key_id ] = "P-256"
102104
Original file line number Diff line number Diff line change @@ -24,11 +24,11 @@ def _gen_subscription_info(self, recv_key):
2424 def test_init (self ):
2525 # use static values so we know what to look for in the reply
2626 subscription_info = {
27- "endpoint" : "https://example.com/" ,
28- "keys" : {
29- "p256dh" : ("BOrnIslXrUow2VAzKCUAE4sIbK00daEZCswOcf8m3T"
30- "F8V82B-OpOg5JbmYLg44kRcvQC1E2gMJshsUYA-_zMPR8" ),
31- "auth" : "k8JV6sjdbhAi1n3_LDBLvA"
27+ u "endpoint" : u "https://example.com/" ,
28+ u "keys" : {
29+ u "p256dh" : (u "BOrnIslXrUow2VAzKCUAE4sIbK00daEZCswOcf8m3T"
30+ "F8V82B-OpOg5JbmYLg44kRcvQC1E2gMJshsUYA-_zMPR8" ),
31+ u "auth" : u "k8JV6sjdbhAi1n3_LDBLvA"
3232 }
3333 }
3434 self .assertRaises (
Original file line number Diff line number Diff line change 33
44from setuptools import find_packages , setup
55
6- __version__ = "0.3.2 "
6+ __version__ = "0.3.3 "
77
88
99def read_from (file ):
You can’t perform that action at this time.
0 commit comments