TotpSecret class

用于生成TotpMultiFactorAssertion 的提供程序

存储共享密钥和其他参数以生成基于时间的 OTP。实现检索共享密钥并生成 QR 码 URL 的方法。

签名:

export declare class TotpSecret 

特性

财产修饰符类型描述
代码间隔秒数数字OTP 代码应更改的时间间隔(以秒为单位)。
代码长度数字要生成的一次性密码的长度。
报名完成截止日期细绳TOTP 注册应完成的时间戳(UTC 字符串)。
哈希算法细绳使用的哈希算法。
密钥细绳用于注册 TOTP MFA 和生成 OTP 的共享密钥/种子。

方法

方法修饰符描述
generateQrCodeUrl(账户名称, 发行者)返回一个 QR 码 URL,如 https://github.com/google/google-authenticator/wiki/Key-Uri-Format 中所述。这可以作为 QR 码显示给用户,以便扫描到 TOTP 应用程序(如 Google Authenticator)中。如果未指定可选参数,则 accountName 为和发行人被使用。

TotpSecret.codeIntervalSeconds

OTP 代码应更改的时间间隔(以秒为单位)。

签名:

readonly codeIntervalSeconds: number;

ToppSecret.codeLength

要生成的一次性密码的长度。

签名:

readonly codeLength: number;

TotpSecret.enrollmentCompletionDeadline

TOTP 注册应完成的时间戳(UTC 字符串)。

签名:

readonly enrollmentCompletionDeadline: string;

ToppSecret.hashing算法

使用的哈希算法。

签名:

readonly hashingAlgorithm: string;

ToppSecret.secretKey

用于注册 TOTP MFA 和生成 OTP 的共享密钥/种子。

签名:

readonly secretKey: string;

TotpSecret.generateQrCodeUrl()

返回一个 QR 码 URL,如 https://github.com/google/google-authenticator/wiki/Key-Uri-Format 中所述。这可以作为 QR 码显示给用户,以便扫描到 TOTP 应用程序(如 Google Authenticator)中。如果未指定可选参数,则 accountName 为和发行人被使用。

签名:

generateQrCodeUrl(accountName?: string, issuer?: string): string;

参数

范围类型描述
帐户名称细绳帐户/应用程序的名称以及用户标识符。
发行人细绳TOTP 的发行者(可能是应用程序名称)。

返回:

细绳

二维码 URL 字符串。