This commit is contained in:
eson
2023-07-27 16:48:43 +08:00
parent abc315a39b
commit 0ce35645b2
10 changed files with 195 additions and 112 deletions

View File

@@ -10,6 +10,12 @@ import (
"net/url"
)
type OperateType int8
const (
OpTypeRegister OperateType = 1 //注册的操作类型
)
type ConfirmationLink[T any] struct {
Secret []byte
DefaultQueryKey string // 默认key 是 token

View File

@@ -13,10 +13,14 @@ import (
)
type RegisterToken struct {
Id int64
Password string
Platform string
Expired time.Time
OperateType // 操作的类型, 验证的token 必须要继承这个
Id int64 // 注册的 id
GuestId uint64 // guest_id 需要继承
WCId uint64 // websocket 通道id
Email string // email
Password string // 密码
Platform string // 平台
CreateAt time.Time // 创建时间
}
func ParseJwtTokenUint64SecretByRequest(r *http.Request, AccessSecret uint64) (jwt.MapClaims, error) {

View File

@@ -39,9 +39,11 @@ var (
CodeServiceErr = &StatusResponse{510, "server logic error"} // 服务逻辑错误
CodeUnAuth = &StatusResponse{401, "unauthorized"} // 未授权
CodeOAuthGoogleApiErr = &StatusResponse{5070, "oauth2 google api error"}
CodeOAuthRegisterTokenErr = &StatusResponse{5071, "oauth2 jwt token error"}
CodeOAuthEmailErr = &StatusResponse{5071, "Invalid email format"}
CodeOAuthGoogleApiErr = &StatusResponse{5070, "oauth2 google api error"}
CodeOAuthRegisterTokenErr = &StatusResponse{5071, "oauth2 register create token error"}
CodeOAuthEmailErr = &StatusResponse{5072, "Invalid email format"}
CodeOAuthRandReaderErr = &StatusResponse{5073, "rand reader error"}
CodeOAuthConfirmationTimeoutErr = &StatusResponse{5074, "confirmation timeout error"}
CodeS3PutObjectRequestErr = &StatusResponse{5060, "s3 PutObjectRequest error"} // s3 PutObjectRequest 错误
CodeS3PutSizeLimitErr = &StatusResponse{5061, "s3 over limit size error"} // s3 超过文件大小限制 错误
@@ -75,7 +77,8 @@ var (
CodeAesCbcEncryptionErr = &StatusResponse{5106, "encryption data err"} // 加密数据失败
CodeAesCbcDecryptionErr = &StatusResponse{5107, "decryption data err"} // 解密数据失败
CodeSharedStateErr = &StatusResponse{5201, "shared state server err"} // 状态机错误
CodeSharedStateErr = &StatusResponse{5201, "shared state server err"} // 状态机错误
CodeEmailConfirmationErr = &StatusResponse{5202, "email confirmation err"} // email 验证错误
)
type Response struct {