Documentation
¶
Index ¶
- func ApiRegisterCodeVerify(w http.ResponseWriter, r *http.Request, deps Dependencies)
- func ApiRegisterCodeVerifyWithAuth(w http.ResponseWriter, r *http.Request, a types.AuthSharedInterface)
- func RegisterCodeVerify(ctx context.Context, r *http.Request, deps Dependencies) (*RegisterCodeVerifyResult, *RegisterCodeVerifyError)
- type Dependencies
- type RegisterCodeVerifyError
- type RegisterCodeVerifyErrorCode
- type RegisterCodeVerifyResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApiRegisterCodeVerify ¶
func ApiRegisterCodeVerify(w http.ResponseWriter, r *http.Request, deps Dependencies)
ApiRegisterCodeVerify is the HTTP-level helper that wires request/response handling to the core RegisterCodeVerify business logic using the provided dependencies.
func ApiRegisterCodeVerifyWithAuth ¶
func ApiRegisterCodeVerifyWithAuth(w http.ResponseWriter, r *http.Request, a types.AuthSharedInterface)
ApiRegisterCodeVerifyWithAuth is a convenience wrapper that allows callers to pass a types.AuthSharedInterface (such as authImplementation) instead of manually wiring Dependencies. It constructs the Dependencies struct using the interface accessors and preserves the existing behaviour.
func RegisterCodeVerify ¶
func RegisterCodeVerify(ctx context.Context, r *http.Request, deps Dependencies) (*RegisterCodeVerifyResult, *RegisterCodeVerifyError)
RegisterCodeVerify encapsulates the core business logic for verifying a registration code, performing optional password validation and creating the user. It does not log or write HTTP responses.
Types ¶
type Dependencies ¶
type Dependencies struct {
DisableRateLimit bool
TemporaryKeyGet func(key string) (string, error)
PasswordStrength *types.PasswordStrengthConfig
Passwordless bool
PasswordlessUserRegister func(ctx context.Context, email, firstName, lastName string) error
UserRegister func(ctx context.Context, email, password, firstName, lastName string) error
// AuthenticateViaUsername is called on successful registration to
// authenticate the user and produce the final HTTP response.
AuthenticateViaUsername func(w http.ResponseWriter, r *http.Request, email, firstName, lastName string)
}
Dependencies defines the dependencies required for verifying a registration code, creating the user account, and authenticating the user.
type RegisterCodeVerifyError ¶
type RegisterCodeVerifyError struct {
Code RegisterCodeVerifyErrorCode
Message string
Err error
}
RegisterCodeVerifyError represents a structured error.
func (*RegisterCodeVerifyError) Error ¶
func (e *RegisterCodeVerifyError) Error() string
type RegisterCodeVerifyErrorCode ¶
type RegisterCodeVerifyErrorCode string
RegisterCodeVerifyErrorCode categorizes error sources in the registration code verification flow.
const ( RegisterCodeVerifyErrorCodeNone RegisterCodeVerifyErrorCode = "" RegisterCodeVerifyErrorCodeValidation RegisterCodeVerifyErrorCode = "validation" RegisterCodeVerifyErrorCodeCodeExpired RegisterCodeVerifyErrorCode = "code_expired" RegisterCodeVerifyErrorCodeDeserialize RegisterCodeVerifyErrorCode = "deserialize" RegisterCodeVerifyErrorCodePasswordValidation RegisterCodeVerifyErrorCode = "password_validation" RegisterCodeVerifyErrorCodeRegister RegisterCodeVerifyErrorCode = "register" )
type RegisterCodeVerifyResult ¶
RegisterCodeVerifyResult represents a successful verification.