models

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditLog

type AuditLog struct {
	ID                uuid.UUID    `db:"id" json:"id"`
	Type              AuditLogType `db:"type" json:"type"`
	Error             *string      `db:"error" json:"error,omitempty"`
	MetaHttpRequestId string       `db:"meta_http_request_id" json:"meta_http_request_id"`
	MetaSourceIp      string       `db:"meta_source_ip" json:"meta_source_ip"`
	MetaUserAgent     string       `db:"meta_user_agent" json:"meta_user_agent"`
	ActorUserId       *uuid.UUID   `db:"actor_user_id" json:"actor_user_id,omitempty"`
	ActorEmail        *string      `db:"actor_email" json:"actor_email,omitempty"`
	CreatedAt         time.Time    `db:"created_at" json:"created_at"`
	UpdatedAt         time.Time    `db:"updated_at" json:"updated_at"`
}

type AuditLogType

type AuditLogType string
var (
	AuditLogUserCreated AuditLogType = "user_created"

	AuditLogPasswordSetSucceeded AuditLogType = "password_set_succeeded"
	AuditLogPasswordSetFailed    AuditLogType = "password_set_failed"

	AuditLogPasswordLoginSucceeded AuditLogType = "password_login_succeeded"
	AuditLogPasswordLoginFailed    AuditLogType = "password_login_failed"

	AuditLogPasscodeLoginInitSucceeded  AuditLogType = "passcode_login_init_succeeded"
	AuditLogPasscodeLoginInitFailed     AuditLogType = "passcode_login_init_failed"
	AuditLogPasscodeLoginFinalSucceeded AuditLogType = "passcode_login_final_succeeded"
	AuditLogPasscodeLoginFinalFailed    AuditLogType = "passcode_login_final_failed"

	AuditLogWebAuthnRegistrationInitSucceeded  AuditLogType = "webauthn_registration_init_succeeded"
	AuditLogWebAuthnRegistrationInitFailed     AuditLogType = "webauthn_registration_init_failed"
	AuditLogWebAuthnRegistrationFinalSucceeded AuditLogType = "webauthn_registration_final_succeeded"
	AuditLogWebAuthnRegistrationFinalFailed    AuditLogType = "webauthn_registration_final_failed"

	AuditLogWebAuthnAuthenticationInitSucceeded  AuditLogType = "webauthn_authentication_init_succeeded"
	AuditLogWebAuthnAuthenticationInitFailed     AuditLogType = "webauthn_authentication_init_failed"
	AuditLogWebAuthnAuthenticationFinalSucceeded AuditLogType = "webauthn_authentication_final_succeeded"
	AuditLogWebAuthnAuthenticationFinalFailed    AuditLogType = "webauthn_authentication_final_failed"
	AuditLogWebAuthnCredentialUpdated            AuditLogType = "webauthn_credential_updated"
	AuditLogWebAuthnCredentialDeleted            AuditLogType = "webauthn_credential_deleted"

	AuditLogEmailCreated        AuditLogType = "email_created"
	AuditLogEmailDeleted        AuditLogType = "email_deleted"
	AuditLogEmailVerified       AuditLogType = "email_verified"
	AuditLogPrimaryEmailChanged AuditLogType = "primary_email_changed"
)

type Email

type Email struct {
	ID           uuid.UUID     `db:"id" json:"id"`
	UserID       *uuid.UUID    `db:"user_id" json:"user_id,omitempty"`
	Address      string        `db:"address" json:"address"`
	Verified     bool          `db:"verified" json:"verified"`
	PrimaryEmail *PrimaryEmail `has_one:"primary_emails" json:"primary_emails,omitempty"`
	User         *User         `belongs_to:"user" json:"user,omitempty"`
	CreatedAt    time.Time     `db:"created_at" json:"created_at"`
	UpdatedAt    time.Time     `db:"updated_at" json:"updated_at"`
}

Email is used by pop to map your users database table to your go code.

func NewEmail

func NewEmail(userId *uuid.UUID, address string) *Email

func (*Email) IsPrimary

func (email *Email) IsPrimary() bool

func (*Email) Validate

func (email *Email) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type Emails

type Emails []Email

func (Emails) GetPrimary

func (emails Emails) GetPrimary() *Email

func (Emails) GetVerified

func (emails Emails) GetVerified() Emails

func (Emails) SetPrimary

func (emails Emails) SetPrimary(primary *PrimaryEmail)

type Jwk

type Jwk struct {
	ID        int       `db:"id"`
	KeyData   string    `db:"key_data"`
	CreatedAt time.Time `db:"created_at"`
}

func (*Jwk) Validate

func (jwk *Jwk) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type Operation

type Operation string
var (
	WebauthnOperationRegistration   Operation = "registration"
	WebauthnOperationAuthentication Operation = "authentication"
)

type Passcode

