Skip to content

Refactoring UserIdentity logics #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 873 commits into
base: syw-UID2-4159-token-gen-code-renaming
Choose a base branch
from

Conversation

sunnywu
Copy link
Contributor

@sunnywu sunnywu commented Oct 16, 2024

  1. Read changes here first
  2. Removed the UserIdentity's refreshedAt field as that's redundant and currently set to the same value as the AdvertisingTokenInput/RefreshTokenInput#createdAt timestamp.
  3. Renamed some token variable names to adTokenInput and refreshTokenInput to make it clearer
  4. Removed privacyBits and establishedAt from UserIdentity/HashedDiidentity/RawUidIdentity but only kept inside FirstLevelHashIdentity - these fields are only relevant when a first level hash is generated for token generation and then passed along into ad token/refresh token generation logic.
  5. As a result, privacyBits and establishedAt are generated from either a. in a brand new token generation call (by default should be 1 and the timestamp at the time of the call) b. or, during token refresh logic, these fields will be inherited from previous refresh token.
  6. RefreshTokenInput, AdvertisingTokenInput and IdentityRequest will now require to store privacyBits and establishedAt itself as a compromise.
  7. generateIdentity will now take in a privacyBits param.
  8. Updated a lot of codes as a result (more refinement required such as not hardcoding the "1, Instant.now()" in a lot of places)
  9. Created verifyFirstLevelHashIdentityAndEstablishedAt method for verifying FirstLevelHashIdentity and added more checks for FirstLevel and check the correctness of raw Uid/First level hash in various unit tests
  10. Added PrivacyBitsTest/IdentityResponseTest/RawUidResponseTest classes and added some extra check for firstLevelHash in existing tests
  11. Replace privacy bits type to PrivacyBits class instance

@sunnywu sunnywu changed the title 1. Refactoring UserIdentity logics Oct 16, 2024
@sunnywu sunnywu changed the base branch from syw-UID2-4159-token-gen-code-refactoring to syw-UID2-4159-token-gen-code-renaming October 16, 2024 07:56
@sunnywu sunnywu changed the base branch from syw-UID2-4159-token-gen-code-renaming to syw-UID2-4159-token-gen-code-refactoring October 16, 2024 07:56
@sunnywu sunnywu changed the base branch from syw-UID2-4159-token-gen-code-refactoring to syw-UID2-4159-token-gen-code-renaming October 22, 2024 00:42
@@ -3,6 +3,9 @@

public class PrivacyBits {

// For historical reason this bit is set
public static final int DEFAULT_PRIVACY_BIT_VALUE = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be PrivacyBits instead?

    public static final PrivacyBits DEFAULT = PrivacyBits.fromInt(1);

Copy link
Contributor Author

@sunnywu sunnywu Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed all uses of int PrivacyBits and use PrivacyBits class instead. Added unit tests to test the class

@sunnywu sunnywu force-pushed the syw-UID2-4159-token-gen-code-refactoring-UserIdentity branch from 78a70d4 to a8f0915 Compare December 10, 2024 06:44
lizk886 and others added 30 commits July 8, 2025 11:44
…251829738723549

[CI Pipeline] Released Patch version: 5.56.36
* Reduce the log entries in var/log/operator.log for private operator
* Add debugging message

* Remove allow_environment_variable_dropping flip

* [CI Pipeline] Released Snapshot version: 5.56.40-alpha-257-SNAPSHOT

---------

Co-authored-by: Release Workflow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.