dto

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnabledProviders added in v0.5.0

func GetEnabledProviders(providers config.ThirdPartyProviders) []string

func NewHTTPErrorHandler

func NewHTTPErrorHandler(config HTTPErrorHandlerConfig) func(err error, c echo.Context)

func ToHttpError

func ToHttpError(err error) *echo.HTTPError

Types

type CreateUserResponse

type CreateUserResponse struct {
	ID      uuid.UUID `json:"id"` // deprecated
	UserID  uuid.UUID `json:"user_id"`
	EmailID uuid.UUID `json:"email_id"`
}

type CustomValidator

type CustomValidator struct {
	Validator *validator.Validate
}

func NewCustomValidator

func NewCustomValidator() *CustomValidator

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

type EmailCreateRequest

type EmailCreateRequest struct {
	Address string `json:"address"`
}

type EmailResponse

type EmailResponse struct {
	ID         uuid.UUID `json:"id"`
	Address    string    `json:"address"`
	IsVerified bool      `json:"is_verified"`
	IsPrimary  bool      `json:"is_primary"`
	Identity   *Identity `json:"identity"`
}

func FromEmailModel

func FromEmailModel(email *models.Email) *EmailResponse

FromEmailModel Converts the DB model to a DTO object

type EmailUpdateRequest

type EmailUpdateRequest struct {
	IsPrimary *bool `json:"is_primary"`
}

type GetUserResponse

type GetUserResponse struct {
	ID                  uuid.UUID                   `json:"id"`
	Email               *string                     `json:"email,omitempty"`
	WebauthnCredentials []models.WebauthnCredential `json:"webauthn_credentials"` // deprecated
	UpdatedAt           time.Time                   `json:"updated_at"`
	CreatedAt           time.Time                   `json:"created_at"`
}

type HTTPErrorHandlerConfig

type HTTPErrorHandlerConfig struct {
	Debug  bool
	Logger echo.Logger
}

type Identity added in v0.5.0

type Identity struct {
	ID       string `json:"id"`
	Provider string `json:"provider"`
}

func FromIdentityModel added in v0.5.0

func FromIdentityModel(identity *models.Identity) *Identity

type PasscodeFinishRequest

type PasscodeFinishRequest struct {
	Id   string `json:"id" validate:"required,uuid4"`
	Code string `json:"code" validate:"required"`
}

type PasscodeInitRequest

type PasscodeInitRequest struct {
	UserId  string  `json:"user_id" validate:"required,uuid4"`
	EmailId *string `json:"email_id"`
}

type PasscodeReturn

type PasscodeReturn struct {
	Id        string    `json:"id"`
	TTL       int       `json:"ttl"`
	CreatedAt time.Time `json:"created_at"`
}

type PublicConfig

type PublicConfig struct {
	Password  config.Password `json:"password"`
	Emails    config.Emails   `json:"emails"`
	Providers []string        `json:"providers"`
	Account   config.Account  `json:"account"`
}

PublicConfig is the part of the configuration that will be shared with the frontend

func FromConfig

func FromConfig(config config.Config) PublicConfig

FromConfig Returns a PublicConfig from the Application configuration

type ThirdPartyAuthCallback added in v0.5.0

type ThirdPartyAuthCallback struct {
	AuthCode         string `query:"code"`
	State            string `query:"state" validate:"required"`
	Error            string `query:"error"`
	ErrorDescription string `query:"error_description"`
}

func (ThirdPartyAuthCallback) HasError added in v0.5.0

func (cb ThirdPartyAuthCallback) HasError() bool

type ThirdPartyAuthRequest added in v0.5.0

type ThirdPartyAuthRequest struct {
	Provider   string `query:"provider" validate:"required"`
	RedirectTo string `query:"redirect_to" validate:"required,url"`
}

type UserInfoResponse

type UserInfoResponse struct {
	ID                    uuid.UUID `json:"id"`
	EmailID               uuid.UUID `json:"email_id"`
	Verified              bool      `json:"verified"`
	HasWebauthnCredential bool      `json:"has_webauthn_credential"`
}

type ValidationErrors

type ValidationErrors struct {
	Errors []string `json:"errors"`
}

type WebauthnCredentialResponse

type WebauthnCredentialResponse struct {
	ID              string     `json:"id"`
	Name            *string    `json:"name,omitempty"`
	PublicKey       string     `json:"public_key"`
	AttestationType string     `json:"attestation_type"`
	AAGUID          uuid.UUID  `json:"aaguid"`
	LastUsedAt      *time.Time `json:"last_used_at,omitempty"`
	CreatedAt       time.Time  `json:"created_at"`
	Transports      []string   `json:"transports"`
	BackupEligible  bool       `json:"backup_eligible"`
	BackupState     bool       `json:"backup_state"`
}

func FromWebauthnCredentialModel

func FromWebauthnCredentialModel(c *models.WebauthnCredential) *WebauthnCredentialResponse

FromWebauthnCredentialModel Converts the DB model to a DTO object

type WebauthnCredentialUpdateRequest

type WebauthnCredentialUpdateRequest struct {
	Name *string `json:"name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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