devicesession

package
v1.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

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

View Source
const (
	IDClaim    = "DeviceId"
	EpochClaim = "DeviceEpoch"
)

Variables

This section is empty.

Functions

func AcquireEpoch

func AcquireEpoch(ctx context.Context, client *redis.Client, id int64) (string, error)

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.

func Binding

func Binding(claims map[string]interface{}) (id int64, epoch string, err error)

Binding rejects malformed and legacy unbound device sessions. IDs are strings so JSON's float64 conversion cannot round a database ID.

func Epoch

func Epoch(ctx context.Context, client *redis.Client, id int64) (string, error)

func Revoke

func Revoke(ctx context.Context, client *redis.Client, id int64) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL