Documentation
¶
Overview ¶
Service assembly for the verification-code subdomain: issuing and pre-checking the email/SMS codes that gate registration and account mutations. Only the module facade may reach it.
Index ¶
- Constants
- type CheckVerificationCodeLogic
- type Deps
- type EmailCodeConfig
- type SendEmailCodeDependencies
- type SendEmailCodeLogic
- type SendSmsCodeDependencies
- type SendSmsCodeLogic
- type Service
- func (s *Service) CheckVerificationCode(ctx context.Context, req *dto.CheckVerificationCodeRequest) (*dto.CheckVerificationCodeRespone, error)
- func (s *Service) SendEmailCode(ctx context.Context, req *dto.SendCodeRequest) (*dto.SendCodeResponse, error)
- func (s *Service) SendSmsCode(ctx context.Context, req *dto.SendSmsCodeRequest) (*dto.SendCodeResponse, error)
- type SmsCodeConfig
- type SmsSendCount
- type Snapshot
- type VerificationCodePolicy
- type VerificationIdentityStore
- type VerificationTaskQueue
Constants ¶
const (
IntervalTime = 60
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckVerificationCodeLogic ¶
func (*CheckVerificationCodeLogic) CheckVerificationCode ¶
func (l *CheckVerificationCodeLogic) CheckVerificationCode(req *dto.CheckVerificationCodeRequest) (resp *dto.CheckVerificationCodeRespone, err error)
type Deps ¶
type Deps struct {
Store VerificationIdentityStore
Redis *redis.Client
Queue VerificationTaskQueue
Policy VerificationCodePolicy
// Config snapshots the runtime-mutable settings per request.
Config func() Snapshot
}
Deps declares the subdomain's dependencies; the identity facade forwards them from the composition root and supplies the register policy from the authentication subdomain.
type EmailCodeConfig ¶
type EmailCodeConfig struct {
DomainSuffixList string
EnableDomainSuffix bool
VerifyCodeInterval int64
VerifyCodeLimit int64
VerifyCodeExpire int64
SiteLogo string
SiteName string
}
EmailCodeConfig is the configuration snapshot consumed by email code delivery.
type SendEmailCodeDependencies ¶
type SendEmailCodeDependencies struct {
Store VerificationIdentityStore
Redis *redis.Client
Queue VerificationTaskQueue
Config EmailCodeConfig
Policy VerificationCodePolicy
}
SendEmailCodeDependencies explicitly declares the collaborators of email code delivery instead of passing ServiceContext to business logic.
type SendEmailCodeLogic ¶
func NewSendEmailCodeLogic ¶
func NewSendEmailCodeLogic(ctx context.Context, deps SendEmailCodeDependencies) *SendEmailCodeLogic
NewSendEmailCodeLogic Get verification code
func (*SendEmailCodeLogic) SendEmailCode ¶
func (l *SendEmailCodeLogic) SendEmailCode(req *dto.SendCodeRequest) (resp *dto.SendCodeResponse, err error)
type SendSmsCodeDependencies ¶
type SendSmsCodeDependencies struct {
Store VerificationIdentityStore
Redis *redis.Client
Queue VerificationTaskQueue
Config SmsCodeConfig
Policy VerificationCodePolicy
}
SendSmsCodeDependencies explicitly declares the collaborators of SMS code delivery instead of passing ServiceContext to business logic.
type SendSmsCodeLogic ¶
func NewSendSmsCodeLogic ¶
func NewSendSmsCodeLogic(ctx context.Context, deps SendSmsCodeDependencies) *SendSmsCodeLogic
NewSendSmsCodeLogic Get sms verification code
func (*SendSmsCodeLogic) SendSmsCode ¶
func (l *SendSmsCodeLogic) SendSmsCode(req *dto.SendSmsCodeRequest) (resp *dto.SendCodeResponse, err error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the verification-code subdomain entry point used by the identity facade.
func NewService ¶
func (*Service) CheckVerificationCode ¶
func (s *Service) CheckVerificationCode(ctx context.Context, req *dto.CheckVerificationCodeRequest) (*dto.CheckVerificationCodeRespone, error)
func (*Service) SendEmailCode ¶
func (s *Service) SendEmailCode(ctx context.Context, req *dto.SendCodeRequest) (*dto.SendCodeResponse, error)
func (*Service) SendSmsCode ¶
func (s *Service) SendSmsCode(ctx context.Context, req *dto.SendSmsCodeRequest) (*dto.SendCodeResponse, error)
type SmsCodeConfig ¶
SmsCodeConfig is the configuration snapshot consumed by SMS code delivery.
type SmsSendCount ¶
type Snapshot ¶
type Snapshot struct {
DomainSuffixList string
EnableDomainSuffix bool
VerifyCodeInterval int64
VerifyCodeLimit int64
VerifyCodeExpire int64
SiteLogo string
SiteName string
}
Snapshot is the per-request view of the runtime-mutable settings the verification-code flows consume.
type VerificationCodePolicy ¶
type VerificationCodePolicy interface {
EnsureRegistrationOpen(ctx context.Context, method string) error
EnsureMethodEnabled(ctx context.Context, method string) error
}
VerificationCodePolicy contains the authentication policy required before issuing a verification code.
type VerificationIdentityStore ¶
type VerificationIdentityStore interface {
UserAuth() repository.UserAuthRepo
}
VerificationIdentityStore is the persistence surface used by verification code delivery. It excludes unrelated application repositories.