/// type AgentCreate = T extends new (...any: any) => Agent ? InstanceType : T extends Function ? OmitThisParameter : T extends {} ? BoundMethods : T; type BoundMethods = { [key in keyof T]: OmitThisParameter>; }; declare class Agent { slug: string; constructor(slug: string); static create(method: (agent: Agent) => T): new (slug: string) => Agent & BoundMethods; } interface eventNameToDataParam { [eventName: string]: unknown; } type eventKnownName = keyof eventNameToDataParam; type callback = (eventData: T) => void; declare function on(eventName: T, method: callback): void; declare function off(eventName: T, method: callback): void; declare function emit(eventName: T, eventData: eventNameToDataParam[T]): void; declare module './events' { interface eventNameToDataParam { [MODULE_INITIALIZED]: undefined; } } declare const MODULE_INITIALIZED: unique symbol; declare const events_MODULE_INITIALIZED: typeof MODULE_INITIALIZED; declare const events_emit: typeof emit; type events_eventNameToDataParam = eventNameToDataParam; declare const events_off: typeof off; declare const events_on: typeof on; declare namespace events { export { events_MODULE_INITIALIZED as MODULE_INITIALIZED, events_emit as emit, events_eventNameToDataParam as eventNameToDataParam, events_off as off, events_on as on, }; } interface initConfigParams { clientId: string; drs?: { enabled?: boolean; serverPath?: string; enableSessionToken?: boolean; [key: string]: any; }; webauthn?: { serverPath?: string; [key: string]: any; }; idv?: { serverPath?: string; [key: string]: any; }; ido?: { serverPath?: string; collectRiskData?: boolean; [key: string]: any; }; [key: string]: any; } declare let initConfig: initConfigParams | null; declare function getInitConfig(): initConfigParams | null; declare function setInitConfig(config: initConfigParams): void; declare const moduleMetadata_getInitConfig: typeof getInitConfig; declare const moduleMetadata_initConfig: typeof initConfig; type moduleMetadata_initConfigParams = initConfigParams; declare const moduleMetadata_setInitConfig: typeof setInitConfig; declare namespace moduleMetadata { export { moduleMetadata_getInitConfig as getInitConfig, moduleMetadata_initConfig as initConfig, moduleMetadata_initConfigParams as initConfigParams, moduleMetadata_setInitConfig as setInitConfig, }; } declare function initialize(params: initConfigParams): void; declare const mainEntry_initialize: typeof initialize; declare namespace mainEntry { export { mainEntry_initialize as initialize, }; } type JsonNode = number | string | boolean | null | undefined | JsonNode[] | { [key: string]: JsonNode; }; declare const COMMON_STORAGE_KEY = "tsec"; declare const GENERAL_ID_KEY = "general"; type storageKeyOptions = { isGeneral?: boolean; sessionOnly?: boolean; }; /** * Storage module handles local storage and session storgae for multyple modules in * same storage key, with JSON serialization. It stores data in 'tsec' key, as an * object with that structure: * { [moduleSlug]: { [clientId | 'general']: { [key]: value } } } */ declare function setValue(this: Agent, key: string, value: JsonNode, options?: storageKeyOptions): void; declare function removeValue(this: Agent, key: string, options?: storageKeyOptions): void; declare function getValue(this: Agent, key: string, options?: storageKeyOptions): JsonNode; declare function hasValue(this: Agent, key: string, options?: storageKeyOptions): JsonNode; declare const storage_COMMON_STORAGE_KEY: typeof COMMON_STORAGE_KEY; declare const storage_GENERAL_ID_KEY: typeof GENERAL_ID_KEY; declare const storage_getValue: typeof getValue; declare const storage_hasValue: typeof hasValue; declare const storage_removeValue: typeof removeValue; declare const storage_setValue: typeof setValue; type storage_storageKeyOptions = storageKeyOptions; declare namespace storage { export { storage_COMMON_STORAGE_KEY as COMMON_STORAGE_KEY, storage_GENERAL_ID_KEY as GENERAL_ID_KEY, storage_getValue as getValue, storage_hasValue as hasValue, storage_removeValue as removeValue, storage_setValue as setValue, storage_storageKeyOptions as storageKeyOptions, }; } declare const INIT_ROTATION_RESPONSE = "init"; declare const COMPLETED_ROTATION_RESPONSE = "completed"; type CryptoKeyInvalidReason = 'IDB_WRITE_TIMEOUT'; type CryptoBindingPublicData = { publicKey: string; keyIdentifier: string; publicKeyId: string; errors?: CryptoKeyInvalidReason[]; }; type CryptoBindingRotationPayload = { data: string; signature: string; }; type CryptoBindingOptions$1 = { /** Set to true if you want to scope your crypto-binding keys with your product only (default is false, to use global-platofrm scope) */ productScope?: boolean; /** Custom database name, will be affected only if set `productScope` to true */ indexedDBName?: string; /** Custom db-versioning, will be be affected only if set `productScope` to true */ dbVersion?: number; /** Custom keys-store (table) name, will be affected only if set `productScope` to true */ keysStoreName?: string; /** Set to true if product supports key rotation */ /** Expiry days - number of days after which the key will expire */ /** Started at - timestamp of the day when the rotation was enabled for the product */ keyRotation?: { isEnabled: boolean; expiryDays: number; startedAt: number; tenantId: string; }; /** Timeout in milliseconds for IDB write transactions. If not set, no timeout is applied. * Use to guard against browsers that silently freeze IDB (e.g. iOS 18.7 WKWebView ephemeral sessions). */ idbWriteTimeoutMs?: number; /** @internal * Warning! This flag shouldn't be used, it was added temporarily for multi-tenant support. * * Internal flag used when the Product SDK instance has its own client ID separate from the Platform SDK root-level client ID */ fallbackClientId?: string; /** Optional string to scope crypto-binding keys to a separate database. * When set, keys are stored in `ts_crypto_binding:` instead of the default `ts_crypto_binding` database. * Use only when instructed by Transmit Security to isolate key storage between browser contexts (e.g. webview vs Safari). */ keyScope?: string; }; /** * @param keysType - the purpose of the keys, will use different key generator * @param options - typeof CryptoBindingOptions */ declare class CryptoBinding { agent: Agent; private keysType; private options?; private indexedDBClient; private indexedDBClientFallback; private keysDatabaseName; private keysStoreName; private dbVersion; private publicKeyBase64; private keyIdentifier; private publicKeyId; private _extractingKeysPromise; private cryptoBindingErrors; constructor(agent: Agent, keysType?: 'encrypt' | 'sign', options?: CryptoBindingOptions$1); private getClientConfiguration; private getKeysRecordKey; private getRotatedKeysRecordKey; private getRotatedKeysRecordKeyPending; private arrayBufferToBase64; private getPKRepresentations; private generateKeyPair; private calcKeyIdentifier; private extractKeysData; private generateKeyPairData; private shouldKeyBeRotated; private extractMainKeysData; private extractFallbackMainKeysData; private extractRotatedKeysData; private extractPendingRotatedKeysData; private saveKeyData; private getKeysData; private getOrCreateRotatedKeys; private getRotatedKeysData; getPublicData(): Promise; sign(message: string): Promise; clearKeys(): Promise; private getBaseRotationPayload; getRotationData(): Promise; private signPayload; handleRotateResponse(response: string): Promise; } declare function createCryptoBinding(this: Agent, keysType?: 'encrypt' | 'sign', options?: CryptoBindingOptions$1): CryptoBinding; declare const generateRSAKeyPair: () => Promise; declare const generateRSASignKeyPair: () => Promise; declare const signAssymetric: (privateKey: CryptoKey, message: string) => Promise; declare const verifyAssymetric: (publicKey: CryptoKey, message: string, signature: ArrayBuffer) => Promise; declare const crypto_COMPLETED_ROTATION_RESPONSE: typeof COMPLETED_ROTATION_RESPONSE; type crypto_CryptoBindingPublicData = CryptoBindingPublicData; declare const crypto_INIT_ROTATION_RESPONSE: typeof INIT_ROTATION_RESPONSE; declare const crypto_createCryptoBinding: typeof createCryptoBinding; declare const crypto_generateRSAKeyPair: typeof generateRSAKeyPair; declare const crypto_generateRSASignKeyPair: typeof generateRSASignKeyPair; declare const crypto_signAssymetric: typeof signAssymetric; declare const crypto_verifyAssymetric: typeof verifyAssymetric; declare namespace crypto { export { crypto_COMPLETED_ROTATION_RESPONSE as COMPLETED_ROTATION_RESPONSE, CryptoBindingOptions$1 as CryptoBindingOptions, crypto_CryptoBindingPublicData as CryptoBindingPublicData, crypto_INIT_ROTATION_RESPONSE as INIT_ROTATION_RESPONSE, crypto_createCryptoBinding as createCryptoBinding, crypto_generateRSAKeyPair as generateRSAKeyPair, crypto_generateRSASignKeyPair as generateRSASignKeyPair, crypto_signAssymetric as signAssymetric, crypto_verifyAssymetric as verifyAssymetric, }; } type QueryObjectStoreOptions = { operation?: 'read' | 'readwrite'; attemptToRecoverDB?: boolean; }; type TransactionOperation = { type: 'put'; key: string; value: any; } | { type: 'delete'; key: string; }; declare class IDBWriteTimeoutError extends Error { constructor(); } type indexedDB_IDBWriteTimeoutError = IDBWriteTimeoutError; declare const indexedDB_IDBWriteTimeoutError: typeof IDBWriteTimeoutError; type indexedDB_QueryObjectStoreOptions = QueryObjectStoreOptions; type indexedDB_TransactionOperation = TransactionOperation; declare namespace indexedDB { export { indexedDB_IDBWriteTimeoutError as IDBWriteTimeoutError, indexedDB_QueryObjectStoreOptions as QueryObjectStoreOptions, indexedDB_TransactionOperation as TransactionOperation, }; } type LogSeverity = 1 | 2 | 3 | 4 | 5 | 6; interface LogRow { timestamp: number; severity: LogSeverity; message: string; module: string; fields: object; } type Middleware = (instance: SdkLogger) => void; declare class SdkLogger { agent: Agent; middlewares: Middleware[]; logs: LogRow[]; constructor(agent: Agent, middlewares?: Middleware[]); info(message: string, fields?: object): void; warn(message: string, fields?: object): void; error(message: string, fields?: object): void; private pushLog; } declare function createSdkLogger(this: Agent, middlewares?: Middleware[]): SdkLogger; declare function consoleMiddleware(logger: SdkLogger): void; type logger_SdkLogger = SdkLogger; declare const logger_SdkLogger: typeof SdkLogger; declare const logger_consoleMiddleware: typeof consoleMiddleware; declare const logger_createSdkLogger: typeof createSdkLogger; declare namespace logger { export { logger_SdkLogger as SdkLogger, logger_consoleMiddleware as consoleMiddleware, logger_createSdkLogger as createSdkLogger, }; } type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE'; type RequestBody = object; type HttpResponse = Response & { data: T; }; type ResponseError = { message: string; }; declare function init(method: HttpMethod, body?: RequestBody, headers?: HeadersInit): RequestInit; /** * constructs a `GET` request * @param path API path * @param params request parameters * @returns a promise of the response body if successful and throw an error if failed */ declare function httpGet(path: string, params?: URLSearchParams, headers?: HeadersInit): Promise>; /** * constructs a `POST` request * @param path API path * @param data content of the request * @param params request parameters * @returns a promise of the response body if successful and throw an error if failed */ declare function httpPost(path: string, data: RequestBody, params?: URLSearchParams, headers?: HeadersInit): Promise>; /** * constructs a `PUT` request * @param path API path * @param data content of the request * @param params request parameters * @returns a promise of the response body if successful and throw an error if failed */ declare function httpPut(path: string, data: RequestBody, params?: URLSearchParams, headers?: HeadersInit): Promise>; /** * constructs a `DELETE` request * @param path API path * @param body content of the request * @param params request parameters * @returns a promise of the response body if successful and throw an error if failed */ declare function httpDelete(path: string, headers?: HeadersInit): Promise>; type http_HttpMethod = HttpMethod; type http_HttpResponse = HttpResponse; type http_RequestBody = RequestBody; type http_ResponseError = ResponseError; declare const http_httpDelete: typeof httpDelete; declare const http_httpGet: typeof httpGet; declare const http_httpPost: typeof httpPost; declare const http_httpPut: typeof httpPut; declare const http_init: typeof init; declare namespace http { export { http_HttpMethod as HttpMethod, http_HttpResponse as HttpResponse, http_RequestBody as RequestBody, http_ResponseError as ResponseError, http_httpDelete as httpDelete, http_httpGet as httpGet, http_httpPost as httpPost, http_httpPut as httpPut, http_init as init, }; } declare const _default$1: new (slug: string) => Agent & BoundMethods<{ events: typeof events; moduleMetadata: typeof moduleMetadata; mainEntry: typeof mainEntry; utils: new (slug: string) => Agent & BoundMethods<{ Agent: typeof Agent; exceptions: new (slug: string) => Agent & BoundMethods<{ TsError: { new (errorCode: string, message: string): { name: string; message: string; stack?: string; }; captureStackTrace(targetObject: object, constructorOpt?: Function): void; prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any; stackTraceLimit: number; }; TsInternalError: { new (errorCode: string): { name: string; message: string; stack?: string; }; captureStackTrace(targetObject: object, constructorOpt?: Function): void; prepareStackTrace?: (err: Error, stackTraces: NodeJS.CallSite[]) => any; stackTraceLimit: number; }; }>; }>; storage: typeof storage; crypto: typeof crypto; indexedDB: typeof indexedDB; logger: typeof logger; http: typeof http; }>; declare namespace index_d$3 { export { _default$1 as default, }; } declare enum RecommendationType { ALLOW = "ALLOW", CHALLENGE = "CHALLENGE", DENY = "DENY", TRUST = "TRUST" } type EventResponse = { actionToken?: string; deviceId?: string; recommendation?: Recommendation; userId?: string; }; type Recommendation = { type: RecommendationType; }; type LightweightPayload = { clientId: string; deviceId?: string; userId: string | null; sdkPlatform: 'mobile_web' | 'desktop_web'; events: Array>; }; type CryptoBindingOptions = { /** Set to true if you want to scope your crypto-binding keys with your product only (default is false, to use global-platofrm scope) */ productScope?: boolean; /** Custom database name, will be affected only if set `productScope` to true */ indexedDBName?: string; /** Custom db-versioning, will be be affected only if set `productScope` to true */ dbVersion?: number; /** Custom keys-store (table) name, will be affected only if set `productScope` to true */ keysStoreName?: string; /** Set to true if product supports key rotation */ /** Expiry days - number of days after which the key will expire */ /** Started at - timestamp of the day when the rotation was enabled for the product */ keyRotation?: { isEnabled: boolean; expiryDays: number; startedAt: number; tenantId: string; }; /** Timeout in milliseconds for IDB write transactions. If not set, no timeout is applied. * Use to guard against browsers that silently freeze IDB (e.g. iOS 18.7 WKWebView ephemeral sessions). */ idbWriteTimeoutMs?: number; /** @internal * Warning! This flag shouldn't be used, it was added temporarily for multi-tenant support. * * Internal flag used when the Product SDK instance has its own client ID separate from the Platform SDK root-level client ID */ fallbackClientId?: string; /** Optional string to scope crypto-binding keys to a separate object store. * When set, keys are stored in `identifiers_store:` instead of the default `identifiers_store`. * Use only when instructed by Transmit Security to isolate key storage between browser contexts (e.g. webview vs Safari). */ keyScope?: string; }; type TransactionType = 'purchase' | 'bill_payment' | 'mobile_recharge' | 'money_transfer' | 'credit_transfer' | 'credit_redemption' | 'top_up' | 'withdrawal' | 'investment' | 'loan' | 'refund' | 'other'; type TransactionMethod = 'bank_account' | 'wire' | 'card' | 'p2p' | 'wallet'; type AvsMatchLevel = 'none' | 'postal' | 'street' | 'full' | 'unknown'; /** The outcome of an action reported via {@link TSAccountProtection.reportActionResult} */ type ActionResult = "success" | "failure" | "incomplete"; /** Type of challenge presented to the user, when a challenge was recommended for the action */ type ChallengeType = "sms_otp" | "email_otp" | "totp" | "push_otp" | "voice_otp" | "idv" | "captcha" | "password" | "passkey"; type AuthMethodType = 'password' | 'webauthn' | 'totp' | 'email_otp' | 'sms_otp' | 'direct_otp' | 'voice_otp' | 'push_otp' | 'idv' | 'email_magic_link' | 'mobile_biometric' | 'face' | 'pin_authenticator' | 'google' | 'facebook' | 'apple' | 'line' | 'saml' | 'oidc'; interface ActionResultOptions { /** Identifier containing sensitive user data. Mosaic will encrypt and securely store this data. */ privateUserIdentifier?: string; /** Type of challenge used when a challenge was recommended for this action. */ challengeType?: ChallengeType; /** Opaque identifier of the user in your system. */ userId?: string; } interface ActionResponse { /** The token return by the SDK when the action was reported */ actionToken?: string; } interface InitOptions { /** Opaque identifier of the user in your system */ userId?: string; } /** * Initial parameters for SDK */ interface ConstructorOptions { /** Print logs to console */ verbose?: boolean; /** Your server URL * @required */ serverPath: string; /** Enable session token fetching * * Default value is false */ enableSessionToken?: boolean; /** First party server url for the identifiers migration * * Default value is undefined */ firstPartyMigrationUrl?: string; /** @internal * Internal flag indicating this web_sdk instance has its own clientId separate from the Platform SDK root-level clientId */ hasOwnClientId?: boolean; /** Tier mode for the SDK: 'standard' (default) or 'lightweight' (server-to-server) */ tier?: 'standard' | 'lightweight'; /** Agentic mode for CDN-injected integrations: enables agentic identity collection and artificial action triggering. Not supported with the lightweight tier. */ agenticCollect?: boolean; /** @internal * Optional configuration for crypto-binding key scoping. * Use only when instructed by Transmit Security. */ cryptoBindingConfig?: Pick; } interface TransactionData { amount: number; currency: string; type?: TransactionType; method?: TransactionMethod; channelId?: string; reason?: string; transactionDate?: number; payer?: { accountId?: string; accountNumber?: string; accountCountryCode?: string; bankIdentifier?: string; branchIdentifier?: string; name?: string; customerTier?: string; card?: { holderName?: string; bin?: string; last4?: string; }; billingInfo?: { name?: string; addressLine1?: string; addressLine2?: string; city?: string; state?: string; zipPostalCode?: string; country?: string; email?: string; phone?: string; }; }; payee?: { accountId?: string; accountNumber?: string; accountCountryCode?: string; bankIdentifier?: string; branchIdentifier?: string; name?: string; card?: { holderName?: string; bin?: string; last4?: string; }; }; purchase?: { totalItems?: number; products: { id?: string; name?: string; amount?: number; price?: number; }[]; shippingInfo?: { name?: string; addressLine1?: string; addressLine2?: string; city?: string; state?: string; zipPostalCode?: string; country?: string; email?: string; phone?: string; }; }; avs?: { code?: string; provider?: string; matchLevel?: AvsMatchLevel; }; } interface AuthContext { /** * Opaque identifier of the authenticated user in your system. Required — providing an auth * context signals the user is already authenticated (e.g. they logged in through a flow * outside this SDK before reaching this action). */ userId: string; /** Unix timestamp (ms) of when the login happened. */ loginTimestamp?: number; /** The challenge type used for the authentication action (e.g. sms_otp, password, passkey). */ challengeType?: ChallengeType; /** The number of failed attempts for the authentication action. */ failedAttempts?: number; /** The authentication method used for the authentication action (e.g. password, biometric, sso). */ authMethod?: AuthMethodType; /** The origin url of the page the user logged in from. */ loginOrigin?: string; } interface ActionEventOptions { /** Any ID that could help relate the action with external context or session */ correlationId?: string; /** User ID of the not yet authenticated user, used to enhance risk and * trust assessments. Once the user is authenticated, * {@link TSAccountProtection.setAuthenticatedUser} should be called. */ claimedUserId?: string; /** * The reported claimedUserId type (if provided), should not contain PII unless it is hashed. * Supported values: email, phone_number, account_id, ssn, national_id, passport_number, drivers_license_number, other. */ claimedUserIdType?: string; /** * A transaction data-points object for transaction-monitoring */ transactionData?: TransactionData; /** * Custom attributes matching the schema previously defined in the Admin Portal */ customAttributes?: Record; /** @internal Set only by AgenticManager, never by customer code. @ignore */ triggerSource?: 'page_load' | 'interaction_interval'; /** @internal Per-type tally of interactions counted toward this checkpoint. Set only by AgenticManager. @ignore */ agenticCountedInteractions?: Record; /** * Authentication context for an already-authenticated user. Providing it signals the user is * authenticated (userId is required) and registers them like {@link TSAccountProtection.setAuthenticatedUser}. * Useful when the login happened outside this SDK (e.g. a different site). */ authContext?: AuthContext; /** * The fields below are supported for Enterprise-IAM sdk usage actions, added `ignore` for avoiding preseting this attribute in the docs * @ignore */ publicKey?: string; /** * @ignore */ extensionMetadata?: string; /** * @ignore */ extensionDeviceAttributes?: Record; /** * @ignore */ suspiciousSignals?: string[]; /** * @ignore */ suspiciousContext?: string; /** * @ignore */ downloadFile?: Record; /** * @ignore */ uploadFile?: Record; } declare class TSAccountProtection { private static initializedInstance; private static initializedAgenticInstance; private initializationPromise; private disabledReason; private enableSessionToken; private identifiersMigrationEnabled; private firstPartyMigrationUrl; private hasOwnClientId; private tier; private agenticCollect; private agenticActive; private agenticManager; private agenticInitStartedAt; private lastCascadePath; private validationManager; private storageManager; private eventsManager; private deviceDataManager; private agenticSignalsManager; private configManager; private requestsManager; private identityManager; private migrationsManager; private cryptoBinding; private logsReporter; private options; private clientId; /** * Creates a new Account Protection SDK instance with your client context @param clientId Your AccountProtection client identifier @param options SDK configuration options */ constructor(clientId: string, options: ConstructorOptions); /** @ignore */ constructor(serverPath: string, clientId: string); private standDownCalled; private standDown; private runDetectionCascade; private standardInitListenerRegistered; private trafficWatchStarted; private startTrafficWatch; private spaRouteHooksRegistered; private registerSpaRouteHooks; private generateDisabledToken; /** * @ignore * @returns List of loaded actions that can be invoked */ get actions(): string[]; /** @ignore */ getActions(): Promise; getSessionToken(): Promise; /** * Returns the lightweight (citadel) device payload to be forwarded to citadel via the caller's backend. * The response from citadel includes a `deviceId` that must be passed back via {@link setDeviceId} * — the server may issue a new one or rotate it, and the SDK only persists it when told to. */ getPayload(): Promise; clearQueue(): void; /** * Sets the deviceId for lightweight mode (citadel). * Should be called after every response from citadel — the server may rotate the deviceId * (e.g. after schema validation), so always propagate the returned value back into the SDK. * @param deviceId - The JWT deviceId returned from citadel backend */ setDeviceId(deviceId: string): void; private resolveAgenticActive; /** * Initializes the AccountProtection SDK, which starts automatically tracking and submitting info of the user journey * @param options Init options * @returns Indicates if the call succeeded */ init(options?: InitOptions | string): Promise; private isInitialized; /** * Reports a user action event to the SDK * @param actionType Type of user action event that was predefined in the Transmit Security server * @returns Indicates if the call succeeded */ triggerActionEvent(actionType: string, options?: ActionEventOptions): Promise; private updateUserId; /** * Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared) * It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required) * @param userId Opaque identifier of the user in your system * @param options Reserved for future use * @returns Indicates if the call succeeded */ setAuthenticatedUser(userId: string, options?: {}): Promise; /** * Reports the result of an action for which a recommendation was previously issued. * This includes whether the user successfully completed the action and, when applicable, * the type of challenge that was presented. * @param actionToken The token returned when the action was triggered by {@link TSAccountProtection.triggerActionEvent} * @param result The outcome of the action * @param options Additional context associated with the action result * @returns Indicates if the call succeeded */ reportActionResult(actionToken: string, result: ActionResult, options?: ActionResultOptions): Promise; /** * Clears the user context for all subsequent events in the browser session * @param options Reserved for future use * @returns Indicates if the call succeeded */ clearUser(options?: {}): Promise; /** * Gets a secure session token that is signed with the device's private key * @param actionType Optional action type to include in the token payload (default: null) * @param expirationSeconds Optional expiration time in seconds (default: 300 seconds / 5 minutes) * @returns A JWT-like token containing the backend session token and device information, signed with the device's private key */ getSecureSessionToken(actionType?: string | null, expirationSeconds?: number): Promise; } /** * Reports a user action event to the SDK * @param actionType Type of user action event that was predefined in the Transmit Security server * @returns Indicates if the call succeeded */ declare const triggerActionEvent: TSAccountProtection['triggerActionEvent']; /** * Sets the user context for all subsequent events in the browser session (or until the user is explicitly cleared) * It should be set only after you've fully authenticated the user (including, for example, any 2FA that was required) * @param userId Opaque identifier of the user in your system * @param options Reserved for future use * @returns Indicates if the call succeeded */ declare const setAuthenticatedUser: TSAccountProtection['setAuthenticatedUser']; /** * Reports the result of an action for which a recommendation was previously issued. * This includes whether the user successfully completed the action and, when applicable, * the type of challenge that was presented. * @param actionToken The token returned when the action was triggered by triggerActionEvent() * @param result The outcome of the action ("success" | "failure" | "incomplete") * @param options Additional context associated with the action result * @returns Indicates if the call succeeded */ declare const reportActionResult: TSAccountProtection['reportActionResult']; /** * Clears the user context for all subsequent events in the browser session * @param options Reserved for future use * @returns Indicates if the call succeeded */ declare const clearUser: TSAccountProtection['clearUser']; /** @ignore */ declare const getActions: TSAccountProtection['getActions']; /** @ignore */ declare const getSessionToken: TSAccountProtection['getSessionToken']; /** * Gets a secure session token that is signed with the device's private key * @param actionType Optional action type to include in the token payload (default: null) * @param expirationSeconds Optional expiration time in seconds (default: 300 seconds / 5 minutes) * @returns A JWT-like token containing the backend session token and device information, signed with the device's private key */ declare const getSecureSessionToken: TSAccountProtection['getSecureSessionToken']; /** @ignore */ declare const getPayload: TSAccountProtection['getPayload']; /** * Sets the deviceId for lightweight mode (citadel). * Should be called after receiving deviceId from backend on first request. * @param deviceId - The JWT deviceId returned from citadel backend */ declare const setDeviceId: TSAccountProtection['setDeviceId']; /** @ignore */ declare const __internal: { getDeviceId(): string; getClientId(): string; flush(): Promise; }; type webSdkModule_d_ActionEventOptions = ActionEventOptions; type webSdkModule_d_ActionResponse = ActionResponse; type webSdkModule_d_ActionResultOptions = ActionResultOptions; type webSdkModule_d_AuthContext = AuthContext; type webSdkModule_d_LightweightPayload = LightweightPayload; declare const webSdkModule_d___internal: typeof __internal; declare const webSdkModule_d_clearUser: typeof clearUser; declare const webSdkModule_d_getActions: typeof getActions; declare const webSdkModule_d_getPayload: typeof getPayload; declare const webSdkModule_d_getSecureSessionToken: typeof getSecureSessionToken; declare const webSdkModule_d_getSessionToken: typeof getSessionToken; declare const webSdkModule_d_reportActionResult: typeof reportActionResult; declare const webSdkModule_d_setAuthenticatedUser: typeof setAuthenticatedUser; declare const webSdkModule_d_setDeviceId: typeof setDeviceId; declare const webSdkModule_d_triggerActionEvent: typeof triggerActionEvent; declare namespace webSdkModule_d { export { webSdkModule_d_ActionEventOptions as ActionEventOptions, webSdkModule_d_ActionResponse as ActionResponse, webSdkModule_d_ActionResultOptions as ActionResultOptions, webSdkModule_d_AuthContext as AuthContext, webSdkModule_d_LightweightPayload as LightweightPayload, webSdkModule_d___internal as __internal, webSdkModule_d_clearUser as clearUser, webSdkModule_d_getActions as getActions, webSdkModule_d_getPayload as getPayload, webSdkModule_d_getSecureSessionToken as getSecureSessionToken, webSdkModule_d_getSessionToken as getSessionToken, webSdkModule_d_reportActionResult as reportActionResult, webSdkModule_d_setAuthenticatedUser as setAuthenticatedUser, webSdkModule_d_setDeviceId as setDeviceId, webSdkModule_d_triggerActionEvent as triggerActionEvent, }; } type AddImagesResponse = { /** * Feedback for the submitted image */ feedback: AddImagesResponse.feedback; /** * Indicates whether all the images required for the verification check were received */ complete: boolean; /** * The additional image types that need to be added */ missing_images: Array<'document_front' | 'document_back' | 'selfie'>; /** * Custom feedback corresponding to the restricted criteria (as configured in the Admin Portal) */ custom_feedback?: string; /** * Indicates whether the document is expected to have a barcode */ has_barcode?: boolean; supported_barcode_symbologies?: string[]; }; declare namespace AddImagesResponse { /** * Feedback for the submitted image */ enum feedback { OK = "ok", OTHER = "other", DOCUMENT_NOT_FOUND = "document_not_found", FACE_NOT_FOUND = "face_not_found", DOCUMENT_FACE_NOT_FOUND = "document_face_not_found", OBSTRUCTED = "obstructed", BLUR = "blur", GLARE = "glare", DOCUMENT_NOT_SUPPORTED = "document_not_supported", DOCUMENT_NOT_MATCHING = "document_not_matching", WRONG_DOCUMENT_SIDE = "wrong_document_side", MULTI_FACE = "multi_face", FACE_ROTATED = "face_rotated", FACE_TOO_SMALL = "face_too_small", FACE_TOO_CLOSE = "face_too_close", CLOSED_EYES = "closed_eyes", FACE_ANGLE_TOO_LARGE = "face_angle_too_large", FACE_CLOSE_TO_BORDER = "face_close_to_border", FACE_OCCLUDED = "face_occluded", FACE_CROPPED = "face_cropped", BARCODE_NOT_FOUND = "barcode_not_found", GLARE_SELFIE = "glare_selfie", BLUR_SELFIE = "blur_selfie", RESTRICTED_CRITERIA = "restricted_criteria", UNCLASSIFIABLE = "unclassifiable" } } type Step = 'loading_screen' | 'init' | 'document_front' | 'document_back' | 'selfie' | 'processing' | 'error' | 'complete' | 'recapture'; type Errors = 'other' | 'camera-error' | 'camera-permission-dismissed' | 'camera-permission-denied' | 'trying-to-initialize-active-session' | 'unable-to-parse-data-uri' | 'failed-to-submit-image' | 'request-error' | 'session-expired'; interface CaptureItem { sessionId: string; type: 'document_front' | 'document_back' | 'selfie'; feedback: AddImagesResponse.feedback; } interface CaptureResult { captures: CaptureItem[]; } declare class CaptureError extends Error { errorCode: Errors; step: Step; constructor(errorCode: Errors, step: Step, message?: string); } /** * The `idv` module allows you to integrate identity verification services into your application. This allows you to * securely verify the identity of your customers using documents like their driver's license or passport. * * After the SDK is initialized, your app can start a verification flow by creating a session in the backend to establish * a secure context and then start the verification session by calling {@link module:tsPlatform.idv.start|start}. The SDK executes * the verification process with the user using the Transmit identity verification experience. Once all the required images are submitted, * Transmit starts processing the verification while the SDK polls for its status. Once processing is completed, the SDK notifies the app * so it can obtain the verification result (via the backend) and proceed accordingly. * @module tsPlatform.idv */ /** * Options for {@link captureDocument}. * @memberof module:tsPlatform.idv */ interface CaptureDocumentOptions { /** * Acquisition id obtained by calling the backend's * `POST /verify/api/v1/verification/{sessionId}/document-acquisition` endpoint. * The same id is used for both document_front and document_back uploads, including any retakes. */ acquisitionId: string; /** Optional callback invoked for each successful image capture. */ onCapture?: (result: CaptureItem) => void; } /** * Options for {@link captureSelfie}. * @memberof module:tsPlatform.idv */ interface CaptureSelfieOptions { /** * Acquisition id obtained by calling the backend's * `POST /verify/api/v1/verification/{sessionId}/selfie-acquisition` endpoint. */ acquisitionId: string; /** Optional callback invoked when the selfie is successfully captured. */ onCapture?: (result: CaptureItem) => void; } /** * Starts a verification session that was created in the backend (via the [Verification API](/openapi/verify/verifications/#operation/createSession)). * This will start the verification process for the user and guides them through the entire identity verification flow * using the Transmit identity verification experience, which includes capturing the required images and submitting them for processing. * @function start * @param {string} startToken - The start_token returned by the backend when the session was created, used to * bind the session to the device * @returns {Promise} Indicates if the session was started successfully * @memberof module:core * @example * const showLoader = true; * const startToken = '123456'; // start_token returned by the backend upon session creation * tsPlatform.idv.start(startToken).then((started) => { * showLoader = false; * if (started) { * console.log('Session started'); * } else { * console.log('Session not started'); * } * }); */ declare function start(startToken?: string): Promise; /** * Recaptures the required images in case the `recapture` status is returned. For example, this may occur in case some data * couldn't be extracted due to poor image quality. * @function recapture * @returns {Promise} Indicates if the session was started successfully * @memberof module:core * @example * const showLoader = true; * tsPlatform.idv.recapture().then((success) => { * showLoader = false; * if (success) { * console.log('Recapture started'); * } else { * console.log('Recapture not started'); * } * }); */ declare function recapture(): Promise; /** * Captures document images (front and back if needed). This method is only available when flowType is 'modular'. * Returns a Promise that resolves when the document capture sequence completes successfully. * * Requires an `acquisitionId` minted via the backend's * `POST /verify/api/v1/verification/{sessionId}/document-acquisition` endpoint. The same id is sent * with every image upload performed during the capture (front, back, retakes). * @function captureDocument * @param {CaptureDocumentOptions} options - Capture options including the required `acquisitionId` * and an optional `onCapture` callback called for each image submission attempt. * @returns {Promise} Promise that resolves with complete capture information * @throws {Error} If `acquisitionId` is missing, flowType is not 'modular', session is not active, * or the document step is not available * @memberof module:tsPlatform.idv * @example * // Mint an acquisition id from your backend, then pass it in: * const { acquisition_id } = await myBackend.createDocumentAcquisition(sessionId); * const result = await tsPlatform.idv.captureDocument({ acquisitionId: acquisition_id }); * console.log('Captured:', result.captures); * * // With callback for intermediate results (synchronous) * const result = await tsPlatform.idv.captureDocument({ * acquisitionId: acquisition_id, * onCapture: (capture) => { * console.log(`Captured ${capture.type} with feedback: ${capture.feedback}`); * }, * }); */ declare function captureDocument(options: CaptureDocumentOptions): Promise; /** * Captures a selfie image. This method is only available when flowType is 'modular'. * Returns a Promise that resolves when the selfie capture completes successfully. * * Requires an `acquisitionId` minted via the backend's * `POST /verify/api/v1/verification/{sessionId}/selfie-acquisition` endpoint. * @function captureSelfie * @param {CaptureSelfieOptions} options - Capture options including the required `acquisitionId` * and an optional `onCapture` callback. * @returns {Promise} Promise that resolves with complete capture information * @throws {Error} If `acquisitionId` is missing, flowType is not 'modular', session is not active, * or the selfie step is not available * @memberof module:tsPlatform.idv * @example * const { acquisition_id } = await myBackend.createSelfieAcquisition(sessionId); * const result = await tsPlatform.idv.captureSelfie({ acquisitionId: acquisition_id }); * console.log('Captured:', result.captures); */ declare function captureSelfie(options: CaptureSelfieOptions): Promise; declare const version: () => string; type index_d$2_CaptureDocumentOptions = CaptureDocumentOptions; type index_d$2_CaptureError = CaptureError; declare const index_d$2_CaptureError: typeof CaptureError; type index_d$2_CaptureItem = CaptureItem; type index_d$2_CaptureResult = CaptureResult; type index_d$2_CaptureSelfieOptions = CaptureSelfieOptions; declare const index_d$2_captureDocument: typeof captureDocument; declare const index_d$2_captureSelfie: typeof captureSelfie; declare const index_d$2_recapture: typeof recapture; declare const index_d$2_start: typeof start; declare const index_d$2_version: typeof version; declare namespace index_d$2 { export { index_d$2_CaptureDocumentOptions as CaptureDocumentOptions, index_d$2_CaptureError as CaptureError, index_d$2_CaptureItem as CaptureItem, index_d$2_CaptureResult as CaptureResult, index_d$2_CaptureSelfieOptions as CaptureSelfieOptions, index_d$2_captureDocument as captureDocument, index_d$2_captureSelfie as captureSelfie, index_d$2_recapture as recapture, index_d$2_start as start, index_d$2_version as version, }; } /** * Alternate paths used by the SDK to route API calls to your proxy server. */ interface WebauthnApis { /** * @defaultValue `/v1/auth/webauthn/authenticate/start` */ startAuthentication: string; /** * @defaultValue `/v1/auth/webauthn/register/start` */ startRegistration: string; /** * @defaultValue `/v1/auth/webauthn/cross-device/register/start` */ startCrossDeviceRegistration: string; /** * @defaultValue `/v1/auth/webauthn/cross-device/authenticate/init` */ initCrossDeviceAuthentication: string; /** * @defaultValue `/v1/auth/webauthn/cross-device/authenticate/start` */ startCrossDeviceAuthentication: string; /** * @defaultValue `/v1/auth/webauthn/cross-device/status` */ getCrossDeviceTicketStatus: string; /** * @defaultValue `/v1/auth/webauthn/cross-device/attach-device` */ attachDeviceToCrossDeviceSession: string; } /** * @private */ interface WebAuthnInitOptions { /** * Base path for sending API requests. This would be either a Transmit Security API deployment URL * such as documented for sandbox, or if you are proxying API requests from your backend - then the base path to your proxy. */ serverPath: string; /** * Override endpoints when using a proxy server in case the proxy server implements its own paths. */ webauthnApiPaths?: WebauthnApis; } /** * WebAuthn cross device interfaces */ declare enum WebauthnCrossDeviceStatus { Pending = "pending", Scanned = "scanned", Success = "success", Error = "error", Timeout = "timeout", Aborted = "aborted" } /** * WebAuthn cross device handlers interfaces */ interface CrossDeviceController { /** * Ticket ID for this cross-device flow. */ crossDeviceTicketId: string; /** * Stops listening for events from devices in cross-device flows */ stop: () => void; } /** * WebAuthn cross device status response interfaces */ interface ApiCrossDeviceStatusResponse { /** * cross device status */ status: WebauthnCrossDeviceStatus; /** * authentication session id */ session_id?: string; } /** * WebAuthn cross device attach device result interfaces */ interface AttachDeviceResult { /** * cross device status */ status: WebauthnCrossDeviceStatus; /** * ticket creation timestamp */ startedAt: string; /** * session's approval data (if exists) */ approvalData?: Record; } interface BaseCrossDeviceHandlers { /** * Called when the user has successfully attached a device to the cross-device flow using the {@link WebauthnCrossDeviceFlows.attachDevice} method. */ onDeviceAttach: () => Promise; /** * Called when there was an error in the cross-device flow with status response {@link ApiCrossDeviceStatusResponse}. */ onFailure: (error: ApiCrossDeviceStatusResponse) => Promise; } interface CrossDeviceAuthenticationHandlers extends BaseCrossDeviceHandlers { /** * Called upon successful webauthn authentication. * @param sessionId Session ID that will be exchanged for the user's access and ID tokens using the /v1/auth/session/authenticate API */ onCredentialAuthenticate: (sessionId: string) => Promise; } interface CrossDeviceRegistrationHandlers extends BaseCrossDeviceHandlers { /** * Called upon successful webauthn registration. */ onCredentialRegister: () => Promise; } interface WebauthnCrossDeviceRegistrationOptions { /** * 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 */ allowCrossPlatformAuthenticators?: boolean; /** * Must be set to true to register credentials as passkeys when supported (except for Apple devices, which always register credentials as passkeys). default: True */ registerAsDiscoverable?: boolean; } interface WebauthnRegistrationOptions extends WebauthnCrossDeviceRegistrationOptions { /** * 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 */ displayName?: string; /** * The timeout in seconds for the registration process. If the timeout is reached, the registration process will be aborted with error {@link ErrorCode.RegistrationAbortedTimeout}. */ timeout?: number; /** * Set to True in order to limit the creation of multiple credentials for the same account on a single authenticator. default: False */ limitSingleCredentialToDevice?: boolean; } interface WebauthnCrossDeviceFlows { /** * 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, * and calls your handlers when a state change is detected. * 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. */ init: { /** * Start a cross device registration flow * This call receives a cross-device ticket ID, and a {@link CrossDeviceRegistrationHandlers} instance that contains your handlers for cross device events. * For example, these handlers may update the UI or any other relevant application state. * @throws {@link ErrorCode.NotInitialized} * @returns {@link CrossDeviceController} - Object that allows you to stop the event loop, and obtain the cross-device ticket ID. */ registration: (params: { crossDeviceTicketId: string; handlers: CrossDeviceRegistrationHandlers; }) => Promise; /** * Start a cross device authentication flow * This call receives an optional username (if already known), and a {@link CrossDeviceAuthenticationHandlers} instance that contains your handlers for cross device events. * For example, these handlers may update the UI or any other relevant application state. * 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. * If the target username is not registered, an SdkError will be thrown when trying to authenticate in the attached device.
* @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.FailedToInitCrossDeviceSession} * @returns {@link CrossDeviceController} - Object that allows you to stop the event loop, and obtain the cross-device ticket ID. */ authentication: (params: { username?: string; handlers: CrossDeviceAuthenticationHandlers; }) => Promise; /** * Start a cross device approval flow * 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. * For example, these handlers may update the UI or any other relevant application state. * This call must be invoked for a registered username. * If the target username is not registered, an SdkError will be thrown when trying to authenticate in the attached device.
* @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.InvalidApprovalData} * @throws {@link ErrorCode.FailedToInitCrossDeviceSession} * @returns {@link CrossDeviceController} - Object that allows you to stop the event loop, and obtain the cross-device ticket ID. */ approval: (params: { username: string; approvalData: Record; handlers: CrossDeviceAuthenticationHandlers; }) => Promise; }; authenticate: { /** * 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.
* 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.
* Once tokens are retrieved, {@link CrossDeviceAuthenticationHandlers.onCredentialAuthenticate} will be called with a session ID that can also be used to retrieve tokens. * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object. * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.AuthenticationFailed} * @throws {@link ErrorCode.AuthenticationCanceled} * @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). */ modal: (crossDeviceTicketId: string) => Promise; }; approve: { /** * 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.
* 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.
* Once tokens are retrieved, {@link CrossDeviceAuthenticationHandlers.onCredentialAuthenticate} will be called with a session ID that can also be used to retrieve tokens. * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object. * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.AuthenticationFailed} * @throws {@link ErrorCode.AuthenticationCanceled} * @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). */ modal: (crossDeviceTicketId: string) => Promise; }; /** * Invokes a WebAuthn credential registration for the user used in the cross device session init, including prompting the user for biometrics. * 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). * If registration fails, an SdkError will be thrown. * If the backend registration call was successful, {@link CrossDeviceRegistrationHandlers.onCredentialRegister} will be called. * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object. * @param options Additional configuration for registration flow * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.RegistrationFailed} * @throws {@link ErrorCode.RegistrationCanceled} */ register: (params: { crossDeviceTicketId: string; options?: WebauthnCrossDeviceRegistrationOptions; }) => Promise; /** * Indicates when a session is accepted on another device in cross-device flows. * * If successful,{@link CrossDeviceRegistrationHandlers.onDeviceAttach} will be called in registration flow and {@link CrossDeviceAuthenticationHandlers.onDeviceAttach} for authentication. * @param crossDeviceTicketId Ticket ID of the cross-device flow. retrieved from the {@link CrossDeviceController} object. * @returns AttachDeviceResult {@link AttachDeviceResult}. Object containing the ticket status, creation timestamp, and approval data (if passed in the init.authentication() call) */ attachDevice: (crossDeviceTicketId: string) => Promise; } /** * @enum */ declare enum ErrorCode$1 { /** * Either the SDK init call failed or another function was called before initializing the SDK */ NotInitialized = "not_initialized", /** * When the call to {@link WebauthnApis.startAuthentication} failed */ AuthenticationFailed = "authentication_failed", /** * When {@link WebauthnAuthenticationFlows.modal authenticate.modal} or {@link AutofillHandlers.activate authenticate.autofill.activate} is called and the modal is closed by the user */ AuthenticationAbortedTimeout = "authentication_aborted_timeout", /** * When {@link register} is called and the modal is closed when reaching the timeout */ AuthenticationCanceled = "webauthn_authentication_canceled", /** * When the call to {@link WebauthnApis.startRegistration} failed */ RegistrationFailed = "registration_failed", /** / When The user attempted to register an authenticator that contains one of the credentials already registered with the relying party. */ AlreadyRegistered = "username_already_registered", /** * When {@link register} is called and the modal is closed by the user */ RegistrationAbortedTimeout = "registration_aborted_timeout", /** * When {@link register} is called and the modal is closed when reaching the timeout */ RegistrationCanceled = "webauthn_registration_canceled", /** * Passkey autofill authentication was aborted by {@link AutofillHandlers.abort} */ AutofillAuthenticationAborted = "autofill_authentication_aborted", /** * Passkey authentication is already active. To start a new authentication, abort the current one first by calling {@link AutofillHandlers.abort} */ AuthenticationProcessAlreadyActive = "authentication_process_already_active", /** * The ApprovalData parameter was sent in the wrong format */ InvalidApprovalData = "invalid_approval_data", /** * When the call to {@link WebauthnApis.initCrossDeviceAuthentication} failed */ FailedToInitCrossDeviceSession = "cross_device_init_failed", /** * When the call to {@link WebauthnApis.getCrossDeviceTicketStatus} failed */ FailedToGetCrossDeviceStatus = "cross_device_status_failed", /** * When the SDK operation fails on an unhandled error */ Unknown = "unknown" } /** * Common interface for `Promise` rejections. * Developers should handle according to the `errorCode` */ interface SdkError { /** * Error code from {@link ErrorCode} */ readonly errorCode: ErrorCode$1; /** * Error message */ readonly message: string; /** * Additional data */ readonly data?: any; } interface AuthenticationAutofillActivateHandlers { /** * A Callback function that will be triggered once biometrics signing is completed successfully. * @param webauthn_encoded_result */ onSuccess: (webauthn_encoded_result: string) => Promise; /** * A Callback function that will be triggered if authentication fails with an SdkError. * @param err */ onError?: (err: SdkError) => Promise; /** * A Callback function that will be triggered when challenge excepted from the service and autofill is ready to use. */ onReady?: () => void; } interface AutofillHandlers { /** * 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.
* 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.
* If it fails, the `onError` callback will be triggered with an SdkError. * @param params.handlers - Handlers that will be invoked once the authentication is completed (success or failure) * @param params.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 * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.AuthenticationFailed} * @throws {@link ErrorCode.AuthenticationCanceled} * @throws {@link ErrorCode.AutofillAuthenticationAborted} */ activate(params: { handlers: AuthenticationAutofillActivateHandlers; username?: string; }): void; /** * 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. */ abort(): void; } interface WebauthnAuthenticationOptions { /** * The timeout in seconds for the authentication process. If the timeout is reached, the registration process will be aborted with error {@link ErrorCode.AuthenticationAbortedTimeout}. */ timeout?: number; } interface WebauthnAuthenticationFlows { /** * 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.
* 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.
* 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.
* * @param params.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 * @param params.options - Options for the authentication process * @param params.identifier - Identifier value (email, phone number, user ID, or custom identifier). Mutually exclusive with username. * @param params.identifierType - Type of identifier (email, phone_number, user_id, username, or custom identifier type). Required when using identifier. * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.AuthenticationFailed} * @throws {@link ErrorCode.AuthenticationCanceled} * @throws {@link ErrorCode.InvalidApprovalData} * @throws {@link ErrorCode.AuthenticationProcessAlreadyActive} * @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). */ modal(params: { username?: string; options?: WebauthnAuthenticationOptions; } | { identifier?: string; identifierType?: string; options?: WebauthnAuthenticationOptions; }): Promise; /** * Property used to implement credential selection via autofill UI. */ autofill: AutofillHandlers; } interface WebauthnApprovalFlows { /** * 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.
* 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.
* 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.
* @param params.username Name of user account, as used in the WebAuthn registration. * @param params.approvalData Data that represents the approval to be signed with a passkey * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.InvalidApprovalData} * @throws {@link ErrorCode.AuthenticationFailed} * @throws {@link ErrorCode.AuthenticationCanceled} * @throws {@link ErrorCode.AuthenticationProcessAlreadyActive} * @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). */ modal(params: { username: string | undefined; approvalData: Record; }): Promise; } declare module '@transmit-security/web-sdk-common/dist/module-metadata/module-metadata' { interface initConfigParams { webauthn?: WebAuthnInitOptions; } } /** * Returns the authentication flows for webauthn */ declare const authenticate: WebauthnAuthenticationFlows; declare const approve: WebauthnApprovalFlows; /** * Invokes a WebAuthn credential registration for the specified user, including prompting the user for biometrics. * 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). * * If registration fails, an SdkError will be thrown. * * @param params.username - WebAuthn username to register * @param params.options - Additional configuration for registration flow * @throws {@link ErrorCode.NotInitialized} * @throws {@link ErrorCode.RegistrationFailed} * @throws {@link ErrorCode.RegistrationCanceled} */ declare function register(params: { username: string; options?: WebauthnRegistrationOptions; }): Promise; /** * Returns webauthn cross device flows * @type WebauthnCrossDeviceFlows */ declare const crossDevice: WebauthnCrossDeviceFlows; /** * Indicates whether this browser supports WebAuthn, and has a platform authenticator */ declare const isPlatformAuthenticatorSupported: () => Promise; /** * Indicates whether this browser supports Passkey Autofill */ declare const isAutofillSupported: () => Promise; /** * Returns the default API paths for webauthn */ declare const getDefaultPaths: () => WebauthnApis; type index_d$1_ApiCrossDeviceStatusResponse = ApiCrossDeviceStatusResponse; type index_d$1_AttachDeviceResult = AttachDeviceResult; type index_d$1_AuthenticationAutofillActivateHandlers = AuthenticationAutofillActivateHandlers; type index_d$1_AutofillHandlers = AutofillHandlers; type index_d$1_CrossDeviceAuthenticationHandlers = CrossDeviceAuthenticationHandlers; type index_d$1_CrossDeviceController = CrossDeviceController; type index_d$1_CrossDeviceRegistrationHandlers = CrossDeviceRegistrationHandlers; type index_d$1_SdkError = SdkError; type index_d$1_WebauthnApis = WebauthnApis; type index_d$1_WebauthnApprovalFlows = WebauthnApprovalFlows; type index_d$1_WebauthnAuthenticationFlows = WebauthnAuthenticationFlows; type index_d$1_WebauthnAuthenticationOptions = WebauthnAuthenticationOptions; type index_d$1_WebauthnCrossDeviceFlows = WebauthnCrossDeviceFlows; type index_d$1_WebauthnCrossDeviceRegistrationOptions = WebauthnCrossDeviceRegistrationOptions; type index_d$1_WebauthnCrossDeviceStatus = WebauthnCrossDeviceStatus; declare const index_d$1_WebauthnCrossDeviceStatus: typeof WebauthnCrossDeviceStatus; type index_d$1_WebauthnRegistrationOptions = WebauthnRegistrationOptions; declare const index_d$1_approve: typeof approve; declare const index_d$1_authenticate: typeof authenticate; declare const index_d$1_crossDevice: typeof crossDevice; declare const index_d$1_getDefaultPaths: typeof getDefaultPaths; declare const index_d$1_isAutofillSupported: typeof isAutofillSupported; declare const index_d$1_isPlatformAuthenticatorSupported: typeof isPlatformAuthenticatorSupported; declare const index_d$1_register: typeof register; declare namespace index_d$1 { export { index_d$1_ApiCrossDeviceStatusResponse as ApiCrossDeviceStatusResponse, index_d$1_AttachDeviceResult as AttachDeviceResult, index_d$1_AuthenticationAutofillActivateHandlers as AuthenticationAutofillActivateHandlers, index_d$1_AutofillHandlers as AutofillHandlers, index_d$1_CrossDeviceAuthenticationHandlers as CrossDeviceAuthenticationHandlers, index_d$1_CrossDeviceController as CrossDeviceController, index_d$1_CrossDeviceRegistrationHandlers as CrossDeviceRegistrationHandlers, ErrorCode$1 as ErrorCode, index_d$1_SdkError as SdkError, index_d$1_WebauthnApis as WebauthnApis, index_d$1_WebauthnApprovalFlows as WebauthnApprovalFlows, index_d$1_WebauthnAuthenticationFlows as WebauthnAuthenticationFlows, index_d$1_WebauthnAuthenticationOptions as WebauthnAuthenticationOptions, index_d$1_WebauthnCrossDeviceFlows as WebauthnCrossDeviceFlows, index_d$1_WebauthnCrossDeviceRegistrationOptions as WebauthnCrossDeviceRegistrationOptions, index_d$1_WebauthnCrossDeviceStatus as WebauthnCrossDeviceStatus, index_d$1_WebauthnRegistrationOptions as WebauthnRegistrationOptions, index_d$1_approve as approve, index_d$1_authenticate as authenticate, index_d$1_crossDevice as crossDevice, index_d$1_getDefaultPaths as getDefaultPaths, index_d$1_isAutofillSupported as isAutofillSupported, index_d$1_isPlatformAuthenticatorSupported as isPlatformAuthenticatorSupported, index_d$1_register as register, }; } /** * @interface * @description Parameters for SDK initialization */ interface IdoInitOptions { /** * Base path for sending API requests. This would be the base URL of the orchestration server. */ serverPath: string; /** * An optional resource URI, if defined in the application settings in the admin portal */ resource?: string; /** * The log level for the SDK. Default is LogLevel.Info * @default LogLevel.Info * @see {@link LogLevel} */ logLevel?: LogLevel; /** * The timeout for polling requests to the server for the wait for another device action in seconds. * @default 3 * @see {@link IdoJourneyActionType.WaitForAnotherDevice} */ pollingTimeout?: number; /** * The expected locale format is the standard language tags as defined by the localization RFC 5646 (https://datatracker.ietf.org/doc/html/rfc5646). */ locale?: string; /** * When true, the SDK will collect queued device events and send them back to the server. * This flag is mandatory for collecting data for the Risk Level Analysis step. * @default false */ collectRiskData?: boolean; } /** * @interface * @description Optional parameters for starting an SDK journey */ interface StartJourneyOptions { /** * Additional parameters to be passed to the Journey, Optional. */ additionalParams?: any; /** * A unique identifier for the flow. Will be auto generated if not provided. */ correlationId?: string; /** * Should client-server communication be double encrypted? Defaults to false. */ encrypted?: boolean; /** * An optional admin debug token to be passed to the Journey. */ adminDebugToken?: string; } /** * @interface * @description Optional parameters for starting an SSO journey */ interface StartSsoJourneyOptions { /** * Should client-server communication be double encrypted? Defaults to false. */ encrypted?: boolean; /** * An optional admin debug token to be passed to the Journey. */ adminDebugToken?: string; } /** * @enum * @description The enum for the log levels. */ declare enum LogLevel { Debug = 0, Info = 1, Warning = 2, Error = 3 } /** * @enum * @description The enum for the sdk error codes. */ declare enum ErrorCode { /** * @description The init options object is invalid. */ InvalidInitOptions = "invalid_initialization_options", /** * @description The sdk is not initialized. */ NotInitialized = "not_initialized", /** * @description There is no active Journey. */ NoActiveJourney = "no_active_journey", /** * @description Unable to receive response from the server. */ NetworkError = "network_error", /** * @description The client response to the Journey is not valid. */ ClientResponseNotValid = "client_response_not_valid", /** * @description The server returned an unexpected error. */ ServerError = "server_error", /** * @description The provided state is not valid for SDK state recovery. */ InvalidState = "invalid_state", /** * @description The provided credentials are invalid. */ InvalidCredentials = "invalid_credentials", /** * @description The provided OTP passcode is expired. */ ExpiredOTPPasscode = "expired_otp_passcode", /** * @description The provided validation passcode is expired. */ ExpiredValidationPasscode = "expired_validation_passcode", /** * @description Max resend attempts reached */ MaxResendReached = "expired_otp_passcode" } /** * @interface * @description Common interface for Promise rejections. Developers should handle according to the @errorCode */ interface IdoSdkError { /** * @description The error code. */ readonly errorCode: ErrorCode; /** * @description The error description. */ readonly description: string; /** * @description The error additional data. Optional. */ readonly data?: any; } /** * @enum * @description The enum for the client response option types. */ declare enum ClientResponseOptionType { /** * @description Client response option type for client input. This is the standard response option for any step. */ ClientInput = "client_input", /** * @description Client response option type for a cancelation branch in the Journey. Use this for canceling the current step. */ Cancel = "cancel", /** * @description Client response option type for a failure branch in the Journey. Use this for reporting client side failure for the current step. */ Fail = "failure", /** * @description Client response option type for custom branch in the Journey, used for custom branching. */ Custom = "custom", /** * @description Client response option type for a resend of the OTP. Use this for restarting the current step (sms / email otp authentication). */ Resend = "resend" } /** * @interface * @description The interface for client response option object. Use this object to submit client input to the Journey * step to process, cancel the current step or choose a custom branch. */ interface ClientResponseOption { /** * @description The type of the client response option. */ readonly type: ClientResponseOptionType; /** * @description The id of the client response option. * Journey step unique id is provided for the {@link ClientResponseOptionType.Custom} response option type. * {@link ClientResponseOptionType.ClientInput} and {@link ClientResponseOptionType.Cancel} have standard Ids _ClientInput_ and _Cancel_, respectively. */ readonly id: string; /** * @description The label of the client response option. */ readonly label: string; /** * @description Optional schema object that can be used for UI rendering. */ schema?: Record; } /** * @deprecated * @enum * @description Deprecated enum. Use {@link IdoJourneyActionType} instead to detect completion, rejection, or a step that requires client input. */ declare enum IdoServiceResponseType { /** * @description The Journey ended successfully. */ JourneySuccess = "journey_success", /** * @description The Journey reached a step that requires client input. */ ClientInputRequired = "client_input_required", /** * @description The current Journey step updated the client data or provided an error message. */ ClientInputUpdateRequired = "client_input_update_required", /** * @description The Journey ended with explicit rejection. */ JourneyRejection = "journey_rejection" } /** * @enum * @description The enum for the Journey step ID, used when the journey step is a predefined typed action. * The actions that do not use this are "Collect information" and "Login Form" which allow the journey author to define a custom ID. * See also {@link IdoServiceResponse.journeyStepId}. */ declare enum IdoJourneyActionType { /** * @description `journeyStepId` for a journey rejection. */ Rejection = "action:rejection", /** * @description `journeyStepId` for a journey completion. */ Success = "action:success", /** * @description `journeyStepId` for an Information action. * * Data received in the {@link IdoServiceResponse} object: * These are the text values that are configured for the Information action step in the journey editor. * This can be used to display the information to the user. * ```json * { * "data": { * "title": "", * "text": "<TEXT>", * "button_text": "<BUTTON TEXT>" * } * } * ``` * The client response does not need to include any data: `ido.submitClientResponse(ClientResponseOptionType.ClientInput);` */ Information = "action:information", /** * @description `journeyStepId` for a server side debugger breakpoint. * This response is sent to the client side when the journey debugger has reached a breakpoint, and will continue to return while * the journey debugger is paused. * * The {@link IdoServiceResponse} object does not include any data. * * The client response does not need to include any data: `ido.submitClientResponse(ClientResponseOptionType.ClientInput);` */ DebugBreak = "action:debug_break", /** * @description `journeyStepId` for a Wait for Cross Session Message action. * * The {@link IdoServiceResponse} object includes information that can be presented as a QR to scan by another device. * The response will remain the same while the cross session message was not consumed by the journey executed by the other device. * * The client response does not need to include any data: `ido.submitClientResponse(ClientResponseOptionType.ClientInput);` */ WaitForAnotherDevice = "action:wait_for_another_device", /** * @hidden * @deprecated Use {@link IdoJourneyActionType.RegisterDeviceAction} instead. */ CryptoBindingRegistration = "action:crypto_binding_registration", /** * @hidden * @deprecated Use {@link IdoJourneyActionType.ValidateDeviceAction} instead. */ CryptoBindingValidation = "action:crypto_binding_validation", /** * @hidden * @description `journeyStepId` for Register Device action. * This action is handled automatically by the SDK. */ RegisterDeviceAction = "transmit_platform_device_registration", /** * @hidden * @description `journeyStepId` for Validate Device action. * This action is handled automatically by the SDK. */ ValidateDeviceAction = "transmit_platform_device_validation", /** * @description `journeyStepId` for WebAuthn Registration action. * * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `webauthn.register()` * ```json * { * "data": { * "username": "<USERNAME>", * "display_name": "<DISPLAY_NAME>", * "register_as_discoverable": <true|false>, * "allow_cross_platform_authenticators": <true|false> * } * } * ``` * * Before responding, activate `webauthn.register()` to obtain the `webauthn_encoded_result` value. * This will present the user with the WebAuthn registration UI. Use the result to send the client response: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "webauthn_encoded_result": "<WEBAUTHN_ENCODED_RESULT_FROM_SDK>" * }) * ``` */ WebAuthnRegistration = "action:webauthn_registration", /** * @description `journeyStepId` for instructing the use of Fraud Prevention trigger action, as part of the Risk Recommendation journey step. * * Data received in the {@link IdoServiceResponse} object: the input parameters that you need to send to `drs.triggerActionEvent()` * ```json * { * "data": { * "correlation_id": "a47ed80a-41f9-464a-a42f-fce775b6e446", * "user_id": "user", * "action_type": "login" * }, * } * ``` * Before responding, activate `drs.triggerActionEvent()` to obtain the `action_token` value. This is a silent action, and does not require user interaction. * Use the result to send the client response: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "action_token": "<Fraud Prevention action token>" * }) * ``` */ DrsTriggerAction = "action:drs_trigger_action", /** * @description `journeyStepId` for Identity Verification action. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "payload": { * "endpoint": "<endpoint to redirect>", * "base_endpoint": "<base endpoint>", * "start_token": "<start token>", * "state": "<state>", * "session": "<session>" * }, * } * } * ``` * Use this data to redirect the user to the identity verification endpoint. * Since this redirects to a different page, make sure you store the SDK state by calling `ido.serializeState()`, and saving the response data in the session storage. * After the user completes the identity verification, you can restore the SDK state and continue the journey, by calling `ido.restoreFromSerializedState()` with the stored state. * * Once done, send the following client response: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "payload": { * "sessionId": "<sessionId>", * "state": "<state>" * } * }) * ``` */ IdentityVerification = "action:id_verification", /** * @description `journeyStepId` for Email OTP authentication action. * * Data received in the {@link IdoServiceResponse} object: * * ```json * { * "data": { * "code_length": <integer_code_length> * } * } * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials} or the error code {@link ErrorCode.ExpiredOTPPasscode}. * * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode. * Also, a resend option (see below) can be provided to the user. * * Client responses: * * - For simple submit of OTP passcode: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "passcode": "<passcode>" * }) * ``` * * - In Order to request resend of OTP (restart the action): * `ido.submitClientResponse(ClientResponseOptionType.Resend)` * */ EmailOTPAuthentication = "transmit_platform_email_otp_authentication", /** * @description `journeyStepId` for SMS OTP authentication action. * * Data received in the {@link IdoServiceResponse} object: * * ```json * { * "data": { * "code_length": <integer_code_length> * } * } * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}, or the error code {@link ErrorCode.ExpiredOTPPasscode} * * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode. * Also, a resend option (see below) can be provided to the user. * * Client responses: * * - For simple submit of OTP passcode: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "passcode": "<passcode>" * }) * ``` * * - In Order to request resend of OTP (restart the action): * `ido.submitClientResponse(ClientResponseOptionType.Resend)` * */ SmsOTPAuthentication = "transmit_platform_sms_otp_authentication", /** * @description `journeyStepId` for Generic OTP authentication action. * * Data received in the {@link IdoServiceResponse} object: * * ```json * { * "data": { * "code_length": <integer_code_length> * } * } * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials}, or the error code {@link ErrorCode.ExpiredOTPPasscode} * * This can be used to indicate that the passcode is invalid, prompting the user to enter a new passcode. * Also, a resend option (see below) can be provided to the user. * * Client responses: * * - For simple submit of OTP passcode: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "passcode": "<passcode>" * }) * ``` * * - In Order to request resend of OTP (restart the action): * `ido.submitClientResponse(ClientResponseOptionType.Resend)` * */ GenericOTPAuthentication = "transmit_platform_generic_otp_authentication", /** * @description `journeyStepId` for TOTP Registration action. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "payload": { * "secret": "<secret>", * "uri": "<uri>" * }, * } * } * ``` * Use this data to display the TOTP registration QR code / link to the user. * The user should use this to register the TOTP secret in their authenticator app. * Once the user has completed the registration, send the following empty client response: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput * ) * ``` * Please note that registration of the TOTP secret is a silent action, and does not require user interaction. * An empty response is sent to the server in order to continue the journey. * */ /** * @description `journeyStepId` for Email Validation action. * * Data received in the {@link IdoServiceResponse} object: * * ```json * { * "data": { * "code_length": <integer_code_length> * } * } * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials} * * Resend option also (see below) can be provided to the user. * * Client responses: * * - For simple submit of validation passcode: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "passcode": "<passcode>" * }) * ``` * * - In Order to request resend of OTP (restart the action): * `ido.submitClientResponse(ClientResponseOptionType.Resend)` * */ EmailValidation = "transmit_platform_email_validation", /** * @description `journeyStepId` for Sms Validation action. * * Data received in the {@link IdoServiceResponse} object: * * ```json * { * "data": { * "code_length": <integer_code_length> * } * } * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain either the error code {@link ErrorCode.InvalidCredentials} * * Resend option also (see below) can be provided to the user. * * Client responses: * * - For simple submit of validation passcode: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "passcode": "<passcode>" * }) * ``` * * - In Order to request resend of OTP (restart the action): * `ido.submitClientResponse(ClientResponseOptionType.Resend)` * */ SmsValidation = "transmit_platform_sms_validation", TotpRegistration = "transmit_platform_totp_registration", /** * @description `journeyStepId` for Transaction Signing with TOTP action. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "transaction_challenge": "<6_DIGIT_CHALLENGE_CODE>", * "approval_data": { * // Note: This is just an example. The actual approval_data can vary. * "transactionId": "<TRANSACTION_ID>", * "amount": "<AMOUNT>", * "currency": "<CURRENCY>" * } * } * } * ``` * Use this data to display the transaction details and the challenge code to the user. * The user should use this challenge code to generate a TOTP code using their authenticator app. * * Client responses: * * - For submitting the TOTP code: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "totp_code": "<6_DIGIT_TOTP_CODE>" * } * ) * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain the error code {@link ErrorCode.InvalidCredentials}. * This can be used to indicate that the TOTP code is invalid, prompting the user to enter a new code. * * Note: The user has a limited number of attempts to enter the correct TOTP code before the journey is rejected. */ TransactionSigningTOTP = "transmit_platform_transaction_signing_totp", /** * @description `journeyStepId` for Invoke IDP action. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "authorization_url": "<URL_OF_THE_AUTHORIZATION_ENDPOINT>", * "authorization_request_method": "<GET_OR_POST>", * "invocation_method": "<PAGE_OR_POPUP>", * "idp_name": "<IDP_NAME>" * } * } * ``` * Use this data to redirect the user to the IDP authorization endpoint. * * * Once done, send the following client response: * ```json * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "idp_response" : { * "code": "<code>", * "state": "<state>", * } * } * ) *``` * * */ InvokeIDP = "invoke_idp", /** * @description `journeyStepId` for Transaction Signing with Passkeys action. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "user_identifier": "<USERNAME>", * "approval_data": { * // Note: This is just an example. The actual approval_data can vary. * "transactionId": "<TRANSACTION_ID>", * "amount": "<AMOUNT>", * "currency": "<CURRENCY>" * } * } * } * ``` * Before responding, call `webauthn.approve.modal()` to obtain the `webauthn_encoded_result` value. * ```javascript * const result = await webauthn.approve.modal( * response.data.approval_data // Transaction details to be approved * ); * ``` * * Then submit the result: * ```javascript * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "webauthn_encoded_result": result * } * ) * ``` * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain * relevant error codes that can be used to handle various failure scenarios. * * Note: The approval_data object can contain up to 10 key-value pairs using only alphanumeric * characters, underscores, hyphens, and periods. The WebAuthn encoded result remains valid for 60 seconds. */ WebAuthnTransactionSigning = "transmit_platform_transaction_signing_webauthn", /** * @description `journeyStepId` for Select Organization action. * * Data received in the {@link IdoServiceResponse} object: * * ```json * { * "data": { * "organizations": [ * { * "id": "aq5Doa_GMiDhL2GC-HdKo", * "name": "Organization 1" * }, * { * "id": "mkiPd9tu0K2h9oCM9pRB7", * "name": "Organization 2" * }, * { * "id": "fdlvZdof5GPvqJlBeAoFs", * "name": "Organization 3" * } * ] * } * } * ``` * * * For organization selection, send the following client response: * ```javascript * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "organization_id": "<ORGANIZATION_ID>" * } * ) * ``` * * Note: If a user is a member of a single organization, this step will pick it implicitly. */ SelectOrganization = "transmit_platform_select_organization", /** * @description `journeyStepId` for Web to Mobile Authentication action. * This action type is used for both simple authentication and transaction signing scenarios. * * Initial Data received in the {@link IdoServiceResponse} object when multiple devices are available: * ```json * { * "data": { * "devices": [ * { * "name": "Device 1", * "code": "1" * }, * { * "name": "Device 2", * "code": "2" * } * ] * } * } * ``` * * For device selection, send the following client response: * ```javascript * ido.submitClientResponse( * ClientResponseOptionType.ClientInput, * { * "selected_device_code": "<DEVICE_CODE>" * } * ) * ``` * * After device selection or when only one device is available, the action will wait for mobile approval. * The response includes polling configuration and optional transaction details: * ```json * { * "data": { * "device_display_name": "Device 1", * "resend_attempts_left": 5, * "polling_interval": 3, * "approval_data": { * // Note: This is just an example. The actual approval_data can vary. * "transactionId": "<TRANSACTION_ID>", * "amount": "<AMOUNT>", * "currency": "<CURRENCY>" * } * } * } * ``` * * The following options are available: * * - To check current authentication status (polling): * ```javascript * // The application should implement its own polling mechanism * // and call this method periodically to check the status * ido.submitClientResponse(ClientResponseOptionType.ClientInput) * ``` * * - To cancel the authentication: * ```javascript * ido.submitClientResponse(ClientResponseOptionType.Cancel) * ``` * * - To resend the push notification: * ```javascript * ido.submitClientResponse(ClientResponseOptionType.Resend) * ``` * * Note: The application is responsible for implementing the polling mechanism * to check the authentication status. The SDK only provides the method to * submit the status check request. Use the polling_interval from the response * to determine the frequency of status checks. * * On failure, the `IdoServiceResponse` {@link IdoServiceResponse.errorData} field will contain * relevant error codes that can be used to handle various failure scenarios. */ MobileApproveAuthentication = "transmit_platform_mobile_approve_authentication", /** * @description `journeyStepId` for a selfie acquisition action. * This action instructs the client to acquire a selfie image from the user, typically as part of an identity verification or face authentication process. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "start_token": "<START_TOKEN>", // Optional: used to start an identity verification session if required * "acquisition_id": "<ACQUISITION_ID>" // Required: ID needed to start selfie capture * } * } * ``` * * To perform the selfie acquisition: * 1. If a `start_token` is present, initialize the IDV SDK session: * ```javascript * if (response.data.start_token !== undefined) { * await idv.start(response.data.start_token); * } * ``` * 2. Run the selfie acquisition by calling the IDV SDK's `captureSelfie()` method: * ```javascript * await idv.captureSelfie({ acquisitionId: response.data.acquisition_id }); * ``` * * After acquiring the selfie, the client response does not need to include any data: * ```javascript * ido.submitClientResponse(ClientResponseOptionType.ClientInput); * ``` * * If an error occurs while capturing the selfie, the client should handle error states and inform the user * and/or retry as appropriate according to application requirements. * * For deeper understanding and more implementation details, refer to the IDV SDK documentation: * {@link https://developer.transmitsecurity.com/sdk-ref/idvsdk/overview IDV SDK Reference} */ SelfieAcquisition = "transmit_platform_selfie_acquisition", /** * @description `journeyStepId` for a document acquisition action. * This action instructs the client to acquire a document image from the user, typically as part of an identity verification or face authentication process. * * Data received in the {@link IdoServiceResponse} object: * ```json * { * "data": { * "start_token": "<START_TOKEN>", // Optional: used to start an identity verification session if required * "acquisition_id": "<ACQUISITION_ID>" // Required: ID needed to start document capture * } * } * ``` * * To perform the document acquisition: * 1. If a `start_token` is present, initialize the IDV SDK session: * ```javascript * if (response.data.start_token !== undefined) { * await idv.start(response.data.start_token); * } * ``` * 2. Run the document acquisition by calling the IDV SDK's `captureDocument()` method: * ```javascript * await idv.captureDocument({ acquisitionId: response.data.acquisition_id }); * ``` * * After acquiring the document, the client response does not need to include any data: * ```javascript * ido.submitClientResponse(ClientResponseOptionType.ClientInput); * ``` * * If an error occurs while capturing the document, the client should handle error states and inform the user * and/or retry as appropriate according to application requirements. * * For deeper understanding and more implementation details, refer to the IDV SDK documentation: * {@link https://developer.transmitsecurity.com/sdk-ref/idvsdk/overview IDV SDK Reference} */ DocumentAcquisition = "transmit_platform_document_acquisition", /** * @description `journeyStepId` for IDV recommendation action. * * When this action is received, it indicates that identity verification (IDV) processing is being performed asynchronously on the backend. * The client is responsible for implementing a polling mechanism: keep calling * `ido.submitClientResponse(ClientResponseOptionType.ClientInput)` in a loop until the server responds with a new action or returns an error. * * Note: No data is provided by the server in the {@link IdoServiceResponse} object for this action at any time. * * It is recommended to show a blocking UI element (such as a loader or progress indicator) while polling, * to inform the user that processing is ongoing. * * This process can take a couple of seconds. The recommended polling interval is every 1 second. */ WaitForIdvRecommendations = "transmit_platform_idv_recommendation" } /** * @interface * @description The interface for the Journey step response object. Including Journey end with either error, rejection and success. */ interface IdoServiceResponse { /** * @deprecated * @description Deprecated attribute. Use {@link IdoJourneyActionType} instead. */ readonly type: IdoServiceResponseType; /** * @description Optional data object returned from the server for any of the journey steps. */ readonly data?: any; /** * @description Additional error data returned from the server for any of the journey steps. */ readonly errorData?: IdoSdkError; /** * @description Contains the Journey step ID, allowing the client side to choose the correct handler and UI. * This will be either a form ID for the "Collect information" and "Login Form" journey steps, * or one of {@link IdoJourneyActionType} for other actions. */ readonly journeyStepId?: IdoJourneyActionType | string; /** * @description The Journey client response options if the response type is {@link IdoServiceResponseType.ClientInputRequired} * or {@link IdoServiceResponseType.ClientInputUpdateRequired}. */ readonly clientResponseOptions?: Record<ClientResponseOptionType | string, ClientResponseOption>; /** * @description A proof of journey completion is provided upon successful completion of the journey, * indicated by the {@link IdoJourneyActionType.Success} step ID. */ token?: string; /** * @description If a browser-redirection is required (for example at the end of an SSO journey) - the server will provide the redirect URL here. * The client should redirect the browser to this URL, i.e. by issuing a `window.location.href = response.redirectUrl;` */ redirectUrl?: string; } /** * @interface * @description The interface for the sdk object. */ interface IdoSdk { /** * @description Creates a new Identity Orchestration SDK instance with your client context. * Do not call this function directly - see below how to initialize via the unified web SDK * @param clientId - Client ID for this application. * @param options - Additional environment configuration for the SDK operation. * @returns The promise that will be resolved when the SDK is initialized. * @throws {@link ErrorCode.InvalidInitOptions} in case of invalid init options. * @example * // Initialize an instance of the Identity Orchestration SDK using the unified SDK * import { initialize } from '@transmitsecurity/platform-web-sdk'; * initialize({ * clientId: 'my-client-id', * ido: { serverPath: 'https://api.transmitsecurity.io/ido'} * }); */ init(clientId: string, options?: IdoInitOptions, cryptoBindingConfig?: { keyScope?: string; }): Promise<void>; /** * @description Starts a Journey with a given id. * @param journeyId - Journey Identifier in the Mosaic Admin Console. * @param options - Additional parameters to be passed to the journey. * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received. * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized. * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout. * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error. * @example * // Start a Journey with the id 'my-journey-id' * try { * const idoResponse = await ido.startJourney('my-journey-id', { additionalParams: 'additionalParams' }); * // Handle Journey response * } catch(error) { * switch(sdkError.errorCode) ... * } */ startJourney(journeyId: string, options?: StartJourneyOptions): Promise<IdoServiceResponse>; /** * @description Starts an SSO Journey with a given Interaction ID. * @param interactionId - Interaction identifier given as part of the response to the initial /authorize request * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received. * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized. * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout. * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error. * @example * // Start a Journey with the Interaction ID '2456E855-05A0-4992-85C1-A2519CBB4AA7' * try { * const idoResponse = await ido.startSsoJourney('2456E855-05A0-4992-85C1-A2519CBB4AA7'); * // Handle Journey response * } catch(error) { * switch(sdkError.errorCode) ... * } */ startSsoJourney(interactionId: string, options?: StartSsoJourneyOptions): Promise<IdoServiceResponse>; /** * * @description This method will submit client input to the Journey step to process. * @param clientResponseOptionId - The response option ID is one of the IDs provided in the {@link IdoServiceResponse.clientResponseOptions}. * This would either be {@link ClientResponseOptionType.ClientInput} for collected user input, * or one of the others if another journey path was selected by the user. * @param data - The client response data object. * Mandatory in {@link ClientResponseOptionType.ClientInput} response option type, populate with data for the Journey step to process. * Optional in {@link ClientResponseOptionType.Cancel} and {@link ClientResponseOptionType.Custom} as an additional parameters for the branch. * @returns The promise that will be resolved when the {@link IdoServiceResponse} is received. * @throws {@link ErrorCode.NotInitialized} - Throws error if the SDK is not initialized. * @throws {@link ErrorCode.NoActiveJourney} - Throws error if the SDK state does not have an active Journey. * @throws {@link ErrorCode.NetworkError} - Throws error if could not connect to server, or server did not respond before timeout. * @throws {@link ErrorCode.ClientResponseNotValid} - Throws error if the client response to the Journey is not valid. * @throws {@link ErrorCode.ServerError} - Throws error if the server returned an unexpected error. * @example * // The previous response may include multiple response options. The standard 'ClientInput' response option * // signals we are sending collected user input to the journey step. * const selectedInputOptionId = ClientResponseOptionType.ClientInput; * * // Submit the client input. The data inside the JSON correspond to the expected fields from the Journey step. * try { * const idoResponse = await ido.submitClientResponse(selectedInputOption, { * 'userEmail': 'user@input.email', * 'userPhone': '111-222-3333', * }); * } catch(sdkError) { * switch(sdkError.errorCode) ... * } */ submitClientResponse(clientResponseOptionId: ClientResponseOptionType | string, data?: any): Promise<IdoServiceResponse>; /** * @description Get the current serialized state of the SDK. Can be stored by the application code and used to * restore the SDK state following page redirects or refresh * @returns The current state of the SDK. */ serializeState(): string; /** * @description Restores the SDK state from a serialized state, can be used to recover from page redirects or refresh. * The application code also receives the latest communication from the Mosaic server. * @param state - The state to restore from. * @returns The last {@link IdoServiceResponse} that was received before the state was saved. * @throws {@link ErrorCode.InvalidState} - Throws error if the provided state string is invalid. */ restoreFromSerializedState(state: string): IdoServiceResponse; /** * @description This method will generate a debug PIN * const debugPin = await ido.generateDebugPin(); * console.log(`Debug PIN: ${debugPin}`); // Output: Debug PIN: 1234 */ generateDebugPin(): Promise<string>; } declare module "@transmit-security/web-sdk-common/dist/module-metadata/module-metadata" { interface initConfigParams { ido?: { serverPath?: string; [key: string]: any; }; } } declare const startJourney: IdoSdk['startJourney']; declare const startSsoJourney: IdoSdk['startSsoJourney']; declare const submitClientResponse: IdoSdk['submitClientResponse']; declare const serializeState: IdoSdk['serializeState']; declare const restoreFromSerializedState: IdoSdk['restoreFromSerializedState']; declare const generateDebugPin: IdoSdk['generateDebugPin']; type index_d_ClientResponseOption = ClientResponseOption; type index_d_ClientResponseOptionType = ClientResponseOptionType; declare const index_d_ClientResponseOptionType: typeof ClientResponseOptionType; type index_d_IdoInitOptions = IdoInitOptions; type index_d_IdoJourneyActionType = IdoJourneyActionType; declare const index_d_IdoJourneyActionType: typeof IdoJourneyActionType; type index_d_IdoSdk = IdoSdk; type index_d_IdoSdkError = IdoSdkError; type index_d_IdoServiceResponse = IdoServiceResponse; type index_d_IdoServiceResponseType = IdoServiceResponseType; declare const index_d_IdoServiceResponseType: typeof IdoServiceResponseType; type index_d_LogLevel = LogLevel; declare const index_d_LogLevel: typeof LogLevel; type index_d_StartJourneyOptions = StartJourneyOptions; type index_d_StartSsoJourneyOptions = StartSsoJourneyOptions; declare const index_d_generateDebugPin: typeof generateDebugPin; declare const index_d_restoreFromSerializedState: typeof restoreFromSerializedState; declare const index_d_serializeState: typeof serializeState; declare const index_d_startJourney: typeof startJourney; declare const index_d_startSsoJourney: typeof startSsoJourney; declare const index_d_submitClientResponse: typeof submitClientResponse; declare namespace index_d { export { index_d_ClientResponseOption as ClientResponseOption, index_d_ClientResponseOptionType as ClientResponseOptionType, ErrorCode as IdoErrorCode, index_d_IdoInitOptions as IdoInitOptions, index_d_IdoJourneyActionType as IdoJourneyActionType, index_d_IdoSdk as IdoSdk, index_d_IdoSdkError as IdoSdkError, index_d_IdoServiceResponse as IdoServiceResponse, index_d_IdoServiceResponseType as IdoServiceResponseType, index_d_LogLevel as LogLevel, index_d_StartJourneyOptions as StartJourneyOptions, index_d_StartSsoJourneyOptions as StartSsoJourneyOptions, index_d_generateDebugPin as generateDebugPin, index_d_restoreFromSerializedState as restoreFromSerializedState, index_d_serializeState as serializeState, index_d_startJourney as startJourney, index_d_startSsoJourney as startSsoJourney, index_d_submitClientResponse as submitClientResponse, }; } interface SdkVersions { 'identity-orchestration': string; 'risk-detection': string; 'identity-verification': string; 'webauthn': string; 'unified-platform': string; } declare const SDK_VERSIONS: SdkVersions; /** * Main SDK class for CDN usage (window.tsPlatform) * Provides access to all modules and common functionality */ declare class TSWebSDK { factories: { drs: () => Record<string, any>; idv: () => Record<string, any>; }; constructor(); } declare const _default: TSWebSDK; declare const PACKAGE_VERSION = "2.6.1"; export { ActionEventOptions, ActionResponse, AuthenticationAutofillActivateHandlers, AutofillHandlers, CrossDeviceController, ErrorCode$1 as ErrorCode, PACKAGE_VERSION, SDK_VERSIONS, SdkError, WebauthnApis, WebauthnAuthenticationFlows, WebauthnCrossDeviceFlows, WebauthnCrossDeviceRegistrationOptions, WebauthnRegistrationOptions, authenticate, index_d$3 as common, crossDevice, _default as default, webSdkModule_d as drs, getDefaultPaths, index_d as ido, index_d$2 as idv, initConfigParams, initialize, isAutofillSupported, isPlatformAuthenticatorSupported, register, index_d$1 as webauthn };