service

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var (
	EarmarkRefIDMatcher = reftag.NewMatcher[model.EarmarkRefID]()
	ParseEarmarkRefID   = reftag.Parse[model.EarmarkRefID]
)
View Source
var (
	EventRefIDMatcher   = reftag.NewMatcher[model.EventRefID]()
	EventRefIDFromBytes = reftag.FromBytes[model.EventRefID]
	ParseEventRefID     = reftag.Parse[model.EventRefID]
)
View Source
var (
	ParseEventItemRefID     = reftag.Parse[model.EventItemRefID]
	EventItemRefIDMatcher   = reftag.NewMatcher[model.EventItemRefID]()
	EventItemRefIDFromBytes = reftag.FromBytes[model.EventItemRefID]
)
View Source
var (
	NotificationRefIDMatcher   = reftag.NewMatcher[model.NotificationRefID]()
	NotificationRefIDFromBytes = reftag.FromBytes[model.NotificationRefID]
	ParseNotificationRefID     = reftag.Parse[model.NotificationRefID]
)
View Source
var (
	ParseUserRefID     = reftag.Parse[model.UserRefID]
	UserRefIDFromBytes = reftag.FromBytes[model.UserRefID]
	UserRefIDMatcher   = reftag.NewMatcher[model.UserRefID]()
)
View Source
var (
	ApiKeyRefIDMatcher   = reftag.NewMatcher[model.ApiKeyRefID]()
	ApiKeyRefIDFromBytes = reftag.FromBytes[model.ApiKeyRefID]
	ParseApiKeyRefID     = reftag.Parse[model.ApiKeyRefID]
)
View Source
var (
	UserPWResetRefIDMatcher   = reftag.NewMatcher[model.UserPWResetRefID]()
	UserPWResetRefIDFromBytes = reftag.FromBytes[model.UserPWResetRefID]
	ParseUserPWResetRefID     = reftag.Parse[model.UserPWResetRefID]
)
View Source
var (
	UserVerifyRefIDMatcher   = reftag.NewMatcher[model.UserVerifyRefID]()
	UserVerifyRefIDFromBytes = reftag.FromBytes[model.UserVerifyRefID]
	ParseUserVerifyRefID     = reftag.Parse[model.UserVerifyRefID]
)
View Source
var (
	CredentialRefIDMatcher   = reftag.NewMatcher[model.CredentialRefID]()
	CredentialRefIDFromBytes = reftag.FromBytes[model.CredentialRefID]
	ParseCredentialRefID     = reftag.Parse[model.CredentialRefID]
)

Functions

func CheckPass

func CheckPass(ctx context.Context, pwHash []byte, passwd []byte) bool

func IsTimerExpired

func IsTimerExpired(tm Timer, expiry time.Duration) bool

func ParseTimeZone

func ParseTimeZone(tz string) (*model.TimeZone, error)

func TxnFunc

func TxnFunc(ctx context.Context, db model.PgxHandle,
	dbfn func(pgx.Tx) error,
) errs.Error

Types

type Credentialer

type Credentialer interface {
	GetUserCredentialsByUser(ctx context.Context, userID int) ([]*model.UserCredential, errs.Error)
	NewUserCredential(ctx context.Context, userID int, keyName string, credential []byte) (*model.UserCredential, errs.Error)
}

type EventUpdateValues

type EventUpdateValues struct {
	StartTime     mo.Option[time.Time] `validate:"omitnil"`
	Name          mo.Option[string]    `validate:"omitnil,notblank"`
	Description   mo.Option[string]    `validate:"omitnil,notblank"`
	Tz            mo.Option[string]    `validate:"omitnil,timezone"`
	ItemSortOrder mo.Option[[]int]     `validate:"omitnil,gt=0"`
}

type FailIfCheckFunc

type FailIfCheckFunc[T any] func(T) bool

type Options

type Options struct {
	Db model.PgxHandle
}

type Pagination

type Pagination struct {
	Limit  int
	Offset int
	Count  int
}

type PasswdUpdate

type PasswdUpdate struct {
	NewPass []byte `validate:"omitempty,notblank,gt=0"`
	OldPass []byte `validate:"omitempty,notblank,gt=0"`
}

type Service

type Service struct {
	Db model.PgxHandle
}

func New

func New(opts Options) *Service

func (*Service) AddEventItem

func (s *Service) AddEventItem(
	ctx context.Context, userID int,
	refID model.EventRefID, description string,
) (*model.EventItem, errs.Error)

