Initial open source release
This commit is contained in:
commit
74992e893f
377 changed files with 118084 additions and 0 deletions
20
internal/store/code.go
Normal file
20
internal/store/code.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PhoneCode 是一条登录验证码记录(与某次 sendCode 的 phone_code_hash 关联)。
|
||||
type PhoneCode struct {
|
||||
Phone string
|
||||
Code string
|
||||
}
|
||||
|
||||
// CodeStore 暂存登录验证码:phone_code_hash → 手机号 + 验证码,带 TTL。
|
||||
// 实现见 store/memory(测试替身)、store/redisstore。
|
||||
type CodeStore interface {
|
||||
Set(ctx context.Context, phoneCodeHash string, code PhoneCode, ttl time.Duration) error
|
||||
Get(ctx context.Context, phoneCodeHash string) (PhoneCode, bool, error)
|
||||
Del(ctx context.Context, phoneCodeHash string) error
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue