Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

supertokens-web-js/recipe/webauthn

References documentation for the supertokens-web-js/recipe/webauthn package

Classes

default

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Constructors

Constructor
new default(): default;
Returns

default

Methods

authenticateCredential()
static authenticateCredential(input): Promise<
  | {
  authenticationResponse: AuthenticationResponseJSON;
  status: "OK";
}
  | {
  error: any;
  status: "FAILED_TO_AUTHENTICATE_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Authenticate the credential with the passed options by using native webauthn functions.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { authenticationOptions: Omit<AuthenticationOptions, "fetchResponse" | "status">; userContext: any; }
input.authenticationOptions Omit<AuthenticationOptions, "fetchResponse" | "status">
input.userContext any
Returns

Promise< | { authenticationResponse: AuthenticationResponseJSON; status: "OK"; } | { error: any; status: "FAILED_TO_AUTHENTICATE_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along with authentication response received

authenticateCredentialWithSignIn()
static authenticateCredentialWithSignIn(input): Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_IN_NOT_ALLOWED";
}
  | {
  error: any;
  status: "FAILED_TO_AUTHENTICATE_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Authenticate the user and sign them in after verifying their identity.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; }
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any
Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_NOT_ALLOWED"; } | { error: any; status: "FAILED_TO_AUTHENTICATE_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email

createAndRegisterCredentialForSessionUser()
static createAndRegisterCredentialForSessionUser(input): Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
}
  | {
  reason?: string;
  status: "REGISTER_CREDENTIAL_NOT_ALLOWED";
}
  | {
  err: string;
  status: "INVALID_EMAIL_ERROR";
}
  | {
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  reason?: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device with the passed user details

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { email: string; options?: RecipeFunctionOptions; recipeUserId: string; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.recipeUserId string
input.userContext any
Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; } | { reason?: string; status: "REGISTER_CREDENTIAL_NOT_ALLOWED"; } | { err: string; status: "INVALID_EMAIL_ERROR"; } | { status: "INVALID_CREDENTIALS_ERROR"; } | { status: "OPTIONS_NOT_FOUND_ERROR"; } | { status: "INVALID_OPTIONS_ERROR"; } | { reason?: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful

createCredential()
static createCredential(input): Promise<
  | {
  registrationResponse: RegistrationResponseJSON;
  status: "OK";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Creates the credential with the passed options by using native webauthn functions.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { registrationOptions: Omit<RegistrationOptions, "fetchResponse" | "status">; userContext: any; }
input.registrationOptions Omit<RegistrationOptions, "fetchResponse" | "status">
input.userContext any
Returns

Promise< | { registrationResponse: RegistrationResponseJSON; status: "OK"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along with registration response received

doesBrowserSupportWebAuthn()
static doesBrowserSupportWebAuthn(input): Promise<
  | {
  browserSupportsWebauthn: boolean;
  platformAuthenticatorIsAvailable: boolean;
  status: "OK";
}
  | {
  error: any;
  status: "ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Parameters
Parameter Type
input { userContext: any; }
input.userContext any
Returns

Promise< | { browserSupportsWebauthn: boolean; platformAuthenticatorIsAvailable: boolean; status: "OK"; } | { error: any; status: "ERROR"; }>

generateRecoverAccountToken()
static generateRecoverAccountToken(input): Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "RECOVER_ACCOUNT_NOT_ALLOWED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Generate and send a recover account token.

Parameters
Parameter Type
input { email: string; options?: RecipeFunctionOptions; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.userContext any
Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; } | { fetchResponse: Response; reason: string; status: "RECOVER_ACCOUNT_NOT_ALLOWED"; }>

{ status: "OK", ...} if successful

getEmailExists()
static getEmailExists(input): Promise<
  | GeneralErrorResponse
  | {
  exists: boolean;
  fetchResponse: Response;
  status: "OK";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Checks whether there is an webauthn user with the passed email.

Parameters
Parameter Type
input { email: string; options?: RecipeFunctionOptions; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.userContext any
Returns

Promise< | GeneralErrorResponse | { exists: boolean; fetchResponse: Response; status: "OK"; }>

{ status: "OK", ...} if successful along with a boolean indicating existence

getRegisterOptions()
static getRegisterOptions(input): Promise<
  | {
  attestation: "none" | "indirect" | "direct" | "enterprise";
  authenticatorSelection: {
     requireResidentKey: boolean;
     residentKey: ResidentKey;
     userVerification: UserVerification;
  };
  challenge: string;
  createdAt: string;
  excludeCredentials: object[];
  expiresAt: string;
  fetchResponse: Response;
  pubKeyCredParams: object[];
  rp: {
     id: string;
     name: string;
  };
  status: "OK";
  timeout: number;
  user: {
     displayName: string;
     id: string;
     name: string;
  };
  webauthnGeneratedOptionsId: string;
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  err: string;
  fetchResponse: Response;
  status: "INVALID_EMAIL_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Registers a new device based on the passed options and returns the challenge to be fulfilled in order for successful addition of the identity.

Parameters
Parameter Type
input object & | { email: string; } | { recoverAccountToken: string; }
Returns

Promise< | { attestation: "none" | "indirect" | "direct" | "enterprise"; authenticatorSelection: { requireResidentKey: boolean; residentKey: ResidentKey; userVerification: UserVerification; }; challenge: string; createdAt: string; excludeCredentials: object[]; expiresAt: string; fetchResponse: Response; pubKeyCredParams: object[]; rp: { id: string; name: string; }; status: "OK"; timeout: number; user: { displayName: string; id: string; name: string; }; webauthnGeneratedOptionsId: string; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { err: string; fetchResponse: Response; status: "INVALID_EMAIL_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the created webauthn details (challenge, etc.)

getSignInOptions()
static getSignInOptions(input): Promise<
  | GeneralErrorResponse
  | {
  challenge: string;
  fetchResponse: Response;
  status: "OK";
  timeout: number;
  userVerification: UserVerification;
  webauthnGeneratedOptionsId: string;
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Returns details about how the authenticator to should verify that a signin is correct.

Parameters
Parameter Type
input { options?: RecipeFunctionOptions; userContext: any; }
input.options? RecipeFunctionOptions
input.userContext any
Returns

Promise< | GeneralErrorResponse | { challenge: string; fetchResponse: Response; status: "OK"; timeout: number; userVerification: UserVerification; webauthnGeneratedOptionsId: string; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the webauthn options (challenge, etc.)

init()
static init(config?): CreateRecipeFunction<PreAndPostAPIHookAction>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Parameters
Parameter Type
config? UserInput
Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

listCredentials()
static listCredentials(input): Promise<
  | GeneralErrorResponse
  | {
  credentials: object[];
  status: "OK";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

List the credentials for the user

Parameters
Parameter Type
input { options?: RecipeFunctionOptions; userContext: any; }
input.options? RecipeFunctionOptions
input.userContext any
Returns

Promise< | GeneralErrorResponse | { credentials: object[]; status: "OK"; }>

{ status: "OK", ...} if successful along with a list of the user’s credentials

recoverAccount()
static recoverAccount(input): Promise<
  | GeneralErrorResponse
  | {
  email: string;
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Recover the account using the token received in email.

Parameters
Parameter Type
input { credential: RegistrationResponseJSON; options?: RecipeFunctionOptions; token: string; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential RegistrationResponseJSON
input.options? RecipeFunctionOptions
input.token string
input.userContext any
input.webauthnGeneratedOptionsId string
Returns

Promise< | GeneralErrorResponse | { email: string; fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email

registerCredential()
static registerCredential(input): Promise<
  | GeneralErrorResponse
  | {
  status: "OK";
}
  | {
  reason?: string;
  status: "REGISTER_CREDENTIAL_NOT_ALLOWED";
}
  | {
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  reason?: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device with the passed user details

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { credential: RegistrationResponseJSON; options?: RecipeFunctionOptions; recipeUserId: string; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential RegistrationResponseJSON
input.options? RecipeFunctionOptions
input.recipeUserId string
input.userContext any
input.webauthnGeneratedOptionsId string
Returns

Promise< | GeneralErrorResponse | { status: "OK"; } | { reason?: string; status: "REGISTER_CREDENTIAL_NOT_ALLOWED"; } | { status: "INVALID_CREDENTIALS_ERROR"; } | { status: "OPTIONS_NOT_FOUND_ERROR"; } | { status: "INVALID_OPTIONS_ERROR"; } | { reason?: string; status: "INVALID_AUTHENTICATOR_ERROR"; }>

{ status: "OK", ...} if successful

registerCredentialWithRecoverAccount()
static registerCredentialWithRecoverAccount(input): Promise<
  | GeneralErrorResponse
  | {
  email: string;
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_GENERATED_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device and recover the user’s account with the recover token.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { options?: RecipeFunctionOptions; recoverAccountToken: string; userContext: any; }
input.options? RecipeFunctionOptions
input.recoverAccountToken string
input.userContext any
Returns

Promise< | GeneralErrorResponse | { email: string; fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { fetchResponse: Response; status: "INVALID_GENERATED_OPTIONS_ERROR"; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email

registerCredentialWithSignUp()
static registerCredentialWithSignUp(input): Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  err: string;
  fetchResponse: Response;
  status: "INVALID_EMAIL_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_GENERATED_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_UP_NOT_ALLOWED";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  fetchResponse: Response;
  status: "EMAIL_ALREADY_EXISTS_ERROR";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device and signup the user with the passed email ID.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters
Parameter Type
input { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any
Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { err: string; fetchResponse: Response; status: "INVALID_EMAIL_ERROR"; } | { fetchResponse: Response; status: "INVALID_GENERATED_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_UP_NOT_ALLOWED"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { fetchResponse: Response; status: "EMAIL_ALREADY_EXISTS_ERROR"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email

removeCredential()
static removeCredential(input): Promise<
  | GeneralErrorResponse
  | {
  status: "OK";
}
  | {
  fetchResponse: Response;
  status: "CREDENTIAL_NOT_FOUND_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Remove the credential for the passed credential ID

Parameters
Parameter Type
input { options?: RecipeFunctionOptions; userContext: any; webauthnCredentialId: string; }
input.options? RecipeFunctionOptions
input.userContext any
input.webauthnCredentialId string
Returns

Promise< | GeneralErrorResponse | { status: "OK"; } | { fetchResponse: Response; status: "CREDENTIAL_NOT_FOUND_ERROR"; }>

{ status: "OK", ...} if successful

signIn()
static signIn(input): Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_IN_NOT_ALLOWED";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Sign in with the credential and the generated options ID.

Parameters
Parameter Type
input { credential: AuthenticationResponseJSON; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential AuthenticationResponseJSON
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any
input.webauthnGeneratedOptionsId string
Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_NOT_ALLOWED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.)

signUp()
static signUp(input): Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_UP_NOT_ALLOWED";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  fetchResponse: Response;
  status: "EMAIL_ALREADY_EXISTS_ERROR";
}>;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Signup to ST with the webauthn options ID and the credential received from the device.

Parameters
Parameter Type
input { credential: RegistrationResponseJSON; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential RegistrationResponseJSON
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any
input.webauthnGeneratedOptionsId string
Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; reason: string; status: "SIGN_UP_NOT_ALLOWED"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { fetchResponse: Response; status: "EMAIL_ALREADY_EXISTS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.)

Variables

authenticateCredential()

const authenticateCredential: (input) => Promise<
  | {
  authenticationResponse: AuthenticationResponseJSON;
  status: "OK";
}
  | {
  error: any;
  status: "FAILED_TO_AUTHENTICATE_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}> = RecipeWrapper.authenticateCredential;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Authenticate the credential with the passed options by using native webauthn functions.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { authenticationOptions: Omit<AuthenticationOptions, "fetchResponse" | "status">; userContext: any; }
input.authenticationOptions Omit<AuthenticationOptions, "fetchResponse" | "status">
input.userContext any

Returns

Promise< | { authenticationResponse: AuthenticationResponseJSON; status: "OK"; } | { error: any; status: "FAILED_TO_AUTHENTICATE_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along with authentication response received


authenticateCredentialWithSignIn()

const authenticateCredentialWithSignIn: (input) => Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_IN_NOT_ALLOWED";
}
  | {
  error: any;
  status: "FAILED_TO_AUTHENTICATE_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}> = RecipeWrapper.authenticateCredentialWithSignIn;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Authenticate the user and sign them in after verifying their identity.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; }
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any

Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_NOT_ALLOWED"; } | { error: any; status: "FAILED_TO_AUTHENTICATE_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email


createAndRegisterCredentialForSessionUser()

const createAndRegisterCredentialForSessionUser: (input) => Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
}
  | {
  reason?: string;
  status: "REGISTER_CREDENTIAL_NOT_ALLOWED";
}
  | {
  err: string;
  status: "INVALID_EMAIL_ERROR";
}
  | {
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  reason?: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}> = RecipeWrapper.createAndRegisterCredentialForSessionUser;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device with the passed user details

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { email: string; options?: RecipeFunctionOptions; recipeUserId: string; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.recipeUserId string
input.userContext any

Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; } | { reason?: string; status: "REGISTER_CREDENTIAL_NOT_ALLOWED"; } | { err: string; status: "INVALID_EMAIL_ERROR"; } | { status: "INVALID_CREDENTIALS_ERROR"; } | { status: "OPTIONS_NOT_FOUND_ERROR"; } | { status: "INVALID_OPTIONS_ERROR"; } | { reason?: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful


createCredential()

const createCredential: (input) => Promise<
  | {
  registrationResponse: RegistrationResponseJSON;
  status: "OK";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}> = RecipeWrapper.createCredential;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Creates the credential with the passed options by using native webauthn functions.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { registrationOptions: Omit<RegistrationOptions, "fetchResponse" | "status">; userContext: any; }
input.registrationOptions Omit<RegistrationOptions, "fetchResponse" | "status">
input.userContext any

Returns

Promise< | { registrationResponse: RegistrationResponseJSON; status: "OK"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along with registration response received


doesBrowserSupportWebAuthn()

const doesBrowserSupportWebAuthn: (input) => Promise<
  | {
  browserSupportsWebauthn: boolean;
  platformAuthenticatorIsAvailable: boolean;
  status: "OK";
}
  | {
  error: any;
  status: "ERROR";
}> = RecipeWrapper.doesBrowserSupportWebAuthn;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Parameters

Parameter Type
input { userContext: any; }
input.userContext any

Returns

Promise< | { browserSupportsWebauthn: boolean; platformAuthenticatorIsAvailable: boolean; status: "OK"; } | { error: any; status: "ERROR"; }>


generateRecoverAccountToken()

const generateRecoverAccountToken: (input) => Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "RECOVER_ACCOUNT_NOT_ALLOWED";
}> = RecipeWrapper.generateRecoverAccountToken;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Generate and send a recover account token.

Parameters

Parameter Type
input { email: string; options?: RecipeFunctionOptions; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.userContext any

Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; } | { fetchResponse: Response; reason: string; status: "RECOVER_ACCOUNT_NOT_ALLOWED"; }>

{ status: "OK", ...} if successful


getEmailExists()

const getEmailExists: (input) => Promise<
  | GeneralErrorResponse
  | {
  exists: boolean;
  fetchResponse: Response;
  status: "OK";
}> = RecipeWrapper.getEmailExists;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Checks whether there is an webauthn user with the passed email.

Parameters

Parameter Type
input { email: string; options?: RecipeFunctionOptions; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.userContext any

Returns

Promise< | GeneralErrorResponse | { exists: boolean; fetchResponse: Response; status: "OK"; }>

{ status: "OK", ...} if successful along with a boolean indicating existence


getRegisterOptions()

const getRegisterOptions: (input) => Promise<
  | {
  attestation: "none" | "indirect" | "direct" | "enterprise";
  authenticatorSelection: {
     requireResidentKey: boolean;
     residentKey: ResidentKey;
     userVerification: UserVerification;
  };
  challenge: string;
  createdAt: string;
  excludeCredentials: object[];
  expiresAt: string;
  fetchResponse: Response;
  pubKeyCredParams: object[];
  rp: {
     id: string;
     name: string;
  };
  status: "OK";
  timeout: number;
  user: {
     displayName: string;
     id: string;
     name: string;
  };
  webauthnGeneratedOptionsId: string;
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  err: string;
  fetchResponse: Response;
  status: "INVALID_EMAIL_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}> = RecipeWrapper.getRegisterOptions;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Registers a new device based on the passed options and returns the challenge to be fulfilled in order for successful addition of the identity.

Parameters

Parameter Type
input object & | { email: string; } | { recoverAccountToken: string; }

Returns

Promise< | { attestation: "none" | "indirect" | "direct" | "enterprise"; authenticatorSelection: { requireResidentKey: boolean; residentKey: ResidentKey; userVerification: UserVerification; }; challenge: string; createdAt: string; excludeCredentials: object[]; expiresAt: string; fetchResponse: Response; pubKeyCredParams: object[]; rp: { id: string; name: string; }; status: "OK"; timeout: number; user: { displayName: string; id: string; name: string; }; webauthnGeneratedOptionsId: string; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { err: string; fetchResponse: Response; status: "INVALID_EMAIL_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the created webauthn details (challenge, etc.)


getSignInOptions()

const getSignInOptions: (input) => Promise<
  | GeneralErrorResponse
  | {
  challenge: string;
  fetchResponse: Response;
  status: "OK";
  timeout: number;
  userVerification: UserVerification;
  webauthnGeneratedOptionsId: string;
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}> = RecipeWrapper.getSignInOptions;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Returns details about how the authenticator to should verify that a signin is correct.

Parameters

Parameter Type
input { options?: RecipeFunctionOptions; userContext: any; }
input.options? RecipeFunctionOptions
input.userContext any

Returns

Promise< | GeneralErrorResponse | { challenge: string; fetchResponse: Response; status: "OK"; timeout: number; userVerification: UserVerification; webauthnGeneratedOptionsId: string; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the webauthn options (challenge, etc.)


init()

const init: (config?) => CreateRecipeFunction<PreAndPostAPIHookAction> = RecipeWrapper.init;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Parameters

Parameter Type
config? UserInput

Returns

CreateRecipeFunction<PreAndPostAPIHookAction>


listCredentials()

const listCredentials: (input) => Promise<
  | GeneralErrorResponse
  | {
  credentials: object[];
  status: "OK";
}> = RecipeWrapper.listCredentials;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

List the credentials for the user

Parameters

Parameter Type
input { options?: RecipeFunctionOptions; userContext: any; }
input.options? RecipeFunctionOptions
input.userContext any

Returns

Promise< | GeneralErrorResponse | { credentials: object[]; status: "OK"; }>

{ status: "OK", ...} if successful along with a list of the user’s credentials


recoverAccount()

const recoverAccount: (input) => Promise<
  | GeneralErrorResponse
  | {
  email: string;
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}> = RecipeWrapper.recoverAccount;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Recover the account using the token received in email.

Parameters

Parameter Type
input { credential: RegistrationResponseJSON; options?: RecipeFunctionOptions; token: string; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential RegistrationResponseJSON
input.options? RecipeFunctionOptions
input.token string
input.userContext any
input.webauthnGeneratedOptionsId string

Returns

Promise< | GeneralErrorResponse | { email: string; fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email


registerCredential()

const registerCredential: (input) => Promise<
  | GeneralErrorResponse
  | {
  status: "OK";
}
  | {
  reason?: string;
  status: "REGISTER_CREDENTIAL_NOT_ALLOWED";
}
  | {
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  reason?: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}> = RecipeWrapper.registerCredential;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device with the passed user details

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { credential: RegistrationResponseJSON; options?: RecipeFunctionOptions; recipeUserId: string; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential RegistrationResponseJSON
input.options? RecipeFunctionOptions
input.recipeUserId string
input.userContext any
input.webauthnGeneratedOptionsId string

Returns

Promise< | GeneralErrorResponse | { status: "OK"; } | { reason?: string; status: "REGISTER_CREDENTIAL_NOT_ALLOWED"; } | { status: "INVALID_CREDENTIALS_ERROR"; } | { status: "OPTIONS_NOT_FOUND_ERROR"; } | { status: "INVALID_OPTIONS_ERROR"; } | { reason?: string; status: "INVALID_AUTHENTICATOR_ERROR"; }>

{ status: "OK", ...} if successful


registerCredentialWithRecoverAccount()

const registerCredentialWithRecoverAccount: (input) => Promise<
  | GeneralErrorResponse
  | {
  email: string;
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_GENERATED_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}> = RecipeWrapper.registerCredentialWithRecoverAccount;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device and recover the user’s account with the recover token.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { options?: RecipeFunctionOptions; recoverAccountToken: string; userContext: any; }
input.options? RecipeFunctionOptions
input.recoverAccountToken string
input.userContext any

Returns

Promise< | GeneralErrorResponse | { email: string; fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { fetchResponse: Response; status: "INVALID_GENERATED_OPTIONS_ERROR"; } | { fetchResponse: Response; status: "RECOVER_ACCOUNT_TOKEN_INVALID_ERROR"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email


registerCredentialWithSignUp()

const registerCredentialWithSignUp: (input) => Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  err: string;
  fetchResponse: Response;
  status: "INVALID_EMAIL_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_GENERATED_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_UP_NOT_ALLOWED";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  fetchResponse: Response;
  status: "EMAIL_ALREADY_EXISTS_ERROR";
}
  | {
  status: "AUTHENTICATOR_ALREADY_REGISTERED";
}
  | {
  error: any;
  status: "FAILED_TO_REGISTER_USER";
}
  | {
  error: any;
  status: "WEBAUTHN_NOT_SUPPORTED";
}> = RecipeWrapper.registerCredentialWithSignUp;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Register the new device and signup the user with the passed email ID.

It uses @simplewebauthn/browser to make the webauthn calls.

Parameters

Parameter Type
input { email: string; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; }
input.email string
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any

Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { err: string; fetchResponse: Response; status: "INVALID_EMAIL_ERROR"; } | { fetchResponse: Response; status: "INVALID_GENERATED_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_UP_NOT_ALLOWED"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { fetchResponse: Response; status: "EMAIL_ALREADY_EXISTS_ERROR"; } | { status: "AUTHENTICATOR_ALREADY_REGISTERED"; } | { error: any; status: "FAILED_TO_REGISTER_USER"; } | { error: any; status: "WEBAUTHN_NOT_SUPPORTED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.) and email


removeCredential()

const removeCredential: (input) => Promise<
  | GeneralErrorResponse
  | {
  status: "OK";
}
  | {
  fetchResponse: Response;
  status: "CREDENTIAL_NOT_FOUND_ERROR";
}> = RecipeWrapper.removeCredential;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Remove the credential for the passed credential ID

Parameters

Parameter Type
input { options?: RecipeFunctionOptions; userContext: any; webauthnCredentialId: string; }
input.options? RecipeFunctionOptions
input.userContext any
input.webauthnCredentialId string

Returns

Promise< | GeneralErrorResponse | { status: "OK"; } | { fetchResponse: Response; status: "CREDENTIAL_NOT_FOUND_ERROR"; }>

{ status: "OK", ...} if successful


signIn()

const signIn: (input) => Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_IN_NOT_ALLOWED";
}> = RecipeWrapper.signIn;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Sign in with the credential and the generated options ID.

Parameters

Parameter Type
input { credential: AuthenticationResponseJSON; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential AuthenticationResponseJSON
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any
input.webauthnGeneratedOptionsId string

Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; reason: string; status: "SIGN_IN_NOT_ALLOWED"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.)


signUp()

const signUp: (input) => Promise<
  | GeneralErrorResponse
  | {
  fetchResponse: Response;
  status: "OK";
  user: User;
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "SIGN_UP_NOT_ALLOWED";
}
  | {
  fetchResponse: Response;
  status: "INVALID_CREDENTIALS_ERROR";
}
  | {
  fetchResponse: Response;
  status: "OPTIONS_NOT_FOUND_ERROR";
}
  | {
  fetchResponse: Response;
  status: "INVALID_OPTIONS_ERROR";
}
  | {
  fetchResponse: Response;
  reason: string;
  status: "INVALID_AUTHENTICATOR_ERROR";
}
  | {
  fetchResponse: Response;
  status: "EMAIL_ALREADY_EXISTS_ERROR";
}> = RecipeWrapper.signUp;

Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts

Signup to ST with the webauthn options ID and the credential received from the device.

Parameters

Parameter Type
input { credential: RegistrationResponseJSON; options?: RecipeFunctionOptions; shouldTryLinkingWithSessionUser?: boolean; userContext: any; webauthnGeneratedOptionsId: string; }
input.credential RegistrationResponseJSON
input.options? RecipeFunctionOptions
input.shouldTryLinkingWithSessionUser? boolean
input.userContext any
input.webauthnGeneratedOptionsId string

Returns

Promise< | GeneralErrorResponse | { fetchResponse: Response; status: "OK"; user: User; } | { fetchResponse: Response; reason: string; status: "SIGN_UP_NOT_ALLOWED"; } | { fetchResponse: Response; status: "INVALID_CREDENTIALS_ERROR"; } | { fetchResponse: Response; status: "OPTIONS_NOT_FOUND_ERROR"; } | { fetchResponse: Response; status: "INVALID_OPTIONS_ERROR"; } | { fetchResponse: Response; reason: string; status: "INVALID_AUTHENTICATOR_ERROR"; } | { fetchResponse: Response; status: "EMAIL_ALREADY_EXISTS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the user details (id, etc.)

References

RecipeInterface

Re-exports RecipeInterface

API reference

API schema and response details