@@ -20,7 +20,7 @@ def test_smoke_test(self, mock_refresh_sharing_keys): # SmokeTest
2020 token = generate_uid_token (expected_scope , expected_version )
2121 mock_refresh_sharing_keys .return_value = create_key_collection (expected_scope )
2222 self ._client .refresh_keys ()
23- decrypted = self ._client .decrypt_sharing_token_into_raw_uid (token )
23+ decrypted = self ._client .decrypt_token_into_raw_uid (token )
2424 self .assertEqual (decrypted .identity_scope , expected_scope )
2525 self .assertEqual (decrypted .advertising_token_version , expected_version )
2626
@@ -35,7 +35,7 @@ def test_token_lifetime_too_long_for_sharing(self, mock_refresh_sharing_keys):
3535 99999 , 86400 , max_sharing_lifetime )
3636 self ._client .refresh_keys ()
3737 with self .assertRaises (EncryptionError ) as context :
38- self ._client .decrypt_sharing_token_into_raw_uid (token )
38+ self ._client .decrypt_token_into_raw_uid (token )
3939 self .assertEqual ('invalid token lifetime' , str (context .exception ))
4040
4141 def test_token_generated_in_the_future_to_simulate_clock_skew (self , mock_refresh_sharing_keys ): # TokenGeneratedInTheFutureToSimulateClockSkew
@@ -48,7 +48,7 @@ def test_token_generated_in_the_future_to_simulate_clock_skew(self, mock_refresh
4848 99999 , 86400 )
4949 self ._client .refresh_keys ()
5050 with self .assertRaises (EncryptionError ) as context :
51- self ._client .decrypt_sharing_token_into_raw_uid (token )
51+ self ._client .decrypt_token_into_raw_uid (token )
5252 self .assertEqual ('invalid token lifetime' , str (context .exception ))
5353
5454 def test_token_generated_in_the_future_within_allowed_clock_skew (self , mock_refresh_sharing_keys ): # TokenGeneratedInTheFutureWithinAllowedClockSkew
@@ -60,7 +60,7 @@ def test_token_generated_in_the_future_within_allowed_clock_skew(self, mock_refr
6060 expected_scope , site_id , 1 ,
6161 99999 , 86400 )
6262 self ._client .refresh_keys ()
63- result = self ._client .decrypt_sharing_token_into_raw_uid (token )
63+ result = self ._client .decrypt_token_into_raw_uid (token )
6464 self .assertIsNotNone (result )
6565 self .assertEqual (result .identity_scope , expected_scope )
6666 self .assertEqual (result .advertising_token_version , expected_version )
@@ -74,7 +74,7 @@ def test_phone_uids(self, mock_refresh_sharing_keys): # PhoneTest
7474 self ._client .refresh_keys ()
7575 token = generate_uid_token (expected_scope , expected_version , phone_uid )
7676 self .assertEqual (IdentityType .Phone , get_identity_type (token ))
77- result = self ._client .decrypt_sharing_token_into_raw_uid (token )
77+ result = self ._client .decrypt_token_into_raw_uid (token )
7878 self .assertIsNotNone (result )
7979 self .assertEqual (result .uid2 , phone_uid )
8080 self .assertEqual (result .identity_scope , expected_scope )
@@ -86,25 +86,25 @@ def test_sharing_client_produces_uid2_token(self, mock_refresh_keys_util): #Cli
8686 mock_refresh_keys_util .return_value = self ._key_collection
8787 self ._client .refresh_keys ()
8888
89- token = self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
89+ token = self ._client .encrypt_raw_uid_into_token (example_uid )
9090 self .assertEqual ("A" , token [0 ])
9191
9292 def test_sharing_client_produces_euid_token (self , mock_refresh_keys_util ): #ClientProducesTokenWithCorrectPrefix
9393 mock_refresh_keys_util .return_value = create_key_collection (IdentityScope .EUID )
9494 self ._client .refresh_keys ()
9595
96- token = self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
96+ token = self ._client .encrypt_raw_uid_into_token (example_uid )
9797 self .assertEqual ("E" , token [0 ])
9898
9999 def test_encrypt_decrypt (self , mock_refresh_sharing_keys ): #CanEncryptAndDecryptForSharing
100100 key_collection = self ._key_collection
101101 mock_refresh_sharing_keys .return_value = key_collection
102102
103103 self ._client .refresh_keys ()
104- sharing_token = self ._client .encrypt_raw_uid_into_sharing_token (example_uid , key_collection .get_default_keyset_id ())
104+ sharing_token = self ._client .encrypt_raw_uid_into_token (example_uid , key_collection .get_default_keyset_id ())
105105 self .assertIsNotNone (sharing_token )
106106 self .assertIsInstance (sharing_token , str )
107- result = self ._client .decrypt_sharing_token_into_raw_uid (sharing_token )
107+ result = self ._client .decrypt_token_into_raw_uid (sharing_token )
108108 self .assertEqual (example_uid , result .uid2 )
109109 mock_refresh_sharing_keys .assert_called_once ()
110110
@@ -113,35 +113,35 @@ def test_can_decrypt_another_clients_encrypted_token(self, mock_refresh_keys_uti
113113 sending_client = SharingClient (self ._CONST_BASE_URL , self ._CONST_API_KEY , client_secret )
114114 sending_client .refresh_keys ()
115115
116- token = sending_client .encrypt_raw_uid_into_sharing_token (example_uid )
116+ token = sending_client .encrypt_raw_uid_into_token (example_uid )
117117
118118 receiving_client = SharingClient (self ._CONST_BASE_URL , self ._CONST_API_KEY , client_secret )
119119 receiving_client .refresh_keys ()
120120
121- result = receiving_client .decrypt_sharing_token_into_raw_uid (token )
121+ result = receiving_client .decrypt_token_into_raw_uid (token )
122122 self .assertEqual (example_uid , result .uid2 )
123123
124124 def test_sharing_token_is_v4 (self , mock_refresh_keys_util ):
125125 mock_refresh_keys_util .return_value = self ._key_collection
126126 self ._client .refresh_keys ()
127127
128- token = self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
128+ token = self ._client .encrypt_raw_uid_into_token (example_uid )
129129 contains_base_64_special_chars = "+" in token or "/" in token or "=" in token
130130 self .assertFalse (contains_base_64_special_chars )
131131
132132 def test_raw_uid_produces_correct_identity_type_in_token (self , mock_refresh_keys_util ): #RawUidProducesCorrectIdentityTypeInToken
133133 mock_refresh_keys_util .return_value = self ._key_collection
134134 self ._client .refresh_keys ()
135135
136- self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_sharing_token (
136+ self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_token (
137137 "Q4bGug8t1xjsutKLCNjnb5fTlXSvIQukmahYDJeLBtk=" )))
138- self .assertEqual (IdentityType .Phone , get_identity_type (self ._client .encrypt_raw_uid_into_sharing_token (
138+ self .assertEqual (IdentityType .Phone , get_identity_type (self ._client .encrypt_raw_uid_into_token (
139139 "BEOGxroPLdcY7LrSiwjY52+X05V0ryELpJmoWAyXiwbZ" )))
140- self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_sharing_token (
140+ self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_token (
141141 "oKg0ZY9ieD/CGMEjAA0kcq+8aUbLMBG0MgCT3kWUnJs=" )))
142- self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_sharing_token (
142+ self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_token (
143143 "AKCoNGWPYng/whjBIwANJHKvvGlGyzARtDIAk95FlJyb" )))
144- self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_sharing_token (
144+ self .assertEqual (IdentityType .Email , get_identity_type (self ._client .encrypt_raw_uid_into_token (
145145 "EKCoNGWPYng/whjBIwANJHKvvGlGyzARtDIAk95FlJyb" )))
146146
147147 def test_multiple_keys_per_keyset (self , mock_refresh_keys_util ): # MultipleKeysPerKeyset
@@ -151,9 +151,9 @@ def get_post_refresh_keys_response_with_multiple_keys():
151151 mock_refresh_keys_util .return_value = get_post_refresh_keys_response_with_multiple_keys ()
152152 self ._client .refresh_keys ()
153153
154- sharing_token = self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
154+ sharing_token = self ._client .encrypt_raw_uid_into_token (example_uid )
155155
156- result = self ._client .decrypt_sharing_token_into_raw_uid (sharing_token )
156+ result = self ._client .decrypt_token_into_raw_uid (sharing_token )
157157 self .assertEqual (example_uid , result .uid2 )
158158
159159 def test_cannot_encrypt_if_no_key_from_default_keyset (self , mock_refresh_keys_util ): #CannotEncryptIfNoKeyFromTheDefaultKeyset
@@ -164,7 +164,7 @@ def get_post_refresh_keys_response_with_no_default_keyset_key():
164164 self ._client .refresh_keys ()
165165
166166 with self .assertRaises (EncryptionError ) as context :
167- self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
167+ self ._client .encrypt_raw_uid_into_token (example_uid )
168168 self .assertEqual ('No Keyset Key Found' , str (context .exception ))
169169
170170 def test_cannot_encrypt_if_theres_no_default_keyset_header (self , mock_refresh_keys_util ): #CannotEncryptIfTheresNoDefaultKeysetHeader
@@ -177,17 +177,17 @@ def get_post_refresh_keys_response_with_no_default_keyset_header():
177177 self ._client .refresh_keys ()
178178
179179 with self .assertRaises (EncryptionError ) as context :
180- self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
180+ self ._client .encrypt_raw_uid_into_token (example_uid )
181181 self .assertEqual ('No Keyset Key Found' , str (context .exception ))
182182
183183 def test_expiry_in_token_matches_expiry_in_response (self , mock_refresh_keys_util ): # ExpiryInTokenMatchesExpiryInResponse
184184
185185 mock_refresh_keys_util .return_value = create_default_key_collection ([master_key , site_key ])
186186 self ._client .refresh_keys ()
187- token = self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
188- self ._client .decrypt_sharing_token_into_raw_uid (token , now + dt .timedelta (seconds = 1 ))
187+ token = self ._client .encrypt_raw_uid_into_token (example_uid )
188+ self ._client .decrypt_token_into_raw_uid (token , now + dt .timedelta (seconds = 1 ))
189189 with self .assertRaises (EncryptionError ) as context :
190- self ._client .decrypt_sharing_token_into_raw_uid (token , now + dt .timedelta (seconds = 3 ))
190+ self ._client .decrypt_token_into_raw_uid (token , now + dt .timedelta (seconds = 3 ))
191191 self .assertEqual ('token expired' , str (context .exception ))
192192
193193 def test_encrypt_key_inactive (self , mock_refresh_keys_util ): #EncryptKeyInactive
@@ -200,7 +200,7 @@ def get_post_refresh_keys_response_with_key_inactive():
200200 self ._client .refresh_keys ()
201201
202202 with self .assertRaises (EncryptionError ) as context :
203- self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
203+ self ._client .encrypt_raw_uid_into_token (example_uid )
204204 self .assertEqual ('No Keyset Key Found' , str (context .exception ))
205205
206206 def test_encrypt_key_expired (self , mock_refresh_keys_util ): #EncryptKeyExpired
@@ -213,7 +213,7 @@ def get_post_refresh_keys_response_with_key_expired():
213213 self ._client .refresh_keys ()
214214
215215 with self .assertRaises (EncryptionError ) as context :
216- self ._client .encrypt_raw_uid_into_sharing_token (example_uid )
216+ self ._client .encrypt_raw_uid_into_token (example_uid )
217217 self .assertEqual ('No Keyset Key Found' , str (context .exception ))
218218
219219 def test_refresh_keys (self , mock_refresh_sharing_keys ):
0 commit comments