commands

package
v0.0.0-...-a869338 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthErrorInvalidToken            CommandErrorCode = 20301
	AuthErrorFailedToRetrieveAccount CommandErrorCode = 20302
	AuthErrorAccountDoesNotExist     CommandErrorCode = 20303
	AuthErrorOtpExists               CommandErrorCode = 20304
)
View Source
const (
	CompleteRegistrationErrorAlreadyRegistered      CommandErrorCode = 20201
	CompleteRegistrationErrorUpdateFailure          CommandErrorCode = 20202
	CompleteRegistrationErrorAccountIsNotRegistered CommandErrorCode = 20203
	CompleteRegistrationErrorFailedToGetAccount     CommandErrorCode = 20203
	CompleteRegistrationErrorInvalidInput           CommandErrorCode = 20204
	CompleteRegistrationErrorPasswordMismatch       CommandErrorCode = 20205
)
View Source
const (
	GenerateOtpErrorInvalidEmail     CommandErrorCode = 20001
	GenerateOtpErrorFailedToGenOtp   CommandErrorCode = 20002
	GenerateOtpErrorFailedToStoreOtp CommandErrorCode = 20003
	GenerateOtpErrorOtpExists        CommandErrorCode = 20004
)
View Source
const (
	GrantAdminRoleErrorFailedToVerifyAccount CommandErrorCode = 20501
	GrantAdminRoleErrorFailedToUpdateAccount CommandErrorCode = 20502
)
View Source
const (
	ResetPasswordErrorInvalidInput          CommandErrorCode = 20401
	ResetPasswordErrorFailedToVerifyAccount CommandErrorCode = 20402
)
View Source
const (
	SavePasswordErrorInvalidInput          CommandErrorCode = 20401
	SavePasswordErrorFailedToVerifyAccount CommandErrorCode = 20402
)
View Source
const (
	SigninMethodPassword SigninMethod = "password"
	SigninMethodOTP      SigninMethod = "otp"

	SigninErrorFailedToGetOtp                   CommandErrorCode = 20101
	SigninErrorOtpExired                        CommandErrorCode = 20102
	SigninErrorWrongOtp                         CommandErrorCode = 20103
	SigninErrorFailedToCreateToken              CommandErrorCode = 20104
	SigninErrorOTPNotFound                      CommandErrorCode = 20105
	SigninErrorOTPFailedToInvalidateOTP         CommandErrorCode = 20106
	SignInErrorPasswordFailedToGetAccountDetail CommandErrorCode = 20107
	SignInErrorFailedToCreateNewAccount         CommandErrorCode = 20108
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthCommand

type AuthCommand struct {
	Token     string
	SecretKey []byte
}

func (AuthCommand) Execute

func (cmd AuthCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.AuthData]

type CommandContext

type CommandContext interface {
	AccountRepository() repositories.AccountRepository
	OtpRepository() repositories.OtpRepository
	PasswordRepository() repositories.PasswordRepository
}

type CompleteRegistrationCommand

type CompleteRegistrationCommand struct {
	Input dto.CompleteRegistrationInput
}

func (CompleteRegistrationCommand) Execute

func (cmd CompleteRegistrationCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.AuthData]

type GenerateOtpCommand

type GenerateOtpCommand struct {
	Email     string
	TTLMillis int64
}

func (GenerateOtpCommand) Execute

func (cmd GenerateOtpCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.OtpResult]

type GenerateResetTokenCommand

type GenerateResetTokenCommand struct {
	Email     string
	TTLMillis int64
}

func (GenerateResetTokenCommand) Execute

func (cmd GenerateResetTokenCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.PasswordResetCodeResult]

type GrantAdminRoleCommand

type GrantAdminRoleCommand struct {
	Email string
}

A hacky command to grant admin role to user TODO refactor

func (GrantAdminRoleCommand) Execute

func (cmd GrantAdminRoleCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.AuthData]

type ResetPasswordCommand

type ResetPasswordCommand struct {
	Input dto.PasswordResetInput
}

func (ResetPasswordCommand) Execute

func (cmd ResetPasswordCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.PasswordResult]

type SavePasswordCommand

type SavePasswordCommand struct {
	Email    entities.EmailAddress
	Password []byte
}

func (SavePasswordCommand) Execute

func (cmd SavePasswordCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.PasswordResult]

type SigninCommand

type SigninCommand struct {
	Email     string
	Password  []byte
	SecretKey []byte
}

func (SigninCommand) Execute

func (cmd SigninCommand) Execute(ctx CommandContext) CommandExecutionResult[dto.SignInResult]

type SigninMethod

type SigninMethod string

Jump to

Keyboard shortcuts

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