func (*Service) AddFavorite

func (s *Service) AddFavorite(
	ctx context.Context, userID int, refID model.EventRefID,
) (*model.Event, errs.Error)

func (*Service) ArchiveOldEvents

func (s *Service) ArchiveOldEvents(ctx context.Context) error

func (*Service) CreateEvent

func (s *Service) CreateEvent(
	ctx context.Context, user *model.User,
	name string, description string,
	when time.Time, tz string,
) (*model.Event, errs.Error)

func (*Service) DeleteAllNotifications

func (s *Service) DeleteAllNotifications(
	ctx context.Context, userID int,
) errs.Error

func (*Service) DeleteEarmark

func (s *Service) DeleteEarmark(
	ctx context.Context, userID int, earmark *model.Earmark,
) errs.Error

func (*Service) DeleteEarmarkByRefID

func (s *Service) DeleteEarmarkByRefID(
	ctx context.Context, userID int, refID model.EarmarkRefID,
) errs.Error

func (*Service) DeleteEvent

func (s *Service) DeleteEvent(
	ctx context.Context, userID int, refID model.EventRefID,
) errs.Error

func (*Service) DeleteNotification

func (s *Service) DeleteNotification(
	ctx context.Context, userID int, refID model.NotificationRefID,
) errs.Error

func (*Service) DeleteUser

func (s *Service) DeleteUser(
	ctx context.Context, userID int,
) errs.Error

func (*Service) DeleteUserCredential

func (s *Service) DeleteUserCredential(
	ctx context.Context, user *model.User, refID model.CredentialRefID,
) errs.Error

func (*Service) DisableRemindersWithNotification

func (s *Service) DisableRemindersWithNotification(
	ctx context.Context,
	email string, suppressionReason string,
) errs.Error

func (*Service) GetApiKeyByUser

func (s *Service) GetApiKeyByUser(
	ctx context.Context, userID int,
) (*model.ApiKey, errs.Error)

func (*Service) GetEarmark

func (s *Service) GetEarmark(
	ctx context.Context, refID model.EarmarkRefID,
) (*model.Earmark, errs.Error)

func (*Service) GetEarmarkByEventItemID

func (s *Service) GetEarmarkByEventItemID(
	ctx context.Context, eventItemID int,
) (*model.Earmark, errs.Error)

func (*Service) GetEarmarks

func (s *Service) GetEarmarks(
	ctx context.Context, userID int, archived bool,
) ([]*model.Earmark, errs.Error)

func (*Service) GetEarmarksByEventID

func (s *Service) GetEarmarksByEventID(
	ctx context.Context, eventID int,
) ([]*model.Earmark, errs.Error)

func (*Service) GetEarmarksCount

func (s *Service) GetEarmarksCount(
	ctx context.Context, userID int,
) (*model.BifurcatedRowCounts, errs.Error)

func (*Service) GetEarmarksPaginated

func (s *Service) GetEarmarksPaginated(
	ctx context.Context, userID int,
	limit, offset int, archived bool,
) ([]*model.Earmark, *Pagination, errs.Error)

func (*Service) GetEvent

func (s *Service) GetEvent(
	ctx context.Context, refID model.EventRefID,
) (*model.Event, errs.Error)

func (*Service) GetEventByID

func (s *Service) GetEventByID(
	ctx context.Context, ID int,
) (*model.Event, errs.Error)

func (*Service) GetEventItem

func (s *Service) GetEventItem(
	ctx context.Context, eventItemRefID model.EventItemRefID,
) (*model.EventItem, errs.Error)

func (*Service) GetEventItemByID

func (s *Service) GetEventItemByID(
	ctx context.Context, eventItemID int,
) (*model.EventItem, errs.Error)

func (*Service) GetEventItemsByEvent

func (s *Service) GetEventItemsByEvent(
	ctx context.Context, refID model.EventRefID,
) ([]*model.EventItem, errs.Error)

func (*Service) GetEventItemsByEventID

func (s *Service) GetEventItemsByEventID(
	ctx context.Context, eventID int,
) ([]*model.EventItem, errs.Error)

func (*Service) GetEventItemsByIDs

func (s *Service) GetEventItemsByIDs(
	ctx context.Context, eventItemIDs []int,
) ([]*model.EventItem, errs.Error)

func (*Service) GetEventItemsCount

func (s *Service) GetEventItemsCount(
	ctx context.Context, eventIDs []int,
) ([]*model.EventItemCount, errs.Error)

