用于生成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 字符串。