Class Secret

OTP secret key.

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a secret key object.

    Parameters

    • Optional config: {
          buffer: undefined | ArrayBuffer;
          size: undefined | number;
      } = {}

      Configuration options.

      • buffer: undefined | ArrayBuffer

        Secret key.

      • size: undefined | number

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

    Returns Secret

Properties

buffer: ArrayBuffer

Secret key.

Accessors

  • get base32(): string
  • Base32 string representation of secret key.

    Returns string

  • 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.