otp-io
Version:
🕖 Typed library to work 2fa via Google Authenticator/Time-based TOTP/Hmac-based HOTP
13 lines (12 loc) • 410 B
TypeScript
import { Hmac } from "./crypto/hmac";
import { TOTPOptions } from "./totp.options";
/**
* Generates TOTP code from secret key and options
*
* @export
* @param {Hmac} hmac
* @param {TOTPOptions} options
* @return {Promise<string>}
* @throws {Error} if HMAC algorithm is invalid. Use {@link HmacAlgorithm} to avoid this
*/
export declare function totp(hmac: Hmac, options: TOTPOptions): Promise<string>;