Documentation
¶
Index ¶
Constants ¶
View Source
const PrefixOTPAuth = "otpauth:"
Variables ¶
View Source
var ErrNotFound = errors.New("no otp key found")
View Source
var (
ErrUnsupportedAlgorithm = errors.New("unsupported algorithm")
)
Functions ¶
func GenerateRecoveryCode ¶
func GenerateRecoveryCode() string
Types ¶
type KeyWrapper ¶
type KeyWrapper struct {
// contains filtered or unexported fields
}
func NewKeyWrapper ¶
func NewKeyWrapper(issuer, userID, algorithm, secret string, digits int) (*KeyWrapper, error)
func NewKeyWrapperFromURI ¶
func NewKeyWrapperFromURI(otpauthURI string) (*KeyWrapper, error)
func (KeyWrapper) Algorithm ¶
func (k KeyWrapper) Algorithm() string
func (KeyWrapper) Digits ¶
func (k KeyWrapper) Digits() int
func (KeyWrapper) PNG ¶
func (k KeyWrapper) PNG() (string, error)
func (KeyWrapper) Secret ¶
func (k KeyWrapper) Secret() string
func (KeyWrapper) URI ¶
func (k KeyWrapper) URI() string
func (KeyWrapper) VerifyCode ¶
func (k KeyWrapper) VerifyCode(code string) bool
type Store ¶
type Store interface {
Lookup(userID string) (*KeyWrapper, error)
Put(userID string, keyWrapper KeyWrapper) (string, error)
VerifyRecoveryCode(userID, recoveryCode string) bool
Delete(userID string) error
Ping() error
ReadOnly() bool
}
func NewInMemoryStore ¶
func NewInMemoryStore(users map[string]people.AuthenticPerson) Store
func NewSqlStore ¶
func NewSqlStore(users map[string]people.AuthenticPerson, dbs map[string]*sql.DB, settings *StoreSettings) (Store, error)
Click to show internal directories.
Click to hide internal directories.