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<T extends HOTPOptions = HOTPOptions> {
    protected _options: Partial<T>;
    protected _defaultOptions: Partial<T>;
    constructor(defaultOptions?: Partial<T>);
    get options(): Partial<T>;
    set options(value: Partial<T>);
    get defaultOptions(): Partial<T>;
    set defaultOptions(value: Partial<T>);
    get optionsAll(): Readonly<ResolvedHOTPOptions>;
    create(defaultOptions?: Partial<T>): HOTP<T>;
    allOptions(): Readonly<ResolvedHOTPOptions>;
    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<T extends TOTPOptions = TOTPOptions> extends HOTP<T> {
    constructor(defaultOptions?: Partial<T>);
    create(defaultOptions?: Partial<T>): TOTP<T>;
    allOptions(): Readonly<ResolvedTOTPOptions>;
    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<T extends AuthenticatorOptions = AuthenticatorOptions> extends TOTP<T> {
    constructor(defaultOptions?: Partial<T>);
    create(defaultOptions?: Partial<T>): Authenticator<T>;
    allOptions(): Readonly<ResolvedAuthenticatorOptions>;
    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<HOTPOptions>;
declare const totp: TOTP<TOTPOptions>;
declare const authenticator: Authenticator<AuthenticatorOptions>;

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 };
