linstrom/storage-new/models/UserAuthenticationMethod.go
mstar 8f8ad3035a
Some checks are pending
/ test (push) Waiting to run
Comment all new code
2025-04-02 15:33:07 +02:00

29 lines
1 KiB
Go

package models
import "database/sql/driver"
// Authentication methods available
type AuthenticationMethodType string
const (
AuthMethodPassword AuthenticationMethodType = "password" // Password based authentication
AuthMethodGAuth AuthenticationMethodType = "g-auth" // Totp based 2nd factor
AuthMethodMail AuthenticationMethodType = "mail" // Mail based 2nd factor. Unused
AuthMethodPasskey2fa AuthenticationMethodType = "passkey-2fa" // Passkey based 2nd factor. Unused
AuthMethodPasskey AuthenticationMethodType = "passkey" // Passkey as only auth key
)
// A list of all known authentication methods.
// Known != supported
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
}