Skip to content

Commit 2204c6a

Browse files
committed
Rename fields to align with other SDKs
1 parent 574cd19 commit 2204c6a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

tests/test_encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def test_smoke_token_v3(self):
418418
token_expiry = now + dt.timedelta(days=30) if keys.get_token_expiry_seconds() is None \
419419
else now + dt.timedelta(seconds=int(keys.get_token_expiry_seconds()))
420420
result = UID2TokenGenerator.generate_uid2_token_v3(uid2, _master_key, _site_id, _site_key,
421-
Params(expiry=token_expiry, token_created_at=now))
421+
Params(expiry=token_expiry, token_generated_at=now))
422422
final = decrypt(result, keys, now=now)
423423

424424
self.assertEqual(uid2, final.uid)

uid2_client/encryption.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def encrypt(uid2, identity_scope, keys, keyset_id=None, **kwargs):
286286
if identity_scope is None:
287287
identity_scope = keys.get_identity_scope()
288288
try:
289-
params = Params(expiry=token_expiry, identity_scope=identity_scope, token_created_at=now)
289+
params = Params(expiry=token_expiry, identity_scope=identity_scope, token_generated_at=now)
290290
return EncryptionDataResponse.make_success(UID2TokenGenerator.generate_uid2_token_v4(uid2, master_key, site_id, key, params))
291291
except Exception:
292292
return EncryptionDataResponse.make_error(EncryptionStatus.ENCRYPTION_FAILURE)

uid2_client/uid2_token_generator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def _encrypt_data_v1(data, key, iv):
5151

5252
class Params:
5353
def __init__(self, expiry=dt.datetime.now(tz=timezone.utc) + dt.timedelta(hours=1),
54-
identity_scope=IdentityScope.UID2.value, token_created_at=dt.datetime.now(tz=timezone.utc)):
54+
identity_scope=IdentityScope.UID2.value, token_generated_at=dt.datetime.now(tz=timezone.utc)):
5555
self.identity_scope = identity_scope
5656
self.token_expiry = expiry
57-
self.token_created_at = token_created_at
57+
self.token_generated_at = token_generated_at
5858
if not isinstance(expiry, dt.datetime):
5959
self.token_expiry = dt.datetime.now(tz=timezone.utc) + expiry
6060

@@ -73,7 +73,7 @@ def generate_uid2_token_v2(id_str, master_key, site_id, site_key, params = defau
7373
identity += id
7474
# old privacy_bits
7575
identity += int.to_bytes(0, 4, 'big')
76-
created = params.token_created_at
76+
created = params.token_generated_at
7777
identity += int.to_bytes(int(created.timestamp()) * 1000, 8, 'big')
7878
identity_iv = bytes([10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9])
7979
expiry = params.token_expiry
@@ -102,7 +102,7 @@ def generate_uid_token(id_str, master_key, site_id, site_key, identity_scope, to
102102
params = default_params()
103103
params.identity_scope = identity_scope
104104
if created_at is not None:
105-
params.token_created_at = created_at
105+
params.token_generated_at = created_at
106106
if expires_at is not None:
107107
params.token_expiry = expires_at
108108
if token_version == AdvertisingTokenVersion.ADVERTISING_TOKEN_V2:
@@ -123,7 +123,7 @@ def generate_uid2_token_with_debug_info(id_str, master_key, site_id, site_key, p
123123
site_payload += int.to_bytes(0, 4, 'big') # client key id
124124

125125
site_payload += int.to_bytes(0, 4, 'big') # privacy bits
126-
created = params.token_created_at
126+
created = params.token_generated_at
127127
site_payload += int.to_bytes(int(created.timestamp()) * 1000, 8, 'big') # established
128128
site_payload += int.to_bytes(int(created.timestamp()) * 1000, 8, 'big') # refreshed
129129
site_payload += id

0 commit comments

Comments
 (0)