Class Secret

OTP secret key.

Constructors

  • Creates a secret key object.

    Parameters

    • Optionalconfig: {
          buffer: undefined | ArrayBufferLike;
          size: undefined | number;
      } = {}

      Configuration options.

      • buffer: undefined | ArrayBufferLike

        Secret key buffer.

      • size: undefined | number

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

    Returns Secret

Properties

bytes: Uint8Array

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.

MMNEPVFCICPMFPCPTTAAATR