model

package
v0.0.0-...-2931f08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateUserID

func GenerateUserID() string

Types

type Credential

type Credential struct {
	gorm.Model
	Name               string
	WebauthnCredential webauthn.Credential `gorm:"serializer:json"`
	UserID             string
}

func (*Credential) UpdateSignCount

func (c *Credential) UpdateSignCount(db *gorm.DB, signCount uint32)

type Session

type Session struct {
	gorm.Model
	ExpirationTime time.Time `gorm:"serializer:json"`
	SessionKey     string    `gorm:"primaryKey"`
}

func GenerateSession

func GenerateSession(validityLength time.Duration) Session

func (Session) IsExpired

func (session Session) IsExpired() bool

func (Session) ValidateSession

func (session Session) ValidateSession(db *gorm.DB) bool

type User

type User struct {
	gorm.Model
	ID          string `gorm:"primaryKey"`
	Username    string
	IsAdmin     bool
	Credentials []Credential
}

Struct that implements the webauthn user interface to store valid credentials

func (User) CredentialExclusionList

func (u User) CredentialExclusionList() []protocol.CredentialDescriptor

func (User) WebAuthnCredentials

func (u User) WebAuthnCredentials() []webauthn.Credential

func (User) WebAuthnDisplayName

func (u User) WebAuthnDisplayName() string

func (User) WebAuthnID

func (u User) WebAuthnID() []byte

func (User) WebAuthnIcon

func (u User) WebAuthnIcon() string

func (User) WebAuthnName

func (u User) WebAuthnName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL