otp-io
Version:
🕖 Typed library to work 2fa via Google Authenticator/Time-based TOTP/Hmac-based HOTP
45 lines (44 loc) • 1.08 kB
TypeScript
import type { Hmac } from "./crypto/hmac";
import type { TOTPOptions } from "./totp.options";
/**
*
*
* @export
* @class TOTP
*/
export declare class TOTP {
private readonly _hmac;
options: TOTPOptions;
/**
* Creates an instance of TOTP.
* @param {Hmac} _hmac
* @param {TOTPOptions} options
* @memberof TOTP
*/
constructor(_hmac: Hmac, options: TOTPOptions);
/**
*
*
* @param {string} name
* @param {string} issuer
* @return {string} {string}
* @memberof TOTP
*/
getUri(name: string, issuer: string): string;
/**
*
*
* @param {string} code
* @param {Partial<TOTPOptions>} [overrides]
* @return {Promise<boolean>} {Promise<boolean>}
* @memberof TOTP
*/
checkCode(code: string, overrides?: Partial<TOTPOptions>): Promise<boolean>;
/**
*
* @param {Partial<TOTPOptions>} [overrides={}]
* @return {Promise<string>} {Promise<string>}
* @memberof TOTP
*/
generateCode(overrides?: Partial<TOTPOptions>): Promise<string>;
}