dto

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: AGPL-3.0 Imports: 14 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

func UseEnterpriseConnection added in v0.9.0

func UseEnterpriseConnection(samlConfig *samlConfig.Saml) bool

Types

type Account added in v1.0.0

type Account struct {
	AllowDeletion bool `json:"allow_deletion"`
	AllowSignup   bool `json:"allow_signup"`
}

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 EmailJwt added in v0.10.1

type EmailJwt struct {
	Address    string `json:"address"`
	IsPrimary  bool   `json:"is_primary"`
	IsVerified bool   `json:"is_verified"`
}

func JwtFromEmailModel added in v0.10.1

func JwtFromEmailModel(email *models.Email) *EmailJwt

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,omitempty"` // Deprecated
	Identities Identities `json:"identities,omitempty"`
}

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 Emails added in v1.0.0

type Emails struct {
	RequireVerification bool `json:"require_verification"`
	MaxNumOfAddresses   int  `json:"max_num_of_addresses"`
}

type GetUserResponse

type GetUserResponse struct {
	ID                  uuid.UUID                   `json:"id"`
	Email               *string                     `json:"email,omitempty"`
	Username            *string                     `json:"username,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 Identities added in v0.10.0

type Identities []Identity

func FromIdentitiesModel added in v0.10.0

func FromIdentitiesModel(identities models.Identities) Identities

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 MFAConfig added in v1.2.0

type MFAConfig struct {
	AuthAppSetUp        bool `json:"auth_app_set_up"`
	TOTPEnabled         bool `json:"totp_enabled"`
	SecurityKeysEnabled bool `json:"security_keys_enabled"`
}

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 Password added in v1.0.0

type Password struct {
	Enabled   bool `json:"enabled"`
	MinLength int  `json:"min_password_length"`
}

type ProfileData added in v1.0.0

type ProfileData struct {
	UserID       uuid.UUID                    `json:"user_id"`
	Passkeys     []WebauthnCredentialResponse `json:"passkeys,omitempty"`
	SecurityKeys []WebauthnCredentialResponse `json:"security_keys,omitempty"`
	MFAConfig    MFAConfig                    `json:"mfa_config"`
	Emails       []EmailResponse              `json:"emails,omitempty"`
	Username     *Username                    `json:"username,omitempty"`
	CreatedAt    time.Time                    `json:"created_at"`
	UpdatedAt    time.Time                    `json:"updated_at"`
}

func ProfileDataFromUserModel added in v1.0.0

func ProfileDataFromUserModel(user *models.User, cfg *config.Config) *ProfileData

type PublicConfig

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

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

func FromConfig

func FromConfig(cfg config.Config) PublicConfig

FromConfig Returns a PublicConfig from the Application configuration

type SessionData added in v1.1.0

type SessionData struct {
	ID           uuid.UUID  `json:"id"`
	UserAgentRaw string     `json:"user_agent_raw"`
	UserAgent    string     `json:"user_agent"`
	IpAddress    string     `json:"ip_address"`
	Current      bool       `json:"current"`
	CreatedAt    time.Time  `json:"created_at"`
	ExpiresAt    *time.Time `json:"expires_at,omitempty"`
	LastUsed     time.Time  `json:"last_used"`
}

func FromSessionModel added in v1.1.0

func FromSessionModel(model models.Session, current bool) SessionData

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 Username added in v1.0.0

type Username struct {
	ID        uuid.UUID `json:"id"`
	Username  string    `json:"username"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func FromUsernameModel added in v1.0.0

func FromUsernameModel(u *models.Username) *Username

type ValidateSessionRequest added in v1.1.0

type ValidateSessionRequest struct {
	SessionToken string `json:"session_token" validate:"required"`
}

type ValidateSessionResponse added in v1.1.0

type ValidateSessionResponse struct {
	IsValid        bool       `json:"is_valid"`
	ExpirationTime *time.Time `json:"expiration_time,omitempty"`
	UserID         *uuid.UUID `json:"user_id,omitempty"`
}

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