Module: url-otpauth

Members

(static) ErrorType

Enumeration of all error types raised by OtpauthInvalidURL.

Source:

(static) OtpauthInvalidURL

Exception thrown whenever there's an error deconstructing an 'otpauth://' URI.

You can query the errorType attribute to obtain the exact reason for failure. The errorType attributes contains a value from the ErrorType enumeration.

Source:

Methods

(static) parse(rawUrl) → {Object}

Parses an OTPAuth URI.

Parses an URL as described in Google Authenticator's "KeyUriFormat" document (see: https://code.google.com/p/google-authenticator/wiki/KeyUriFormat) and returns an object that contains the following properties:

  • account: The account name.
  • digits: The number of digits of the resulting OTP. Default is 6 (six).
  • key: The shared key in Base32 encoding.
  • issuer: Provider or service this account is associated with. The default is the empty string.
  • type: Either the string hotp or totp.

OTP of type hotp have an additional counter field which contains the start value for the HOTP counter. In all other cases this field is missing from the resulting object.

Parameters:
Name Type Description
rawUrl string

The URI to parse.

Source:
Returns:

An object with properties described above.

Type
Object