@transmitsecurity/platform-web-sdk 1.16.2 → 1.17.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 (77) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/README.md +69 -48
  3. package/dist/drs.cjs +1 -1
  4. package/dist/drs.d.ts +1 -14
  5. package/dist/drs.js +1 -1
  6. package/dist/ido.cjs +2 -2
  7. package/dist/ido.d.ts +889 -6
  8. package/dist/ido.js +1 -1
  9. package/dist/idv.cjs +1 -1
  10. package/dist/idv.d.ts +1 -7
  11. package/dist/idv.js +1 -1
  12. package/dist/index.cjs +2 -2
  13. package/dist/index.esm.js +2 -2
  14. package/dist/index.umd.js +2 -2
  15. package/dist/ts-platform-websdk.js +2 -2
  16. package/dist/web-sdk-drs+idv+webauthn+ido.js +2 -2
  17. package/dist/web-sdk.d.ts +1 -1
  18. package/dist/webauthn.cjs +1 -1
  19. package/dist/webauthn.d.ts +1 -9
  20. package/dist/webauthn.js +1 -1
  21. package/package.json +11 -12
  22. package/build/drs-entry.d.ts +0 -20
  23. package/build/drs-entry.js +0 -19
  24. package/build/drs-only.d.ts +0 -22
  25. package/build/drs-only.js +0 -25
  26. package/build/drs.d.ts +0 -28
  27. package/build/drs.js +0 -45
  28. package/build/ido/idoImpl.d.ts +0 -2
  29. package/build/ido/idoImpl.js +0 -4
  30. package/build/ido/index.d.ts +0 -7
  31. package/build/ido/index.js +0 -9
  32. package/build/ido-entry.d.ts +0 -17
  33. package/build/ido-entry.js +0 -19
  34. package/build/ido.d.ts +0 -18
  35. package/build/ido.js +0 -27
  36. package/build/idv-entry.d.ts +0 -17
  37. package/build/idv-entry.js +0 -19
  38. package/build/idv.d.ts +0 -18
  39. package/build/idv.js +0 -27
  40. package/build/initialize-only.d.ts +0 -7
  41. package/build/initialize-only.js +0 -40
  42. package/build/initialize.d.ts +0 -1
  43. package/build/initialize.js +0 -2
  44. package/build/mainExport.d.ts +0 -16
  45. package/build/mainExport.js +0 -43
  46. package/build/sdk-factory.d.ts +0 -109
  47. package/build/sdk-factory.js +0 -108
  48. package/build/shared-state.d.ts +0 -4
  49. package/build/shared-state.js +0 -32
  50. package/build/webauthn-entry.d.ts +0 -19
  51. package/build/webauthn-entry.js +0 -19
  52. package/build/webauthn.d.ts +0 -24
  53. package/build/webauthn.js +0 -44
  54. package/bundler-config.json +0 -14
  55. package/dist/docs/.nojekyll +0 -1
  56. package/dist/docs/README.md +0 -72
  57. package/dist/docs/enums/ErrorCode.md +0 -113
  58. package/dist/docs/interfaces/ActionEventOptions.md +0 -44
  59. package/dist/docs/interfaces/ActionResponse.md +0 -9
  60. package/dist/docs/interfaces/AuthenticationAutofillActivateHandlers.md +0 -61
  61. package/dist/docs/interfaces/AutofillHandlers.md +0 -50
  62. package/dist/docs/interfaces/CrossDeviceController.md +0 -27
  63. package/dist/docs/interfaces/SdkError.md +0 -28
  64. package/dist/docs/interfaces/WebauthnApis.md +0 -73
  65. package/dist/docs/interfaces/WebauthnAuthenticationFlows.md +0 -52
  66. package/dist/docs/interfaces/WebauthnCrossDeviceFlows.md +0 -107
  67. package/dist/docs/interfaces/WebauthnCrossDeviceRegistrationOptions.md +0 -23
  68. package/dist/docs/interfaces/WebauthnRegistrationOptions.md +0 -55
  69. package/dist/docs/interfaces/initConfigParams.md +0 -7
  70. package/dist/docs/modules/drs.md +0 -92
  71. package/dist/docs/modules/idv.md +0 -106
  72. package/dist/docs/modules/webauthn.md +0 -197
  73. package/dist/docs/modules.md +0 -146
  74. package/scripts/make-semver-aliases.sh +0 -11
  75. package/scripts/upload-dist.sh +0 -9
  76. package/src/mainExport.ts +0 -75
  77. package/src/tsconfig.json +0 -14
package/dist/ido.d.ts CHANGED
@@ -28,6 +28,34 @@ interface IdoInitOptions {
28
28
  */
29
29
  locale?: string;
30
30
  }
