type AtLeast = Partial & Pick; /** * Represents a sign-in method. */ type SigninMethod = { userId: string; } | { alias: string; } | { autofill: boolean; } | { discoverable: boolean; }; /** * Represents a step-up request to initiate a specific action or operation. * * @interface StepupRequest */ interface StepupRequest { signinMethod: SigninMethod; purpose: string; } type RegisterBeginResponse = { session: string; data: PublicKeyCredentialCreationOptions; }; type Success = { [P in keyof T]: T[P]; } & { error: undefined; }; type Error = { [P in keyof T]?: undefined; } & { error: ProblemDetails; }; type Result = Success | Error; type PromiseResult = Promise>; interface TokenResponse { token: string; } type SigninBeginResponse = { data: PublicKeyCredentialRequestOptions; session: string; }; interface ProblemDetails { from: string; errorCode: string; title: string; status?: number; detail?: string; } interface Config { apiUrl: string; apiKey: string; origin: string; rpid: string; } declare class Client { private config; private _clientVersion; private abortController; constructor(config: AtLeast); /** * Register a new credential to a user * * @param {string} token Token generated by your backend and the Passwordless API * @param {string} credentialNickname A nickname for the passkey credential being created */ register(token: string, credentialNickname?: string): PromiseResult; /** * Sign in a user using the userid * @param {string} userId * @returns */ signinWithId(userId: string): PromiseResult; /** * Sign in a user using an alias * @param {string} alias * @returns a verify_token */ signinWithAlias(alias: string): PromiseResult; /** * Sign in a user using autofill UI (a.k.a conditional) sign in * @returns a verify_token */ signinWithAutofill(): PromiseResult; /** * Sign in a user using discoverable credentials * @returns a verify_token */ signinWithDiscoverable(): PromiseResult; abort(): void; isPlatformSupported(): Promise; isBrowserSupported(): boolean; isAutofillSupported(): Promise; private registerBegin; private registerComplete; /** * Sign in a user * * @param {SigninMethod} Object containing either UserID or Alias * @returns */ private signin; /** * Performs a step-up authentication process. This is essentially an overload for the sign-in workflow. It allows for * a user authentication to be given a purpose or context for the sign-in, enabling a "step-up" authentication flow. * * @param {StepupRequest} stepup - The step-up request object. This includes the sign-in method and the purpose of the authentication * * @returns {token} - The result of the step-up sign-in process. */ stepup(stepup: StepupRequest): PromiseResult; private signinBegin; private signinComplete; private handleAbort; private assertBrowserSupported; private createHeaders; get clientVersionRegex(): RegExp; /** * (Internal use only) Sets the `Client-Version` header for client SDK implementations based off the Javascript Client SDK. By setting the * property, the parameter will be prepended. * @param {string} value The new `Client-Version` header value. * @throws {Error} Throws an error if the `Client-Version` has already been set. * @throws {Error} Throws an error if the `Client-Version` format is invalid. Expected format is 'prefix-x.x.x' where prefix is a lowercase string. * @remarks Do not set this property when integrating the client SDK. */ set clientVersion(value: string); /** * Gets the `Client-Version` header for client SDK implementations based off the Javascript Client SDK. */ get clientVersion(): string; } declare function isPlatformSupported(): Promise; declare function isBrowserSupported(): boolean; declare function isAutofillSupported(): Promise; export { type AtLeast, Client, type Config, type Error, type ProblemDetails, type PromiseResult, type RegisterBeginResponse, type Result, type SigninBeginResponse, type SigninMethod, type StepupRequest, type Success, type TokenResponse, isAutofillSupported, isBrowserSupported, isPlatformSupported };