func (*Service) GetEvents

func (s *Service) GetEvents(
	ctx context.Context, userID int,
	archived bool,
) ([]*model.Event, errs.Error)

func (*Service) GetEventsByIDs

func (s *Service) GetEventsByIDs(
	ctx context.Context, eventIDs []int,
) ([]*model.Event, errs.Error)

func (*Service) GetEventsComingSoonPaginated

func (s *Service) GetEventsComingSoonPaginated(
	ctx context.Context, userID int,
	limit, offset int,
) ([]*model.Event, *Pagination, errs.Error)

func (*Service) GetEventsCount

func (s *Service) GetEventsCount(
	ctx context.Context, userID int,
) (*model.BifurcatedRowCounts, errs.Error)

func (*Service) GetEventsPaginated

func (s *Service) GetEventsPaginated(
	ctx context.Context, userID int,
	limit, offset int, archived bool,
) ([]*model.Event, *Pagination, errs.Error)

func (*Service) GetFavoriteByUserEvent

func (s *Service) GetFavoriteByUserEvent(
	ctx context.Context, userID int, eventID int,
) (*model.Favorite, errs.Error)

func (*Service) GetFavoriteEvents

func (s *Service) GetFavoriteEvents(
	ctx context.Context, userID int, archived bool,
) ([]*model.Event, errs.Error)

func (*Service) GetFavoriteEventsCount

func (s *Service) GetFavoriteEventsCount(
	ctx context.Context, userID int,
) (*model.BifurcatedRowCounts, errs.Error)

func (*Service) GetFavoriteEventsPaginated

func (s *Service) GetFavoriteEventsPaginated(
	ctx context.Context, userID int,
	limit, offset int, archived bool,
) ([]*model.Event, *Pagination, errs.Error)

func (*Service) GetNotifications

func (s *Service) GetNotifications(
	ctx context.Context, userID int,
) ([]*model.Notification, errs.Error)

func (*Service) GetNotificationsCount

func (s *Service) GetNotificationsCount(
	ctx context.Context, userID int,
) (int, errs.Error)

func (*Service) GetNotificationsPaginated

func (s *Service) GetNotificationsPaginated(
	ctx context.Context, userID int, limit, offset int,
) ([]*model.Notification, *Pagination, errs.Error)

func (*Service) GetUser

func (s *Service) GetUser(
	ctx context.Context, refID model.UserRefID,
) (*model.User, errs.Error)

func (*Service) GetUserByApiKey

func (s *Service) GetUserByApiKey(
	ctx context.Context, token string,
) (*model.User, errs.Error)

func (*Service) GetUserByEmail

func (s *Service) GetUserByEmail(
	ctx context.Context, email string,
) (*model.User, errs.Error)

func (*Service) GetUserByID

func (s *Service) GetUserByID(
	ctx context.Context, ID int,
) (*model.User, errs.Error)

func (*Service) GetUserCredentialByRefID

func (s *Service) GetUserCredentialByRefID(
	ctx context.Context, userID int, refID model.CredentialRefID,
) (*model.UserCredential, errs.Error)

func (*Service) GetUserCredentialCountByUser

func (s *Service) GetUserCredentialCountByUser(
	ctx context.Context, userID int,
) (int, errs.Error)

func (*Service) GetUserCredentialsByUser

func (s *Service) GetUserCredentialsByUser(
	ctx context.Context, userID int,
) ([]*model.UserCredential, errs.Error)

func (*Service) GetUserPWResetByRefID

func (s *Service) GetUserPWResetByRefID(
	ctx context.Context, refID model.UserPWResetRefID,
) (*model.UserPWReset, errs.Error)

func (*Service) GetUserVerifyByRefID

func (s *Service) GetUserVerifyByRefID(
	ctx context.Context, refID model.UserVerifyRefID,
) (*model.UserVerify, errs.Error)

func (*Service) GetUsersByIDs

func (s *Service) GetUsersByIDs(
	ctx context.Context, userIDs []int,
) ([]*model.User, errs.Error)

func (*Service) NewApiKey

func (s *Service) NewApiKey(
	ctx context.Context, userID int,
) (*model.ApiKey, errs.Error)

func (*Service) NewApiKeyIfNotExists

func (s *Service) NewApiKeyIfNotExists(
	ctx context.Context, userID int,
) (*model.ApiKey, errs.Error)

func (*Service) NewEarmark

