feat: sync login email verification support
This commit is contained in:
parent
e0cabb4930
commit
9a501f900a
39 changed files with 2198 additions and 117 deletions
|
|
@ -14,9 +14,25 @@ var (
|
|||
ErrPasswordRecoveryNA = errors.New("password recovery not available")
|
||||
ErrEmailCodeInvalid = errors.New("email code invalid")
|
||||
ErrEmailInvalid = errors.New("email invalid")
|
||||
ErrEmailNotAllowed = errors.New("email not allowed")
|
||||
ErrEmailOccupied = errors.New("email occupied")
|
||||
ErrSessionPasswordNeeded = errors.New("session password needed")
|
||||
)
|
||||
|
||||
type AuthCodeDeliveryKind string
|
||||
|
||||
const (
|
||||
AuthCodeDeliveryPhone AuthCodeDeliveryKind = "phone"
|
||||
AuthCodeDeliveryEmail AuthCodeDeliveryKind = "email"
|
||||
AuthCodeDeliveryEmailSetupRequired AuthCodeDeliveryKind = "email_setup_required"
|
||||
)
|
||||
|
||||
type AuthCodeDelivery struct {
|
||||
Kind AuthCodeDeliveryKind
|
||||
EmailPattern string
|
||||
Length int
|
||||
}
|
||||
|
||||
// PasswordKDFAlgo 是业务层的 SRP KDF 算法描述,不依赖 tg.*。
|
||||
type PasswordKDFAlgo struct {
|
||||
Salt1 []byte
|
||||
|
|
@ -83,10 +99,10 @@ type PasswordSettings struct {
|
|||
// LoginEmailPattern)。它独立于 2FA 恢复邮箱 RecoveryEmail:账号可只设登录邮箱而无 2FA。
|
||||
LoginEmail string
|
||||
LoginEmailPattern string
|
||||
NewAlgo PasswordKDFAlgo
|
||||
NewSecureAlgo SecurePasswordKDFAlgo
|
||||
SecureRandom []byte
|
||||
PendingResetDate int
|
||||
NewAlgo PasswordKDFAlgo
|
||||
NewSecureAlgo SecurePasswordKDFAlgo
|
||||
SecureRandom []byte
|
||||
PendingResetDate int
|
||||
|
||||
// Server-only SRP fields. They are persisted but never exposed to rpc/tg conversion.
|
||||
SRPVerifier []byte
|
||||
|
|
|
|||
|
|
@ -21,3 +21,15 @@ type Authorization struct {
|
|||
CreatedAt time.Time
|
||||
ActiveAt time.Time
|
||||
}
|
||||
|
||||
// AuthKeyClientInfo 是未登录 auth_key 也需要保留的客户端协商元数据。
|
||||
// 登录后的设备授权仍由 Authorization 表达;这里仅用于服务端重启后恢复
|
||||
// pre-auth / setup 流程的 client type 与 layer。
|
||||
type AuthKeyClientInfo struct {
|
||||
Layer int
|
||||
DeviceModel string
|
||||
Platform string
|
||||
SystemVersion string
|
||||
APIID int
|
||||
AppVersion string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue