otpauth
    Preparing search index...

    Class Secret

    OTP secret key.

    Index

    Constructors

    • Creates a secret key object.

      Parameters

      • Optionalconfig: { buffer?: ArrayBufferLike; size?: number } = {}

        Configuration options.

        • Optionalbuffer?: ArrayBufferLike

          Secret key buffer.

        • Optionalsize?: number

          Number of random bytes to generate, ignored if 'buffer' is provided.

      Returns Secret

    Properties

    bytes: Uint8Array<ArrayBufferLike>

    Secret key.

    Accessors

    • get base32(): string

      Base32 string representation of secret key.

      Returns string

    • get buffer(): ArrayBufferLike

      Secret key buffer.

      Returns ArrayBufferLike

      For backward compatibility, the "bytes" property should be used instead.

    • get hex(): string

      Hexadecimal string representation of secret key.

      Returns string

    • get latin1(): string

      Latin-1 string representation of secret key.

      Returns string

    • get utf8(): string

      UTF-8 string representation of secret key.

      Returns string

    Methods

    • Converts a base32 string to a Secret object.

      Parameters

      • str: string

        Base32 string.

      Returns Secret

      Secret object.

    • Converts a hexadecimal string to a Secret object.

      Parameters

      • str: string

        Hexadecimal string.

      Returns Secret

      Secret object.

    • Converts a Latin-1 string to a Secret object.

      Parameters

      • str: string

        Latin-1 string.

      Returns Secret

      Secret object.

    • Converts an UTF-8 string to a Secret object.

      Parameters

      • str: string

        UTF-8 string.

      Returns Secret

      Secret object.