Skip to main content
References

TOTP

Classes

default

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

Constructors

Constructor
new default(): default;
Returns

default

Methods

createDevice()
static createDevice(input?): Promise<
| {
deviceName: string;
fetchResponse: Response;
qrCodeString: string;
secret: string;
status: "OK";
}
| {
fetchResponse: Response;
status: "DEVICE_ALREADY_EXISTS_ERROR";
}>;

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

Creates a new unverified device.

Parameters
ParameterType
input?{ deviceName?: string; options?: RecipeFunctionOptions; userContext?: any; }
input.deviceName?string
input.options?RecipeFunctionOptions
input.userContext?any
Returns

Promise< | { deviceName: string; fetchResponse: Response; qrCodeString: string; secret: string; status: "OK"; } | { fetchResponse: Response; status: "DEVICE_ALREADY_EXISTS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the created device (secret, etc.)

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

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

Parameters
ParameterType
config?UserInput
Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

listDevices()
static listDevices(input?): Promise<{
devices: object[];
fetchResponse: Response;
status: "OK";
}>;

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

Lists all TOTP devices of the current user

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

Promise<{ devices: object[]; fetchResponse: Response; status: "OK"; }>

{ status: "OK", ...} if successful with a list of devices in the devices prop

removeDevice()
static removeDevice(input): Promise<{
didDeviceExist: boolean;
fetchResponse: Response;
status: "OK";
}>;

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

Removes a TOTP device

Parameters
ParameterType
input{ deviceName: string; options?: RecipeFunctionOptions; userContext?: any; }
input.deviceNamestring
input.options?RecipeFunctionOptions
input.userContext?any
Returns

Promise<{ didDeviceExist: boolean; fetchResponse: Response; status: "OK"; }>

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

verifyCode()
static verifyCode(input): Promise<
| {
fetchResponse: Response;
status: "OK";
}
| {
currentNumberOfFailedAttempts: number;
fetchResponse: Response;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
fetchResponse: Response;
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>;

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

Verifies that the totp code belongs to a verified device of the current user

Parameters
ParameterType
input{ options?: RecipeFunctionOptions; totp: string; userContext?: any; }
input.options?RecipeFunctionOptions
input.totpstring
input.userContext?any
Returns

Promise< | { fetchResponse: Response; status: "OK"; } | { currentNumberOfFailedAttempts: number; fetchResponse: Response; maxNumberOfFailedAttempts: number; status: "INVALID_TOTP_ERROR"; } | { fetchResponse: Response; retryAfterMs: number; status: "LIMIT_REACHED_ERROR"; }>

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

verifyDevice()
static verifyDevice(input): Promise<
| {
fetchResponse: Response;
status: "OK";
wasAlreadyVerified: boolean;
}
| {
currentNumberOfFailedAttempts: number;
fetchResponse: Response;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
fetchResponse: Response;
status: "UNKNOWN_DEVICE_ERROR";
}
| {
fetchResponse: Response;
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>;

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

Verifies the totp device for the current user

Parameters
ParameterType
input{ deviceName: string; options?: RecipeFunctionOptions; totp: string; userContext?: any; }
input.deviceNamestring
input.options?RecipeFunctionOptions
input.totpstring
input.userContext?any
Returns

Promise< | { fetchResponse: Response; status: "OK"; wasAlreadyVerified: boolean; } | { currentNumberOfFailedAttempts: number; fetchResponse: Response; maxNumberOfFailedAttempts: number; status: "INVALID_TOTP_ERROR"; } | { fetchResponse: Response; status: "UNKNOWN_DEVICE_ERROR"; } | { fetchResponse: Response; retryAfterMs: number; status: "LIMIT_REACHED_ERROR"; }>

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

Variables

createDevice()

const createDevice: (input?) => Promise<
| {
deviceName: string;
fetchResponse: Response;
qrCodeString: string;
secret: string;
status: "OK";
}
| {
fetchResponse: Response;
status: "DEVICE_ALREADY_EXISTS_ERROR";
}> = RecipeWrapper.createDevice;

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

Creates a new unverified device.

Parameters

ParameterType
input?{ deviceName?: string; options?: RecipeFunctionOptions; userContext?: any; }
input.deviceName?string
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise< | { deviceName: string; fetchResponse: Response; qrCodeString: string; secret: string; status: "OK"; } | { fetchResponse: Response; status: "DEVICE_ALREADY_EXISTS_ERROR"; }>

{ status: "OK", ...} if successful along a description of the created device (secret, etc.)

init()

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

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

Parameters

ParameterType
config?UserInput

Returns

CreateRecipeFunction<PreAndPostAPIHookAction>

listDevices()

const listDevices: (input?) => Promise<{
devices: object[];
fetchResponse: Response;
status: "OK";
}> = RecipeWrapper.listDevices;

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

Lists all TOTP devices of the current user

Parameters

ParameterType
input?{ options?: RecipeFunctionOptions; userContext?: any; }
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise<{ devices: object[]; fetchResponse: Response; status: "OK"; }>

{ status: "OK", ...} if successful with a list of devices in the devices prop

removeDevice()

const removeDevice: (input) => Promise<{
didDeviceExist: boolean;
fetchResponse: Response;
status: "OK";
}> = RecipeWrapper.removeDevice;

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

Removes a TOTP device

Parameters

ParameterType
input{ deviceName: string; options?: RecipeFunctionOptions; userContext?: any; }
input.deviceNamestring
input.options?RecipeFunctionOptions
input.userContext?any

Returns

Promise<{ didDeviceExist: boolean; fetchResponse: Response; status: "OK"; }>

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

verifyCode()

const verifyCode: (input) => Promise<
| {
fetchResponse: Response;
status: "OK";
}
| {
currentNumberOfFailedAttempts: number;
fetchResponse: Response;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
fetchResponse: Response;
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}> = RecipeWrapper.verifyCode;

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

Verifies that the totp code belongs to a verified device of the current user

Parameters

ParameterType
input{ options?: RecipeFunctionOptions; totp: string; userContext?: any; }
input.options?RecipeFunctionOptions
input.totpstring
input.userContext?any

Returns

Promise< | { fetchResponse: Response; status: "OK"; } | { currentNumberOfFailedAttempts: number; fetchResponse: Response; maxNumberOfFailedAttempts: number; status: "INVALID_TOTP_ERROR"; } | { fetchResponse: Response; retryAfterMs: number; status: "LIMIT_REACHED_ERROR"; }>

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

verifyDevice()

const verifyDevice: (input) => Promise<
| {
fetchResponse: Response;
status: "OK";
wasAlreadyVerified: boolean;
}
| {
currentNumberOfFailedAttempts: number;
fetchResponse: Response;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
fetchResponse: Response;
status: "UNKNOWN_DEVICE_ERROR";
}
| {
fetchResponse: Response;
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}> = RecipeWrapper.verifyDevice;

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

Verifies the totp device for the current user

Parameters

ParameterType
input{ deviceName: string; options?: RecipeFunctionOptions; totp: string; userContext?: any; }
input.deviceNamestring
input.options?RecipeFunctionOptions
input.totpstring
input.userContext?any

Returns

Promise< | { fetchResponse: Response; status: "OK"; wasAlreadyVerified: boolean; } | { currentNumberOfFailedAttempts: number; fetchResponse: Response; maxNumberOfFailedAttempts: number; status: "INVALID_TOTP_ERROR"; } | { fetchResponse: Response; status: "UNKNOWN_DEVICE_ERROR"; } | { fetchResponse: Response; retryAfterMs: number; status: "LIMIT_REACHED_ERROR"; }>

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

References

DeviceInfo

Re-exports DeviceInfo

PostAPIHookContext

Re-exports PostAPIHookContext

PreAndPostAPIHookAction

Re-exports PreAndPostAPIHookAction

PreAPIHookContext

Re-exports PreAPIHookContext

RecipeFunctionOptions

Re-exports RecipeFunctionOptions

RecipeInterface

Re-exports RecipeInterface

UserInput

Re-exports UserInput