Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type OTP ¶
func NewOtp ¶
* The init function must be provided with an OTP struct * The secret string must be always provided and it can be encoded in any of base32, base64, hex or utf-8; * if the string encoding differs from base32 you must provide the encoding parameter too * * The variables of the OTP struct are optional other than Secret are optional: * Digits: the lengh of the otp string (values admitted 5 - 10; default: 6) * TimeStep: the time step for totp code duration (values admitted any positive value; default: 30) * HashName: the name of the hashing function (values admitted sha1, sha256, sha512; default: sha1) * Encoding: the encoding of the secret string (values admitted base32, base64, hex, utf-8; default: base32)
func (*OTP) GenerateHmacOtp ¶
* Generates a HMAC based one time password based on a counter * * The counter value must be provided as function parameter which is not auto incremented
func (*OTP) GenerateSteamguardCode ¶
* Generates the steamguard version of the time-based one time password * every time_step interval using the current unix timestamp as timecode; * use this if alphanumeric code is needed * * To use this the digits parameter must be set to 5
func (*OTP) GenerateSteamguardCodeAt ¶
* Generates the steamguard version of the time-based one time password * every time_step interval using the unix timestamp specified in function parameter * as timecode; use this if alphanumeric code is needed * * To use this the digits parameter must be set to 5
func (*OTP) GenerateTotpAt ¶
* Generates a time-based one time password every time_step interval * using the unix timestamp specified in function parameter
func (*OTP) GenerateTotpNow ¶
* Generates a time-based one time password every time_step interval * using the current unix timestamp as timecode