WebAuthn
Classes
default
Defined in: tmp/supertokens-web-js/lib/ts/recipe/webauthn/index.ts:30
Constructors
Constructor
new default(): default;
Returns
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:352
Authenticate the credential with the passed options by using native webauthn functions.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:433
Authenticate the user and sign them in after verifying their identity.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:526
Register the new device with the passed user details
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:328
Creates the credential with the passed options by using native webauthn functions.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:633
Parameters
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:260
Generate and send a recover account token.
Parameters
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:235
Checks whether there is an webauthn user with the passed email.
Parameters
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:49
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
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:120
Returns details about how the authenticator to should verify that a signin is correct.
Parameters
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:31
Parameters
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:560
List the credentials for the user
Parameters
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:293
Recover the account using the token received in email.
Parameters
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:615
Register the new device with the passed user details
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:476
Register the new device and recover the user's account with the recover token.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:379
Register the new device and signup the user with the passed email ID.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:587
Remove the credential for the passed credential ID
Parameters
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:198
Sign in with the credential and the generated options ID.
Parameters
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:155
Signup to ST with the webauthn options ID and the credential received from the device.
Parameters
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:660
Authenticate the credential with the passed options by using native webauthn functions.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:657
Authenticate the user and sign them in after verifying their identity.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:665
Register the new device with the passed user details
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:659
Creates the credential with the passed options by using native webauthn functions.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:661
Parameters
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:654
Generate and send a recover account token.
Parameters
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:653
Checks whether there is an webauthn user with the passed email.
Parameters
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:649
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
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:650
Returns details about how the authenticator to should verify that a signin is correct.
Parameters
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:648
Parameters
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:662
List the credentials for the user
Parameters
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:655
Recover the account using the token received in email.
Parameters
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:664
Register the new device with the passed user details
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:658
Register the new device and recover the user's account with the recover token.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:656
Register the new device and signup the user with the passed email ID.
It uses @simplewebauthn/browser to make the webauthn calls.
Parameters
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:663
Remove the credential for the passed credential ID
Parameters
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:652
Sign in with the credential and the generated options ID.
Parameters
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:651
Signup to ST with the webauthn options ID and the credential received from the device.
Parameters
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