Documentation
¶
Overview ¶
Package devicesession supplies per-device session generations. Rotating a generation revokes all sessions for that device, including offline clients, without scanning Redis or affecting the user's other sessions.
Index ¶
- Constants
- func AcquireEpoch(ctx context.Context, client Store, id int64) (string, error)
- func Binding(claims map[string]any) (id int64, epoch string, err error)
- func Epoch(ctx context.Context, client Store, id int64) (string, error)
- func Revoke(ctx context.Context, client Store, id int64) error
- type Store
Constants ¶
View Source
const ( IDClaim = "DeviceId" EpochClaim = "DeviceEpoch" )
Variables ¶
This section is empty.
Functions ¶
func AcquireEpoch ¶
AcquireEpoch is used only when issuing a new, authenticated session. A missing generation during token validation must never default to an old value: eviction of a key must not resurrect a previously revoked token.
Types ¶
type Store ¶ added in v1.21.0
type Store interface {
Get(ctx context.Context, key string) *redis.StringCmd
Set(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd
SetNX(ctx context.Context, key string, value any, expiration time.Duration) *redis.BoolCmd
}
Store is the Redis surface the generations use; *redis.Client satisfies it.
Click to show internal directories.
Click to hide internal directories.