Documentation ¶
Index ¶
Constants ¶
const ( // default time step interval: 30 seconds TIMESTEP = 30 // gmtime(0) or 1 Jan 1970. Unix Epoch EPOCH = 0 )
Variables ¶
This section is empty.
Functions ¶
func GoogleAuth ¶
Google Auth compliant TOTP generation function
key: array of base32-encoded key bytes length: length of the resulting totp token
Types ¶
type TOTP ¶
type TOTP struct {
// contains filtered or unexported fields
}
totp token object
func NewTotp ¶
func NewTotp(key []byte, timecounter int, timestep int, token_len int, is_base32 bool, algorithm string) TOTP
generate a new totp object
func (*TOTP) TokenToString ¶
return a string representation of the totp token integer value
totpToken: result of the TotpToken() function token_len: length of the computed Token
func (*TOTP) TotpToken ¶
generic TOTP compute function computes the TOTP token as per RFC 6238. returns an unsigned 32-bit integer representation of the TOTP token that can be used as is or otherwise converted into another formant (e.g. string)
key: byte array of the secret key to use during computation timecounter: point in time from epoch for which you wan to compute the TOTP (default is time.Now()) timestep: TOTP token period. default is 30 seconds (google-auth compatibility) token_len: length of the TOTP token in bytes (default is 6) is_base32: specifies whether the key array is base32 encoded or not (google-auth compatibility) digestFunc: HMAC function to use during computation