31
+ /**
32
+ * @interface
33
+ * @description Optional parameters for starting an SDK journey
34
+ */
35
+ interface StartJourneyOptions {
36
+ /**
37
+ * Additional parameters to be passed to the Journey, Optional.
38
+ */
39
+ additionalParams?: any;
40
+ /**
41
+ * A unique identifier for the flow. Will be auto generated if not provided.
42
+ */
43
+ correlationId?: string;
44
+ /**
45
+ * Should client-server communication be double encrypted? Defaults to false.
46
+ */
47
+ encrypted?: boolean;
48
+ }
49
+ /**
50
+ * @interface
51
+ * @description Optional parameters for starting an SSO journey
52
+ */
53
+ interface StartSsoJourneyOptions {
54
+ /**
55
+ * Should client-server communication be double encrypted? Defaults to false.
56
+ */
57
+ encrypted?: boolean;
58
+ }
31
59
  /**
32
60
  * @enum
33
61
  * @description The enum for the log levels.
@@ -38,20 +66,875 @@ declare enum LogLevel {
38
66
  Warning = 2,
39
67
  Error = 3
40
68
  }
69
+ /**
70
+ * @enum
71
+ * @description The enum for the sdk error codes.
72
+ */
73
+ declare enum ErrorCode {
74
+ /**
75
+ * @description The init options object is invalid.
76
+ */
77
+ InvalidInitOptions = "invalid_initialization_options",
78
+ /**
79
+ * @description The sdk is not initialized.
80
+ */
81
+ NotInitialized = "not_initialized",
82
+ /**
83
+ * @description There is no active Journey.
84
+ */
85
+ NoActiveJourney = "no_active_journey",
86
+ /**
87
+ * @description Unable to receive response from the server.
88
+ */
89
+ NetworkError = "network_error",
90
+ /**
91
+ * @description The client response to the Journey is not valid.
92
+ */
93
+ ClientResponseNotValid = "client_response_not_valid",
94
+ /**
95
+ * @description The server returned an unexpected error.
96
+ */
97
+ ServerError = "server_error",
98
+ /**
99
+ * @description The provided state is not valid for SDK state recovery.
100
+ */
101
+ InvalidState = "invalid_state",
102
+ /**
103
+ * @description The provided credentials are invalid.
104
+ */
105
+ InvalidCredentials = "invalid_credentials",
106
+ /**
107
+ * @description The provided OTP passcode is expired.
108
+ */
109
+ ExpiredOTPPasscode = "expired_otp_passcode",
110
+ /**
111
+ * @description The provided validation passcode is expired.
112
+ */
113
+ ExpiredValidationPasscode = "expired_validation_passcode",
114
+ /**
115
+ * @description Max resend attempts reached
116
+ */
117
+ MaxResendReached = "expired_otp_passcode"
118
+ }
119
+ /**
120
+ * @interface
121
+ * @description Common interface for Promise rejections. Developers should handle according to the @errorCode
122
+ */
123
+ interface IdoSdkError {
124
+ /**
125
+ * @description The error code.
126
+ */
127
+ readonly errorCode: ErrorCode;
128
+ /**
129
+ * @description The error description.
130
+ */
131
+ readonly description: string;
132
+ /**
133
+ * @description The error additional data. Optional.
134
+ */
135
+ readonly data?: any;
136
+ }
137
+ /**
138
+ * @enum
139
+ * @description The enum for the client response option types.
140
+ */
141
+ declare enum ClientResponseOptionType {
142
+ /**
143
+ * @description Client response option type for client input. This is the standard response option for any step.
144
+ */
145
+ ClientInput = "client_input",
146
+ /**
147
+ * @description Client response option type for a cancelation branch in the Journey. Use this for canceling the current step.
148
+ */
149
+ Cancel = "cancel",
150
+ /**
151
+ * @description Client response option type for a failure branch in the Journey. Use this for reporting client side failure for the current step.
152
+ */
153
+ Fail = "failure",
154
+ /**
155
+ * @description Client response option type for custom branch in the Journey, used for custom branching.
156
+ */
157
+ Custom = "custom",
158
+ /**
159
+ * @description Client response option type for a resend of the OTP. Use this for restarting the current step (sms / email otp authentication).
160
+ */
161
+ Resend = "resend"
162
+ }
163
+ /**
164
+ * @interface
165
+ * @description The interface for client response option object. Use this object to submit client input to the Journey
166
+ * step to process, cancel the current step or choose a custom branch.
167
+ */
168
+ interface ClientResponseOption {
169
+ /**
170
+ * @description The type of the client response option.
171
+ */
172
+ readonly type: ClientResponseOptionType;
173
+ /**
174
+ * @description The id of the client response option.
175
+ * Journey step unique id is provided for the {@link ClientResponseOptionType.Custom} response option type.
176
+ * {@link ClientResponseOptionType.ClientInput} and {@link ClientResponseOptionType.Cancel} have standard Ids _ClientInput_ and _Cancel_, respectively.
177
+ */
178
+ readonly id: string;
179
+ /**
180
+ * @description The label of the client response option.
181
+ */
182
+ readonly label: string;
183
+ /**
184
+ * @description Optional schema object that can be used for UI rendering.
185
+ */
186
+ schema?: Record<string, any>;
187
+ }
188
+ /**
189
+ * @deprecated
190
+ * @enum
191
+ * @description Deprecated enum. Use {@link IdoJourneyActionType} instead to detect completion, rejection, or a step that requires client input.
192
+ */
193
+ declare enum IdoServiceResponseType {
194
+ /**
195
+ * @description The Journey ended successfully.
196
+ */
197
+ JourneySuccess = "journey_success",
198
+ /**
199
+ * @description The Journey reached a step that requires client input.
200
+ */
201
+ ClientInputRequired = "client_input_required",
202
+ /**
203
+ * @description The current Journey step updated the client data or provided an error message.
204
+ */
205
+ ClientInputUpdateRequired = "client_input_update_required",
206
+ /**
207
+ * @description The Journey ended with explicit rejection.
208
+ */
209
+ JourneyRejection = "journey_rejection"
210
+ }
211
+ /**
212
+ * @enum
213
+ * @description The enum for the Journey step ID, used when the journey step is a predefined typed action.
214
+ * 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.
215
+ * See also {@link IdoServiceResponse.journeyStepId}.
216
+ */
217
+ declare enum IdoJourneyActionType {
218
+ /**
219
+ * @description `journeyStepId` for a journey rejection.
220
+ */
221
+ Rejection = "action:rejection",
222
+ /**
223
+ * @description `journeyStepId` for a journey completion.
224
+ */
225
+ Success = "action:success",
226
+ /**
227
+ * @description `journeyStepId` for an Information action.
228
+ *
229
+ * Data received in the {@link IdoServiceResponse} object:
230
+ * These are the text values that are configured for the Information action step in the journey editor.
231
+ * This can be used to display the information to the user.
232
+ * ```json
233
+ * {
234
+ * "data": {
235
+ * "title": "<TITLE>",
236
+ * "text": "<TEXT>",
237
+ * "button_text": "<BUTTON TEXT>"
238
+ * }
239
+ * }
240
+ * ```
241
+ * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
242
+ */
243
+ Information = "action:information",
244
+ /**
245
+ * @description `journeyStepId` for a server side debugger breakpoint.
246
+ * This response is sent to the client side when the journey debugger has reached a breakpoint, and will continue to return while
247
+ * the journey debugger is paused.
248
+ *
249
+ * The {@link IdoServiceResponse} object does not include any data.
250
+ *
251
+ * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
252
+ */
253
+ DebugBreak = "action:debug_break",
254
+ /**
255
+ * @description `journeyStepId` for a Wait for Cross Session Message action.
256
+ *
257
+ * The {@link IdoServiceResponse} object includes information that can be presented as a QR to scan by another device.
258
+ * The response will remain the same while the cross session message was not consumed by the journey executed by the other device.
259
+ *
260
+ * The client response does not need to include any data: `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput);`
261
+ */
262
+ WaitForAnotherDevice = "action:wait_for_another_device",
263
+ /**
264
+ * @hidden
265
+ * @deprecated Use {@link IdoJourneyActionType.RegisterDeviceAction} instead.
266
+ */
267
+ CryptoBindingRegistration = "action:crypto_binding_registration",
268
+ /**
269
+ * @hidden
270
+ * @deprecated Use {@link IdoJourneyActionType.ValidateDeviceAction} instead.
271
+ */
272
+ CryptoBindingValidation = "action:crypto_binding_validation",
273
+ /**
274
+ * @hidden
275
+ * @description `journeyStepId` for Register Device action.
276
+ * This action is handled automatically by the SDK.
277
+ */
278
+ RegisterDeviceAction = "transmit_platform_device_registration",
279
+ /**
280
+ * @hidden
281
+ * @description `journeyStepId` for Validate Device action.
282
+ * This action is handled automatically by the SDK.
283
+ */
284
+ ValidateDeviceAction = "transmit_platform_device_validation",
285
+ /**
286
+ * @description `journeyStepId` for WebAuthn Registration action.
287
+ *
288
+ * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `tsPlatform.webauthn.register()`
289
+ * ```json
290
+ * {
291
+ * "data": {
292
+ * "username": "<USERNAME>",
293
+ * "display_name": "<DISPLAY_NAME>",
294
+ * "register_as_discoverable": <true|false>,
295
+ * "allow_cross_platform_authenticators": <true|false>
296
+ * }
297
+ * }
298
+ * ```
299
+ *
300
+ * Before responding, activate `tsPlatform.webauthn.register()` to obtain the `webauthn_encoded_result` value.
301
+ * This will present the user with the WebAuthn registration UI. Use the result to send the client response:
302
+ * ```json
303
+ * tsPlatform.ido.submitClientResponse(
304
+ * ClientResponseOptionType.ClientInput,
305
+ * {
306
+ * "webauthn_encoded_result": "<WEBAUTHN_ENCODED_RESULT_FROM_SDK>"
307
+ * })
308
+ * ```
309
+ */
310
+ WebAuthnRegistration = "action:webauthn_registration",
311
+ /**
312
+ * @description `journeyStepId` for instructing the use of DRS trigger action, as part of the Risk Recommendation journey step.
313
+ *
314
+ * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `tsPlatform.drs.triggerActionEvent()`
315
+ * ```json
316
+ * {
317
+ * "data": {
318
+ * "correlation_id": "a47ed80a-41f9-464a-a42f-fce775b6e446",
319
+ * "user_id": "user",
320
+ * "action_type": "login"
321
+ * },
322
+ * }
323
+ * ```
324
+ * Before responding, activate `tsPlatform.drs.triggerActionEvent()` to obtain the `action_token` value. This is a silent action, and does not require user interaction.
325
+ * Use the result to send the client response:
326
+ * ```json
327
+ * tsPlatform.ido.submitClientResponse(
328
+ * ClientResponseOptionType.ClientInput,
329
+ * {
330
+ * "action_token": "<DRS action token>"
331
+ * })
332
+ * ```
333
+ */
334
+ DrsTriggerAction = "action:drs_trigger_action",
335
+ /**
336
+ * @description `journeyStepId` for Identity Verification action.
337
+ *
338
+ * Data received in the {@link IdoServiceResponse} object:
339
+ * ```json
340
+ * {
341
+ * "data": {
342
+ * "payload": {
343
+ * "endpoint": "<endpoint to redirect>",
344
+ * "base_endpoint": "<base endpoint>",
345
+ * "start_token": "<start token>",
346
+ * "state": "<state>",
347
+ * "session": "<session>"
348
+ * },
349
+ * }
350
+ * }
351
+ * ```
352
+ * Use this data to redirect the user to the identity verification endpoint.
353
+ * 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.
354
+ * 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.
355
+ *
356
+ * Once done, send the following client response:
357
+ * ```json
358
+ * tsPlatform.ido.submitClientResponse(
359
+ * ClientResponseOptionType.ClientInput,
360
+ * {
361
+ * "payload": {
362
+ * "sessionId": "<sessionId>",
363
+ * "state": "<state>"
364
+ * }
365
+ * })
366
+ * ```
367
+ */
368
+ IdentityVerification = "action:id_verification",
369
+ /**
370
+ * @description `journeyStepId` for Email OTP authentication action.
371
+ *
372
+ * Data received in the {@link IdoServiceResponse} object:
373
+ *
374
+ * ```json
375
+ * {
376
+ * "data": {
377
+ * "code_length": <integer_code_length>
378
+ * }
379
+ * }
380
+ * ```
381
+ *
382
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials} or the error code {@link ErrorCode.ExpiredOTPPasscode}.
383
+ *
384
+ * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode.
385
+ * Also, a resend option (see below) can be provided to the user.
386
+ *
387
+ * Client responses:
388
+ *
389
+ * - For simple submit of OTP passcode:
390
+ * ```json
391
+ * tsPlatform.ido.submitClientResponse(
392
+ * ClientResponseOptionType.ClientInput,
393
+ * {
394
+ * "passcode": "<passcode>"
395
+ * })
396
+ * ```
397
+ *
398
+ * - In Order to request resend of OTP (restart the action):
399
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
400
+ *
401
+ */
402
+ EmailOTPAuthentication = "transmit_platform_email_otp_authentication",
403
+ /**
404
+ * @description `journeyStepId` for SMS OTP authentication action.
405
+ *
406
+ * Data received in the {@link IdoServiceResponse} object:
407
+ *
408
+ * ```json
409
+ * {
410
+ * "data": {
411
+ * "code_length": <integer_code_length>
412
+ * }
413
+ * }
414
+ * ```
415
+ *
416
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}, or the error code {@link ErrorCode.ExpiredOTPPasscode}
417
+ *
418
+ * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode.
419
+ * Also, a resend option (see below) can be provided to the user.
420
+ *
421
+ * Client responses:
422
+ *
423
+ * - For simple submit of OTP passcode:
424
+ * ```json
425
+ * tsPlatform.ido.submitClientResponse(
426
+ * ClientResponseOptionType.ClientInput,
427
+ * {
428
+ * "passcode": "<passcode>"
429
+ * })
430
+ * ```
431
+ *
432
+ * - In Order to request resend of OTP (restart the action):
433
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
434
+ *
435
+ */
436
+ SmsOTPAuthentication = "transmit_platform_sms_otp_authentication",
437
+ /**
438
+ * @description `journeyStepId` for TOTP Registration action.
439
+ *
440
+ * Data received in the {@link IdoServiceResponse} object:
441
+ * ```json
442
+ * {
443
+ * "data": {
444
+ * "payload": {
445
+ * "secret": "<secret>",
446
+ * "uri": "<uri>"
447
+ * },
448
+ * }
449
+ * }
450
+ * ```
451
+ * Use this data to display the TOTP registration QR code / link to the user.
452
+ * The user should use this to register the TOTP secret in their authenticator app.
453
+ * Once the user has completed the registration, send the following empty client response:
454
+ * ```json
455
+ * tsPlatform.ido.submitClientResponse(
456
+ * ClientResponseOptionType.ClientInput
457
+ * )
458
+ * ```
459
+ * Please note that registration of the TOTP secret is a silent action, and does not require user interaction.
460
+ * An empty response is sent to the server in order to continue the journey.
461
+ *
462
+ */
463
+ /**
464
+ * @description `journeyStepId` for Email Validation action.
465
+ *
466
+ * Data received in the {@link IdoServiceResponse} object:
467
+ *
468
+ * ```json
469
+ * {
470
+ * "data": {
471
+ * "code_length": <integer_code_length>
472
+ * }
473
+ * }
474
+ * ```
475
+ *
476
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}
477
+ *
478
+ * Resend option also (see below) can be provided to the user.
479
+ *
480
+ * Client responses:
481
+ *
482
+ * - For simple submit of validation passcode:
483
+ * ```json
484
+ * tsPlatform.ido.submitClientResponse(
485
+ * ClientResponseOptionType.ClientInput,
486
+ * {
487
+ * "passcode": "<passcode>"
488
+ * })
489
+ * ```
490
+ *
491
+ * - In Order to request resend of OTP (restart the action):
492
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
493
+ *
494
+ */
495
+ EmailValidation = "transmit_platform_email_validation",
496
+ /**
497
+ * @description `journeyStepId` for Sms Validation action.
498
+ *
499
+ * Data received in the {@link IdoServiceResponse} object:
500
+ *
501
+ * ```json
502
+ * {
503
+ * "data": {
504
+ * "code_length": <integer_code_length>
505
+ * }
506
+ * }
507
+ * ```
508
+ *
509
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}
510
+ *
511
+ * Resend option also (see below) can be provided to the user.
512
+ *
513
+ * Client responses:
514
+ *
515
+ * - For simple submit of validation passcode:
516
+ * ```json
517
+ * tsPlatform.ido.submitClientResponse(
518
+ * ClientResponseOptionType.ClientInput,
519
+ * {
520
+ * "passcode": "<passcode>"
521
+ * })
522
+ * ```
523
+ *
524
+ * - In Order to request resend of OTP (restart the action):
525
+ * `tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)`
526
+ *
527
+ */
528
+ SmsValidation = "transmit_platform_sms_validation",
529
+ TotpRegistration = "transmit_platform_totp_registration",
530
+ /**
531
+ * @description `journeyStepId` for Transaction Signing with TOTP action.
532
+ *
533
+ * Data received in the {@link IdoServiceResponse} object:
534
+ * ```json
535
+ * {
536
+ * "data": {
537
+ * "transaction_challenge": "<6_DIGIT_CHALLENGE_CODE>",
538
+ * "approval_data": {
539
+ * // Note: This is just an example. The actual approval_data can vary.
540
+ * "transactionId": "<TRANSACTION_ID>",
541
+ * "amount": "<AMOUNT>",
542
+ * "currency": "<CURRENCY>"
543
+ * }
544
+ * }
545
+ * }
546
+ * ```
547
+ * Use this data to display the transaction details and the challenge code to the user.
548
+ * The user should use this challenge code to generate a TOTP code using their authenticator app.
549
+ *
550
+ * Client responses:
551
+ *
552
+ * - For submitting the TOTP code:
553
+ * ```json
554
+ * tsPlatform.ido.submitClientResponse(
555
+ * ClientResponseOptionType.ClientInput,
556
+ * {
557
+ * "totp_code": "<6_DIGIT_TOTP_CODE>"
558
+ * }
559
+ * )
560
+ * ```
561
+ *
562
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain the error code {@link ErrorCode.InvalidCredentials}.
563
+ * This can be used to indicate that the TOTP code is invalid, prompting the user to enter a new code.
564
+ *
565
+ * Note: The user has a limited number of attempts to enter the correct TOTP code before the journey is rejected.
566
+ */
567
+ TransactionSigningTOTP = "transmit_platform_transaction_signing_totp",
568
+ /**
569
+ * @description `journeyStepId` for Invoke IDP action.
570
+ *
571
+ * Data received in the {@link IdoServiceResponse} object:
572
+ * ```json
573
+ * {
574
+ * "data": {
575
+ * "authorization_url": "<URL_OF_THE_AUTHORIZATION_ENDPOINT>",
576
+ * "authorization_request_method": "<GET_OR_POST>",
577
+ * "invocation_method": "<PAGE_OR_POPUP>",
578
+ * "idp_name": "<IDP_NAME>"
579
+ * }
580
+ * }
581
+ * ```
582
+ * Use this data to redirect the user to the IDP authorization endpoint.
583
+ *
584
+ *
585
+ * Once done, send the following client response:
586
+ * ```json
587
+ * tsPlatform.ido.submitClientResponse(
588
+ * ClientResponseOptionType.ClientInput,
589
+ * {
590
+ * "idp_response" : {
591
+ * "code": "<code>",
592
+ * "state": "<state>",
593
+ * }
594
+ * }
595
+ * )
596
+ *```
597
+ *
598
+ *
599
+ */
600
+ InvokeIDP = "invoke_idp",
601
+ /**
602
+ * @description `journeyStepId` for Transaction Signing with Passkeys action.
603
+ *
604
+ * Data received in the {@link IdoServiceResponse} object:
605
+ * ```json
606
+ * {
607
+ * "data": {
608
+ * "user_identifier": "<USERNAME>",
609
+ * "approval_data": {
610
+ * // Note: This is just an example. The actual approval_data can vary.
611
+ * "transactionId": "<TRANSACTION_ID>",
612
+ * "amount": "<AMOUNT>",
613
+ * "currency": "<CURRENCY>"
614
+ * }
615
+ * }
616
+ * }
617
+ * ```
618
+ * Before responding, call `tsPlatform.webauthn.approve.modal()` to obtain the `webauthn_encoded_result` value.
619
+ * ```javascript
620
+ * const result = await tsPlatform.webauthn.approve.modal(
621
+ * response.data.approval_data // Transaction details to be approved
622
+ * );
623
+ * ```
624
+ *
625
+ * Then submit the result:
626
+ * ```javascript
627
+ * tsPlatform.ido.submitClientResponse(
628
+ * ClientResponseOptionType.ClientInput,
629
+ * {
630
+ * "webauthn_encoded_result": result
631
+ * }
632
+ * )
633
+ * ```
634
+ *
635
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain
636
+ * relevant error codes that can be used to handle various failure scenarios.
637
+ *
638
+ * Note: The approval_data object can contain up to 10 key-value pairs using only alphanumeric
639
+ * characters, underscores, hyphens, and periods. The WebAuthn encoded result remains valid for 60 seconds.
640
+ */
641
+ WebAuthnTransactionSigning = "transmit_platform_transaction_signing_webauthn",
642
+ /**
643
+ * @description `journeyStepId` for Select Organization action.
644
+ *
645
+ * Data received in the {@link IdoServiceResponse} object:
646
+ *
647
+ * ```json
648
+ * {
649
+ * "data": {
650
+ * "organizations": [
651
+ * {
652
+ * "id": "aq5Doa_GMiDhL2GC-HdKo",
653
+ * "name": "Organization 1"
654
+ * },
655
+ * {
656
+ * "id": "mkiPd9tu0K2h9oCM9pRB7",
657
+ * "name": "Organization 2"
658
+ * },
659
+ * {
660
+ * "id": "fdlvZdof5GPvqJlBeAoFs",
661
+ * "name": "Organization 3"
662
+ * }
663
+ * ]
664
+ * }
665
+ * }
666
+ * ```
667
+ *
668
+ *
669
+ * For organization selection, send the following client response:
670
+ * ```javascript
671
+ * tsPlatform.ido.submitClientResponse(
672
+ * ClientResponseOptionType.ClientInput,
673
+ * {
674
+ * "organization_id": "<ORGANIZATION_ID>"
675
+ * }
676
+ * )
677
+ * ```
678
+ *
679
+ * Note: If a user is a member of a single organization, this step will pick it implicitly.
680
+ */
681
+ SelectOrganization = "transmit_platform_select_organization",
682
+ /**
683
+ * @description `journeyStepId` for Web to Mobile Authentication action.
684
+ * This action type is used for both simple authentication and transaction signing scenarios.
685
+ *
686
+ * Initial Data received in the {@link IdoServiceResponse} object when multiple devices are available:
687
+ * ```json
688
+ * {
689
+ * "data": {
690
+ * "devices": [
691
+ * {
692
+ * "name": "Device 1",
693
+ * "code": "1"
694
+ * },
695
+ * {
696
+ * "name": "Device 2",
697
+ * "code": "2"
698
+ * }
699
+ * ]
700
+ * }
701
+ * }
702
+ * ```
703
+ *
704
+ * For device selection, send the following client response:
705
+ * ```javascript
706
+ * tsPlatform.ido.submitClientResponse(
707
+ * ClientResponseOptionType.ClientInput,
708
+ * {
709
+ * "selected_device_code": "<DEVICE_CODE>"
710
+ * }
711
+ * )
712
+ * ```
713
+ *
714
+ * After device selection or when only one device is available, the action will wait for mobile approval.
715
+ * The response includes polling configuration and optional transaction details:
716
+ * ```json
717
+ * {
718
+ * "data": {
719
+ * "device_display_name": "Device 1",
720
+ * "resend_attempts_left": 5,
721
+ * "polling_interval": 3,
722
+ * "approval_data": {
723
+ * // Note: This is just an example. The actual approval_data can vary.
724
+ * "transactionId": "<TRANSACTION_ID>",
725
+ * "amount": "<AMOUNT>",
726
+ * "currency": "<CURRENCY>"
727
+ * }
728
+ * }
729
+ * }
730
+ * ```
731
+ *
732
+ * The following options are available:
733
+ *
734
+ * - To check current authentication status (polling):
735
+ * ```javascript
736
+ * // The application should implement its own polling mechanism
737
+ * // and call this method periodically to check the status
738
+ * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.ClientInput)
739
+ * ```
740
+ *
741
+ * - To cancel the authentication:
742
+ * ```javascript
743
+ * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Cancel)
744
+ * ```
745
+ *
746
+ * - To resend the push notification:
747
+ * ```javascript
748
+ * tsPlatform.ido.submitClientResponse(ClientResponseOptionType.Resend)
749
+ * ```
750
+ *
751
+ * Note: The application is responsible for implementing the polling mechanism
752
+ * to check the authentication status. The SDK only provides the method to
753
+ * submit the status check request. Use the polling_interval from the response
754
+ * to determine the frequency of status checks.
755
+ *
756
+ * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain
757
+ * relevant error codes that can be used to handle various failure scenarios.
758
+ */
759
+ MobileApproveAuthentication = "transmit_platform_mobile_approve_authentication"
760
+ }
761
+ /**
762
+ * @interface
763
+ * @description The interface for the Journey step response object. Including Journey end with either error, rejection and success.
764
+ */
765
+ interface IdoServiceResponse {
766
+ /**
767
+ * @deprecated
768
+ * @description Deprecated attribute. Use {@link IdoJourneyActionType} instead.
769
+ */
770
+ readonly type: IdoServiceResponseType;
771
+ /**
772
+ * @description Optional data object returned from the server for any of the journey steps.
773
+ */
774
+ readonly data?: any;
775
+ /**
776
+ * @description Additional error data returned from the server for any of the journey steps.
777
+ */
778
+ readonly errorData?: IdoSdkError;
779
+ /**
780
+ * @description Contains the Journey step ID, allowing the client side to choose the correct handler and UI.
781
+ * This will be either a form ID for the "Get Information from Client" and "Login Form" journey steps,
782
+ * or one of {@link IdoJourneyActionType} for other actions.
783
+ */
784
+ readonly journeyStepId?: IdoJourneyActionType | string;
785
+ /**
786
+ * @description The Journey client response options if the response type is {@link IdoServiceResponseType.ClientInputRequired}
787
+ * or {@link IdoServiceResponseType.ClientInputUpdateRequired}.
788
+ */
789
+ readonly clientResponseOptions?: Record<ClientResponseOptionType | string, ClientResponseOption>;
790
+ /**
791
+ * @description A proof of journey completion is provided upon successful completion of the journey,
792
+ * indicated by the {@link IdoJourneyActionType.Success} step ID.
793
+ */
794
+ token?: string;
795
+ /**
796
+ * @description If a browser-redirection is required (for example at the end of an SSO journey) - the server will provide the redirect URL here.
797
+ * The client should redirect the browser to this URL, i.e. by issuing a `window.location.href = response.redirectUrl;`
798
+ */
799
+ redirectUrl?: string;
800
+ }
801
+ /**
802
+ * @interface
803
+ * @description The interface for the sdk object.
804
+ */
805
+ interface IdoSdk {
806
+ /**
807
+ * @description Creates a new Identity Orchestration SDK instance with your client context.
808
+ * Do not call this function directly - see below how to initialize via the unified web SDK
809
+ * @param clientId - Client ID for this application.
810
+ * @param options - Additional environment configuration for the SDK operation.
811
+ * @returns The promise that will be resolved when the SDK is initialized.
812
+ * @throws {@link ErrorCode.InvalidInitOptions} in case of invalid init options.
813
+ * @example
814
+ * // Initialize an instance of the Identity Orchestration SDK using the unified SDK
815
+ * await window.tsPlatform.initialize({
816
+ * clientId: 'my-client-id',
817
+ * ido: { serverPath: 'https://api.transmitsecurity.io/ido'}
818
+ * });
819
+ */
820
+ init(clientId: string, options?: IdoInitOptions): Promise<void>;
821
+ /**
822
+ * @description Starts a Journey with a given id.
823
+ * @param journeyId - Journey Identifier in the Mosaic Admin Console.
824
+ * @param options - Additional parameters to be passed to the journey.
825
+ * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received.
826
+ * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized.
827
+ * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout.
828
+ * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error.
829
+ * @example
830
+ * // Start a Journey with the id 'my-journey-id'
831
+ * try {
832
+ * const idoResponse = await window.tsPlatform.ido.startJourney('my-journey-id', { additionalParams: 'additionalParams' });
833
+ * // Handle Journey response
834
+ * } catch(error) {
835
+ * switch(sdkError.errorCode) ...
836
+ * }
837
+ */
838
+ startJourney(journeyId: string, options?: StartJourneyOptions): Promise<IdoServiceResponse>;
839
+ /**
840
+ * @description Starts an SSO Journey with a given Interaction ID.
841
+ * @param interactionId - Interaction identifier given as part of the response to the initial /authorize request
842
+ * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received.
843
+ * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized.
844
+ * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout.
845
+ * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error.
846
+ * @example
847
+ * // Start a Journey with the Interaction ID '2456E855-05A0-4992-85C1-A2519CBB4AA7'
848
+ * try {
849
+ * const idoResponse = await window.tsPlatform.ido.startSsoJourney('2456E855-05A0-4992-85C1-A2519CBB4AA7');
850
+ * // Handle Journey response
851
+ * } catch(error) {
852
+ * switch(sdkError.errorCode) ...
853
+ * }
854
+ */
855
+ startSsoJourney(interactionId: string, options?: StartSsoJourneyOptions): Promise<IdoServiceResponse>;
856
+ /**
857
+ *
858
+ * @description This method will submit client input to the Journey step to process.
859
+ * @param clientResponseOptionId - The response option ID is one of the IDs provided in the {@link IdoServiceResponse.clientResponseOptions}.
860
+ * This would either be {@link ClientResponseOptionType.ClientInput} for collected user input,
861
+ * or one of the others if another journey path was selected by the user.
862
+ * @param data - The client response data object.
863
+ * Mandatory in {@link ClientResponseOptionType.ClientInput} response option type, populate with data for the Journey step to process.
864
+ * Optional in {@link ClientResponseOptionType.Cancel} and {@link ClientResponseOptionType.Custom} as an additional parameters for the branch.
865
+ * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received.
866
+ * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized.
867
+ * @throws {@link ErrorCode.NoActiveJourney} - Throws error if the SDK state does not have an active Journey.
868
+ * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout.
869
+ * @throws {@link ErrorCode.ClientResponseNotValid} - Throws error if the client response to the Journey is not valid.
870
+ * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error.
871
+ * @example
872
+ * // The previous response may include multiple response options. The standard 'ClientInput' response option
873
+ * // signals we are sending collected user input to the journey step.
874
+ * const selectedInputOptionId = ClientResponseOptionType.ClientInput;
875
+ *
876
+ * // Submit the client input. The data inside the JSON correspond to the expected fields from the Journey step.
877
+ * try {
878
+ * const idoResponse = await window.tsPlatform.ido.submitClientResponse(selectedInputOption, {
879
+ * 'userEmail': 'user@input.email',
880
+ * 'userPhone': '111-222-3333',
881
+ * });
882
+ * } catch(sdkError) {
883
+ * switch(sdkError.errorCode) ...
884
+ * }
885
+ */
886
+ submitClientResponse(clientResponseOptionId: ClientResponseOptionType | string, data?: any): Promise<IdoServiceResponse>;
887
+ /**
888
+ * @description Get the current serialized state of the SDK. Can be stored by the application code and used to
889
+ * restore the SDK state following page redirects or refresh
890
+ * @returns The current state of the SDK.
891
+ */
892
+ serializeState(): string;
893
+ /**
894
+ * @description Restores the SDK state from a serialized state, can be used to recover from page redirects or refresh.
895
+ * The application code also receives the latest communication from the orchestration server.
896
+ * @param state - The state to restore from.
897
+ * @returns The last {@link IdoServiceResponse} that was received before the state was saved.
898
+ * @throws {@link ErrorCode.InvalidState} - Throws error if the provided state string is invalid.
899
+ */
900
+ restoreFromSerializedState(state: string): IdoServiceResponse;
901
+ /**
902
+ * @description This method will generate a debug PIN
903
+ * const debugPin = await sdk.generateDebugPin();
904
+ * console.log(`Debug PIN: ${debugPin}`); // Output: Debug PIN: 1234
905
+ */
906
+ generateDebugPin(): Promise<string>;
907
+ }
41
908
 
