TotpSecret class

TotpMultiFactorAssertionを生成するためのプロバイダー

時間ベースの OTP を生成するための共有秘密キーとその他のパラメーターを保存します。共有秘密キーを取得し、QR コード URL を生成するメソッドを実装します。

サイン:

export declare class TotpSecret 

プロパティ

財産修飾子タイプ説明
コード間隔秒番号OTP コードを変更する間隔 (秒単位)。
コードの長さ番号生成されるワンタイムパスワードの長さ。
入学手続き完了締切TOTP 登録が完了するまでのタイムスタンプ (UTC 文字列)。
ハッシュアルゴリズムハッシュアルゴリズムが使用されています。
秘密鍵TOTP MFA への登録と OTP の生成に使用される共有秘密キー/シード。

メソッド

方法修飾子説明
generateQrCodeUrl(アカウント名、発行者) https://github.com/google/google-authenticator/wiki/Key-Uri-Format で説明されているように、QR コード URL を返します。これは、Google Authenticator などの TOTP アプリにスキャンされる QR コードとしてユーザーに表示できます。 。オプションのパラメータが指定されていない場合、accountName はと発行者使用されています。

TotpSecret.codeIntervalSeconds

OTP コードを変更する間隔 (秒単位)。

サイン:

readonly codeIntervalSeconds: number;

TotpSecret.codeLength

生成されるワンタイムパスワードの長さ。

サイン:

readonly codeLength: number;

TotpSecret.enrollment完了期限

TOTP 登録が完了するまでのタイムスタンプ (UTC 文字列)。

サイン:

readonly enrollmentCompletionDeadline: string;

TotpSecret.hashingアルゴリズム

ハッシュアルゴリズムが使用されています。

サイン:

readonly hashingAlgorithm: string;

TotpSecret.secretKey

TOTP MFA への登録と OTP の生成に使用される共有秘密キー/シード。

サイン:

readonly secretKey: string;

TotpSecret.generateQrCodeUrl()

https://github.com/google/google-authenticator/wiki/Key-Uri-Format で説明されているように、QR コード URL を返します。これは、Google Authenticator などの TOTP アプリにスキャンされる QR コードとしてユーザーに表示できます。 。オプションのパラメータが指定されていない場合、accountName はと発行者使用されています。

サイン:

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

パラメーター

パラメータタイプ説明
アカウント名アカウント/アプリの名前とユーザー識別子。
発行者TOTP の発行者 (おそらくアプリ名)。

戻り値:

QRコードのURL文字列。