Class HOTP

HOTP: An HMAC-based One-time Password Algorithm.

Constructors

  • Creates an HOTP object.

    Parameters

    • Optionalconfig: {
          algorithm: undefined | string;
          counter: undefined | number;
          digits: undefined | number;
          issuer: undefined | string;
          issuerInLabel: undefined | boolean;
          label: undefined | string;
          secret: undefined | string | Secret;
      } = {}

      Configuration options.

      • algorithm: undefined | string

        HMAC hashing algorithm.

      • counter: undefined | number

        Initial counter value.

      • digits: undefined | number

        Token length.

      • issuer: undefined | string

        Account provider.

      • issuerInLabel: undefined | boolean

        Include issuer prefix in label.

      • label: undefined | string

        Account label.

      • secret: undefined | string | Secret

        Secret key.

    Returns HOTP

Properties

algorithm: string

HMAC hashing algorithm.

counter: number

Initial counter value.

digits: number

Token length.

issuer: string

Account provider.

issuerInLabel: boolean

Include issuer prefix in label.

label: string

Account label.

secret: Secret

Secret key.

Accessors

  • get defaults(): {
        algorithm: string;
        counter: number;
        digits: number;
        issuer: string;
        issuerInLabel: boolean;
        label: string;
        window: number;
    }
  • Default configuration.

    Returns {
        algorithm: string;
        counter: number;
        digits: number;
        issuer: string;
        issuerInLabel: boolean;
        label: string;
        window: number;
    }

    • algorithm: string
    • counter: number
    • digits: number
    • issuer: string
    • issuerInLabel: boolean
    • label: string
    • window: number

Methods

  • Generates an HOTP token.

    Parameters

    • Optionalconfig: {
          counter: undefined | number;
      } = {}

      Configuration options.

      • counter: undefined | number

        Counter value.

    Returns string

    Token.

  • Returns a Google Authenticator key URI.

    Returns string

    URI.

  • Validates an HOTP token.

    Parameters

    • config: {
          counter: undefined | number;
          token: string;
          window: undefined | number;
      }

      Configuration options.

      • counter: undefined | number

        Counter value.

      • token: string

        Token value.

      • window: undefined | number

        Window of counter values to test.

    Returns null | number

    Token delta or null if it is not found in the search window, in which case it should be considered invalid.

  • Generates an HOTP token.

    Parameters

    • config: {
          algorithm: undefined | string;
          counter: undefined | number;
          digits: undefined | number;
          secret: Secret;
      }

      Configuration options.

      • algorithm: undefined | string

        HMAC hashing algorithm.

      • counter: undefined | number

        Counter value.

      • digits: undefined | number

        Token length.

      • secret: Secret

        Secret key.

    Returns string

    Token.

  • Validates an HOTP token.

    Parameters

    • config: {
          algorithm: undefined | string;
          counter: undefined | number;
          digits: undefined | number;
          secret: Secret;
          token: string;
          window: undefined | number;
      }

      Configuration options.

      • algorithm: undefined | string

        HMAC hashing algorithm.

      • counter: undefined | number

        Counter value.

      • digits: undefined | number

        Token length.

      • secret: Secret

        Secret key.

      • token: string

        Token value.

      • window: undefined | number

        Window of counter values to test.

    Returns null | number

    Token delta or null if it is not found in the search window, in which case it should be considered invalid.

MMNEPVFCICPMFPCPTTAAATR