supertokens-node/recipe/totp
References documentation for the supertokens-node/recipe/totp package
Classes
default
Defined in: recipe/totp/index.ts
Constructors
Constructor
new default(): default;
Returns
Properties
| Property | Modifier | Type | Default value | Defined in |
|---|---|---|---|---|
init |
static |
(config?) => RecipeListFunction |
Recipe.init |
recipe/totp/index.ts |
Methods
createDevice()
static createDevice(
userId,
userIdentifierInfo?,
deviceName?,
skew?,
period?,
userContext?): Promise<
| {
deviceName: string;
qrCodeString: string;
secret: string;
status: "OK";
}
| {
status: "DEVICE_ALREADY_EXISTS_ERROR";
}
| {
status: "UNKNOWN_USER_ID_ERROR";
}>;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
userIdentifierInfo? |
string |
deviceName? |
string |
skew? |
number |
period? |
number |
userContext? |
Record<string, any> |
Returns
Promise<
| {
deviceName: string;
qrCodeString: string;
secret: string;
status: "OK";
}
| {
status: "DEVICE_ALREADY_EXISTS_ERROR";
}
| {
status: "UNKNOWN_USER_ID_ERROR";
}>
listDevices()
static listDevices(userId, userContext?): Promise<{
devices: object[];
status: "OK";
}>;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
userContext? |
Record<string, any> |
Returns
Promise<{
devices: object[];
status: "OK";
}>
removeDevice()
static removeDevice(
userId,
deviceName,
userContext?): Promise<{
didDeviceExist: boolean;
status: "OK";
}>;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
deviceName |
string |
userContext? |
Record<string, any> |
Returns
Promise<{
didDeviceExist: boolean;
status: "OK";
}>
updateDevice()
static updateDevice(
userId,
existingDeviceName,
newDeviceName,
userContext?): Promise<{
status: "OK" | "DEVICE_ALREADY_EXISTS_ERROR" | "UNKNOWN_DEVICE_ERROR";
}>;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
existingDeviceName |
string |
newDeviceName |
string |
userContext? |
Record<string, any> |
Returns
Promise<{
status: "OK" | "DEVICE_ALREADY_EXISTS_ERROR" | "UNKNOWN_DEVICE_ERROR";
}>
verifyDevice()
static verifyDevice(
tenantId,
userId,
deviceName,
totp,
userContext?): Promise<
| {
status: "OK";
wasAlreadyVerified: boolean;
}
| {
status: "UNKNOWN_DEVICE_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
tenantId |
string |
userId |
string |
deviceName |
string |
totp |
string |
userContext? |
Record<string, any> |
Returns
Promise<
| {
status: "OK";
wasAlreadyVerified: boolean;
}
| {
status: "UNKNOWN_DEVICE_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>
verifyTOTP()
static verifyTOTP(
tenantId,
userId,
totp,
userContext?): Promise<
| {
status: "OK" | "UNKNOWN_USER_ID_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
tenantId |
string |
userId |
string |
totp |
string |
userContext? |
Record<string, any> |
Returns
Promise<
| {
status: "OK" | "UNKNOWN_USER_ID_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>
Variables
createDevice()
createDevice: (userId, userIdentifierInfo?, deviceName?, skew?, period?, userContext?) => Promise<
| {
deviceName: string;
qrCodeString: string;
secret: string;
status: "OK";
}
| {
status: "DEVICE_ALREADY_EXISTS_ERROR";
}
| {
status: "UNKNOWN_USER_ID_ERROR";
}> = Wrapper.createDevice;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
userIdentifierInfo? |
string |
deviceName? |
string |
skew? |
number |
period? |
number |
userContext? |
Record<string, any> |
Returns
Promise<
| {
deviceName: string;
qrCodeString: string;
secret: string;
status: "OK";
}
| {
status: "DEVICE_ALREADY_EXISTS_ERROR";
}
| {
status: "UNKNOWN_USER_ID_ERROR";
}>
init()
init: (config?) => RecipeListFunction = Wrapper.init;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
config? |
TypeInput |
Returns
listDevices()
listDevices: (userId, userContext?) => Promise<{
devices: object[];
status: "OK";
}> = Wrapper.listDevices;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
userContext? |
Record<string, any> |
Returns
Promise<{
devices: object[];
status: "OK";
}>
removeDevice()
removeDevice: (userId, deviceName, userContext?) => Promise<{
didDeviceExist: boolean;
status: "OK";
}> = Wrapper.removeDevice;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
deviceName |
string |
userContext? |
Record<string, any> |
Returns
Promise<{
didDeviceExist: boolean;
status: "OK";
}>
updateDevice()
updateDevice: (userId, existingDeviceName, newDeviceName, userContext?) => Promise<{
status: "OK" | "DEVICE_ALREADY_EXISTS_ERROR" | "UNKNOWN_DEVICE_ERROR";
}> = Wrapper.updateDevice;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
userId |
string |
existingDeviceName |
string |
newDeviceName |
string |
userContext? |
Record<string, any> |
Returns
Promise<{
status: "OK" | "DEVICE_ALREADY_EXISTS_ERROR" | "UNKNOWN_DEVICE_ERROR";
}>
verifyDevice()
verifyDevice: (tenantId, userId, deviceName, totp, userContext?) => Promise<
| {
status: "OK";
wasAlreadyVerified: boolean;
}
| {
status: "UNKNOWN_DEVICE_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}> = Wrapper.verifyDevice;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
tenantId |
string |
userId |
string |
deviceName |
string |
totp |
string |
userContext? |
Record<string, any> |
Returns
Promise<
| {
status: "OK";
wasAlreadyVerified: boolean;
}
| {
status: "UNKNOWN_DEVICE_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>
verifyTOTP()
verifyTOTP: (tenantId, userId, totp, userContext?) => Promise<
| {
status: "OK" | "UNKNOWN_USER_ID_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}> = Wrapper.verifyTOTP;
Defined in: recipe/totp/index.ts
Parameters
| Parameter | Type |
|---|---|
tenantId |
string |
userId |
string |
totp |
string |
userContext? |
Record<string, any> |
Returns
Promise<
| {
status: "OK" | "UNKNOWN_USER_ID_ERROR";
}
| {
currentNumberOfFailedAttempts: number;
maxNumberOfFailedAttempts: number;
status: "INVALID_TOTP_ERROR";
}
| {
retryAfterMs: number;
status: "LIMIT_REACHED_ERROR";
}>
References
APIInterface
Re-exports APIInterface
APIOptions
Re-exports APIOptions
RecipeInterface
Re-exports RecipeInterface