@transmitsecurity/platform-web-sdk 2.0.0 → 2.1.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/CHANGELOG.md +4 -0
- package/dist/common.cjs +1 -1
- package/dist/common.js +1 -1
- package/dist/drs.cjs +1 -1
- package/dist/drs.d.ts +78 -7
- package/dist/drs.js +1 -1
- package/dist/ido.cjs +1 -1
- package/dist/ido.js +1 -1
- package/dist/idv.cjs +1 -1
- package/dist/idv.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/ts-platform-websdk.js +1 -1
- package/dist/web-sdk-drs+idv+webauthn+ido.js +1 -1
- package/dist/web-sdk.d.ts +102 -11
- package/dist/webauthn.cjs +1 -1
- package/dist/webauthn.js +1 -1
- package/package.json +2 -8
package/dist/drs.d.ts
CHANGED
|
@@ -15,24 +15,41 @@ type Recommendation = {
|
|
|
15
15
|
};
|
|
16
16
|
type LightweightPayload = {
|
|
17
17
|
clientId: string;
|
|
18
|
-
deviceId
|
|
18
|
+
deviceId?: string;
|
|
19
19
|
userId: string | null;
|
|
20
20
|
sdkPlatform: 'mobile_web' | 'desktop_web';
|
|
21
21
|
events: Array<Record<string, unknown>>;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
interface ActionResponse {
|
|
25
|
+
/** The token return by the SDK when the action was reported */
|
|
25
26
|
actionToken?: string;
|
|
26
27
|
}
|
|
27
28
|
interface InitOptions {
|
|
29
|
+
/** Opaque identifier of the user in your system */
|
|
28
30
|
userId?: string;
|
|
29
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Initial parameters for SDK
|
|
34
|
+
*/
|
|
30
35
|
interface ConstructorOptions {
|
|
36
|
+
/** Print logs to console */
|
|
31
37
|
verbose?: boolean;
|
|
38
|
+
/** Your server URL
|
|
39
|
+
* @required */
|
|
32
40
|
serverPath: string;
|
|
41
|
+
/** Enable session token fetching
|
|
42
|
+
*
|
|
43
|
+
* Default value is false */
|
|
33
44
|
enableSessionToken?: boolean;
|
|
45
|
+
/** First party server url for the identifiers migration
|
|
46
|
+
*
|
|
47
|
+
* Default value is undefined */
|
|
34
48
|
firstPartyMigrationUrl?: string;
|
|
49
|
+
/** @internal
|
|
50
|
+
* Internal flag indicating this web_sdk instance has its own clientId separate from the Platform SDK root-level clientId */
|
|
35
51
|
hasOwnClientId?: boolean;
|
|
52
|
+
/** Tier mode for the SDK: 'standard' (default) or 'lightweight' (server-to-server) */
|
|
36
53
|
tier?: 'standard' | 'lightweight';
|
|
37
54
|
}
|
|
38
55
|
interface TransactionData {
|
|
@@ -54,12 +71,27 @@ interface TransactionData {
|
|
|
54
71
|
};
|
|
55
72
|
}
|
|
56
73
|
interface ActionEventOptions {
|
|
74
|
+
/** Any ID that could help relate the action with external context or session */
|
|
57
75
|
correlationId?: string;
|
|
76
|
+
/** User ID of the not yet authenticated user, used to enhance risk and
|
|
77
|
+
* trust assessments. Once the user is authenticated,
|
|
78
|
+
* {@link TSAccountProtection.setAuthenticatedUser} should be called. */
|
|
58
79
|
claimedUserId?: string;
|
|
80
|
+
/**
|
|
81
|
+
* The reported claimedUserId type (if provided), should not contain PII unless it is hashed.
|
|
82
|
+
* Supported values: email, phone_number, account_id, ssn, national_id, passport_number, drivers_license_number, other.
|
|
83
|
+
*/
|
|
59
84
|
claimedUserIdType?: string;
|
|
85
|
+
/**
|
|
86
|
+
* A transaction data-points object for transaction-monitoring
|
|
87
|
+
*/
|
|
60
88
|
transactionData?: TransactionData;
|
|
89
|
+
/**
|
|
90
|
+
* Custom attributes matching the schema previously defined in the Admin Portal
|
|
91
|
+
*/
|
|
61
92
|
customAttributes?: Record<string, string | number | boolean>;
|
|
62
93
|
/**
|
|
94
|
+
* The fields below are supported for Enterprise-IAM sdk usage actions, added `ignore` for avoiding preseting this attribute in the docs
|
|
63
95
|
* @ignore
|
|
64
96
|
*/
|
|
65
97
|
publicKey?: string;
|
|
@@ -109,12 +141,19 @@ declare class TSAccountProtection {
|
|
|
109
141
|
private logsReporter;
|
|
110
142
|
private options;
|
|
111
143
|
private clientId;
|
|
144
|
+
/**
|
|
145
|
+
*
|
|
146
|
+
Creates a new Account Protection SDK instance with your client context
|
|
147
|
+
@param clientId Your AccountProtection client identifier
|
|
148
|
+
@param options SDK configuration options
|
|
149
|
+
*/
|
|
112
150
|
constructor(clientId: string, options: ConstructorOptions);
|
|
113
151
|
/** @ignore */
|
|
114
152
|
constructor(serverPath: string, clientId: string);
|
|
115
153
|
private generateDisabledToken;
|
|
116
154
|
/**
|
|
117
155
|
* @ignore
|
|
156
|
+
* @returns List of loaded actions that can be invoked
|
|
118
157
|
*/
|
|
119
158
|
get actions(): string[];
|
|
120
159
|
/** @ignore */
|
|
@@ -122,20 +161,46 @@ declare class TSAccountProtection {
|
|
|
122
161
|
getSessionToken(): Promise<any>;
|
|
123
162
|
getPayload(): Promise<LightweightPayload>;
|
|
124
163
|
clearQueue(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Sets the deviceId for lightweight mode (citadel).
|
|
166
|
+
* Should be called after receiving deviceId from backend on first request.
|
|
167
|
+
* @param deviceId - The JWT deviceId returned from citadel backend
|
|
168
|
+
*/
|
|
169
|
+
setDeviceId(deviceId: string): void;
|
|
170
|
+
/**
|
|
171
|
+
* Initializes the AccountProtection SDK, which starts automatically tracking and submitting info of the user journey
|
|
172
|
+
* @param options Init options
|
|
173
|
+
* @returns Indicates if the call succeeded
|
|
174
|
+
*/
|
|
125
175
|
init(options?: InitOptions | string): Promise<boolean>;
|
|
126
176
|
private isInitialized;
|
|
127
|
-
triggerActionEvent(actionType: string, options?: ActionEventOptions): Promise<ActionResponse>;
|
|
128
177
|
/**
|
|
129
|
-
*
|
|
178
|
+
* Reports a user action event to the SDK
|
|
179
|
+
* @param actionType Type of user action event that was predefined in the Transmit Security server
|
|
180
|
+
* @returns Indicates if the call succeeded
|
|
130
181
|
*/
|
|
131
|
-
|
|
182
|
+
triggerActionEvent(actionType: string, options?: ActionEventOptions): Promise<ActionResponse>;
|
|
132
183
|
private updateUserId;
|
|
184
|
+
/**
|
|
185
|
+
* Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared)
|
|
186
|
+
* It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required)
|
|
187
|
+
* @param userId Opaque identifier of the user in your system
|
|
188
|
+
* @param options Reserved for future use
|
|
189
|
+
* @returns Indicates if the call succeeded
|
|
190
|
+
*/
|
|
133
191
|
setAuthenticatedUser(userId: string, options?: {}): Promise<boolean>;
|
|
192
|
+
/**
|
|
193
|
+
* Clears the user context for all subsequent events in the browser session
|
|
194
|
+
* @param options Reserved for future use
|
|
195
|
+
* @returns Indicates if the call succeeded
|
|
196
|
+
*/
|
|
134
197
|
clearUser(options?: {}): Promise<boolean>;
|
|
135
198
|
/**
|
|
136
|
-
*
|
|
199
|
+
* Gets a secure session token that is signed with the device's private key
|
|
200
|
+
* @param actionType Optional action type to include in the token payload (default: null)
|
|
201
|
+
* @param expirationSeconds Optional expiration time in seconds (default: 300 seconds / 5 minutes)
|
|
202
|
+
* @returns A JWT-like token containing the backend session token and device information, signed with the device's private key
|
|
137
203
|
*/
|
|
138
|
-
unidentifiedUser(): Promise<boolean>;
|
|
139
204
|
getSecureSessionToken(actionType?: string | null, expirationSeconds?: number): Promise<string>;
|
|
140
205
|
}
|
|
141
206
|
|
|
@@ -181,6 +246,12 @@ declare const getSessionToken: TSAccountProtection['getSessionToken'];
|
|
|
181
246
|
declare const getSecureSessionToken: TSAccountProtection['getSecureSessionToken'];
|
|
182
247
|
/** @ignore */
|
|
183
248
|
declare const getPayload: TSAccountProtection['getPayload'];
|
|
249
|
+
/**
|
|
250
|
+
* Sets the deviceId for lightweight mode (citadel).
|
|
251
|
+
* Should be called after receiving deviceId from backend on first request.
|
|
252
|
+
* @param deviceId - The JWT deviceId returned from citadel backend
|
|
253
|
+
*/
|
|
254
|
+
declare const setDeviceId: TSAccountProtection['setDeviceId'];
|
|
184
255
|
/** @ignore */
|
|
185
256
|
declare const __internal: {
|
|
186
257
|
getDeviceId(): string;
|
|
@@ -191,4 +262,4 @@ declare const __internal: {
|
|
|
191
262
|
declare const PACKAGE_VERSION: string;
|
|
192
263
|
declare function initialize(config: any): void;
|
|
193
264
|
|
|
194
|
-
export { ActionEventOptions, ActionResponse, LightweightPayload, PACKAGE_VERSION, __internal, clearUser, getActions, getPayload, getSecureSessionToken, getSessionToken, initialize, setAuthenticatedUser, triggerActionEvent };
|
|
265
|
+
export { ActionEventOptions, ActionResponse, LightweightPayload, PACKAGE_VERSION, __internal, clearUser, getActions, getPayload, getSecureSessionToken, getSessionToken, initialize, setAuthenticatedUser, setDeviceId, triggerActionEvent };
|