Documentation ¶
Overview ¶
Package 'otp' is an easy-to-use implementation of RFC 4226 (HOTP) and RFC 6238 (TOTP).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HOTPKey ¶
type HOTPKey struct { SecretKey string `json:"secret_key"` HashFunction HashFunction `json:"hash_function"` Digits byte `json:"digits"` Counter uint64 `json:"counter"` }
Represents an HOTP parameter-set. SecretKey must be base-32 encoded.
type HashFunction ¶
type HashFunction string
const ( SHA1 HashFunction = "SHA1" SHA256 HashFunction = "SHA256" SHA512 HashFunction = "SHA512" MinKeySize = 16 MaxDigits = 10 )
type TOTPKey ¶
type TOTPKey struct { SecretKey string `json:"secret_key"` HashFunction HashFunction `json:"hash_function"` Digits byte `json:"digits"` TimeStep uint64 `json:"time_step"` T0 uint64 `json:"t0"` }
Represents a TOTP parameter-set. Like in HOTPKey, SecretKey must be base-32 encoded. Even though T0 not a parameter in virtually all implementations, according to RFC 6238, it is not necessarily always 0—which is why it is a parameter here.
Click to show internal directories.
Click to hide internal directories.