@transmitsecurity/platform-web-sdk 1.15.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +479 -0
  2. package/README.md +72 -0
  3. package/VITE_CONFIG.md +107 -0
  4. package/build/drs-entry.d.ts +20 -0
  5. package/build/drs-entry.js +19 -0
  6. package/build/drs-only.d.ts +22 -0
  7. package/build/drs-only.js +25 -0
  8. package/build/drs.d.ts +13 -0
  9. package/build/drs.js +45 -0
  10. package/build/ido-entry.d.ts +17 -0
  11. package/build/ido-entry.js +19 -0
  12. package/build/ido.d.ts +8 -0
  13. package/build/ido.js +27 -0
  14. package/build/idv-entry.d.ts +17 -0
  15. package/build/idv-entry.js +19 -0
  16. package/build/idv.d.ts +8 -0
  17. package/build/idv.js +27 -0
  18. package/build/initialize-only.d.ts +7 -0
  19. package/build/initialize-only.js +40 -0
  20. package/build/initialize.d.ts +1 -0
  21. package/build/initialize.js +2 -0
  22. package/build/mainExport.d.ts +16 -0
  23. package/build/mainExport.js +43 -0
  24. package/build/sdk-factory.d.ts +109 -0
  25. package/build/sdk-factory.js +108 -0
  26. package/build/shared-state.d.ts +4 -0
  27. package/build/shared-state.js +32 -0
  28. package/build/webauthn-entry.d.ts +19 -0
  29. package/build/webauthn-entry.js +19 -0
  30. package/build/webauthn.d.ts +12 -0
  31. package/build/webauthn.js +44 -0
  32. package/bundler-config.json +15 -0
  33. package/dist/docs/.nojekyll +1 -0
  34. package/dist/docs/README.md +72 -0
  35. package/dist/docs/enums/ErrorCode.md +113 -0
  36. package/dist/docs/interfaces/ActionEventOptions.md +44 -0
  37. package/dist/docs/interfaces/ActionResponse.md +9 -0
  38. package/dist/docs/interfaces/AuthenticationAutofillActivateHandlers.md +61 -0
  39. package/dist/docs/interfaces/AutofillHandlers.md +50 -0
  40. package/dist/docs/interfaces/CrossDeviceController.md +27 -0
  41. package/dist/docs/interfaces/SdkError.md +28 -0
  42. package/dist/docs/interfaces/WebauthnApis.md +73 -0
  43. package/dist/docs/interfaces/WebauthnAuthenticationFlows.md +52 -0
  44. package/dist/docs/interfaces/WebauthnCrossDeviceFlows.md +107 -0
  45. package/dist/docs/interfaces/WebauthnCrossDeviceRegistrationOptions.md +23 -0
  46. package/dist/docs/interfaces/WebauthnRegistrationOptions.md +55 -0
  47. package/dist/docs/interfaces/initConfigParams.md +7 -0
  48. package/dist/docs/modules/drs.md +92 -0
  49. package/dist/docs/modules/idv.md +106 -0
  50. package/dist/docs/modules/webauthn.md +197 -0
  51. package/dist/docs/modules.md +146 -0
  52. package/dist/drs.cjs +1 -0
  53. package/dist/drs.d.ts +241 -0
  54. package/dist/drs.js +1 -0
  55. package/dist/ido.cjs +1 -0
  56. package/dist/ido.d.ts +8 -0
  57. package/dist/ido.js +1 -0
  58. package/dist/idv.cjs +1 -0
  59. package/dist/idv.d.ts +68 -0
  60. package/dist/idv.js +1 -0
  61. package/dist/index.cjs +1 -0
  62. package/dist/index.esm.js +1 -0
  63. package/dist/index.umd.js +1 -0
  64. package/dist/ts-platform-websdk.js +1 -0
  65. package/dist/web-sdk-drs+idv+webauthn+ido.js +1 -0
  66. package/dist/web-sdk.d.ts +1737 -0
  67. package/dist/webauthn.cjs +1 -0
  68. package/dist/webauthn.d.ts +461 -0
  69. package/dist/webauthn.js +1 -0
  70. package/package.json +98 -0
  71. package/scripts/make-semver-aliases.sh +11 -0
  72. package/scripts/upload-dist.sh +6 -0
  73. package/src/mainExport.ts +75 -0
  74. package/src/tsconfig.json +14 -0
