linstrom/storage-new/models/UserAuthenticationMethod.go
mstar 67b507f4bd
Some checks are pending
/ test (push) Waiting to run
Describe all types for the new storage system
2025-03-27 10:45:57 +01:00

27 lines
883 B
Go

package models
import "database/sql/driver"
// Authentication methods available
type AuthenticationMethodType string
const (
AuthMethodPassword AuthenticationMethodType = "password"
AuthMethodGAuth AuthenticationMethodType = "g-auth" // Google Authenticator / totp
AuthMethodMail AuthenticationMethodType = "mail"
AuthMethodPasskey2fa AuthenticationMethodType = "passkey-2fa" // Passkey used as 2fa factor
AuthMethodPasskey AuthenticationMethodType = "passkey" // Passkey as only auth key
)
var AllAuthMethods = []AuthenticationMethodType{
AuthMethodPassword, AuthMethodGAuth, AuthMethodMail, AuthMethodPasskey, AuthMethodPasskey2fa,
}
func (ct *AuthenticationMethodType) Scan(value any) error {
*ct = AuthenticationMethodType(value.([]byte))
return nil
}
func (ct AuthenticationMethodType) Value() (driver.Value, error) {
return string(ct), nil
}