Documentation
¶
Index ¶
- type Account
- type CreateProfileRequest
- type DeleteAccountRequest
- type ErrorResponse
- type ForgotPasswordRequest
- type LoginRequest
- type NativeAccount
- type OAuthLink
- type OTPCode
- type PasswordChangeRequest
- type Profile
- type RegisterRequest
- type ResetPasswordRequest
- type TokenResponse
- type UpdateProfileRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
bun.BaseModel `bun:"table:auth_accounts,alias:a"`
ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"`
CreatedAt time.Time `bun:"created_at,nullzero,notnull" json:"created_at"`
UpdatedAt time.Time `bun:"updated_at,nullzero,notnull" json:"updated_at"`
Native *NativeAccount `bun:"rel:has-one,join:id=account_id" json:"native,omitempty"`
OAuthLinks []*OAuthLink `bun:"rel:has-many,join:id=account_id" json:"oauth_links,omitempty"`
}
Account is the identity — "you exist"
type CreateProfileRequest ¶ added in v0.2.0
type CreateProfileRequest struct {
DisplayName string `json:"display_name" binding:"required,min=2,max=32"`
}
type DeleteAccountRequest ¶
type DeleteAccountRequest struct {
Password string `json:"password" binding:"required"`
}
type ErrorResponse ¶
type ForgotPasswordRequest ¶
type ForgotPasswordRequest struct {
Email string `json:"email" binding:"required,email"`
}
type LoginRequest ¶
type NativeAccount ¶
type NativeAccount struct {
bun.BaseModel `bun:"table:auth_native,alias:n"`
ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"`
AccountID uuid.UUID `bun:"account_id,notnull,type:uuid" json:"account_id"`
Email string `bun:"email,notnull,unique" json:"email"`
Username string `bun:"username,notnull,unique" json:"username"`
PasswordHash string `bun:"password_hash,notnull" json:"-"`
CreatedAt time.Time `bun:"created_at,nullzero,notnull,default:current_timestamp" json:"created_at"`
Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"-"`
}
NativeAccount is email/password authentication
type OAuthLink ¶
type OAuthLink struct {
bun.BaseModel `bun:"table:auth_oauth,alias:o"`
ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"`
AccountID uuid.UUID `bun:"account_id,notnull,type:uuid" json:"account_id"`
Provider string `bun:"provider,notnull" json:"provider"`
ProviderID string `bun:"provider_id,notnull" json:"provider_id"`
ProviderEmail string `bun:"provider_email" json:"provider_email,omitempty"`
CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"`
Account *Account `bun:"rel:belongs-to,join:account_id=id" json:"-"`
}
OAuthLink is a provider login linked to an account
type OTPCode ¶
type OTPCode struct {
bun.BaseModel `bun:"table:auth_otp_codes,alias:otp"`
ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"`
Email string `bun:"email,notnull" json:"email"`
Code string `bun:"code,notnull" json:"code"`
Type string `bun:"type,notnull" json:"type"`
ExpiresAt time.Time `bun:"expires_at,notnull" json:"expires_at"`
CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"`
Metadata string `bun:"metadata" json:"metadata,omitempty"`
}
type PasswordChangeRequest ¶
type Profile ¶ added in v0.2.0
type Profile struct {
bun.BaseModel `bun:"table:profiles,alias:p"`
AccountID uuid.UUID `bun:"account_id,pk,type:uuid" json:"account_id"`
DisplayName string `bun:"display_name,notnull" json:"display_name"`
CreatedAt time.Time `bun:"created_at,notnull" json:"created_at"`
UpdatedAt time.Time `bun:"updated_at,notnull" json:"updated_at"`
}
type RegisterRequest ¶
type ResetPasswordRequest ¶
type TokenResponse ¶
type UpdateProfileRequest ¶ added in v0.2.0
type UpdateProfileRequest struct {
DisplayName string `json:"display_name" binding:"omitempty,min=2,max=32"`
}
Click to show internal directories.
Click to hide internal directories.