Documentation ¶
Overview ¶
Package to generate/validate TOPT from 4 to 8 digits with SHA1/SHA256/SHA512 hash functions
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTOPT ¶
func GetTOPT(str_secret string, digits int, shaX string) (str_token string, remain uint64, err error)
Generate a TOPT
str_secret: secret key (strict base32) digits: number of digits (from 4 to 8) shaX: hash function (SHA1, SHA256, or SHA512)
returns:
str_token: string representation of token (type string) remain: remaining validity time (type uint64) err: error
func ValidateTOPT ¶
func ValidateTOPT(str_secret string, digits int, shaX string, topt string, interval int) (valid_token bool, err error)
Validate a TOPT
str_secret: secret key (strict base32) digits: number of digits (from 4 to 8) shaX: hash function (SHA1, SHA256, or SHA512) topt: token to validate (type string) interval: validate against previous interval window (30s)
returns
valid_token: boolean : true if valid, false if not err: error
XXX: need test
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.