@forgerock/protect 0.0.0-beta-20250825180717

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.
@@ -0,0 +1,156 @@
1
+ /*
2
+ *
3
+ * Copyright © 2025 Ping Identity Corporation. All right reserved.
4
+ *
5
+ * This software may be modified and distributed under the terms
6
+ * of the MIT license. See the LICENSE file for details.
7
+ *
8
+ */
9
+ import { FRStep } from '@forgerock/javascript-sdk';
10
+ export const standardPingProtectInitializeStep = new FRStep({
11
+ authId: 'foo',
12
+ callbacks: [
13
+ {
14
+ type: 'MetadataCallback',
15
+ output: [
16
+ {
17
+ name: 'data',
18
+ value: {
19
+ _type: 'PingOneProtect',
20
+ _action: 'protect_initialize',
21
+ envId: 'some_id',
22
+ consoleLogEnabled: true,
23
+ deviceAttributesToIgnore: [],
24
+ customHost: '',
25
+ lazyMetadata: true,
26
+ behavioralDataCollection: true,
27
+ disableHub: true,
28
+ deviceKeyRsyncIntervals: 10,
29
+ enableTrust: true,
30
+ disableTags: true,
31
+ },
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ type: 'HiddenValueCallback',
37
+ output: [
38
+ {
39
+ name: 'value',
40
+ value: '',
41
+ },
42
+ {
43
+ name: 'id',
44
+ value: 'clientError',
45
+ },
46
+ ],
47
+ input: [
48
+ {
49
+ name: 'IDToken1',
50
+ value: 'clientError',
51
+ },
52
+ ],
53
+ },
54
+ ],
55
+ });
56
+ export const standardPingProtectEvaluationStep = new FRStep({
57
+ authId: 'foo',
58
+ callbacks: [
59
+ {
60
+ type: 'MetadataCallback',
61
+ output: [
62
+ {
63
+ name: 'data',
64
+ value: {
65
+ _type: 'PingOneProtect',
66
+ _action: 'protect_risk_evaluation',
67
+ envId: 'some_id',
68
+ pauseBehavioralData: true,
69
+ },
70
+ },
71
+ ],
72
+ },
73
+ {
74
+ type: 'HiddenValueCallback',
75
+ output: [
76
+ {
77
+ name: 'value',
78
+ value: '',
79
+ },
80
+ {
81
+ name: 'id',
82
+ value: 'pingone_risk_evaluation_signals',
83
+ },
84
+ ],
85
+ input: [
86
+ {
87
+ name: 'IDToken1',
88
+ value: 'pingone_risk_evaluation_signals',
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ type: 'HiddenValueCallback',
94
+ output: [
95
+ {
96
+ name: 'value',
97
+ value: '',
98
+ },
99
+ {
100
+ name: 'id',
101
+ value: 'clientError',
102
+ },
103
+ ],
104
+ input: [
105
+ {
106
+ name: 'IDToken1',
107
+ value: 'clientError',
108
+ },
109
+ ],
110
+ },
111
+ ],
112
+ });
113
+ export const noProtectType = new FRStep({
114
+ authId: 'foo',
115
+ callbacks: [
116
+ {
117
+ type: 'HiddenValueCallback',
118
+ output: [
119
+ {
120
+ name: 'value',
121
+ value: '',
122
+ },
123
+ {
124
+ name: 'id',
125
+ value: 'pingone_risk_evaluation_signals',
126
+ },
127
+ ],
128
+ input: [
129
+ {
130
+ name: 'IDToken1',
131
+ value: 'pingone_risk_evaluation_signals',
132
+ },
133
+ ],
134
+ },
135
+ {
136
+ type: 'HiddenValueCallback',
137
+ output: [
138
+ {
139
+ name: 'value',
140
+ value: '',
141
+ },
142
+ {
143
+ name: 'id',
144
+ value: 'clientError',
145
+ },
146
+ ],
147
+ input: [
148
+ {
149
+ name: 'IDToken1',
150
+ value: 'clientError',
151
+ },
152
+ ],
153
+ },
154
+ ],
155
+ });
156
+ //# sourceMappingURL=protect.mock.data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protect.mock.data.js","sourceRoot":"","sources":["../../../src/lib/protect.mock.data.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAgB,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,MAAM,CAAC;IAC1D,MAAM,EAAE,KAAK;IACb,SAAS,EAAE;QACT;YACE,IAAI,EAAE,kBAAmD;YACzD,MAAM,EAAE;gBACN;oBACE,IAAI,EAA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AiC;iBACzC;aACF;SACF;QACD;YACE,IAAI,EAAE,qBAAyD;YAC/D,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE;iBACV;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,aAAa;iBACrB;aACF;YACD,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,aAAa;iBACrB;aACF;SACF;KACF;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,MAAM,CAAC;IACtC,MAAM,EAAE,KAAK;IACb,SAAS,EAAE;QACT;YACE,IAAI,EAAE,qBAAyD;YAC/D,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE;iBACV;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,iCAAiC;iBACzC;aACF;YACD,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,iCAAiC;iBACzC;aACF;SACF;QACD;YACE,IAAI,EAAE,qBAAyD;YAC/D,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE;iBACV;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,aAAa;iBACrB;aACF;YACD,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,aAAa;iBACrB;aACF;SACF;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,147 @@
1
+ import FRStep from '@forgerock/javascript-sdk/src/fr-auth/fr-step';
2
+ /**
3
+ * @interface ProtectConfig - Interface for the Protect module configuration parameters
4
+ * @description - envId is required. All other parameters are optional.
5
+ */
6
+ export interface ProtectConfig {
7
+ /**
8
+ * @property {string} envId - the environment id from your PingOne tenant
9
+ */
10
+ envId: string;
11
+ /**
12
+ * @property {boolean} [waitForWindowLoad] - true to init the SDK on load event, instead of DOMContentLoaded event. default is true
13
+ */
14
+ waitForWindowLoad?: boolean;
15
+ /**
16
+ * @property {string} [hubUrl] - iframe url for cross-storage device ID
17
+ */
18
+ hubUrl?: string;
19
+ /**
20
+ * @property {boolean} [disableHub] - when true, the SDK store the deviceId to the localStorage only and won't use an iframe (hub). default is false
21
+ */
22
+ disableHub?: boolean;
23
+ /**
24
+ * @property {string[]} [deviceAttributesToIgnore] - metadata blacklist
25
+ */
26
+ deviceAttributesToIgnore?: string[];
27
+ /**
28
+ * @property {boolean} [behavioralDataCollection] - true to collect behavioral data. default is true
29
+ */
30
+ behavioralDataCollection?: boolean;
31
+ /**
32
+ * @property {boolean} [disableTags] - true to skip tag collection. default is false
33
+ */
34
+ disableTags?: boolean;
35
+ /**
36
+ * @property {Record<string, string>} [externalIdentifiers] - optional customer external identifiers that should be reflected on a device entity
37
+ */
38
+ externalIdentifiers?: Record<string, string>;
39
+ /**
40
+ * @property {boolean} [universalDeviceIdentification] - set to true if you want the device data in the SDK payload to be provided as a signed JWT
41
+ */
42
+ universalDeviceIdentification?: boolean;
43
+ /**
44
+ * @property {boolean} [agentIdentification] - set to true if you are using risk policies that contain the PingID Device Trust predictor. default is false
45
+ */
46
+ agentIdentification?: boolean;
47
+ /**
48
+ * @property {number} [agentTimeout] - If agentIdentification is true, use agentTimeout to specify the timeout the trust agent should use if you don't want to use the default timeout setting. Can be between 200 and 10,000 milliseconds. Default is 5000.
49
+ */
50
+ agentTimeout?: number;
51
+ /**
52
+ * @property {number} [agentPort] - If agentIdentification is true, use agentPort to specify the port to use when connecting to the trust agent if you don't want to use the default port. Default is 9400.
53
+ */
54
+ agentPort?: number;
55
+ }
56
+ export interface ProtectInitializeConfig {
57
+ _type: 'PingOneProtect';
58
+ _action: 'protect_initialize';
59
+ envId?: string;
60
+ consoleLogEnabled?: boolean;
61
+ deviceAttributesToIgnore?: string[];
62
+ customHost?: string;
63
+ lazyMetadata?: boolean;
64
+ behavioralDataCollection?: boolean;
65
+ deviceKeyRsyncIntervals?: number;
66
+ enableTrust?: boolean;
67
+ disableTags?: boolean;
68
+ disableHub?: boolean;
69
+ }
70
+ export interface ProtectEvaluationConfig {
71
+ _type: 'PingOneProtect';
72
+ _action: 'protect_risk_evaluation';
73
+ envId: string;
74
+ pauseBehavioralData: boolean;
75
+ }
76
+ export type ProtectType = 'initialize' | 'evaluate' | 'none';
77
+ /**
78
+ * @interface Protect - Interface for methods to interact with the PingOne Signals SDK
79
+ */
80
+ export interface Protect {
81
+ /**
82
+ * @async
83
+ * @method start - Method to initialize and start the PingOne Signals SDK
84
+ * @returns {Promise<void | { error: string }>} - Returns an error if PingOne Signals SDK failed to load
85
+ */
86
+ start: () => Promise<void | {
87
+ error: string;
88
+ }>;
89
+ /**
90
+ * @async
91
+ * @method getData - Method to get the device data
92
+ * @returns {Promise<string | { error: string }>} - Returns the device data or an error if PingOne Signals SDK failed to load
93
+ */
94
+ getData: () => Promise<string | {
95
+ error: string;
96
+ }>;
97
+ /**
98
+ * @method pauseBehavioralData - Method to pause the behavioral data collection
99
+ * @returns {void | { error: string }} - Returns an error if PingOne Signals SDK failed to load
100
+ * @description Pause the behavioral data collection only; device profile data will still be collected
101
+ */
102
+ pauseBehavioralData: () => void | {
103
+ error: string;
104
+ };
105
+ /**
106
+ * @method resumeBehavioralData - Method to resume the behavioral data collection
107
+ * @returns {void | { error: string }} - Returns an error if PingOne Signals SDK failed to load
108
+ * @description Resume the behavioral data collection
109
+ */
110
+ resumeBehavioralData: () => void | {
111
+ error: string;
112
+ };
113
+ /**
114
+ * @method getPauseBehavioralData
115
+ * @param {FRStep} step - A journey step
116
+ * @returns {boolean}
117
+ * @description - Required when using Ping Protect Marketplace nodes
118
+ */
119
+ getPauseBehavioralData: (step: FRStep) => boolean;
120
+ /**
121
+ * @method getNodeConfig - Method for getting the Protect intitialization config options
122
+ * @param {FRStep} step - A journey step
123
+ * @returns {ProtectInitializeConfig | undefined} - The Protect config options
124
+ */
125
+ getNodeConfig: (step: FRStep) => ProtectInitializeConfig | undefined;
126
+ /**
127
+ * @method getPingProtectType - Method for getting the type of step in the Protect flow
128
+ * @param {FRStep} step - A journey step
129
+ * @returns {ProtectType} - The type of step in the Protect flow
130
+ */
131
+ getProtectType: (step: FRStep) => ProtectType;
132
+ /**
133
+ * @method setNodeClientError - Method for setting an error on a Ping Protect Marketplace node
134
+ * @param {FRStep} step - A journey step
135
+ * @param {string} value - The error message to set
136
+ * @returns {void}
137
+ */
138
+ setNodeClientError: (step: FRStep, value: string) => void;
139
+ /**
140
+ * @method setNodeInputValue - Method for setting an input value on a Ping Protect Marketplace node
141
+ * @param {FRStep} step - A journey step
142
+ * @param {string} value - The value to set the input to
143
+ * @returns {void}
144
+ */
145
+ setNodeInputValue: (step: FRStep, value: string) => void;
146
+ }
147
+ //# sourceMappingURL=protect.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protect.types.d.ts","sourceRoot":"","sources":["../../../src/lib/protect.types.ts"],"names":[],"mappings":"AASA,OAAO,MAAM,MAAM,+CAA+C,CAAC;AAEnE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpC;;OAEG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7C;;OAEG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC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MAAM,CAAA;KAAE,CAAC;IAErD;;;;;OAKG;IACH,sBAAsB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAElD;;;;OAIG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,uBAAuB,GAAG,SAAS,CAAC;IAErE;;;;OAIG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,CAAC;IAE9C;;;;;OAKG;IACH,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1D;;;;;OAKG;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D"}
@@ -0,0 +1,10 @@
1
+ /*
2
+ *
3
+ * Copyright © 2025 Ping Identity Corporation. All right reserved.
4
+ *
5
+ * This software may be modified and distributed under the terms
6
+ * of the MIT license. See the LICENSE file for details.
7
+ *
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=protect.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protect.types.js","sourceRoot":"","sources":["../../../src/lib/protect.types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=signals-sdk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals-sdk.d.ts","sourceRoot":"","sources":["../../../src/lib/signals-sdk.js"],"names":[],"mappings":""}