linstrom/storage-new/models/UserAuthentication.go

25 lines
818 B
Go

package models
import "gorm.io/gorm"
// FIXME: Move passkeys to separate table
// Storing passkey credentials in this table requires marshalling
// them to json as of right now
// This causes problems with updating if encryption has to be added
// Same also needs to be done for the login process
// One authentication method linked to one account.
// Contains the method and whatever the token may be
// For a password, this would be a hash of that password,
// totp would be the seed,
// and passkey would be the webauthn.Credential, marshalled into json
//
// Password hashes may only exist at most once per user, the rest 0-m
type UserAuthMethod struct {
gorm.Model
User User
UserId string
AuthMethod AuthenticationMethodType `gorm:"type:auth_method_type"`
Token []byte
Name string
}