UNPKG

@bsv/sdk

Version:

BSV Blockchain Software Development Kit

42 lines 1.69 kB
export type TOTPAlgorithm = 'SHA-1' | 'SHA-256' | 'SHA-512'; /** * Options for TOTP generation. * @param {number} [digits=6] - The number of digits in the OTP. * @param {TOTPAlgorithm} [algorithm="SHA-1"] - Algorithm used for hashing. * @param {number} [period=30] - The time period for OTP validity in seconds. * @param {number} [timestamp=Date.now()] - The current timestamp. */ export interface TOTPOptions { digits?: number; algorithm?: TOTPAlgorithm; period?: number; timestamp?: number; } /** * Options for TOTP validation. * @param {number} [skew=1] - The number of time periods to check before and after the current time period. */ export type TOTPValidateOptions = TOTPOptions & { skew?: number; }; export declare class TOTP { /** * Generates a Time-based One-Time Password (TOTP). * @param {number[]} secret - The secret key for TOTP. * @param {TOTPOptions} options - Optional parameters for TOTP. * @returns {string} The generated TOTP. */ static generate(secret: number[], options?: TOTPOptions): string; /** * Validates a Time-based One-Time Password (TOTP). * @param {number[]} secret - The secret key for TOTP. * @param {string} passcode - The passcode to validate. * @param {TOTPValidateOptions} options - Optional parameters for TOTP validation. * @returns {boolean} A boolean indicating whether the passcode is valid. */ static validate(secret: number[], passcode: string, options?: TOTPValidateOptions): boolean; private static getCounter; private static withDefaultOptions; private static withDefaultValidateOptions; } //# sourceMappingURL=totp.d.ts.map