models

package
v0.0.0-...-4648e5f Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VeriflowUsersTable           = "VeriflowUsers"
	VeriflowWebAuthnSessionTable = "VeriflowWebAuthnSessions"
	VeriflowRequestsTable        = "VeriflowRequests"
)

Variables

This section is empty.

Functions

func SaveUser

func SaveUser(user User) error

Types

type Authenticator

type Authenticator struct {
	Secret    string `dynamodbav:"secret"`
	FilePath  string `dynamodbav:"filePath"`
	Permalink string `dynamodbav:"permalink"`
	Validated bool   `dynamodbav:"validated"`
}

type SlackRequest

type SlackRequest struct {
	UserID      string `json:"user_id"`
	ResponseURL string `json:"response_url"`
	RecipientID string `json:"recipient_id"`
	Text        string `json:"text"`

	MessageTS string `json:"message_ts"`
	Channel   string `json:"channel"`

	InitMessageTS string `json:"init_message_ts"`
	InitChannel   string `json:"init_channel"`
}

type User

type User struct {
	ID              string                `dynamodbav:"id"`
	Name            string                `dynamodbav:"name"`
	Email           string                `dynamodbav:"email"`
	Image           string                `dynamodbav:"image"`
	Authenticator   Authenticator         `dynamodbav:"authenticator"`
	CredentialsJSON string                `dynamodbav:"credentialsJSON"`
	Credentials     []webauthn.Credential `dynamodbav:"-"`
}

func GetOrCreateUser

func GetOrCreateUser(userEmail string) (User, error)

func GetUser

func GetUser(userID string) (User, error)

func GetUserByEmail

func GetUserByEmail(userEmail string) (User, error)

func (*User) DeleteSessionData

func (u *User) DeleteSessionData(userID string) error

func (*User) GetCredentials

func (u *User) GetCredentials(userID string) []webauthn.Credential

func (*User) GetSessionData

func (u *User) GetSessionData(userID string) (*webauthn.SessionData, error)

func (*User) GetUserByID

func (u *User) GetUserByID(userID string) (webauthn.User, error)

func (*User) SaveCredentials

func (u *User) SaveCredentials(userID string, credentials *webauthn.Credential) error

func (*User) SaveSessionData

func (u *User) SaveSessionData(userID string, sessionData *webauthn.SessionData) error

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

type UserStore

type UserStore interface {
	GetUserByID(userID string) (webauthn.User, error)
	SaveSessionData(userID string, sessionData *webauthn.SessionData) error
	GetSessionData(userID string) (*webauthn.SessionData, error)
	DeleteSessionData(userID string) error
	SaveCredentials(userID string, credential *webauthn.Credential) error
	GetCredentials(userID string) []webauthn.Credential
}

func NewUserStore

func NewUserStore() UserStore

type VerifyRequest

type VerifyRequest struct {
	ID             string `dynamodbav:"id"`
	RequestorEmail string `dynamodbav:"requestor_email"`

	Start             time.Time `dynamodbav:"start_time"`
	End               time.Time `dynamodbav:"end_time,omitempty"`
	CommunicationTool string    `dynamodbav:"communication_tool"`
	Status            string    `dynamodbav:"status"`

	Requestor User `dynamodbav:"requestor"`
	Recipient User `dynamodbav:"recipient"`

	Message string `dynamodbav:"message"`
	Error   string `dynamodbav:"error,omitempty"`

	OIDCInfo string `dynamodbav:"user_info,omitempty"`

	StatusLink string `dynamodbav:"status_link"`
	AuthLink   string `dynamodbav:"auth_link"`
	ReportLink string `dynamodbav:"report_link"`

	Slack SlackRequest `json:"slack"  dynamodbav:"slack"`

	Permalink string `json:"permalink"  dynamodbav:"permalink"`

	DurationSinceStart string `json:"duration_since_start" dynamodbav:"-"`
	Duration           string `json:"duration" dynamodbav:"-"`
}

func GetAllByRecipientEmail

func GetAllByRecipientEmail(email string) ([]VerifyRequest, error)

func GetAllByUser

func GetAllByUser(email string) ([]VerifyRequest, error)

func GetByID

func GetByID(id string) (VerifyRequest, error)

func (*VerifyRequest) Done

func (vr *VerifyRequest) Done() error

func (*VerifyRequest) DoneWithError

func (vr *VerifyRequest) DoneWithError(errorString string) error

func (*VerifyRequest) Get

func (vr *VerifyRequest) Get() error

func (*VerifyRequest) GetOIDCInfo

func (vr *VerifyRequest) GetOIDCInfo() (*oidc.UserInfo, error)

func (*VerifyRequest) PrepareForSave

func (vr *VerifyRequest) PrepareForSave()

func (*VerifyRequest) Save

func (vr *VerifyRequest) Save() error

func (*VerifyRequest) SetOIDCInfo

func (vr *VerifyRequest) SetOIDCInfo(info *oidc.UserInfo) error

Jump to

Keyboard shortcuts

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