Skip to content

Commit 588e980

Browse files
committed
Rename encryption status
1 parent 3c3cf97 commit 588e980

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

tests/test_bidstream_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_token_expiry_custom_decryption_time(self): #TokenExpiryAndCustomNow
249249
created_at=created_at, expires_at=expires_at)
250250
result = self._client._decrypt_token_into_raw_uid(token, None, expires_at + dt.timedelta(seconds=1))
251251
self.assertFalse(result.success)
252-
self.assertEqual(result.status, DecryptionStatus.TOKEN_EXPIRED)
252+
self.assertEqual(result.status, DecryptionStatus.EXPIRED_TOKEN)
253253
self.assertEqual(result.expiry, expires_at)
254254

255255
result = self._client._decrypt_token_into_raw_uid(token, None, expires_at - dt.timedelta(seconds=1))

tests/test_sharing_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def test_expiry_in_token_matches_expiry_in_response(self): # ExpiryInTokenMatch
278278

279279
future_decryption_result = self._client._decrypt_token_into_raw_uid(encryption_data_response.encrypted_data, now + dt.timedelta(seconds=3))
280280
self.assertFalse(future_decryption_result.success)
281-
self.assertEqual(DecryptionStatus.TOKEN_EXPIRED, future_decryption_result.status)
281+
self.assertEqual(DecryptionStatus.EXPIRED_TOKEN, future_decryption_result.status)
282282
self.assertEqual(now + dt.timedelta(seconds=2), future_decryption_result.expiry)
283283

284284
def test_encrypt_key_expired(self): #EncryptKeyExpired

uid2_client/decryption_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ class DecryptionStatus(Enum):
1010
NOT_AUTHORIZED_FOR_MASTER_KEY = "not authorized for master key"
1111
NOT_INITIALIZED = "keys not initialized"
1212
SUCCESS = "success"
13-
TOKEN_EXPIRED = "token expired"
13+
EXPIRED_TOKEN = "token expired"
1414
VERSION_NOT_SUPPORTED = "token version not supported"

uid2_client/encryption.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def _decrypt_token_v2(token_bytes, keys, domain_name, client_type, now):
157157
expires_ms = int.from_bytes(master_payload[:8], 'big')
158158
expires = dt.datetime.fromtimestamp(expires_ms / 1000.0, tz=timezone.utc)
159159
if expires < now:
160-
return DecryptedToken(DecryptionStatus.TOKEN_EXPIRED, None, None, None, None,
161-
keys.get_identity_scope(), None, AdvertisingTokenVersion.ADVERTISING_TOKEN_V2, False, expires)
160+
return DecryptedToken(DecryptionStatus.EXPIRED_TOKEN, None, None, None, None,
161+
keys.get_identity_scope(), None, AdvertisingTokenVersion.ADVERTISING_TOKEN_V2, False, expires)
162162

163163
site_key_id = int.from_bytes(master_payload[8:12], 'big')
164164
site_key = keys.get(site_key_id)
@@ -209,8 +209,8 @@ def _decrypt_token_v3(token_bytes, keys, domain_name, client_type, now, token_ve
209209
expires_ms = int.from_bytes(master_payload[:8], 'big')
210210
expires = dt.datetime.fromtimestamp(expires_ms / 1000.0, tz=timezone.utc)
211211
if expires < now:
212-
return DecryptedToken(DecryptionStatus.TOKEN_EXPIRED, None, None, None, None,
213-
keys.get_identity_scope(), identity_type, token_version, None, expires)
212+
return DecryptedToken(DecryptionStatus.EXPIRED_TOKEN, None, None, None, None,
213+
keys.get_identity_scope(), identity_type, token_version, None, expires)
214214

215215
# created 8:16
216216
# operator site id 16:20

0 commit comments

Comments
 (0)