merged from gramsrv upstream
This commit is contained in:
parent
79c64ee916
commit
21a0856587
651 changed files with 54774 additions and 4590 deletions
|
|
@ -2,10 +2,13 @@ package store
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
var ErrAuthorizationStateChanged = errors.New("authorization state changed")
|
||||
|
||||
// AuthorizationStore 持久化设备授权(auth_key ↔ user 绑定)。实现见 store/memory(测试替身)、store/postgres。
|
||||
type AuthorizationStore interface {
|
||||
Bind(ctx context.Context, a domain.Authorization) error
|
||||
|
|
@ -16,8 +19,9 @@ type AuthorizationStore interface {
|
|||
Delete(ctx context.Context, authKeyID [8]byte) error
|
||||
DeleteByHash(ctx context.Context, userID, hash int64) (domain.Authorization, bool, error)
|
||||
DeleteByUserExcept(ctx context.Context, userID int64, keepAuthKeyID [8]byte) ([]domain.Authorization, error)
|
||||
// MarkPasswordPassed 清除 auth_key 的 password_pending 标记,使其转为完全授权(两步验证通过后调用)。
|
||||
MarkPasswordPassed(ctx context.Context, authKeyID [8]byte) error
|
||||
// MarkPasswordPassed 仅在 auth_key 仍属于 expectedUserID 且仍为
|
||||
// password_pending 时提升为完全授权,避免旧用户的密码 proof 提升重绑后的账号。
|
||||
MarkPasswordPassed(ctx context.Context, authKeyID [8]byte, expectedUserID int64) error
|
||||
}
|
||||
|
||||
// AuthKeyAuthorityLinker is an optional in-process store-composition boundary.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue