28 lines
957 B
Go
28 lines
957 B
Go
package auth
|
|
|
|
import "errors"
|
|
|
|
var (
|
|
// The provided authentication method is not known to the server
|
|
ErrUnknownAuthMethod = errors.New("unknown authentication method")
|
|
// The user hasn't setup the provided authentication method
|
|
ErrUnsupportedAuthMethod = errors.New("authentication method not supported for this user")
|
|
ErrInvalidCombination = errors.New("invalid account and token combination")
|
|
ErrProcessTimeout = errors.New("authentication process timed out")
|
|
// A user may not login, for whatever reason
|
|
ErrCantLogin = errors.New("user can't login")
|
|
ErrDecryptionFailure = errors.New("failed to decrypt content")
|
|
ErrTotpRecentlyUsed = errors.New("totp token was used too recently")
|
|
)
|
|
|
|
type CombinedError struct {
|
|
Err1, Err2 error
|
|
}
|
|
|
|
func (c *CombinedError) Is(e error) bool {
|
|
return errors.Is(e, c.Err1) || errors.Is(e, c.Err2)
|
|
}
|
|
|
|
func (c *CombinedError) Error() string {
|
|
return c.Err1.Error() + " + " + c.Err2.Error()
|
|
}
|