42
909
  declare module "@transmit-security/web-sdk-common/dist/module-metadata/module-metadata" {
43
910
  interface initConfigParams {
44
911
  ido?: IdoInitOptions;
45
912
  }
46
913
  }
914
+ declare const instance: IdoSdk;
47
915
 
48
- declare const PACKAGE_VERSION: string;
49
- declare namespace ido {
50
- export function initialize(config: any): void;
51
- export * from "@transmit-security/ido-web-sdk";
52
-
916
+ declare namespace _transmit_security_ido_web_sdk {
917
+ export {
918
+ instance as default,
919
+ };
53
920
  }
54
921
 
922
+ declare const PACKAGE_VERSION: string;
55
923
  declare function initialize(config: any): void;
56
924
 
57
- export { PACKAGE_VERSION, ido, initialize };
925
+ declare const ido: { initialize: (config: any) => void; default: typeof instance } & typeof _transmit_security_ido_web_sdk;
926
+
927
+
928
+ export { IdoInitOptions };
929
+ export { StartJourneyOptions };
930
+ export { StartSsoJourneyOptions };
931
+ export { LogLevel };
932
+ export { ErrorCode };
933
+ export { IdoSdkError };
934
+ export { ClientResponseOptionType };
935
+ export { ClientResponseOption };
936
+ export { IdoServiceResponseType };
937
+ export { IdoJourneyActionType };
938
+ export { IdoServiceResponse };
939
+
940
+ export { PACKAGE_VERSION, instance as default, ido, initialize };