Skip to content

uid2: add refreshUid2Token protocol client - #328

Open
mosherBT wants to merge 3 commits into
masterfrom
uid2-refresh-addon
Open

uid2: add refreshUid2Token protocol client#328
mosherBT wants to merge 3 commits into
masterfrom
uid2-refresh-addon

Conversation

@mosherBT

@mosherBT mosherBT commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Why

UID2 tokens expire and must be refreshed client-side against the UID2 operator. web-sdk has no refresh client; refreshUid2Token is duplicated in 18 solutions bundles.

UID2 documentation reference for this API - https://unifiedid.com/docs/endpoints/post-token-refresh

What Changed

  • addons: new lib/addons/uid2-refresh.ts exporting refreshUid2Token(refreshToken, refreshResponseKey) — POSTs the refresh token to the UID2 operator, AES-GCM-decrypts the response (12-byte nonce prefix, refresh_response_key), returns the body or null on non-OK / opt-out / missing advertising_token. Malformed responses throw; error policy stays with the caller.
  • addons: Uid2RefData type — the response body and the _ref shape on cached EIDs.

How to Test

Unit tests cover a webcrypto round-trip, raw-body POST, non-OK, opt-out, missing token, and undecryptable payload.

  • Tested
  • Docs updated

Notes

  • First of three PRs for the addon: protocol client, then cache apply, then the refreshStaleUid2s orchestrator.

  • Breaking change

  • Requires release

@mosherBT
mosherBT requested review from a team as code owners August 24, 2026 19:50
@mosherBT mosherBT self-assigned this Aug 24, 2026
Comment thread lib/addons/uid2-refresh.ts Outdated
Comment thread lib/addons/uid2-refresh.ts
@etiennelatendresse-optable

Copy link
Copy Markdown
Contributor

Other addons had an update to the README.md. We probably want one here also

Comment thread lib/addons/uid2-refresh.ts Outdated
Comment thread lib/addons/uid2-refresh.ts Outdated
@mosherBT

mosherBT commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Other addons had an update to the README.md. We probably want one here also

Will do this when feature is full ready. More PRs will follow

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.

2 participants