@@ -0,0 +1,1737 @@
1
+ declare enum RecommendationType {
2
+ ALLOW = "ALLOW",
3
+ CHALLENGE = "CHALLENGE",
4
+ DENY = "DENY",
5
+ TRUST = "TRUST"
6
+ }
7
+ type EventResponse = {
8
+ actionToken?: string;
9
+ deviceId?: string;
10
+ recommendation?: Recommendation;
11
+ userId?: string;
12
+ };
13
+ type Recommendation = {
14
+ type: RecommendationType;
15
+ };
16
+
17
+ interface ActionResponse {
18
+ /** The token return by the SDK when the action was reported */
19
+ actionToken?: string;
20
+ }
21
+ interface InitOptions {
22
+ /** Opaque identifier of the user in your system */
23
+ userId?: string;
24
+ }
25
+ /**
26
+ * Initial parameters for SDK
27
+ */
28
+ interface ConstructorOptions {
29
+ /** Print logs to console */
30
+ verbose?: boolean;
31
+ /** Your server URL
32
+ *
33
+ * Default value is https://collect.riskid.security */
34
+ serverPath?: string;
35
+ /** Enable session token fetching
36
+ *
37
+ * Default value is false */
38
+ enableSessionToken?: boolean;
39
+ /** First party server url for the identifiers migration
40
+ *
41
+ * Default value is undefined */
42
+ firstPartyMigrationUrl?: string;
43
+ }
44
+ interface TransactionData {
45
+ amount: number;
46
+ currency: string;
47
+ reason?: string;
48
+ transactionDate?: number;
49
+ payer?: {
50
+ name?: string;
51
+ bankIdentifier?: string;
52
+ branchIdentifier?: string;
53
+ accountNumber?: string;
54
+ };
55
+ payee?: {
56
+ name?: string;
57
+ bankIdentifier?: string;
58
+ branchIdentifier?: string;
59
+ accountNumber?: string;
60
+ };
61
+ }
62
+ interface ActionEventOptions {
63
+ /** Any ID that could help relate the action with external context or session */
64
+ correlationId?: string;
65
+ /** User ID of the not yet authenticated user, used to enhance risk and
66
+ * trust assessments. Once the user is authenticated,
67
+ * {@link TSAccountProtection.setAuthenticatedUser} should be called. */
68
+ claimedUserId?: string;
69
+ /**
70
+ * The reported claimedUserId type (if provided), should not contain PII unless it is hashed.
71
+ * Supported values: email, phone_number, account_id, ssn, national_id, passport_number, drivers_license_number, other.
72
+ */
73
+ claimedUserIdType?: string;
74
+ /**
75
+ * A transaction data-points object for transaction-monitoring
76
+ */
77
+ transactionData?: TransactionData;
78
+ /**
79
+ * Custom attributes matching the schema previously defined in the Admin Portal
80
+ */
81
+ customAttributes?: Record<string, string | number | boolean>;
82
+ /**
83
+ * The fields below are supported for Enterprise-IAM sdk usage actions, added `ignore` for avoiding preseting this attribute in the docs
84
+ * @ignore
85
+ */
86
+ publicKey?: string;
87
+ /**
88
+ * @ignore
89
+ */
90
+ extensionMetadata?: string;
91
+ /**
92
+ * @ignore
93
+ */
94
+ extensionDeviceAttributes?: Record<string, string>;
95
+ /**
96
+ * @ignore
97
+ */
98
+ suspiciousSignals?: string[];
99
+ /**
100
+ * @ignore
101
+ */
102
+ suspiciousContext?: string;
103
+ /**
104
+ * @ignore
105
+ */
106
+ downloadFile?: Record<string, boolean | string | number>;
107
+ /**
108
+ * @ignore
109
+ */
110
+ uploadFile?: Record<string, boolean | string | number>;
111
+ }
112
+ declare class TSAccountProtection {
113
+ private static initializedInstance;
114
+ private initializationPromise;
115
+ private isSDKDisabled;
116
+ private enableSessionToken;
117
+ private identifiersMigrationEnabled;
118
+ private firstPartyMigrationUrl;
119
+ private validationManager;
120
+ private storageManager;
121
+ private eventsManager;
122
+ private deviceDataManager;
123
+ private configManager;
124
+ private requestsManager;
125
+ private identityManager;
126
+ private migrationsManager;
127
+ private cryptoBinding;
128
+ private logsReporter;
129
+ private options;
130
+ private clientId;
131
+ /**
132
+ *
133
+ Creates a new Account Protection SDK instance with your client context
134
+ @param clientId Your AccountProtection client identifier
135
+ @param options SDK configuration options
136
+ */
137
+ constructor(clientId: string, options?: ConstructorOptions);
138
+ /** @ignore */
139
+ constructor(serverPath: string, clientId: string);
140
+ /**
141
+ * @ignore
142
+ * @returns List of loaded actions that can be invoked
143
+ */
144
+ get actions(): string[];
145
+ /** @ignore */
146
+ getActions(): Promise<string[]>;
147
+ getSessionToken(): Promise<any>;
148
+ /**
149
+ * Initializes the AccountProtection SDK, which starts automatically tracking and submitting info of the user journey
150
+ * @param options Init options
151
+ * @returns Indicates if the call succeeded
152
+ */
153
+ init(options?: InitOptions | string): Promise<boolean>;
154
+ private isInitialized;
155
+ /**
156
+ * Reports a user action event to the SDK
157
+ * @param actionType Type of user action event that was predefined in the Transmit Security server
158
+ * @returns Indicates if the call succeeded
159
+ */
160
+ triggerActionEvent(actionType: string, options?: ActionEventOptions): Promise<ActionResponse>;
161
+ /**
162
+ * @ignore
163
+ */
164
+ identifyUser(userId: string): Promise<boolean>;
165
+ private updateUserId;
166
+ /**
167
+ * @ignore
168
+ */
169
+ unidentifiedUser(): Promise<boolean>;
170
+ /**
171
+ * Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared)
172
+ * It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required)
173
+ * @param userId Opaque identifier of the user in your system
174
+ * @param options Reserved for future use
175
+ * @returns Indicates if the call succeeded
176
+ */
177
+ setAuthenticatedUser(userId: string, options?: {}): Promise<boolean>;
178
+ /** @ignore */
179
+ setUser(userId: string, _options?: {}): Promise<boolean>;
180
+ /**
181
+ * Clears the user context for all subsequent events in the browser session
182
+ * @param options Reserved for future use
183
+ * @returns Indicates if the call succeeded
184
+ */
185
+ clearUser(options?: {}): Promise<boolean>;
186
+ }
187
+
188
+ declare module '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata' {
189
+ interface initConfigParams {
190
+ drs?: InitOptions & ConstructorOptions & {
191
+ enabled: boolean;
192
+ };
193
+ }
194
+ }
195
+ /**
196
+ * Reports a user action event to the SDK
197
+ * @param actionType Type of user action event that was predefined in the Transmit Security server
198
+ * @returns Indicates if the call succeeded
199
+ */
200
+ declare const triggerActionEvent: TSAccountProtection['triggerActionEvent'];
201
+ /** @ignore */
202
+ declare const setUser: TSAccountProtection['setUser'];
203
+ /**
204
+ * Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared)
205
+ * It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required)
206
+ * @param userId Opaque identifier of the user in your system
207
+ * @param options Reserved for future use
208
+ * @returns Indicates if the call succeeded
209
+ */
210
+ declare const setAuthenticatedUser: TSAccountProtection['setAuthenticatedUser'];
211
+ /**
212
+ * Clears the user context for all subsequent events in the browser session
213
+ * @param options Reserved for future use
214
+ * @returns Indicates if the call succeeded
215
+ */
216
+ declare const clearUser: TSAccountProtection['clearUser'];
217
+ /** @ignore */
218
+ declare const identifyUser: TSAccountProtection['identifyUser'];
219
+ /** @ignore */
220
+ declare const unidentifiedUser: TSAccountProtection['unidentifiedUser'];
221
+ /** @ignore */
222
+ declare const getActions: TSAccountProtection['getActions'];
223
+ /** @ignore */
224
+ declare const getSessionToken: TSAccountProtection['getSessionToken'];
225
+ /** @ignore */
226
+ declare const __internal: {
227
+ getDeviceId(): string;
228
+ getClientId(): string;
229
+ flush(): Promise<EventResponse>;
230
+ };
231
+
232
+ type webSdkModule_d_ActionEventOptions = ActionEventOptions;
233
+ type webSdkModule_d_ActionResponse = ActionResponse;
234
+ declare const webSdkModule_d___internal: typeof __internal;
235
+ declare const webSdkModule_d_clearUser: typeof clearUser;
236
+ declare const webSdkModule_d_getActions: typeof getActions;
237
+ declare const webSdkModule_d_getSessionToken: typeof getSessionToken;
238
+ declare const webSdkModule_d_identifyUser: typeof identifyUser;
239
+ declare const webSdkModule_d_setAuthenticatedUser: typeof setAuthenticatedUser;
240
+ declare const webSdkModule_d_setUser: typeof setUser;
241
+ declare const webSdkModule_d_triggerActionEvent: typeof triggerActionEvent;
242
+ declare const webSdkModule_d_unidentifiedUser: typeof unidentifiedUser;
243
+ declare namespace webSdkModule_d {
244
+ export { webSdkModule_d___internal as __internal, webSdkModule_d_clearUser as clearUser, webSdkModule_d_getActions as getActions, webSdkModule_d_getSessionToken as getSessionToken, webSdkModule_d_identifyUser as identifyUser, webSdkModule_d_setAuthenticatedUser as setAuthenticatedUser, webSdkModule_d_setUser as setUser, webSdkModule_d_triggerActionEvent as triggerActionEvent, webSdkModule_d_unidentifiedUser as unidentifiedUser };
245
+ export type { webSdkModule_d_ActionEventOptions as ActionEventOptions, webSdkModule_d_ActionResponse as ActionResponse };
246
+ }
247
+
248
+ /**
249
+ * The `idv` module allows you to integrate identity verification services into your application. This allows you to
250
+ * securely verify the identity of your customers using documents like their driver's license or passport.
251
+ *
252
+ * After the SDK is initialized, your app can start a verification flow by creating a session in the backend to establish
253
+ * a secure context and then start the verification session by calling {@link module:tsPlatform.idv.start|start}. The SDK executes
254
+ * the verification process with the user using the Transmit identity verification experience. Once all the required images are submitted,
255
+ * Transmit starts processing the verification while the SDK polls for its status. Once processing is completed, the SDK notifies the app
256
+ * so it can obtain the verification result (via the backend) and proceed accordingly.
257
+ * @module tsPlatform.idv
258
+ */
259
+
260
+ /**
261
+ * Starts a verification session that was created in the backend (via the [Verification API](/openapi/verify/verifications/#operation/createSession)).
262
+ * This will start the verification process for the user and guides them through the entire identity verification flow
263
+ * using the Transmit identity verification experience, which includes capturing the required images and submitting them for processing.
264
+ * @function start
265
+ * @param {string} startToken - The start_token returned by the backend when the session was created, used to
266
+ * bind the session to the device
267
+ * @returns {Promise<boolean>} Indicates if the session was started successfully
268
+ * @memberof module:core
269
+ * @example
270
+ * const showLoader = true;
271
+ * const startToken = '123456'; // start_token returned by the backend upon session creation
272
+ * tsPlatform.idv.start(startToken).then((started) => {
273
+ * showLoader = false;
274
+ * if (started) {
275
+ * console.log('Session started');
276
+ * } else {
277
+ * console.log('Session not started');
278
+ * }
279
+ * });
280
+ */
281
+ declare function start(startToken?: string): Promise<boolean>;
282
+ /**
283
+ * Recaptures the required images in case the `recapture` status is returned. For example, this may occur in case some data
284
+ * couldn't be extracted due to poor image quality.
285
+ * @function recapture
286
+ * @returns {Promise<boolean>} Indicates if the session was started successfully
287
+ * @memberof module:core
288
+ * @example
289
+ * const showLoader = true;
290
+ * tsPlatform.idv.recapture().then((success) => {
291
+ * showLoader = false;
292
+ * if (success) {
293
+ * console.log('Recapture started');
294
+ * } else {
295
+ * console.log('Recapture not started');
296
+ * }
297
+ * });
298
+ */
299
+ declare function recapture(): Promise<boolean>;
300
+ /**
301
+ * deprecated use {@link module:tsPlatform.idv.recapture|recapture} instead
302
+ * TODO: [VER-3126](https://transmitsecurity.atlassian.net/browse/VER-3126)
303
+ */
304
+ declare function restart(): Promise<boolean>;
305
+ declare const version: () => string;
306
+
307
+ declare const index_d$1_recapture: typeof recapture;
308
+ declare const index_d$1_restart: typeof restart;
309
+ declare const index_d$1_start: typeof start;
310
+ declare const index_d$1_version: typeof version;
311
+ declare namespace index_d$1 {
312
+ export {
313
+ index_d$1_recapture as recapture,
314
+ index_d$1_restart as restart,
315
+ index_d$1_start as start,
316
+ index_d$1_version as version,
317
+ };
318
+ }
319
+
320
+ /**
321
+ * Alternate paths used by the SDK to route API calls to your proxy server.
322
+ */
323
+ interface WebauthnApis {
324
+ /**
325
+ * @defaultValue `/v1/auth/webauthn/authenticate/start`
326
+ */
327
+ startAuthentication: string;
328
+ /**
329
+ * @defaultValue `/v1/auth/webauthn/register/start`
330
+ */
331
+ startRegistration: string;
332
+ /**
333
+ * @defaultValue `/v1/auth/webauthn/cross-device/register/start`
334
+ */
335
+ startCrossDeviceRegistration: string;
336
+ /**
337
+ * @defaultValue `/v1/auth/webauthn/cross-device/authenticate/init`
338
+ */
339
+ initCrossDeviceAuthentication: string;
340
+ /**
341
+ * @defaultValue `/v1/auth/webauthn/cross-device/authenticate/start`
342
+ */
343
+ startCrossDeviceAuthentication: string;
344
+ /**
345
+ * @defaultValue `/v1/auth/webauthn/cross-device/status`
346
+ */
347
+ getCrossDeviceTicketStatus: string;
348
+ /**
349
+ * @defaultValue `/v1/auth/webauthn/cross-device/attach-device`
350
+ */
351
+ attachDeviceToCrossDeviceSession: string;
352
+ }
353
+ /**
354
+ * @private
355
+ */
356
+ interface WebAuthnInitOptions {
357
+ /**
358
+ * Base path for sending API requests. This would be either a Transmit Security API deployment URL
359
+ * such as documented for sandbox, or if you are proxying API requests from your backend - then the base path to your proxy.
360
+ */
361
+ serverPath: string;
362
+ /**
363
+ * Override endpoints when using a proxy server in case the proxy server implements its own paths.
364
+ */
365
+ webauthnApiPaths?: WebauthnApis;
366
+ }
367
+
368
+ /**
369
+ * WebAuthn cross device interfaces
370
+ */
371
+ declare enum WebauthnCrossDeviceStatus {
372
+ Pending = "pending",
373
+ Scanned = "scanned",
374
+ Success = "success",
375
+ Error = "error",
376
+ Timeout = "timeout",
377
+ Aborted = "aborted"
378
+ }
379
+ /**
380
+ * WebAuthn cross device handlers interfaces
381
+ */
382
+ interface CrossDeviceController {
383
+ /**
384
+ * Ticket ID for this cross-device flow.
385
+ */
386
+ crossDeviceTicketId: string;
387
+ /**
388
+ * Stops listening for events from devices in cross-device flows
389
+ */
390
+ stop: () => void;
391
+ }
392
+ /**
393
+ * WebAuthn cross device status response interfaces
394
+ */
395
+ interface ApiCrossDeviceStatusResponse {
396
+ /**
397
+ * cross device status
398
+ */
399
+ status: WebauthnCrossDeviceStatus;
400
+ /**
401
+ * authentication session id
402
+ */
403
+ session_id?: string;
404
+ }
405
+ /**
406
+ * WebAuthn cross device attach device result interfaces
407
+ */
408
+ interface AttachDeviceResult {
409
+ /**
410
+ * cross device status
411
+ */
412
+ status: WebauthnCrossDeviceStatus;
413
+ /**
414
+ * ticket creation timestamp
415
+ */
416
+ startedAt: string;
417
+ /**
418
+ * session's approval data (if exists)
419
+ */
420
+ approvalData?: Record<string, string>;
421
+ }
422
+
423
+ interface BaseCrossDeviceHandlers {
424
+ /**
425
+ * Called when the user has successfully attached a device to the cross-device flow using the {@link WebauthnCrossDeviceFlows.attachDevice} method.
426
+ */
427
+ onDeviceAttach: () => Promise<void>;
428
+ /**
429
+ * Called when there was an error in the cross-device flow with status response {@link ApiCrossDeviceStatusResponse}.
430
+ */
431
+ onFailure: (error: ApiCrossDeviceStatusResponse) => Promise<void>;
432
+ }
433
+ interface CrossDeviceAuthenticationHandlers extends BaseCrossDeviceHandlers {
434
+ /**
435
+ * Called upon successful webauthn authentication.
436
+ * @param sessionId Session ID that will be exchanged for the user's access and ID tokens using the /v1/auth/session/authenticate API
437
+ */
438
+ onCredentialAuthenticate: (sessionId: string) => Promise<void>;
439
+ }
440
+ interface CrossDeviceRegistrationHandlers extends BaseCrossDeviceHandlers {
441
+ /**
442
+ * Called upon successful webauthn registration.
443
+ */
444
+ onCredentialRegister: () => Promise<void>;
445
+ }
446
+
447
+ interface WebauthnCrossDeviceRegistrationOptions {
448
+ /**
449
+ * Allow registration using cross-platform authenticators, such as a USB security key or a different device. If enabled, cross-device authentication flows can be performed using the native browser experience (via QR code). default: True
450
+ */
451
+ allowCrossPlatformAuthenticators?: boolean;
452
+ /**
453
+ * Must be set to true to register credentials as passkeys when supported (except for Apple devices, which always register credentials as passkeys). default: True
454
+ */
455
+ registerAsDiscoverable?: boolean;
456
+ }
457
+ interface WebauthnRegistrationOptions extends WebauthnCrossDeviceRegistrationOptions {
458
+ /**
459
+ * Human-palatable name for the user account, only for display (max 64 characters). If not set, the username parameter will also act as the display name
460
+ */
461
+ displayName?: string;
462
+ /**
463
+ * The timeout in seconds for the registration process. If the timeout is reached, the registration process will be aborted with error {@link ErrorCode.RegistrationAbortedTimeout}.
464
+ */
465
+ timeout?: number;
466
+ /**
467
+ * Set to True in order to limit the creation of multiple credentials for the same account on a single authenticator. default: False
468
+ */
469
+ limitSingleCredentialToDevice?: boolean;
470
+ }
471
+
472
+ interface WebauthnCrossDeviceFlows {
473
+ /**
474
+ * Initializes a cross device flow, such as when users request to login to a desktop using their mobile device. Once invoked, the SDK will start listening for events occurring on the other device,
475
+ * and calls your handlers when a state change is detected.
476
+ * These methods return a promise that resolves to a {@link CrossDeviceController} object, which allows you to stop listening to events and includes the cross-device ticket ID which is used when attaching another device to the flow.
477
+ */
478
+ init: {
479
+ /**
480
+ * Start a cross device registration flow
481
+ * This call receives a cross-device ticket ID, and a {@link CrossDeviceRegistrationHandlers} instance that contains your handlers for cross device events.
482
+ * For example, these handlers may update the UI or any other relevant application state.
483
+ * @throws {@link ErrorCode.NotInitialized}
484
+ * @returns {@link CrossDeviceController} - Object that allows you to stop the event loop, and obtain the cross-device ticket ID.
485
+ */
486
+ registration: (params: {
487
+ crossDeviceTicketId: string;
488
+ handlers: CrossDeviceRegistrationHandlers;
489
+ }) => Promise<CrossDeviceController>;
490
+ /**
491
+ * Start a cross device authentication flow
492
+ * This call receives an optional username (if already known), and a {@link CrossDeviceAuthenticationHandlers} instance that contains your handlers for cross device events.
493
+ * For example, these handlers may update the UI or any other relevant application state.
494
+ * If username isn't provided, it will promote a modal with a list of all discoverable credentials on the attached device. If username is provided, this call must be invoked for a registered username.
495
+ * If the target username is not registered, an SdkError will be thrown when trying to authenticate in the attached device.<br/>
496
+ * @throws {@link ErrorCode.NotInitialized}
497
+ * @throws {@link ErrorCode.FailedToInitCrossDeviceSession}
498
+ * @returns {@link CrossDeviceController} - Object that allows you to stop the event loop, and obtain the cross-device ticket ID.
499
+ */
500
+ authentication: (params: {
501
+ username?: string;
502
+ handlers: CrossDeviceAuthenticationHandlers;
503
+ }) => Promise<CrossDeviceController>;
504
+ /**
505
+ * Start a cross device approval flow
506
+ * This call receives a optional username, approval data (data to be signed using a passkey), and a {@link CrossDeviceAuthenticationHandlers} instance that contains your handlers for cross device events.
507
+ * For example, these handlers may update the UI or any other relevant application state.
508
+ * This call must be invoked for a registered username.
509
+ * If the target username is not registered, an SdkError will be thrown when trying to authenticate in the attached device.<br/>
510
+ * @throws {@link ErrorCode.NotInitialized}
511
+ * @throws {@link ErrorCode.InvalidApprovalData}
512
+ * @throws {@link ErrorCode.FailedToInitCrossDeviceSession}
513
+ * @returns {@link CrossDeviceController} - Object that allows you to stop the event loop, and obtain the cross-device ticket ID.
514
+ */
515
+ approval: (params: {
516
+ username: string;
517
+ approvalData: Record<string, string>;
518
+ handlers: CrossDeviceAuthenticationHandlers;
519
+ }) => Promise<CrossDeviceController>;
520
+ };
521
+ authenticate: {
522
+ /**
523
+ * Invokes a WebAuthn authentication for the user used in the cross device session init, including prompting the user to select from a list of registered credentials, and then prompting the user for biometrics. The credentials list is displayed using the native browser modal.<br/>
524
+ * If authentication is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
525
+ * Once tokens are retrieved, {@link CrossDeviceAuthenticationHandlers.onCredentialAuthenticate} will be called with a session ID that can also be used to retrieve tokens.
526
+ * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object.
527
+ * @throws {@link ErrorCode.NotInitialized}
528
+ * @throws {@link ErrorCode.AuthenticationFailed}
529
+ * @throws {@link ErrorCode.AuthenticationCanceled}
530
+ * @returns Base64-encoded object, which contains the credential result. This encoded result will be used to fetch user tokens via the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential).
531
+ */
532
+ modal: (crossDeviceTicketId: string) => Promise<string>;
533
+ };
534
+ approve: {
535
+ /**
536
+ * Invokes a WebAuthn approval for the user used in the cross device session init, including prompting the user to select from a list of registered credentials, and then prompting the user for biometrics. The credentials list is displayed using the native browser modal.<br/>
537
+ * If authentication is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
538
+ * Once tokens are retrieved, {@link CrossDeviceAuthenticationHandlers.onCredentialAuthenticate} will be called with a session ID that can also be used to retrieve tokens.
539
+ * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object.
540
+ * @throws {@link ErrorCode.NotInitialized}
541
+ * @throws {@link ErrorCode.AuthenticationFailed}
542
+ * @throws {@link ErrorCode.AuthenticationCanceled}
543
+ * @returns Base64-encoded object, which contains the credential result. This encoded result will be used to fetch user tokens via the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential).
544
+ */
545
+ modal: (crossDeviceTicketId: string) => Promise<string>;
546
+ };
547
+ /**
548
+ * Invokes a WebAuthn credential registration for the user used in the cross device session init, including prompting the user for biometrics.
549
+ * If registration is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the relevant backend registration endpoint to complete the registration for either a [logged-in user](/openapi/user/backend-webauthn/#operation/webauthn-registration) or [logged-out user](/openapi/user/backend-webauthn/#operation/webauthn-registration-external).
550
+ * If registration fails, an SdkError will be thrown.
551
+ * If the backend registration call was successful, {@link CrossDeviceRegistrationHandlers.onCredentialRegister} will be called.
552
+ * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object.
553
+ * @param options Additional configuration for registration flow
554
+ * @throws {@link ErrorCode.NotInitialized}
555
+ * @throws {@link ErrorCode.RegistrationFailed}
556
+ * @throws {@link ErrorCode.RegistrationCanceled}
557
+ */
558
+ register: (crossDeviceTicketId: string, options?: WebauthnCrossDeviceRegistrationOptions) => Promise<string>;
559
+ /**
560
+ * Indicates when a session is accepted on another device in cross-device flows.
561
+ *
562
+ * If successful,{@link CrossDeviceRegistrationHandlers.onDeviceAttach} will be called in registration flow and {@link CrossDeviceAuthenticationHandlers.onDeviceAttach} for authentication.
563
+ * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object.
564
+ * @returns AttachDeviceResult {@link AttachDeviceResult}. Object containing the ticket status, creation timestamp, and approval data (if passed in the init.authentication() call)
565
+ */
566
+ attachDevice: (crossDeviceTicketId: string) => Promise<AttachDeviceResult>;
567
+ }
568
+
569
+ /**
570
+ * @enum
571
+ */
572
+ declare enum ErrorCode$1 {
573
+ /**
574
+ * Either the SDK init call failed or another function was called before initializing the SDK
575
+ */
576
+ NotInitialized = "not_initialized",
577
+ /**
578
+ * When the call to {@link WebauthnApis.startAuthentication} failed
579
+ */
580
+ AuthenticationFailed = "authentication_failed",
581
+ /**
582
+ * When {@link WebauthnAuthenticationFlows.modal authenticate.modal} or {@link AutofillHandlers.activate authenticate.autofill.activate} is called and the modal is closed by the user
583
+ */
584
+ AuthenticationAbortedTimeout = "authentication_aborted_timeout",
585
+ /**
586
+ * When {@link register} is called and the modal is closed when reaching the timeout
587
+ */
588
+ AuthenticationCanceled = "webauthn_authentication_canceled",
589
+ /**
590
+ * When the call to {@link WebauthnApis.startRegistration} failed
591
+ */
592
+ RegistrationFailed = "registration_failed",
593
+ /**
594
+ / When The user attempted to register an authenticator that contains one of the credentials already registered with the relying party.
595
+ */
596
+ AlreadyRegistered = "username_already_registered",
597
+ /**
598
+ * When {@link register} is called and the modal is closed by the user
599
+ */
600
+ RegistrationAbortedTimeout = "registration_aborted_timeout",
601
+ /**
602
+ * When {@link register} is called and the modal is closed when reaching the timeout
603
+ */
604
+ RegistrationCanceled = "webauthn_registration_canceled",
605
+ /**
606
+ * Passkey autofill authentication was aborted by {@link AutofillHandlers.abort}
607
+ */
608
+ AutofillAuthenticationAborted = "autofill_authentication_aborted",
609
+ /**
610
+ * Passkey authentication is already active. To start a new authentication, abort the current one first by calling {@link AutofillHandlers.abort}
611
+ */
612
+ AuthenticationProcessAlreadyActive = "authentication_process_already_active",
613
+ /**
614
+ * The ApprovalData parameter was sent in the wrong format
615
+ */
616
+ InvalidApprovalData = "invalid_approval_data",
617
+ /**
618
+ * When the call to {@link WebauthnApis.initCrossDeviceAuthentication} failed */
619
+ FailedToInitCrossDeviceSession = "cross_device_init_failed",
620
+ /**
621
+ * When the call to {@link WebauthnApis.getCrossDeviceTicketStatus} failed */
622
+ FailedToGetCrossDeviceStatus = "cross_device_status_failed",
623
+ /**
624
+ * When the SDK operation fails on an unhandled error
625
+ */
626
+ Unknown = "unknown"
627
+ }
628
+
629
+ /**
630
+ * Common interface for `Promise` rejections.
631
+ * Developers should handle according to the `errorCode`
632
+ */
633
+ interface SdkError {
634
+ /**
635
+ * Error code from {@link ErrorCode}
636
+ */
637
+ readonly errorCode: ErrorCode$1;
638
+ /**
639
+ * Error message
640
+ */
641
+ readonly message: string;
642
+ /**
643
+ * Additional data
644
+ */
645
+ readonly data?: any;
646
+ }
647
+
648
+ interface AuthenticationAutofillActivateHandlers {
649
+ /**
650
+ * A Callback function that will be triggered once biometrics signing is completed successfully.
651
+ * @param webauthn_encoded_result
652
+ */
653
+ onSuccess: (webauthn_encoded_result: string) => Promise<void>;
654
+ /**
655
+ * A Callback function that will be triggered if authentication fails with an SdkError.
656
+ * @param err
657
+ */
658
+ onError?: (err: SdkError) => Promise<void>;
659
+ /**
660
+ * A Callback function that will be triggered when challenge excepted from the service and autofill is ready to use.
661
+ */
662
+ onReady?: () => void;
663
+ }
664
+
665
+ interface AutofillHandlers {
666
+ /**
667
+ * Invokes a WebAuthn authentication, including prompting the user to select from a list of registered credentials using autofill, and then prompting the user for biometrics. In order to prompt this credentials list, the autocomplete="username webauthn" attribute **must** be defined on the username input box of the authentication page.<br/>
668
+ * If authentication is completed successfully, the `onSuccess` callback will be triggered with the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
669
+ * If it fails, the `onError` callback will be triggered with an SdkError.
670
+ * @throws {@link ErrorCode.NotInitialized}
671
+ * @throws {@link ErrorCode.AuthenticationFailed}
672
+ * @throws {@link ErrorCode.AuthenticationCanceled}
673
+ * @throws {@link ErrorCode.AutofillAuthenticationAborted}
674
+ * @param handlers Handlers that will be invoked once the authentication is completed (success or failure)
675
+ * @param username Name of user account, as used in the WebAuthn registration. If not provided, the authentication will start without the context of a user and it will be inferred by the chosen passkey
676
+ */
677
+ activate(handlers: AuthenticationAutofillActivateHandlers, username?: string): void;
678
+ /**
679
+ * Aborts a WebAuthn authentication. This method should be called after the passkey autofill is dismissed in order to be able to query existing passkeys once again. This will end the browser's `navigator.credentials.get()` operation.
680
+ */
681
+ abort(): void;
682
+ }
683
+
684
+ interface WebauthnAuthenticationOptions {
685
+ /**
686
+ * The timeout in seconds for the authentication process. If the timeout is reached, the registration process will be aborted with error {@link ErrorCode.AuthenticationAbortedTimeout}.
687
+ */
688
+ timeout?: number;
689
+ }
690
+
691
+ interface WebauthnAuthenticationFlows {
692
+ /**
693
+ * Invokes a WebAuthn authentication, including prompting the user to select from a list of registered credentials, and then prompting the user for biometrics. The credentials list is displayed using the native browser modal.<br/>
694
+ * If username isn't provided, it will promote a modal with a list of all discoverable credentials on the device. If username is provided, this call must be invoked for a registered username. If the target username is not registered or in case of any other failure, an SdkError will be thrown.<br/>
695
+ * If authentication is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
696
+
697
+ * @param username Name of user account, as used in the WebAuthn registration. If not provided, the authentication will start without the context of a user and it will be inferred by the chosen passkey
698
+ * @param options {@link WebauthnAuthenticationOptions} Options for the authentication process
699
+ * @throws {@link ErrorCode.NotInitialized}
700
+ * @throws {@link ErrorCode.AuthenticationFailed}
701
+ * @throws {@link ErrorCode.AuthenticationCanceled}
702
+ * @throws {@link ErrorCode.InvalidApprovalData}
703
+ * @throws {@link ErrorCode.AuthenticationProcessAlreadyActive}
704
+ * @returns Base64-encoded object, which contains the credential result. This encoded result will be used to fetch user tokens via the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential).
705
+ */
706
+ modal(username?: string, options?: WebauthnAuthenticationOptions): Promise<string>;
707
+ /**
708
+ * Property used to implement credential selection via autofill UI.
709
+ */
710
+ autofill: AutofillHandlers;
711
+ }
712
+
713
+ interface WebauthnApprovalFlows {
714
+ /**
715
+ * Invokes a WebAuthn approval, including prompting the user to select from a list of registered credentials, and then prompting the user for biometrics. The credentials list is displayed using the native browser modal.<br/>
716
+ * This call must be invoked for a registered username. If the target username is not registered or in case of any other failure, an SdkError will be thrown.<br/>
717
+ * If approval is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential) to retrieve user tokens.<br/>
718
+ * @param username Name of user account, as used in the WebAuthn registration.
719
+ * @param approvalData Data that represents the approval to be signed with a passkey
720
+ * @throws {@link ErrorCode.NotInitialized}
721
+ * @throws {@link ErrorCode.InvalidApprovalData}
722
+ * @throws {@link ErrorCode.AuthenticationFailed}
723
+ * @throws {@link ErrorCode.AuthenticationCanceled}
724
+ * @throws {@link ErrorCode.AuthenticationProcessAlreadyActive}
725
+ * @returns Base64-encoded object, which contains the credential result. This encoded result will be used to fetch user tokens via the [backend authentication endpoint](/openapi/user/backend-webauthn/#operation/authenticateWebauthnCredential).
726
+ */
727
+ modal(username: string | undefined, approvalData: Record<string, string>): Promise<string>;
728
+ }
729
+
730
+ declare module '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata' {
731
+ interface initConfigParams {
732
+ webauthn?: WebAuthnInitOptions;
733
+ }
734
+ }
735
+ /**
736
+ * Returns the authentication flows for webauthn
737
+ */
738
+ declare const authenticate: WebauthnAuthenticationFlows;
739
+ declare const approve: WebauthnApprovalFlows;
740
+ /**
741
+ * Invokes a WebAuthn credential registration for the specified user, including prompting the user for biometrics.
742
+ * If registration is completed successfully, this call will return a promise that resolves to the credential result, which is an object encoded as a base64 string. This encoded result should then be passed to the relevant backend registration endpoint to complete the registration for either a [logged-in user](/openapi/user/backend-webauthn/#operation/webauthn-registration) or [logged-out user](/openapi/user/backend-webauthn/#operation/webauthn-registration-external).
743
+ *
744
+ * If registration fails, an SdkError will be thrown.
745
+ *
746
+ * @param username WebAuthn username to register
747
+ * @param options Additional configuration for registration flow
748
+ * @throws {@link ErrorCode.NotInitialized}
749
+ * @throws {@link ErrorCode.RegistrationFailed}
750
+ * @throws {@link ErrorCode.RegistrationCanceled}
751
+ */
752
+ declare function register(username: string, options?: WebauthnRegistrationOptions): Promise<string>;
753
+ /**
754
+ * Returns webauthn cross device flows
755
+ * @type WebauthnCrossDeviceFlows
756
+ */
757
+ declare const crossDevice: WebauthnCrossDeviceFlows;
758
+ /**
759
+ * Indicates whether this browser supports WebAuthn, and has a platform authenticator
760
+ */
761
+ declare const isPlatformAuthenticatorSupported: () => Promise<boolean | undefined>;
762
+ /**
763
+ * Indicates whether this browser supports Passkey Autofill
764
+ */
765
+ declare const isAutofillSupported: () => Promise<boolean>;
766
+ /**
767
+ * Returns the default API paths for webauthn
768
+ */
769
+ declare const getDefaultPaths: () => WebauthnApis;
770
+
771
+ type index_d_ApiCrossDeviceStatusResponse = ApiCrossDeviceStatusResponse;
772
+ type index_d_AttachDeviceResult = AttachDeviceResult;
773
+ type index_d_AuthenticationAutofillActivateHandlers = AuthenticationAutofillActivateHandlers;
774
+ type index_d_AutofillHandlers = AutofillHandlers;
775
+ type index_d_CrossDeviceAuthenticationHandlers = CrossDeviceAuthenticationHandlers;
776
+ type index_d_CrossDeviceController = CrossDeviceController;
777
+ type index_d_CrossDeviceRegistrationHandlers = CrossDeviceRegistrationHandlers;
778
+ type index_d_SdkError = SdkError;
779
+ type index_d_WebauthnApis = WebauthnApis;
780
+ type index_d_WebauthnApprovalFlows = WebauthnApprovalFlows;
781
+ type index_d_WebauthnAuthenticationFlows = WebauthnAuthenticationFlows;
782
+ type index_d_WebauthnAuthenticationOptions = WebauthnAuthenticationOptions;
783
+ type index_d_WebauthnCrossDeviceFlows = WebauthnCrossDeviceFlows;
784
+ type index_d_WebauthnCrossDeviceRegistrationOptions = WebauthnCrossDeviceRegistrationOptions;
785
+ type index_d_WebauthnCrossDeviceStatus = WebauthnCrossDeviceStatus;
786
+ declare const index_d_WebauthnCrossDeviceStatus: typeof WebauthnCrossDeviceStatus;
787
+ type index_d_WebauthnRegistrationOptions = WebauthnRegistrationOptions;
788
+ declare const index_d_approve: typeof approve;
789
+ declare const index_d_authenticate: typeof authenticate;
790
+ declare const index_d_crossDevice: typeof crossDevice;
791
+ declare const index_d_getDefaultPaths: typeof getDefaultPaths;
792
+ declare const index_d_isAutofillSupported: typeof isAutofillSupported;
793
+ declare const index_d_isPlatformAuthenticatorSupported: typeof isPlatformAuthenticatorSupported;
794
+ declare const index_d_register: typeof register;
795
+ declare namespace index_d {
796
+ export { ErrorCode$1 as ErrorCode, index_d_WebauthnCrossDeviceStatus as WebauthnCrossDeviceStatus, index_d_approve as approve, index_d_authenticate as authenticate, index_d_crossDevice as crossDevice, index_d_getDefaultPaths as getDefaultPaths, index_d_isAutofillSupported as isAutofillSupported, index_d_isPlatformAuthenticatorSupported as isPlatformAuthenticatorSupported, index_d_register as register };
797
+ export type { index_d_ApiCrossDeviceStatusResponse as ApiCrossDeviceStatusResponse, index_d_AttachDeviceResult as AttachDeviceResult, index_d_AuthenticationAutofillActivateHandlers as AuthenticationAutofillActivateHandlers, index_d_AutofillHandlers as AutofillHandlers, index_d_CrossDeviceAuthenticationHandlers as CrossDeviceAuthenticationHandlers, index_d_CrossDeviceController as CrossDeviceController, index_d_CrossDeviceRegistrationHandlers as CrossDeviceRegistrationHandlers, index_d_SdkError as SdkError, index_d_WebauthnApis as WebauthnApis, index_d_WebauthnApprovalFlows as WebauthnApprovalFlows, index_d_WebauthnAuthenticationFlows as WebauthnAuthenticationFlows, index_d_WebauthnAuthenticationOptions as WebauthnAuthenticationOptions, index_d_WebauthnCrossDeviceFlows as WebauthnCrossDeviceFlows, index_d_WebauthnCrossDeviceRegistrationOptions as WebauthnCrossDeviceRegistrationOptions, index_d_WebauthnRegistrationOptions as WebauthnRegistrationOptions };
798
+ }
799
+
800
+ /**
801
+ * @interface
802
+ * @description Parameters for SDK initialization
803
+ */
804
+ interface IdoInitOptions {
805
+ /**
806
+ * Base path for sending API requests. This would be the base URL of the orchestration server.
807
+ */
808
+ serverPath: string;
809
+ /**
810
+ * An optional resource URI, if defined in the application settings in the admin portal
811
+ */
812
+ resource?: string;
813
+ /**
814
+ * The log level for the SDK. Default is LogLevel.Info
815
+ * @default LogLevel.Info
816
+ * @see {@link LogLevel}
817
+ */
818
+ logLevel?: LogLevel;
819
+ /**
820
+ * The timeout for polling requests to the server for the wait for another device action in seconds.
821
+ * @default 3
822
+ * @see {@link IdoJourneyActionType.WaitForAnotherDevice}
823
+ */
824
+ pollingTimeout?: number;
825
+ /**
826
+ * The expected locale format is the standard language tags as defined by the localization RFC 5646 (https://datatracker.ietf.org/doc/html/rfc5646).
827
+ */
828
+ locale?: string;
829
+ }
830
+ /**
831
+ * @interface
832
+ * @description Optional parameters for starting an SDK journey
833
+ */
834
+ interface StartJourneyOptions {
835
+ /**
836
+ * Additional parameters to be passed to the Journey, Optional.
837
+ */
838
+ additionalParams?: any;
839
+ /**
840
+ * A unique identifier for the flow. Will be auto generated if not provided.
841
+ */
842
+ correlationId?: string;
843
+ /**
844
+ * Should client-server communication be double encrypted? Defaults to false.
845
+ */
846
+ encrypted?: boolean;
847
+ }
848
+ /**
849
+ * @interface
850
+ * @description Optional parameters for starting an SSO journey
851
+ */
852
+ interface StartSsoJourneyOptions {
853
+ /**
854
+ * Should client-server communication be double encrypted? Defaults to false.
855
+ */
856
+ encrypted?: boolean;
857
+ }
858
+ /**
859
+ * @enum
860
+ * @description The enum for the log levels.
861
+ */
862
+ declare enum LogLevel {
863
+ Debug = 0,
864
+ Info = 1,
865
+ Warning = 2,
866
+ Error = 3
867
+ }
868
+ /**
869
+ * @enum
870
+ * @description The enum for the sdk error codes.
871
+ */
872
+ declare enum ErrorCode {
873
+ /**
874
+ * @description The init options object is invalid.
875
+ */
876
+ InvalidInitOptions = "invalid_initialization_options",
877
+ /**
878
+ * @description The sdk is not initialized.
879
+ */
880
+ NotInitialized = "not_initialized",
881
+ /**
882
+ * @description There is no active Journey.
883
+ */
884
+ NoActiveJourney = "no_active_journey",
885
+ /**
886
+ * @description Unable to receive response from the server.
887
+ */
888
+ NetworkError = "network_error",
889
+ /**
890
+ * @description The client response to the Journey is not valid.
891
+ */
892
+ ClientResponseNotValid = "client_response_not_valid",
893
+ /**
894
+ * @description The server returned an unexpected error.
895
+ */
896
+ ServerError = "server_error",
897
+ /**
898
+ * @description The provided state is not valid for SDK state recovery.
899
+ */
900
+ InvalidState = "invalid_state",
901
+ /**
902
+ * @description The provided credentials are invalid.
903
+ */
904
+ InvalidCredentials = "invalid_credentials",
905
+ /**
906
+ * @description The provided OTP passcode is expired.
907
+ */
908
+ ExpiredOTPPasscode = "expired_otp_passcode",
909
+ /**
910
+ * @description The provided validation passcode is expired.
911
+ */
912
+ ExpiredValidationPasscode = "expired_validation_passcode",
913
+ /**
914
+ * @description Max resend attempts reached
915
+ */
916
+ MaxResendReached = "expired_otp_passcode"
917
+ }
918
+ /**
919
+ * @interface
920
+ * @description Common interface for Promise rejections. Developers should handle according to the @errorCode
921
+ */
922
+ interface IdoSdkError {
923
+ /**
924
+ * @description The error code.
925
+ */
926
+ readonly errorCode: ErrorCode;
927
+ /**
928
+ * @description The error description.
929
+ */
930
+ readonly description: string;
931
+ /**
932
+ * @description The error additional data. Optional.
933
+ */
934
+ readonly data?: any;
935
+ }
936
+ /**
937
+ * @enum
938
+ * @description The enum for the client response option types.
939
+ */
940
+ declare enum ClientResponseOptionType {
941
+ /**
942
+ * @description Client response option type for client input. This is the standard response option for any step.
943
+ */
944
+ ClientInput = "client_input",
945
+ /**
946
+ * @description Client response option type for a cancelation branch in the Journey. Use this for canceling the current step.
947
+ */
948
+ Cancel = "cancel",
949
+ /**
950
+ * @description Client response option type for a failure branch in the Journey. Use this for reporting client side failure for the current step.
951
+ */
952
+ Fail = "failure",
953
+ /**
954
+ * @description Client response option type for custom branch in the Journey, used for custom branching.
955
+ */
956
+ Custom = "custom",
957
+ /**
958
+ * @description Client response option type for a resend of the OTP. Use this for restarting the current step (sms / email otp authentication).
959
+ */
960
+ Resend = "resend"
961
+ }
962
+ /**
963
+ * @interface
964
+ * @description The interface for client response option object. Use this object to submit client input to the Journey
965
+ * step to process, cancel the current step or choose a custom branch.
966
+ */
967
+ interface ClientResponseOption {
968
+ /**
969
+ * @description The type of the client response option.
970
+ */
971
+ readonly type: ClientResponseOptionType;
972
+ /**
973
+ * @description The id of the client response option.
974
+ * Journey step unique id is provided for the {@link ClientResponseOptionType.Custom} response option type.
975
+ * {@link ClientResponseOptionType.ClientInput} and {@link ClientResponseOptionType.Cancel} have standard Ids _ClientInput_ and _Cancel_, respectively.
976
+ */
977
+ readonly id: string;
978
+ /**
979
+ * @description The label of the client response option.
980
+ */
981
+ readonly label: string;
982
+ /**
983
+ * @description Optional schema object that can be used for UI rendering.
984
+ */
985
+ schema?: Record<string, any>;
986
+ }
987
+ /**
988
+ * @deprecated
989
+ * @enum
990
+ * @description Deprecated enum. Use {@link IdoJourneyActionType} instead to detect completion, rejection, or a step that requires client input.
991
+ */
992
+ declare enum IdoServiceResponseType {
993
+ /**
994
+ * @description The Journey ended successfully.
995
+ */
996
+ JourneySuccess = "journey_success",
997
+ /**
998
+ * @description The Journey reached a step that requires client input.
999
+ */
1000
+ ClientInputRequired = "client_input_required",
1001
+ /**
1002
+ * @description The current Journey step updated the client data or provided an error message.
1003
+ */
1004
+ ClientInputUpdateRequired = "client_input_update_required",
1005
+ /**
1006
+ * @description The Journey ended with explicit rejection.
1007
+ */
1008
+ JourneyRejection = "journey_rejection"
1009
+ }
1010
+ /**
1011
+ * @enum
1012
+ * @description The enum for the Journey step ID, used when the journey step is a predefined typed action.
1013
+ * The actions that do not use this are "Get Information from Client" and "Login Form" which allow the journey author to define a custom ID.
1014
+ * See also {@link IdoServiceResponse.journeyStepId}.
1015
+ */
1016
+ declare enum IdoJourneyActionType {
1017
+ /**
1018
+ * @description `journeyStepId` for a journey rejection.
1019
+ */
1020
+ Rejection = "action:rejection",
1021
+ /**
1022
+ * @description `journeyStepId` for a journey completion.
1023
+ */
1024
+ Success = "action:success",
1025
+ /**
1026
+ * @description `journeyStepId` for an Information action.
1027
+ *
1028
+ * Data received in the {@link IdoServiceResponse} object:
1029
+ * These are the text values that are configured for the Information action step in the journey editor.
1030
+ * This can be used to display the information to the user.
1031
+ * ```json
1032
+ * {
1033
+ * "data": {
1034
+ * "title": "<TITLE>",
1035
+ * "text": "<TEXT>",
1036
+ * "button_text": "<BUTTON TEXT>"
1037
+ * }
1038
+ * }
1039
+ * ```
1040
+ * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
1041
+ */
1042
+ Information = "action:information",
1043
+ /**
1044
+ * @description `journeyStepId` for a server side debugger breakpoint.
1045
+ * This response is sent to the client side when the journey debugger has reached a breakpoint, and will continue to return while
1046
+ * the journey debugger is paused.
1047
+ *
1048
+ * The {@link IdoServiceResponse} object does not include any data.
1049
+ *
1050
+ * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
1051
+ */
1052
+ DebugBreak = "action:debug_break",
1053
+ /**
1054
+ * @description `journeyStepId` for a Wait for Cross Session Message action.
1055
+ *
1056
+ * The {@link IdoServiceResponse} object includes information that can be presented as a QR to scan by another device.
1057
+ * The response will remain the same while the cross session message was not consumed by the journey executed by the other device.
1058
+ *
1059
+ * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
1060
+ */
1061
+ WaitForAnotherDevice = "action:wait_for_another_device",
1062
+ /**
1063
+ * @hidden
1064
+ * @deprecated Use {@link IdoJourneyActionType.RegisterDeviceAction} instead.
1065
+ */
1066
+ CryptoBindingRegistration = "action:crypto_binding_registration",
1067
+ /**
1068
+ * @hidden
1069
+ * @deprecated Use {@link IdoJourneyActionType.ValidateDeviceAction} instead.
1070
+ */
1071
+ CryptoBindingValidation = "action:crypto_binding_validation",
1072
+ /**
1073
+ * @hidden
1074
+ * @description `journeyStepId` for Register Device action.
1075
+ * This action is handled automatically by the SDK.
1076
+ */
1077
+ RegisterDeviceAction = "transmit_platform_device_registration",
1078
+ /**
1079
+ * @hidden
1080
+ * @description `journeyStepId` for Validate Device action.
1081
+ * This action is handled automatically by the SDK.
1082
+ */
1083
+ ValidateDeviceAction = "transmit_platform_device_validation",
1084
+ /**
1085
+ * @description `journeyStepId` for WebAuthn Registration action.
1086
+ *
1087
+ * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `tsPlatform.webauthn.register()`
1088
+ * ```json
1089
+ * {
1090
+ * "data": {
1091
+ * "username": "<USERNAME>",
1092
+ * "display_name": "<DISPLAY_NAME>",
1093
+ * "register_as_discoverable": <true|false>,
1094
+ * "allow_cross_platform_authenticators": <true|false>
1095
+ * }
1096
+ * }
1097
+ * ```
1098
+ *
1099
+ * Before responding, activate `tsPlatform.webauthn.register()` to obtain the `webauthn_encoded_result` value.
1100
+ * This will present the user with the WebAuthn registration UI. Use the result to send the client response:
1101
+ * ```json
1102
+ * tsPlatform.ido.submitClientResponse(
1103
+ * ClientResponseOptionType.ClientInput,
1104
+ * {
1105
+ * "webauthn_encoded_result": "<WEBAUTHN_ENCODED_RESULT_FROM_SDK>"
1106
+ * })
1107
+ * ```
1108
+ */
1109
+ WebAuthnRegistration = "action:webauthn_registration",
1110
+ /**
1111
+ * @description `journeyStepId` for instructing the use of DRS trigger action, as part of the Risk Recommendation journey step.
1112
+ *
1113
+ * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `tsPlatform.drs.triggerActionEvent()`
1114
+ * ```json
1115
+ * {
1116
+ * "data": {
1117
+ * "correlation_id": "a47ed80a-41f9-464a-a42f-fce775b6e446",
1118
+ * "user_id": "user",
1119
+ * "action_type": "login"
1120
+ * },
1121
+ * }
1122
+ * ```
1123
+ * Before responding, activate `tsPlatform.drs.triggerActionEvent()` to obtain the `action_token` value. This is a silent action, and does not require user interaction.
1124
+ * Use the result to send the client response:
1125
+ * ```json
1126
+ * tsPlatform.ido.submitClientResponse(
1127
+ * ClientResponseOptionType.ClientInput,
1128
+ * {
1129
+ * "action_token": "<DRS action token>"
1130
+ * })
1131
+ * ```
1132
+ */
1133
+ DrsTriggerAction = "action:drs_trigger_action",
1134
+ /**
1135
+ * @description `journeyStepId` for Identity Verification action.
1136
+ *
1137
+ * Data received in the {@link IdoServiceResponse} object:
1138
+ * ```json
1139
+ * {
1140
+ * "data": {
1141
+ * "payload": {
1142
+ * "endpoint": "<endpoint to redirect>",
1143
+ * "base_endpoint": "<base endpoint>",
1144
+ * "start_token": "<start token>",
1145
+ * "state": "<state>",
1146
+ * "session": "<session>"
1147
+ * },
1148
+ * }
1149
+ * }
1150
+ * ```
1151
+ * Use this data to redirect the user to the identity verification endpoint.
1152
+ * Since this redirects to a different page, make sure you store the SDK state by calling `tsPlatform.ido.serializeState()`, and saving the response data in the session storage.
1153
+ * After the user completes the identity verification, you can restore the SDK state and continue the journey, by calling `tsPlatform.ido.restoreFromSerializedState()` with the stored state.
1154
+ *
1155
+ * Once done, send the following client response:
1156
+ * ```json
1157
+ * tsPlatform.ido.submitClientResponse(
1158
+ * ClientResponseOptionType.ClientInput,
1159
+ * {
1160
+ * "payload": {
1161
+ * "sessionId": "<sessionId>",
1162
+ * "state": "<state>"
1163
+ * }
1164
+ * })
1165
+ * ```
1166
+ */
1167
+ IdentityVerification = "action:id_verification",
1168
+ /**
1169
+ * @description `journeyStepId` for Email OTP authentication action.
1170
+ *
1171
+ * Data received in the {@link IdoServiceResponse} object:
1172
+ *
1173
+ * ```json
1174
+ * {
1175
+ * "data": {
1176
+ * "code_length": <integer_code_length>
1177
+ * }
1178
+ * }
1179
+ * ```
1180
+ *
1181
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials} or the error code {@link ErrorCode.ExpiredOTPPasscode}.
1182
+ *
1183
+ * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode.
1184
+ * Also, a resend option (see below) can be provided to the user.
1185
+ *
1186
+ * Client responses:
1187
+ *
1188
+ * - For simple submit of OTP passcode:
1189
+ * ```json
1190
+ * tsPlatform.ido.submitClientResponse(
1191
+ * ClientResponseOptionType.ClientInput,
1192
+ * {
1193
+ * "passcode": "<passcode>"
1194
+ * })
1195
+ * ```
1196
+ *
1197
+ * - In Order to request resend of OTP (restart the action):
1198
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
1199
+ *
1200
+ */
1201
+ EmailOTPAuthentication = "transmit_platform_email_otp_authentication",
1202
+ /**
1203
+ * @description `journeyStepId` for SMS OTP authentication action.
1204
+ *
1205
+ * Data received in the {@link IdoServiceResponse} object:
1206
+ *
1207
+ * ```json
1208
+ * {
1209
+ * "data": {
1210
+ * "code_length": <integer_code_length>
1211
+ * }
1212
+ * }
1213
+ * ```
1214
+ *
1215
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}, or the error code {@link ErrorCode.ExpiredOTPPasscode}
1216
+ *
1217
+ * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode.
1218
+ * Also, a resend option (see below) can be provided to the user.
1219
+ *
1220
+ * Client responses:
1221
+ *
1222
+ * - For simple submit of OTP passcode:
1223
+ * ```json
1224
+ * tsPlatform.ido.submitClientResponse(
1225
+ * ClientResponseOptionType.ClientInput,
1226
+ * {
1227
+ * "passcode": "<passcode>"
1228
+ * })
1229
+ * ```
1230
+ *
1231
+ * - In Order to request resend of OTP (restart the action):
1232
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
1233
+ *
1234
+ */
1235
+ SmsOTPAuthentication = "transmit_platform_sms_otp_authentication",
1236
+ /**
1237
+ * @description `journeyStepId` for TOTP Registration action.
1238
+ *
1239
+ * Data received in the {@link IdoServiceResponse} object:
1240
+ * ```json
1241
+ * {
1242
+ * "data": {
1243
+ * "payload": {
1244
+ * "secret": "<secret>",
1245
+ * "uri": "<uri>"
1246
+ * },
1247
+ * }
1248
+ * }
1249
+ * ```
1250
+ * Use this data to display the TOTP registration QR code / link to the user.
1251
+ * The user should use this to register the TOTP secret in their authenticator app.
1252
+ * Once the user has completed the registration, send the following empty client response:
1253
+ * ```json
1254
+ * tsPlatform.ido.submitClientResponse(
1255
+ * ClientResponseOptionType.ClientInput
1256
+ * )
1257
+ * ```
1258
+ * Please note that registration of the TOTP secret is a silent action, and does not require user interaction.
1259
+ * An empty response is sent to the server in order to continue the journey.
1260
+ *
1261
+ */
1262
+ /**
1263
+ * @description `journeyStepId` for Email Validation action.
1264
+ *
1265
+ * Data received in the {@link IdoServiceResponse} object:
1266
+ *
1267
+ * ```json
1268
+ * {
1269
+ * "data": {
1270
+ * "code_length": <integer_code_length>
1271
+ * }
1272
+ * }
1273
+ * ```
1274
+ *
1275
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}
1276
+ *
1277
+ * Resend option also (see below) can be provided to the user.
1278
+ *
1279
+ * Client responses:
1280
+ *
1281
+ * - For simple submit of validation passcode:
1282
+ * ```json
1283
+ * tsPlatform.ido.submitClientResponse(
1284
+ * ClientResponseOptionType.ClientInput,
1285
+ * {
1286
+ * "passcode": "<passcode>"
1287
+ * })
1288
+ * ```
1289
+ *
1290
+ * - In Order to request resend of OTP (restart the action):
1291
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
1292
+ *
1293
+ */
1294
+ EmailValidation = "transmit_platform_email_validation",
1295
+ /**
1296
+ * @description `journeyStepId` for Sms Validation action.
1297
+ *
1298
+ * Data received in the {@link IdoServiceResponse} object:
1299
+ *
1300
+ * ```json
1301
+ * {
1302
+ * "data": {
1303
+ * "code_length": <integer_code_length>
1304
+ * }
1305
+ * }
1306
+ * ```
1307
+ *
1308
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}
1309
+ *
1310
+ * Resend option also (see below) can be provided to the user.
1311
+ *
1312
+ * Client responses:
1313
+ *
1314
+ * - For simple submit of validation passcode:
1315
+ * ```json
1316
+ * tsPlatform.ido.submitClientResponse(
1317
+ * ClientResponseOptionType.ClientInput,
1318
+ * {
1319
+ * "passcode": "<passcode>"
1320
+ * })
1321
+ * ```
1322
+ *
1323
+ * - In Order to request resend of OTP (restart the action):
1324
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
1325
+ *
1326
+ */
1327
+ SmsValidation = "transmit_platform_sms_validation",
1328
+ TotpRegistration = "transmit_platform_totp_registration",
1329
+ /**
1330
+ * @description `journeyStepId` for Transaction Signing with TOTP action.
1331
+ *
1332
+ * Data received in the {@link IdoServiceResponse} object:
1333
+ * ```json
1334
+ * {
1335
+ * "data": {
1336
+ * "transaction_challenge": "<6_DIGIT_CHALLENGE_CODE>",
1337
+ * "approval_data": {
1338
+ * // Note: This is just an example. The actual approval_data can vary.
1339
+ * "transactionId": "<TRANSACTION_ID>",
1340
+ * "amount": "<AMOUNT>",
1341
+ * "currency": "<CURRENCY>"
1342
+ * }
1343
+ * }
1344
+ * }
1345
+ * ```
1346
+ * Use this data to display the transaction details and the challenge code to the user.
1347
+ * The user should use this challenge code to generate a TOTP code using their authenticator app.
1348
+ *
1349
+ * Client responses:
1350
+ *
1351
+ * - For submitting the TOTP code:
1352
+ * ```json
1353
+ * tsPlatform.ido.submitClientResponse(
1354
+ * ClientResponseOptionType.ClientInput,
1355
+ * {
1356
+ * "totp_code": "<6_DIGIT_TOTP_CODE>"
1357
+ * }
1358
+ * )
1359
+ * ```
1360
+ *
1361
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain the error code {@link ErrorCode.InvalidCredentials}.
1362
+ * This can be used to indicate that the TOTP code is invalid, prompting the user to enter a new code.
1363
+ *
1364
+ * Note: The user has a limited number of attempts to enter the correct TOTP code before the journey is rejected.
1365
+ */
1366
+ TransactionSigningTOTP = "transmit_platform_transaction_signing_totp",
1367
+ /**
1368
+ * @description `journeyStepId` for Invoke IDP action.
1369
+ *
1370
+ * Data received in the {@link IdoServiceResponse} object:
1371
+ * ```json
1372
+ * {
1373
+ * "data": {
1374
+ * "authorization_url": "<URL_OF_THE_AUTHORIZATION_ENDPOINT>",
1375
+ * "authorization_request_method": "<GET_OR_POST>",
1376
+ * "invocation_method": "<PAGE_OR_POPUP>",
1377
+ * "idp_name": "<IDP_NAME>"
1378
+ * }
1379
+ * }
1380
+ * ```
1381
+ * Use this data to redirect the user to the IDP authorization endpoint.
1382
+ *
1383
+ *
1384
+ * Once done, send the following client response:
1385
+ * ```json
1386
+ * tsPlatform.ido.submitClientResponse(
1387
+ * ClientResponseOptionType.ClientInput,
1388
+ * {
1389
+ * "idp_response" : {
1390
+ * "code": "<code>",
1391
+ * "state": "<state>",
1392
+ * }
1393
+ * }
1394
+ * )
1395
+ *```
1396
+ *
1397
+ *
1398
+ */
1399
+ InvokeIDP = "invoke_idp",
1400
+ /**
1401
+ * @description `journeyStepId` for Transaction Signing with Passkeys action.
1402
+ *
1403
+ * Data received in the {@link IdoServiceResponse} object:
1404
+ * ```json
1405
+ * {
1406
+ * "data": {
1407
+ * "user_identifier": "<USERNAME>",
1408
+ * "approval_data": {
1409
+ * // Note: This is just an example. The actual approval_data can vary.
1410
+ * "transactionId": "<TRANSACTION_ID>",
1411
+ * "amount": "<AMOUNT>",
1412
+ * "currency": "<CURRENCY>"
1413
+ * }
1414
+ * }
1415
+ * }
1416
+ * ```
1417
+ * Before responding, call `tsPlatform.webauthn.approve.modal()` to obtain the `webauthn_encoded_result` value.
1418
+ * ```javascript
1419
+ * const result = await tsPlatform.webauthn.approve.modal(
1420
+ * response.data.approval_data // Transaction details to be approved
1421
+ * );
1422
+ * ```
1423
+ *
1424
+ * Then submit the result:
1425
+ * ```javascript
1426
+ * tsPlatform.ido.submitClientResponse(
1427
+ * ClientResponseOptionType.ClientInput,
1428
+ * {
1429
+ * "webauthn_encoded_result": result
1430
+ * }
1431
+ * )
1432
+ * ```
1433
+ *
1434
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain
1435
+ * relevant error codes that can be used to handle various failure scenarios.
1436
+ *
1437
+ * Note: The approval_data object can contain up to 10 key-value pairs using only alphanumeric
1438
+ * characters, underscores, hyphens, and periods. The WebAuthn encoded result remains valid for 60 seconds.
1439
+ */
1440
+ WebAuthnTransactionSigning = "transmit_platform_transaction_signing_webauthn",
1441
+ /**
1442
+ * @description `journeyStepId` for Select Organization action.
1443
+ *
1444
+ * Data received in the {@link IdoServiceResponse} object:
1445
+ *
1446
+ * ```json
1447
+ * {
1448
+ * "data": {
1449
+ * "organizations": [
1450
+ * {
1451
+ * "id": "aq5Doa_GMiDhL2GC-HdKo",
1452
+ * "name": "Organization 1"
1453
+ * },
1454
+ * {
1455
+ * "id": "mkiPd9tu0K2h9oCM9pRB7",
1456
+ * "name": "Organization 2"
1457
+ * },
1458
+ * {
1459
+ * "id": "fdlvZdof5GPvqJlBeAoFs",
1460
+ * "name": "Organization 3"
1461
+ * }
1462
+ * ]
1463
+ * }
1464
+ * }
1465
+ * ```
1466
+ *
1467
+ *
1468
+ * For organization selection, send the following client response:
1469
+ * ```javascript
1470
+ * tsPlatform.ido.submitClientResponse(
1471
+ * ClientResponseOptionType.ClientInput,
1472
+ * {
1473
+ * "organization_id": "<ORGANIZATION_ID>"
1474
+ * }
1475
+ * )
1476
+ * ```
1477
+ *
1478
+ * Note: If a user is a member of a single organization, this step will pick it implicitly.
1479
+ */
1480
+ SelectOrganization = "transmit_platform_select_organization",
1481
+ /**
1482
+ * @description `journeyStepId` for Web to Mobile Authentication action.
1483
+ * This action type is used for both simple authentication and transaction signing scenarios.
1484
+ *
1485
+ * Initial Data received in the {@link IdoServiceResponse} object when multiple devices are available:
1486
+ * ```json
1487
+ * {
1488
+ * "data": {
1489
+ * "devices": [
1490
+ * {
1491
+ * "name": "Device 1",
1492
+ * "code": "1"
1493
+ * },
1494
+ * {
1495
+ * "name": "Device 2",
1496
+ * "code": "2"
1497
+ * }
1498
+ * ]
1499
+ * }
1500
+ * }
1501
+ * ```
1502
+ *
1503
+ * For device selection, send the following client response:
1504
+ * ```javascript
1505
+ * tsPlatform.ido.submitClientResponse(
1506
+ * ClientResponseOptionType.ClientInput,
1507
+ * {
1508
+ * "selected_device_code": "<DEVICE_CODE>"
1509
+ * }
1510
+ * )
1511
+ * ```
1512
+ *
1513
+ * After device selection or when only one device is available, the action will wait for mobile approval.
1514
+ * The response includes polling configuration and optional transaction details:
1515
+ * ```json
1516
+ * {
1517
+ * "data": {
1518
+ * "device_display_name": "Device 1",
1519
+ * "resend_attempts_left": 5,
1520
+ * "polling_interval": 3,
1521
+ * "approval_data": {
1522
+ * // Note: This is just an example. The actual approval_data can vary.
1523
+ * "transactionId": "<TRANSACTION_ID>",
1524
+ * "amount": "<AMOUNT>",
1525
+ * "currency": "<CURRENCY>"
1526
+ * }
1527
+ * }
1528
+ * }
1529
+ * ```
1530
+ *
1531
+ * The following options are available:
1532
+ *
1533
+ * - To check current authentication status (polling):
1534
+ * ```javascript
1535
+ * // The application should implement its own polling mechanism
1536
+ * // and call this method periodically to check the status
1537
+ * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput)
1538
+ * ```
1539
+ *
1540
+ * - To cancel the authentication:
1541
+ * ```javascript
1542
+ * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Cancel)
1543
+ * ```
1544
+ *
1545
+ * - To resend the push notification:
1546
+ * ```javascript
1547
+ * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)
1548
+ * ```
1549
+ *
1550
+ * Note: The application is responsible for implementing the polling mechanism
1551
+ * to check the authentication status. The SDK only provides the method to
1552
+ * submit the status check request. Use the polling_interval from the response
1553
+ * to determine the frequency of status checks.
1554
+ *
1555
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain
1556
+ * relevant error codes that can be used to handle various failure scenarios.
1557
+ */
1558
+ MobileApproveAuthentication = "transmit_platform_mobile_approve_authentication"
1559
+ }
1560
+ /**
1561
+ * @interface
1562
+ * @description The interface for the Journey step response object. Including Journey end with either error, rejection and success.
1563
+ */
1564
+ interface IdoServiceResponse {
1565
+ /**
1566
+ * @deprecated
1567
+ * @description Deprecated attribute. Use {@link IdoJourneyActionType} instead.
1568
+ */
1569
+ readonly type: IdoServiceResponseType;
1570
+ /**
1571
+ * @description Optional data object returned from the server for any of the journey steps.
1572
+ */
1573
+ readonly data?: any;
1574
+ /**
1575
+ * @description Additional error data returned from the server for any of the journey steps.
1576
+ */
1577
+ readonly errorData?: IdoSdkError;
1578
+ /**
1579
+ * @description Contains the Journey step ID, allowing the client side to choose the correct handler and UI.
1580
+ * This will be either a form ID for the "Get Information from Client" and "Login Form" journey steps,
1581
+ * or one of {@link IdoJourneyActionType} for other actions.
1582
+ */
1583
+ readonly journeyStepId?: IdoJourneyActionType | string;
1584
+ /**
1585
+ * @description The Journey client response options if the response type is {@link IdoServiceResponseType.ClientInputRequired}
1586
+ * or {@link IdoServiceResponseType.ClientInputUpdateRequired}.
1587
+ */
1588
+ readonly clientResponseOptions?: Record<ClientResponseOptionType | string, ClientResponseOption>;
1589
+ /**
1590
+ * @description A proof of journey completion is provided upon successful completion of the journey,
1591
+ * indicated by the {@link IdoJourneyActionType.Success} step ID.
1592
+ */
1593
+ token?: string;
1594
+ /**
1595
+ * @description If a browser-redirection is required (for example at the end of an SSO journey) - the server will provide the redirect URL here.
1596
+ * The client should redirect the browser to this URL, i.e. by issuing a `window.location.href = response.redirectUrl;`
1597
+ */
1598
+ redirectUrl?: string;
1599
+ }
1600
+ /**
1601
+ * @interface
1602
+ * @description The interface for the sdk object.
1603
+ */
1604
+ interface IdoSdk {
1605
+ /**
1606
+ * @description Creates a new Identity Orchestration SDK instance with your client context.
1607
+ * Do not call this function directly - see below how to initialize via the unified web SDK
1608
+ * @param clientId - Client ID for this application.
1609
+ * @param options - Additional environment configuration for the SDK operation.
1610
+ * @returns The promise that will be resolved when the SDK is initialized.
1611
+ * @throws {@link ErrorCode.InvalidInitOptions} in case of invalid init options.
1612
+ * @example
1613
+ * // Initialize an instance of the Identity Orchestration SDK using the unified SDK
1614
+ * await window.tsPlatform.initialize({
1615
+ * clientId: 'my-client-id',
1616
+ * ido: { serverPath: 'https://api.transmitsecurity.io/ido'}
1617
+ * });
1618
+ */
1619
+ init(clientId: string, options?: IdoInitOptions): Promise<void>;
1620
+ /**
1621
+ * @description Starts a Journey with a given id.
1622
+ * @param journeyId - Journey Identifier in the Mosaic Admin Console.
1623
+ * @param options - Additional parameters to be passed to the journey.
1624
+ * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received.
1625
+ * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized.
1626
+ * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout.
1627
+ * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error.
1628
+ * @example
1629
+ * // Start a Journey with the id 'my-journey-id'
1630
+ * try {
1631
+ * const idoResponse = await window.tsPlatform.ido.startJourney('my-journey-id', { additionalParams: 'additionalParams' });
1632
+ * // Handle Journey response
1633
+ * } catch(error) {
1634
+ * switch(sdkError.errorCode) ...
1635
+ * }
1636
+ */
1637
+ startJourney(journeyId: string, options?: StartJourneyOptions): Promise<IdoServiceResponse>;
1638
+ /**
1639
+ * @description Starts an SSO Journey with a given Interaction ID.
1640
+ * @param interactionId - Interaction identifier given as part of the response to the initial /authorize request
1641
+ * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received.
1642
+ * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized.
1643
+ * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout.
1644
+ * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error.
1645
+ * @example
1646
+ * // Start a Journey with the Interaction ID '2456E855-05A0-4992-85C1-A2519CBB4AA7'
1647
+ * try {
1648
+ * const idoResponse = await window.tsPlatform.ido.startSsoJourney('2456E855-05A0-4992-85C1-A2519CBB4AA7');
1649
+ * // Handle Journey response
1650
+ * } catch(error) {
1651
+ * switch(sdkError.errorCode) ...
1652
+ * }
1653
+ */
1654
+ startSsoJourney(interactionId: string, options?: StartSsoJourneyOptions): Promise<IdoServiceResponse>;
1655
+ /**
1656
+ *
1657
+ * @description This method will submit client input to the Journey step to process.
1658
+ * @param clientResponseOptionId - The response option ID is one of the IDs provided in the {@link IdoServiceResponse.clientResponseOptions}.
1659
+ * This would either be {@link ClientResponseOptionType.ClientInput} for collected user input,
1660
+ * or one of the others if another journey path was selected by the user.
1661
+ * @param data - The client response data object.
1662
+ * Mandatory in {@link ClientResponseOptionType.ClientInput} response option type, populate with data for the Journey step to process.
1663
+ * Optional in {@link ClientResponseOptionType.Cancel} and {@link ClientResponseOptionType.Custom} as an additional parameters for the branch.
1664
+ * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received.
1665
+ * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized.
1666
+ * @throws {@link ErrorCode.NoActiveJourney} - Throws error if the SDK state does not have an active Journey.
1667
+ * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout.
1668
+ * @throws {@link ErrorCode.ClientResponseNotValid} - Throws error if the client response to the Journey is not valid.
1669
+ * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error.
1670
+ * @example
1671
+ * // The previous response may include multiple response options. The standard 'ClientInput' response option
1672
+ * // signals we are sending collected user input to the journey step.
1673
+ * const selectedInputOptionId = ClientResponseOptionType.ClientInput;
1674
+ *
1675
+ * // Submit the client input. The data inside the JSON correspond to the expected fields from the Journey step.
1676
+ * try {
1677
+ * const idoResponse = await window.tsPlatform.ido.submitClientResponse(selectedInputOption, {
1678
+ * 'userEmail': 'user@input.email',
1679
+ * 'userPhone': '111-222-3333',
1680
+ * });
1681
+ * } catch(sdkError) {
1682
+ * switch(sdkError.errorCode) ...
1683
+ * }
1684
+ */
1685
+ submitClientResponse(clientResponseOptionId: ClientResponseOptionType | string, data?: any): Promise<IdoServiceResponse>;
1686
+ /**
1687
+ * @description Get the current serialized state of the SDK. Can be stored by the application code and used to
1688
+ * restore the SDK state following page redirects or refresh
1689
+ * @returns The current state of the SDK.
1690
+ */
1691
+ serializeState(): string;
1692
+ /**
1693
+ * @description Restores the SDK state from a serialized state, can be used to recover from page redirects or refresh.
1694
+ * The application code also receives the latest communication from the orchestration server.
1695
+ * @param state - The state to restore from.
1696
+ * @returns The last {@link IdoServiceResponse} that was received before the state was saved.
1697
+ * @throws {@link ErrorCode.InvalidState} - Throws error if the provided state string is invalid.
1698
+ */
1699
+ restoreFromSerializedState(state: string): IdoServiceResponse;
1700
+ /**
1701
+ * @description This method will generate a debug PIN
1702
+ * const debugPin = await sdk.generateDebugPin();
1703
+ * console.log(`Debug PIN: ${debugPin}`); // Output: Debug PIN: 1234
1704
+ */
1705
+ generateDebugPin(): Promise<string>;
1706
+ }
1707
+
1708
+ declare module "@transmit-security/web-sdk-common/dist/module-metadata/module-metadata" {
1709
+ interface initConfigParams {
1710
+ ido?: IdoInitOptions;
1711
+ }
1712
+ }
1713
+ declare const instance: IdoSdk;
1714
+
1715
+ interface initConfigParams {
1716
+ clientId: string;
1717
+ }
1718
+
1719
+ declare function initialize(params: initConfigParams): void;
1720
+
1721
+ /**
1722
+ * Main SDK class for CDN usage (window.tsPlatform)
1723
+ * Provides access to all modules and common functionality
1724
+ */
1725
+ declare class TSWebSDK {
1726
+ factories: {
1727
+ drs: () => Record<string, any>;
1728
+ idv: () => Record<string, any>;
1729
+ };
1730
+ constructor();
1731
+ }
1732
+ declare const _default: TSWebSDK;
1733
+
1734
+ declare const PACKAGE_VERSION = "1.15.0";
1735
+
1736
+ export { ErrorCode$1 as ErrorCode, PACKAGE_VERSION, authenticate, crossDevice, _default as default, webSdkModule_d as drs, getDefaultPaths, instance as ido, index_d$1 as idv, initialize, isAutofillSupported, isPlatformAuthenticatorSupported, register, index_d as webauthn };
1737
+ export type { ActionEventOptions, ActionResponse, AuthenticationAutofillActivateHandlers, AutofillHandlers, CrossDeviceController, SdkError, WebauthnApis, WebauthnAuthenticationFlows, WebauthnCrossDeviceFlows, WebauthnCrossDeviceRegistrationOptions, WebauthnRegistrationOptions, initConfigParams };