type Passcode struct {
	ID        uuid.UUID `db:"id"`
	UserId    uuid.UUID `db:"user_id"`
	EmailID   uuid.UUID `db:"email_id"`
	Ttl       int       `db:"ttl"` // in seconds
	Code      string    `db:"code"`
	TryCount  int       `db:"try_count"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
	Email     Email     `belongs_to:"email"`
}

Passcode is used by pop to map your passcodes database table to your go code.

func (*Passcode) Validate

func (passcode *Passcode) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type PasswordCredential

type PasswordCredential struct {
	ID        uuid.UUID `db:"id"`
	UserId    uuid.UUID `db:"user_id"`
	Password  string    `db:"password"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

func (*PasswordCredential) Validate

func (password *PasswordCredential) Validate(tx *pop.Connection) (*validate.Errors, error)

type PrimaryEmail

type PrimaryEmail struct {
	ID        uuid.UUID `db:"id" json:"id"`
	EmailID   uuid.UUID `db:"email_id" json:"email_id"`
	UserID    uuid.UUID `db:"user_id" json:"-"`
	Email     *Email    `belongs_to:"email" json:"email"`
	User      *User     `belongs_to:"user" json:"-"`
	CreatedAt time.Time `db:"created_at" json:"-"`
	UpdatedAt time.Time `db:"updated_at" json:"-"`
}

func NewPrimaryEmail

func NewPrimaryEmail(emailId uuid.UUID, userId uuid.UUID) *PrimaryEmail

func (*PrimaryEmail) Validate

func (primaryEmail *PrimaryEmail) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type Transports

type Transports []WebauthnCredentialTransport

func (Transports) GetNames

func (transports Transports) GetNames() []string

type User

type User struct {
	ID                  uuid.UUID            `db:"id" json:"id"`
	WebauthnCredentials []WebauthnCredential `has_many:"webauthn_credentials" json:"webauthn_credentials,omitempty"`
	Emails              Emails               `has_many:"emails" json:"-"`
	CreatedAt           time.Time            `db:"created_at" json:"created_at"`
	UpdatedAt           time.Time            `db:"updated_at" json:"updated_at"`
}

User is used by pop to map your users database table to your go code.

func NewUser

func NewUser() User

func (*User) GetEmailById

func (user *User) GetEmailById(emailId uuid.UUID) *Email

func (*User) Validate

func (user *User) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type WebauthnCredential

type WebauthnCredential struct {
	ID              string     `db:"id" json:"id"`
	Name            *string    `db:"name" json:"-"`
	UserId          uuid.UUID  `db:"user_id" json:"-"`
	PublicKey       string     `db:"public_key" json:"-"`
	AttestationType string     `db:"attestation_type" json:"-"`
	AAGUID          uuid.UUID  `db:"aaguid" json:"-"`
	SignCount       int        `db:"sign_count" json:"-"`
	CreatedAt       time.Time  `db:"created_at" json:"-"`
	UpdatedAt       time.Time  `db:"updated_at" json:"-"`
	Transports      Transports `has_many:"webauthn_credential_transports" json:"-"`
}

WebauthnCredential is used by pop to map your webauthn_credentials database table to your go code.

func (*WebauthnCredential) Validate

func (credential *WebauthnCredential) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type WebauthnCredentialTransport

type WebauthnCredentialTransport struct {
	ID                   uuid.UUID           `db:"id"`
	Name                 string              `db:"name"`
	WebauthnCredentialID string              `db:"webauthn_credential_id"`
	WebauthnCredential   *WebauthnCredential `belongs_to:"webauthn_credential"`
}

WebauthnCredentialTransport is used by pop to map your webauthn_credential_transport table to your go code.

func (*WebauthnCredentialTransport) Validate

func (transport *WebauthnCredentialTransport) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type WebauthnSessionData

type WebauthnSessionData struct {
	ID                 uuid.UUID                              `db:"id"`
	Challenge          string                                 `db:"challenge"`
	UserId             uuid.UUID                              `db:"user_id"`
	UserVerification   string                                 `db:"user_verification"`
	CreatedAt          time.Time                              `db:"created_at"`
	UpdatedAt          time.Time                              `db:"updated_at"`
	Operation          Operation                              `db:"operation"`
	AllowedCredentials []WebauthnSessionDataAllowedCredential `has_many:"webauthn_session_data_allowed_credentials"`
}

WebauthnSessionData is used by pop to map your webauthn_session_data database table to your go code.

func (*WebauthnSessionData) Validate

func (sd *WebauthnSessionData) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

type WebauthnSessionDataAllowedCredential

type WebauthnSessionDataAllowedCredential struct {
	ID                    uuid.UUID            `db:"id"`
	CredentialId          string               `db:"credential_id"`
	WebauthnSessionDataID uuid.UUID            `db:"webauthn_session_data_id"`
	CreatedAt             time.Time            `db:"created_at"`
	UpdatedAt             time.Time            `db:"updated_at"`
	WebauthnSessionData   *WebauthnSessionData `belongs_to:"webauthn_session_data"`
}

WebauthnSessionDataAllowedCredential is used by pop to map your webauthn_session_data_allowed_credential database table to your go code.

func (*WebauthnSessionDataAllowedCredential) Validate

func (credential *WebauthnSessionDataAllowedCredential) Validate(tx *pop.Connection) (*validate.Errors, error)

Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.

Jump to

Keyboard shortcuts

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