import { HashAlgorithm, CryptoPlugin, Base32Plugin, OTPGuardrails } from '@otplib/core'; /** * @otplib/preset-v11 * * v11-compatible type definitions. * v11 used functionality similar to v12 but with seconds-based epochs. */ declare const HashAlgorithms: { readonly SHA1: "sha1"; readonly SHA256: "sha256"; readonly SHA512: "sha512"; }; type HashAlgorithms = (typeof HashAlgorithms)[keyof typeof HashAlgorithms]; declare const KeyEncodings: { readonly ASCII: "ascii"; readonly HEX: "hex"; readonly BASE32: "base32"; readonly BASE64: "base64"; readonly LATIN1: "latin1"; readonly UTF8: "utf8"; }; type KeyEncodings = (typeof KeyEncodings)[keyof typeof KeyEncodings]; type SecretKey = string; type Base32SecretKey = string; type HOTPOptions = { algorithm?: HashAlgorithm; digits?: number; encoding?: KeyEncodings; crypto?: CryptoPlugin; base32?: Base32Plugin; guardrails?: OTPGuardrails; }; type TOTPOptions = HOTPOptions & { epoch?: number | null; step?: number; window?: number | [number, number]; }; type KeyEncoder = (secret: SecretKey, encoding: KeyEncodings) => Base32SecretKey; type KeyDecoder = (encodedSecret: Base32SecretKey, encoding: KeyEncodings) => SecretKey; type AuthenticatorOptions = TOTPOptions & { keyEncoder?: KeyEncoder; keyDecoder?: KeyDecoder; }; type ResolvedHOTPOptions = { algorithm: HashAlgorithm; digits: number; encoding: KeyEncodings; crypto: CryptoPlugin; base32: Base32Plugin; guardrails: OTPGuardrails; }; type ResolvedTOTPOptions = ResolvedHOTPOptions & { epoch: number; step: number; window: number | [number, number]; }; type ResolvedAuthenticatorOptions = ResolvedTOTPOptions & { keyEncoder: KeyEncoder; keyDecoder: KeyDecoder; }; /** * @otplib/preset-v11 * * v11-compatible HOTP class implementation. */ declare class HOTP { protected _options: Partial; protected _defaultOptions: Partial; constructor(defaultOptions?: Partial); get options(): Partial; set options(value: Partial); get defaultOptions(): Partial; set defaultOptions(value: Partial); get optionsAll(): Readonly; create(defaultOptions?: Partial): HOTP; allOptions(): Readonly; resetOptions(): this; generate(secret: SecretKey, counter: number): string; check(token: string, secret: SecretKey, counter: number): boolean; verify(opts: { token: string; secret: SecretKey; counter: number; }): boolean; keyuri(accountName: string, issuer: string, secret: SecretKey, counter: number): string; getClass(): typeof HOTP; } /** * @otplib/preset-v11 * * v11-compatible TOTP class implementation. */ declare class TOTP extends HOTP { constructor(defaultOptions?: Partial); create(defaultOptions?: Partial): TOTP; allOptions(): Readonly; generate(secret: SecretKey): string; check(token: string, secret: SecretKey): boolean; checkDelta(token: string, secret: SecretKey): number | null; verify(opts: { token: string; secret: SecretKey; }): boolean; keyuri(accountName: string, issuer: string, secret: SecretKey): string; timeUsed(): number; timeRemaining(): number; } /** * @otplib/preset-v11 * * v11-compatible Authenticator class implementation. */ declare class Authenticator extends TOTP { constructor(defaultOptions?: Partial); create(defaultOptions?: Partial): Authenticator; allOptions(): Readonly; generate(secret: Base32SecretKey): string; check(token: string, secret: Base32SecretKey): boolean; checkDelta(token: string, secret: Base32SecretKey): number | null; verify(opts: { token: string; secret: Base32SecretKey; }): boolean; encode(secret: SecretKey): Base32SecretKey; decode(secret: Base32SecretKey): SecretKey; generateSecret(numberOfBytes?: number): Base32SecretKey; } declare const hotp: HOTP; declare const totp: TOTP; declare const authenticator: Authenticator; export { Authenticator, type AuthenticatorOptions, type Base32SecretKey, HOTP, type HOTPOptions, HashAlgorithms, type KeyDecoder, type KeyEncoder, KeyEncodings, type ResolvedAuthenticatorOptions, type ResolvedHOTPOptions, type ResolvedTOTPOptions, type SecretKey, TOTP, type TOTPOptions, authenticator, hotp, totp };