func (s *Service) NewEarmark(
	ctx context.Context, user *model.User, eventItemID int, note string,
) (*model.Earmark, errs.Error)

func (*Service) NewNotification

func (s *Service) NewNotification(
	ctx context.Context, userID int, message string,
) (*model.Notification, errs.Error)

func (*Service) NewUser

func (s *Service) NewUser(
	ctx context.Context, email, name string, rawPass []byte,
) (*model.User, errs.Error)

func (*Service) NewUserCredential

func (s *Service) NewUserCredential(
	ctx context.Context, userID int, keyName string, credential []byte,
) (*model.UserCredential, errs.Error)

func (*Service) NewUserPWReset

func (s *Service) NewUserPWReset(
	ctx context.Context, userID int,
) (*model.UserPWReset, errs.Error)

func (*Service) NewUserVerify

func (s *Service) NewUserVerify(
	ctx context.Context, userID int,
) (*model.UserVerify, errs.Error)

func (*Service) NotifyUsersPendingEvents

func (s *Service) NotifyUsersPendingEvents(ctx context.Context,
	mailer mail.MailSender, tplContainer resources.TGetter,
	siteBaseUrl string,
) error

func (*Service) RemoveEventItem

func (s *Service) RemoveEventItem(
	ctx context.Context, userID int, eventItemRefID model.EventItemRefID,
	failIfChecks FailIfCheckFunc[*model.EventItem],
) errs.Error

func (*Service) RemoveFavorite

func (s *Service) RemoveFavorite(
	ctx context.Context, userID int, refID model.EventRefID,
) errs.Error

func (*Service) SetUserVerified

func (s *Service) SetUserVerified(
	ctx context.Context, user *model.User, verifier *model.UserVerify,
) errs.Error

func (*Service) UpdateEvent

func (s *Service) UpdateEvent(
	ctx context.Context, userID int,
	refID model.EventRefID, euvs *EventUpdateValues,
) errs.Error

func (*Service) UpdateEventItem

func (s *Service) UpdateEventItem(
	ctx context.Context, userID int,
	refID model.EventItemRefID, description string,
	failIfChecks FailIfCheckFunc[*model.EventItem],
) (*model.EventItem, errs.Error)

func (*Service) UpdateEventItemSorting

func (s *Service) UpdateEventItemSorting(
	ctx context.Context, userID int,
	refID model.EventRefID, itemSortOrder []int,
) (*model.Event, errs.Error)

func (*Service) UpdateUser

func (s *Service) UpdateUser(
	ctx context.Context, user *model.User, euvs *UserUpdateValues,
) errs.Error

func (*Service) UpdateUserPWReset

func (s *Service) UpdateUserPWReset(
	ctx context.Context, user *model.User, upw *model.UserPWReset,
) errs.Error

func (*Service) UpdateUserSettings

func (s *Service) UpdateUserSettings(
	ctx context.Context, userID int, pm *model.UserSettings,
) errs.Error

func (*Service) WebAuthnUserFrom

func (s *Service) WebAuthnUserFrom(user *model.User) *WebAuthnUser

type Servicer

