Skip to content
Esc
navigateopen⌘Jpreview
Dashboard
On this page

supertokens-auth-react/recipe/webauthn

References documentation for the supertokens-auth-react/recipe/webauthn package

Classes

default

Defined in: recipe/webauthn/index.ts

Constructors

Constructor
new default(): default;
Returns

default

Properties

Property Modifier Type Default value Defined in
ComponentsOverrideProvider static any RecipeComponentsOverrideContextProvider recipe/webauthn/index.ts

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: recipe/webauthn/index.ts

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

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

authenticateCredentialWithSignIn()
static authenticateCredentialWithSignIn(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

createAndRegisterCredentialForSessionUser()
static createAndRegisterCredentialForSessionUser(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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<any>

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: recipe/webauthn/index.ts

Parameters
Parameter Type
input { registrationOptions: Omit<SuperTokensWrapper, "fetchResponse" | "status">; userContext: any; }
input.registrationOptions Omit<SuperTokensWrapper, "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"; }>

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

Defined in: 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<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

getEmailExists()
static getEmailExists(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

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: recipe/webauthn/index.ts

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"; }>

getSignInOptions()
static getSignInOptions(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

init()
static init(config?): any;

Defined in: recipe/webauthn/index.ts

Parameters
Parameter Type
config? UserInput
Returns

any

listCredentials()
static listCredentials(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

recoverAccount()
static recoverAccount(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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<any>

registerCredential()
static registerCredential(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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<any>

registerCredentialWithRecoverAccount()
static registerCredentialWithRecoverAccount(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

registerCredentialWithSignUp()
static registerCredentialWithSignUp(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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<any>

removeCredential()
static removeCredential(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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

Promise<any>

signIn()
static signIn(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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<any>

signUp()
static signUp(input): Promise<any>;

Defined in: recipe/webauthn/index.ts

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<any>

Variables

authenticateCredential()

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

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

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


authenticateCredentialWithSignIn()

const authenticateCredentialWithSignIn: (input) => Promise<any> = Wrapper.authenticateCredentialWithSignIn;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


createAndRegisterCredentialForSessionUser()

const createAndRegisterCredentialForSessionUser: (input) => Promise<any> = Wrapper.createAndRegisterCredentialForSessionUser;

Defined in: recipe/webauthn/index.ts

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<any>


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";
}> = Wrapper.createCredential;

Defined in: recipe/webauthn/index.ts

Parameters

Parameter Type
input { registrationOptions: Omit<SuperTokensWrapper, "fetchResponse" | "status">; userContext: any; }
input.registrationOptions Omit<SuperTokensWrapper, "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"; }>


doesBrowserSupportWebAuthn()

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

Defined in: 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<any> = Wrapper.generateRecoverAccountToken;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


getEmailExists()

const getEmailExists: (input) => Promise<any> = Wrapper.getEmailExists;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


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";
}> = Wrapper.getRegisterOptions;

Defined in: recipe/webauthn/index.ts

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"; }>


getSignInOptions()

const getSignInOptions: (input) => Promise<any> = Wrapper.getSignInOptions;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


init()

const init: (config?) => any = Wrapper.init;

Defined in: recipe/webauthn/index.ts

Parameters

Parameter Type
config? UserInput

Returns

any


listCredentials()

const listCredentials: (input) => Promise<any> = Wrapper.listCredentials;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


recoverAccount()

const recoverAccount: (input) => Promise<any> = Wrapper.recoverAccount;

Defined in: recipe/webauthn/index.ts

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<any>


registerCredential()

const registerCredential: (input) => Promise<any> = Wrapper.registerCredential;

Defined in: recipe/webauthn/index.ts

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<any>


registerCredentialWithRecoverAccount()

const registerCredentialWithRecoverAccount: (input) => Promise<any> = Wrapper.registerCredentialWithRecoverAccount;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


registerCredentialWithSignUp()

const registerCredentialWithSignUp: (input) => Promise<any> = Wrapper.registerCredentialWithSignUp;

Defined in: recipe/webauthn/index.ts

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<any>


removeCredential()

const removeCredential: (input) => Promise<any> = Wrapper.removeCredential;

Defined in: recipe/webauthn/index.ts

Parameters

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

Returns

Promise<any>


signIn()

const signIn: (input) => Promise<any> = Wrapper.signIn;

Defined in: recipe/webauthn/index.ts

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<any>


signUp()

const signUp: (input) => Promise<any> = Wrapper.signUp;

Defined in: recipe/webauthn/index.ts

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<any>


WebauthnComponentsOverrideProvider

const WebauthnComponentsOverrideProvider: any = Wrapper.ComponentsOverrideProvider;

Defined in: recipe/webauthn/index.ts

API reference

API schema and response details