Documentation
¶
Overview ¶
Package twofactor allows authentication via one time passwords
Index ¶
- Constants
- func BCryptRecoveryCodes(codes []string) ([]string, error)
- func DecodeRecoveryCodes(codes string) []string
- func EncodeRecoveryCodes(codes []string) string
- func GenerateRecoveryCodes() ([]string, error)
- func UseRecoveryCode(codes []string, inputCode string) ([]string, bool)
- type Recovery
- type User
Constants ¶
View Source
const ( DataRecoveryCode = "recovery_code" DataRecoveryCodes = "recovery_codes" DataNumRecoveryCodes = "n_recovery_codes" )
Data constants
View Source
const (
PageRecovery2FA = "recovery2fa"
)
Page constants
Variables ¶
This section is empty.
Functions ¶
func BCryptRecoveryCodes ¶
BCryptRecoveryCodes hashes each recovery code given and return them in a new slice.
func DecodeRecoveryCodes ¶
DecodeRecoveryCodes is an alias for strings.Split(",")
func EncodeRecoveryCodes ¶
EncodeRecoveryCodes is an alias for strings.Join(",")
func GenerateRecoveryCodes ¶
GenerateRecoveryCodes creates 10 recovery codes of the form: abd34-1b24do (using alphabet, of length recoveryCodeLength).
Types ¶
type Recovery ¶
Recovery for two-factor authentication is handled by this type
func (*Recovery) GetRegen ¶
GetRegen shows a button that enables a user to regen their codes as well as how many codes are currently remaining.
type User ¶
type User interface {
authboss.User
GetEmail() string
PutEmail(string)
// GetRecoveryCodes retrieves a CSV string of bcrypt'd recovery codes
GetRecoveryCodes() string
// PutRecoveryCodes uses a single string to store many
// bcrypt'd recovery codes
PutRecoveryCodes(codes string)
}
User interface
Directories
¶
| Path | Synopsis |
|---|---|
|
Package sms2fa implements two factor auth using sms-transmitted one time passwords.
|
Package sms2fa implements two factor auth using sms-transmitted one time passwords. |
|
Package totp2fa implements two factor auth using time-based one time passwords.
|
Package totp2fa implements two factor auth using time-based one time passwords. |
Click to show internal directories.
Click to hide internal directories.