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