UNPKG

@authsignal/browser

Version:

**[Authsignal](https://www.authsignal.com) provides passwordless step up authentication (Multi-factor Authentication - MFA) that can be placed anywhere within your application. Authsignal also provides a no-code fraud risk rules engine to manage when step

36 lines (35 loc) 1.68 kB
import { QrCodeChallengeResponse } from "./api/types/qr-code"; import { ChallengeState } from "./api/types/websocket"; import { AuthsignalResponse } from "./types"; type QrCodeOptions = { baseUrl: string; tenantId: string; }; export type ChallengeParams = { /** The action to be performed when the QR code is scanned. If track action is called, this must match the action passed to track. */ action: string; /** Custom data to be included in the challenge request. If track action is called, this must be omitted. */ custom?: Record<string, unknown>; /** Use REST API polling instead of WebSocket connection. Default: false */ polling?: boolean; /** The interval in milliseconds at which the QR code challenge will be polled. Default: 5 seconds (Only used when polling is true)*/ pollInterval?: number; /** The interval in milliseconds at which the QR code challenge will be refreshed. Default: 9 minutes */ refreshInterval?: number; /** A callback function that is called when the QR code challenge is refreshed. */ onRefresh?: (challengeId: string, expiresAt: string) => void; /** A callback function that is called when the state of the QR code challenge changes. */ onStateChange: (state: ChallengeState, accessToken?: string) => void; }; export declare class QrCode { private handler; private baseUrl; private tenantId; constructor({ baseUrl, tenantId }: QrCodeOptions); challenge(params: ChallengeParams): Promise<AuthsignalResponse<QrCodeChallengeResponse>>; refresh({ custom }?: { custom?: Record<string, unknown>; }): Promise<void>; disconnect(): void; } export {};