verification

package
v0.0.0-...-c4f7e29 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DependencySet = wire.NewSet(
	wire.Struct(new(StorePQ), "*"),
	wire.Bind(new(ClaimStore), new(*StorePQ)),
	wire.Struct(new(Service), "*"),
)
View Source
var ErrClaimUnverified = errors.New("claim is unverified")
View Source
var ErrCodeNotFound = InvalidVerificationCode.NewWithCause("verification code is expired or invalid", apierrors.StringCause("CodeNotFound"))
View Source
var ErrInvalidVerificationCode = InvalidVerificationCode.NewWithCause("invalid verification code", apierrors.StringCause("InvalidVerificationCode"))
View Source
var ErrUnsupportedClaim = errors.New("unsupported claim")
View Source
var InvalidVerificationCode = apierrors.Forbidden.WithReason("InvalidVerificationCode")

Functions

This section is empty.

Types

type AuthenticatorStatus

type AuthenticatorStatus string
const (
	AuthenticatorStatusUnverified AuthenticatorStatus = "unverified"
	AuthenticatorStatusVerified   AuthenticatorStatus = "verified"
)

type Claim

type Claim struct {
	ID        string
	UserID    string
	Name      string
	Value     string
	CreatedAt time.Time
}

type ClaimStatus

type ClaimStatus struct {
	Name                       string
	Value                      string
	Verified                   bool
	RequiredToVerifyOnCreation bool
	EndUserTriggerable         bool
}

func (ClaimStatus) IsVerifiable

func (s ClaimStatus) IsVerifiable() bool

type ClaimStore

type ClaimStore interface {
	ListByUser(userID string) ([]*Claim, error)
	ListByUserIDs(userIDs []string) ([]*Claim, error)
	ListByClaimName(userID string, claimName string) ([]*Claim, error)
	Get(userID string, claimName string, claimValue string) (*Claim, error)
	Create(claim *Claim) error
	Delete(id string) error
	DeleteAll(userID string) error
}

type Service

type Service struct {
	Config            *config.VerificationConfig
	UserProfileConfig *config.UserProfileConfig

	Clock      clock.Clock
	ClaimStore ClaimStore
}

func (*Service) AreUsersVerified

func (s *Service) AreUsersVerified(identitiesByUserIDs map[string][]*identity.Info) (map[string]bool, error)

func (*Service) DeleteClaim

func (s *Service) DeleteClaim(claim *Claim) error

func (*Service) GetAuthenticatorVerificationStatus

func (s *Service) GetAuthenticatorVerificationStatus(a *authenticator.Info) (AuthenticatorStatus, error)

func (*Service) GetClaimStatus

func (s *Service) GetClaimStatus(userID string, claimName model.ClaimName, claimValue string) (*ClaimStatus, error)

func (*Service) GetClaims

func (s *Service) GetClaims(userID string) ([]*Claim, error)

func (*Service) GetIdentityVerificationStatus

func (s *Service) GetIdentityVerificationStatus(i *identity.Info) ([]ClaimStatus, error)

func (*Service) GetVerificationStatuses

func (s *Service) GetVerificationStatuses(is []*identity.Info) (map[string][]ClaimStatus, error)

func (*Service) IsUserVerified

func (s *Service) IsUserVerified(identities []*identity.Info) (bool, error)

func (*Service) MarkClaimVerified

func (s *Service) MarkClaimVerified(claim *Claim) error

func (*Service) NewVerifiedClaim

func (s *Service) NewVerifiedClaim(userID string, claimName string, claimValue string) *Claim

func (*Service) RemoveOrphanedClaims

func (s *Service) RemoveOrphanedClaims(userID string, identities []*identity.Info, authenticators []*authenticator.Info) error

func (*Service) ResetVerificationStatus

func (s *Service) ResetVerificationStatus(userID string) error

type StorePQ

type StorePQ struct {
	SQLBuilder  *appdb.SQLBuilderApp
	SQLExecutor *appdb.SQLExecutor
}

func (*StorePQ) Create

func (s *StorePQ) Create(claim *Claim) error

func (*StorePQ) Delete

func (s *StorePQ) Delete(id string) error

func (*StorePQ) DeleteAll

func (s *StorePQ) DeleteAll(userID string) error

func (*StorePQ) Get

func (s *StorePQ) Get(userID string, claimName string, claimValue string) (*Claim, error)

func (*StorePQ) ListByClaimName

func (s *StorePQ) ListByClaimName(userID string, claimName string) ([]*Claim, error)

func (*StorePQ) ListByUser

func (s *StorePQ) ListByUser(userID string) ([]*Claim, error)

func (*StorePQ) ListByUserIDs

func (s *StorePQ) ListByUserIDs(userIDs []string) ([]*Claim, error)

func (*StorePQ) ListByUserIDsAndClaimNames

func (s *StorePQ) ListByUserIDsAndClaimNames(userIDs []string, claimNames []string) ([]*Claim, error)

Jump to

Keyboard shortcuts

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