Skip to content
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

UID2: support Client-side token generation and build tag #10510

Merged
merged 44 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
343f855
Add CSTG to common module
jingyi-gao-ttd Sep 6, 2023
89bedd3
Add generateToken calls
jingyi-gao-ttd Sep 11, 2023
eb1700b
Fix bug
jingyi-gao-ttd Sep 11, 2023
f439110
Use async function and clean up code
jingyi-gao-ttd Sep 11, 2023
a931a0b
Update xhrrequest to ajax
jingyi-gao-ttd Sep 12, 2023
dc47a41
Add try catch
jingyi-gao-ttd Sep 12, 2023
2a44894
refactor
jingyi-gao-ttd Sep 12, 2023
249d8f6
add tests
jingyi-gao-ttd Sep 13, 2023
fe25f48
Fix tests after change to ajax
jingyi-gao-ttd Sep 13, 2023
b7bce96
Add new test cases for stored token expired
jingyi-gao-ttd Sep 13, 2023
86ee5f5
Address feedbacks
jingyi-gao-ttd Sep 18, 2023
1a9d62e
Add new test cases
jingyi-gao-ttd Sep 20, 2023
64491af
Using ramdom token instead
jingyi-gao-ttd Sep 20, 2023
0584b38
Add tests for cstg-derived and non-cstg-derived token
jingyi-gao-ttd Sep 20, 2023
e4a2c3e
Store hashed identity instead of original DII
jingyi-gao-ttd Sep 20, 2023
2058d80
Remove X-UID2-Client-Version
jingyi-gao-ttd Sep 21, 2023
f48bc59
kick off integration tests
ChrisHuie Sep 21, 2023
70ff90f
kick off tests
jingyi-gao-ttd Sep 22, 2023
676fadf
Add console log to debug integration tests
jingyi-gao-ttd Sep 22, 2023
cb7d205
Test action delay
jingyi-gao-ttd Sep 22, 2023
083c446
Mock window.crypto.subtle.digest
jingyi-gao-ttd Sep 22, 2023
879b401
Fix window.crypto.subtle.digest in firefox
jingyi-gao-ttd Sep 22, 2023
75a685a
Decouple cstg
jingyi-gao-ttd Oct 4, 2023
2190545
Move uid2Cstg out
jingyi-gao-ttd Oct 5, 2023
f610667
Wrap cstg with feature flag
jingyi-gao-ttd Oct 9, 2023
0006d66
Fix formatting
jingyi-gao-ttd Oct 9, 2023
bfb2204
Remove export
jingyi-gao-ttd Oct 9, 2023
bfb8b41
Add cstg enabled check
jingyi-gao-ttd Oct 9, 2023
a48d11f
Fix tests
jingyi-gao-ttd Oct 9, 2023
7a43682
Remove clientId
jingyi-gao-ttd Oct 9, 2023
ca8ca5d
wrap test with feature flag
jingyi-gao-ttd Oct 9, 2023
3357b94
cleanup
jingyi-gao-ttd Oct 9, 2023
e18a787
cleanup
jingyi-gao-ttd Oct 9, 2023
95b3144
cleanup example
jingyi-gao-ttd Oct 9, 2023
f013e21
add refresh token
jingyi-gao-ttd Oct 9, 2023
0e62274
change back to const
jingyi-gao-ttd Oct 10, 2023
f644840
Merge pull request #2 from jingyi-gao-ttd/uid2-decouple-cstg
jingyi-gao-ttd Oct 10, 2023
c14ab29
Merge branch 'master' into uid2-cstg-integration
jingyi-gao-ttd Oct 10, 2023
ad08101
Fix tests
jingyi-gao-ttd Oct 10, 2023
f32d1f8
restore pacakge lock
jingyi-gao-ttd Oct 10, 2023
1cfc36b
Restore test files
jingyi-gao-ttd Oct 10, 2023
272676b
Add more tests
jingyi-gao-ttd Oct 16, 2023
f27192d
Fix normalize email bug
jingyi-gao-ttd Oct 16, 2023
93532b2
remove redundant condition
jingyi-gao-ttd Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion features.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
"NATIVE",
"VIDEO"
"VIDEO",
"UID2_CSTG"
]
23 changes: 22 additions & 1 deletion modules/uid2IdSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { logInfo, logWarn } from '../src/utils.js';
import {submodule} from '../src/hook.js';
import { submodule } from '../src/hook.js';
import {getStorageManager} from '../src/storageManager.js';
import {MODULE_TYPE_UID} from '../src/activities/modules.js';

Expand All @@ -33,6 +33,19 @@ function createLogger(logger, prefix) {
logger(prefix + ' ', ...strings);
}
}

function extractIdentityFromParams(params) {
const keysToCheck = ['emailHash', 'phoneHash', 'email', 'phone'];

for (let key of keysToCheck) {
if (params.hasOwnProperty(key)) {
return { [key]: params[key] };
}
}

return {};
}

const _logInfo = createLogger(logInfo, LOG_PRE_FIX);
const _logWarn = createLogger(logWarn, LOG_PRE_FIX);

Expand Down Expand Up @@ -79,6 +92,14 @@ export const uid2IdSubmodule = {
clientId: UID2_CLIENT_ID,
internalStorage: ADVERTISING_COOKIE
}

if (FEATURES.UID2_CSTG) {
mappedConfig.cstg = {
serverPublicKey: config?.params?.serverPublicKey,
subscriptionId: config?.params?.subscriptionId,
...extractIdentityFromParams(config?.params ?? {})
}
}
_logInfo(`UID2 configuration loaded and mapped.`, mappedConfig);
const result = Uid2GetId(mappedConfig, storage, _logInfo, _logWarn);
_logInfo(`UID2 getId returned`, result);
Expand Down
Loading