type Servicer interface {
	GetEarmarksByEventID(ctx context.Context, eventID int) ([]*model.Earmark, errs.Error)
	GetEarmarkByEventItemID(ctx context.Context, eventItemID int) (*model.Earmark, errs.Error)
	GetEarmarksCount(ctx context.Context, userID int) (*model.BifurcatedRowCounts, errs.Error)
	GetEarmarksPaginated(ctx context.Context, userID int, limit, offset int, archived bool) ([]*model.Earmark, *Pagination, errs.Error)
	GetEarmarks(ctx context.Context, userID int, archived bool) ([]*model.Earmark, errs.Error)
	NewEarmark(ctx context.Context, user *model.User, eventItemID int, note string) (*model.Earmark, errs.Error)
	GetEarmark(ctx context.Context, refID model.EarmarkRefID) (*model.Earmark, errs.Error)
	DeleteEarmark(ctx context.Context, userID int, earmark *model.Earmark) errs.Error
	DeleteEarmarkByRefID(ctx context.Context, userID int, refID model.EarmarkRefID) errs.Error
	GetEvent(ctx context.Context, refID model.EventRefID) (*model.Event, errs.Error)
	GetEventByID(ctx context.Context, ID int) (*model.Event, errs.Error)
	GetEventsByIDs(ctx context.Context, eventIDs []int) ([]*model.Event, errs.Error)
	DeleteEvent(ctx context.Context, userID int, refID model.EventRefID) errs.Error
	UpdateEvent(ctx context.Context, userID int, refID model.EventRefID, euvs *EventUpdateValues) errs.Error
	UpdateEventItemSorting(ctx context.Context, userID int, refID model.EventRefID, itemSortOrder []int) (*model.Event, errs.Error)
	CreateEvent(ctx context.Context, user *model.User, name string, description string, when time.Time, tz string) (*model.Event, errs.Error)
	GetEventsPaginated(ctx context.Context, userID int, limit, offset int, archived bool) ([]*model.Event, *Pagination, errs.Error)
	GetEventsComingSoonPaginated(ctx context.Context, userID int, limit, offset int) ([]*model.Event, *Pagination, errs.Error)
	GetEventsCount(ctx context.Context, userID int) (*model.BifurcatedRowCounts, errs.Error)
	GetEvents(ctx context.Context, userID int, archived bool) ([]*model.Event, errs.Error)
	ArchiveOldEvents(ctx context.Context) error
	GetEventItemsCount(ctx context.Context, eventIDs []int) ([]*model.EventItemCount, errs.Error)
	GetEventItemsByEvent(ctx context.Context, refID model.EventRefID) ([]*model.EventItem, errs.Error)
	GetEventItemsByEventID(ctx context.Context, eventID int) ([]*model.EventItem, errs.Error)
	GetEventItemsByIDs(ctx context.Context, eventItemIDs []int) ([]*model.EventItem, errs.Error)
	GetEventItem(ctx context.Context, eventItemRefID model.EventItemRefID) (*model.EventItem, errs.Error)
	GetEventItemByID(ctx context.Context, eventItemID int) (*model.EventItem, errs.Error)
	RemoveEventItem(ctx context.Context, userID int, eventItemRefID model.EventItemRefID, failIfChecks FailIfCheckFunc[*model.EventItem]) errs.Error
	AddEventItem(ctx context.Context, userID int, refID model.EventRefID, description string) (*model.EventItem, errs.Error)
	UpdateEventItem(ctx context.Context, userID int, refID model.EventItemRefID, description string, failIfChecks FailIfCheckFunc[*model.EventItem]) (*model.EventItem, errs.Error)
	AddFavorite(ctx context.Context, userID int, refID model.EventRefID) (*model.Event, errs.Error)
	RemoveFavorite(ctx context.Context, userID int, refID model.EventRefID) errs.Error
	GetFavoriteEventsPaginated(ctx context.Context, userID int, limit, offset int, archived bool) ([]*model.Event, *Pagination, errs.Error)
	GetFavoriteEventsCount(ctx context.Context, userID int) (*model.BifurcatedRowCounts, errs.Error)
	GetFavoriteEvents(ctx context.Context, userID int, archived bool) ([]*model.Event, errs.Error)
	GetFavoriteByUserEvent(ctx context.Context, userID int, eventID int) (*model.Favorite, errs.Error)
	GetNotificationsCount(ctx context.Context, userID int) (int, errs.Error)
	GetNotificationsPaginated(ctx context.Context, userID int, limit, offset int) ([]*model.Notification, *Pagination, errs.Error)
	GetNotifications(ctx context.Context, userID int) ([]*model.Notification, errs.Error)
	DeleteNotification(ctx context.Context, userID int, refID model.NotificationRefID) errs.Error
	DeleteAllNotifications(ctx context.Context, userID int) errs.Error
	NewNotification(ctx context.Context, userID int, message string) (*model.Notification, errs.Error)
	GetUser(ctx context.Context, refID model.UserRefID) (*model.User, errs.Error)
	GetUserByEmail(ctx context.Context, email string) (*model.User, errs.Error)
	GetUserByID(ctx context.Context, ID int) (*model.User, errs.Error)
	GetUsersByIDs(ctx context.Context, userIDs []int) ([]*model.User, errs.Error)
	NewUser(ctx context.Context, email, name string, rawPass []byte) (*model.User, errs.Error)
	UpdateUser(ctx context.Context, user *model.User, euvs *UserUpdateValues) errs.Error
	UpdateUserSettings(ctx context.Context, userID int, pm *model.UserSettings) errs.Error
	DeleteUser(ctx context.Context, userID int) errs.Error
	GetApiKeyByUser(ctx context.Context, userID int) (*model.ApiKey, errs.Error)
	GetUserByApiKey(ctx context.Context, token string) (*model.User, errs.Error)
	NewApiKey(ctx context.Context, userID int) (*model.ApiKey, errs.Error)
	NewApiKeyIfNotExists(ctx context.Context, userID int) (*model.ApiKey, errs.Error)
	NotifyUsersPendingEvents(ctx context.Context, mailer mail.MailSender, tplContainer resources.TGetter, siteBaseUrl string) error
	GetUserPWResetByRefID(ctx context.Context, refID model.UserPWResetRefID) (*model.UserPWReset, errs.Error)
	NewUserPWReset(ctx context.Context, userID int) (*model.UserPWReset, errs.Error)
	UpdateUserPWReset(ctx context.Context, user *model.User, upw *model.UserPWReset) errs.Error
	GetUserVerifyByRefID(ctx context.Context, refID model.UserVerifyRefID) (*model.UserVerify, errs.Error)
	NewUserVerify(ctx context.Context, userID int) (*model.UserVerify, errs.Error)
	SetUserVerified(ctx context.Context, user *model.User, verifier *model.UserVerify) errs.Error
	GetUserCredentialByRefID(ctx context.Context, userID int, refID model.CredentialRefID) (*model.UserCredential, errs.Error)
	GetUserCredentialsByUser(ctx context.Context, userID int) ([]*model.UserCredential, errs.Error)
	GetUserCredentialCountByUser(ctx context.Context, userID int) (int, errs.Error)
	DeleteUserCredential(ctx context.Context, user *model.User, refID model.CredentialRefID) errs.Error
	NewUserCredential(ctx context.Context, userID int, keyName string, credential []byte) (*model.UserCredential, errs.Error)
	WebAuthnUserFrom(user *model.User) *WebAuthnUser
	DisableRemindersWithNotification(ctx context.Context, email string, suppressionReason string) errs.Error
}

