@didomi/react-native 1.4.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +4 -2
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/java/com/reactnativedidomi/DidomiModule.kt +118 -29
- package/android/src/main/java/com/reactnativedidomi/EventTypes.kt +3 -2
- package/ios/Didomi.m +29 -14
- package/ios/RNDidomi.swift +127 -65
- package/lib/commonjs/Constants.js +13 -0
- package/lib/commonjs/Constants.js.map +1 -0
- package/lib/commonjs/Didomi.js +46 -9
- package/lib/commonjs/Didomi.js.map +1 -1
- package/lib/commonjs/DidomiListener.js +2 -0
- package/lib/commonjs/DidomiListener.js.map +1 -1
- package/lib/commonjs/DidomiTypes.js +1 -0
- package/lib/commonjs/DidomiTypes.js.map +1 -1
- package/lib/module/Constants.js +5 -0
- package/lib/module/Constants.js.map +1 -0
- package/lib/module/Didomi.js +45 -9
- package/lib/module/Didomi.js.map +1 -1
- package/lib/module/DidomiListener.js +2 -0
- package/lib/module/DidomiListener.js.map +1 -1
- package/lib/module/DidomiTypes.js +1 -0
- package/lib/module/DidomiTypes.js.map +1 -1
- package/lib/typescript/Constants.d.ts +2 -0
- package/lib/typescript/Didomi.d.ts +28 -7
- package/lib/typescript/DidomiTypes.d.ts +3 -2
- package/package.json +2 -2
- package/react-native-didomi.podspec +1 -1
- package/src/Constants.ts +4 -0
- package/src/Didomi.ts +88 -13
- package/src/DidomiListener.ts +2 -0
- package/src/DidomiTypes.ts +2 -1
package/src/Didomi.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NativeModules } from 'react-native';
|
|
2
2
|
import { DidomiListener } from './DidomiListener';
|
|
3
3
|
import { DidomiEventType } from './DidomiTypes';
|
|
4
|
+
import { DIDOMI_USER_AGENT_NAME, DIDOMI_VERSION } from './Constants';
|
|
4
5
|
|
|
5
6
|
const { Didomi: RNDidomi } = NativeModules;
|
|
6
7
|
|
|
@@ -30,6 +31,8 @@ export const Didomi = {
|
|
|
30
31
|
|
|
31
32
|
// Trigger native SDK init
|
|
32
33
|
RNDidomi.initialize(
|
|
34
|
+
DIDOMI_USER_AGENT_NAME,
|
|
35
|
+
DIDOMI_VERSION,
|
|
33
36
|
apiKey,
|
|
34
37
|
localConfigurationPath,
|
|
35
38
|
remoteConfigurationUrl,
|
|
@@ -42,17 +45,17 @@ export const Didomi = {
|
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* Listen to SDK ready state
|
|
45
|
-
|
|
48
|
+
*/
|
|
46
49
|
onReady: (): Promise<void> => DidomiListener.onReady(),
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
52
|
* Listen to SDK errors
|
|
50
|
-
|
|
53
|
+
*/
|
|
51
54
|
onError: (): Promise<any> => DidomiListener.onError(),
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
* Provide the objects required to display UI elements
|
|
58
|
+
*/
|
|
56
59
|
setupUI: (): Promise<void> => RNDidomi.setupUI(),
|
|
57
60
|
|
|
58
61
|
/**
|
|
@@ -353,20 +356,20 @@ export const Didomi = {
|
|
|
353
356
|
isReady: (): Promise<boolean> => RNDidomi.isReady(),
|
|
354
357
|
|
|
355
358
|
/**
|
|
356
|
-
* Set user information
|
|
359
|
+
* Set user information without authentication
|
|
357
360
|
*
|
|
358
361
|
* @param id Organization user ID
|
|
359
|
-
* @param algorithm
|
|
360
|
-
* @param secretId
|
|
361
|
-
* @param salt
|
|
362
|
-
* @param digest
|
|
362
|
+
* @param algorithm Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
363
|
+
* @param secretId Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
364
|
+
* @param salt Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
365
|
+
* @param digest Deprecated. To set user with authentication, use setUserWithHashAuth or setUserWithEncryptionAuth.
|
|
363
366
|
*/
|
|
364
367
|
setUser: (
|
|
365
368
|
organizationUserId: string,
|
|
366
|
-
organizationUserIdAuthAlgorithm
|
|
367
|
-
organizationUserIdAuthSid
|
|
368
|
-
organizationUserIdAuthSalt
|
|
369
|
-
organizationUserIdAuthDigest
|
|
369
|
+
organizationUserIdAuthAlgorithm?: string,
|
|
370
|
+
organizationUserIdAuthSid?: string,
|
|
371
|
+
organizationUserIdAuthSalt?: string,
|
|
372
|
+
organizationUserIdAuthDigest?: string
|
|
370
373
|
): Promise<void> =>
|
|
371
374
|
RNDidomi.setUser(
|
|
372
375
|
organizationUserId,
|
|
@@ -376,6 +379,78 @@ export const Didomi = {
|
|
|
376
379
|
organizationUserIdAuthDigest
|
|
377
380
|
),
|
|
378
381
|
|
|
382
|
+
/**
|
|
383
|
+
* Set user information with Hash authentication
|
|
384
|
+
*
|
|
385
|
+
* @param id Organization user ID
|
|
386
|
+
* @param algorithm Algorithm used for computing the digest
|
|
387
|
+
* @param secretId ID of the secret used for computing the digest
|
|
388
|
+
* @param digest Digest of the organization user ID and secret
|
|
389
|
+
* @param salt Salt used for computing the digest (optional)
|
|
390
|
+
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
391
|
+
*/
|
|
392
|
+
setUserWithHashAuth: (
|
|
393
|
+
organizationUserId: string,
|
|
394
|
+
algorithm: string,
|
|
395
|
+
secretId: string,
|
|
396
|
+
digest: string,
|
|
397
|
+
salt?: string,
|
|
398
|
+
expiration?: BigInt
|
|
399
|
+
): void => {
|
|
400
|
+
if (expiration === undefined) {
|
|
401
|
+
RNDidomi.setUserWithHashAuth(
|
|
402
|
+
organizationUserId,
|
|
403
|
+
algorithm,
|
|
404
|
+
secretId,
|
|
405
|
+
digest,
|
|
406
|
+
salt
|
|
407
|
+
);
|
|
408
|
+
} else {
|
|
409
|
+
RNDidomi.setUserWithHashAuthWithExpiration(
|
|
410
|
+
organizationUserId,
|
|
411
|
+
algorithm,
|
|
412
|
+
secretId,
|
|
413
|
+
digest,
|
|
414
|
+
salt,
|
|
415
|
+
expiration
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Set user information with Encryption authentication
|
|
422
|
+
*
|
|
423
|
+
* @param id Organization user ID
|
|
424
|
+
* @param algorithm Algorithm used for computing the digest
|
|
425
|
+
* @param secretId ID of the secret used for computing the digest
|
|
426
|
+
* @param initializationVector Initialization Vector used for computing the user ID
|
|
427
|
+
* @param expiration Expiration date as timestamp (to prevent replay attacks)
|
|
428
|
+
*/
|
|
429
|
+
setUserWithEncryptionAuth: (
|
|
430
|
+
organizationUserId: string,
|
|
431
|
+
algorithm: string,
|
|
432
|
+
secretId: string,
|
|
433
|
+
initializationVector: string,
|
|
434
|
+
expiration?: BigInt
|
|
435
|
+
): void => {
|
|
436
|
+
if (expiration === undefined) {
|
|
437
|
+
RNDidomi.setUserWithEncryptionAuth(
|
|
438
|
+
organizationUserId,
|
|
439
|
+
algorithm,
|
|
440
|
+
secretId,
|
|
441
|
+
initializationVector
|
|
442
|
+
);
|
|
443
|
+
} else {
|
|
444
|
+
RNDidomi.setUserWithEncryptionAuthWithExpiration(
|
|
445
|
+
organizationUserId,
|
|
446
|
+
algorithm,
|
|
447
|
+
secretId,
|
|
448
|
+
initializationVector,
|
|
449
|
+
expiration
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
|
|
379
454
|
/**
|
|
380
455
|
* Show the consent notice (if required, not disabled in the config and not already displayed)
|
|
381
456
|
*/
|
package/src/DidomiListener.ts
CHANGED
|
@@ -15,6 +15,8 @@ export const DidomiListener = {
|
|
|
15
15
|
init: () => {
|
|
16
16
|
// Register all native event listeners
|
|
17
17
|
Object.values(DidomiEventType).forEach((eventTypeValue) => {
|
|
18
|
+
// Remove previous listeners, as init() can be called several times in some configs
|
|
19
|
+
DidomiListener.eventEmitter.removeAllListeners(eventTypeValue);
|
|
18
20
|
DidomiListener.eventEmitter.addListener(eventTypeValue, (_event: any) => {
|
|
19
21
|
let events = DidomiListener.listeners.get(eventTypeValue);
|
|
20
22
|
if (events) {
|
package/src/DidomiTypes.ts
CHANGED
|
@@ -30,6 +30,7 @@ export enum DidomiEventType {
|
|
|
30
30
|
PREFERENCES_CLICK_DISAGREE_TO_ALL_PURPOSES = 'on_preferences_click_disagree_to_all_purposes',
|
|
31
31
|
PREFERENCES_CLICK_RESET_ALL_PURPOSES = 'on_preferences_click_reset_all_purposes',
|
|
32
32
|
SYNC_DONE = 'on_sync_done',
|
|
33
|
+
SYNC_ERROR = 'on_sync_error',
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
export interface Vendor {
|
|
@@ -50,7 +51,7 @@ export interface VendorNamespaces {
|
|
|
50
51
|
|
|
51
52
|
export interface Purpose {
|
|
52
53
|
id: string;
|
|
53
|
-
|
|
54
|
+
iabId: string;
|
|
54
55
|
name: string;
|
|
55
56
|
description: string;
|
|
56
57
|
descriptionLegal: string;
|