package
module
Version:
v1.0.1
Opens a new window with list of versions in this module.
Published: Aug 5, 2015
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
twofactor - Two-factor authentication library
go-twofactor is a library for handling two-factor authentication in Go.
To use the library, you need to install one of the implementations below.
TOTP
This implementation generates and verifies codes using the time-based one time password (TOTP) algorithm specified in RFC6238.
go get gopkg.in/zhevron/go-twofactor.v1/totp
License
go-twofactor is licensed under the MIT license.
Documentation
¶
Package twofactor contains support functions and types for two-factor authentication.
This package provides shared structs and functions for all implementations.
To generate a new secret for 2FA, use the NewSecret method:
import "gopkg.in/zhevron/go-twofactor.v1"
secret := twofactor.NewSecret(0)
Int64ToBytes converts a 64-bit integer to a 8-byte slice.
Secret wraps a string with functions to generate a cryptographically secure secret.
NewSecret generates a cryptograpically secure string of the given length.
If the length provided is 0 or less, it will default to a length of 10.
Bytes decodes the secret into a byte slice.
String returns the secret as a string.
Source Files
¶
Directories
¶
Package totp contains an RFC6238 implementation of time-based one time passwords.
|
Package totp contains an RFC6238 implementation of time-based one time passwords. |
Click to show internal directories.
Click to hide internal directories.