Servicer ...

type Timer

type Timer interface {
	Time() time.Time
}

type UserUpdateValues

type UserUpdateValues struct {
	Name      mo.Option[string] `validate:"omitnil,notblank"`
	Email     mo.Option[string] `validate:"omitnil,notblank,email"`
	Verified  mo.Option[bool]
	PWAuth    mo.Option[bool]
	ApiAccess mo.Option[bool]
	WebAuthn  mo.Option[bool]
	PwUpdate  mo.Option[*PasswdUpdate] `validate:"omitnil"`
}

type WebAuthnUser

type WebAuthnUser struct {
	*model.User
	// contains filtered or unexported fields
}

func (*WebAuthnUser) AddCredential

func (u *WebAuthnUser) AddCredential(keyName string, credential *webauthn.Credential) error

func (*WebAuthnUser) WebAuthnCredentials

func (u *WebAuthnUser) WebAuthnCredentials() []webauthn.Credential

WebAuthnCredentials provides the list of Credential objects owned by the user.

func (*WebAuthnUser) WebAuthnDisplayName

func (u *WebAuthnUser) WebAuthnDisplayName() string

WebAuthnDisplayName provides the name attribute of the user account during registration and is a human-palatable name for the user account, intended only for display. For example, "Alex Müller" or "田中倫". The Relying Party SHOULD let the user choose this, and SHOULD NOT restrict the choice more than necessary.

Specification: §5.4.3. User Account Parameters for Credential Generation (https://www.w3.org/TR/webauthn/#dom-publickeycredentialuserentity-displayname)

func (*WebAuthnUser) WebAuthnID

func (u *WebAuthnUser) WebAuthnID() []byte

WebAuthnID provides the user handle of the user account. A user handle is an opaque byte sequence with a maximum size of 64 bytes, and is not meant to be displayed to the user.

To ensure secure operation, authentication and authorization decisions MUST be made on the basis of this id member, not the displayName nor name members. See Section 6.1 of [RFC8266].

It's recommended this value is completely random and uses the entire 64 bytes.

Specification: §5.4.3. User Account Parameters for Credential Generation (https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-id)

func (*WebAuthnUser) WebAuthnName

func (u *WebAuthnUser) WebAuthnName() string

WebAuthnName provides the name attribute of the user account during registration and is a human-palatable name for the user account, intended only for display. For example, "Alex Müller" or "田中倫". The Relying Party SHOULD let the user choose this, and SHOULD NOT restrict the choice more than necessary.

Specification: §5.4.3. User Account Parameters for Credential Generation (https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentity)

Directories

Path Synopsis
Package mockservice is a generated GoMock package.
Package mockservice is a generated GoMock package.

Jump to

Keyboard shortcuts

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