Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNilData = errors.New("data map cannot be nil")
var ErrNotExists = errors.New("value does not exist")
Functions ¶
This section is empty.
Types ¶
type InMemory ¶
type InMemory struct {
// contains filtered or unexported fields
}
InMemory provides an in-memory implementation of a token storage system. It stores encrypted tokens associated with clients, supports expiration, and is safe for concurrent use.
func NewInMemory ¶
NewInMemory creates a new in-memory token storage with the given encryption key and expiration duration.
func (*InMemory) Close ¶ added in v1.23.1
Close is a no-op for in-memory storage, but implements the interface for compatibility.
func (*InMemory) Delete ¶
Delete removes the token data for a given client from storage. If the storage is empty or the client does not exist, it does nothing.
func (*InMemory) Get ¶
Get retrieves and decrypts the token for a given client. If the token is expired or does not exist, an error is returned.
func (*InMemory) Set ¶
Set stores an encrypted token for a given client, with an expiration time. The token is encrypted using AES before storage.
func (*InMemory) SetStorage ¶ added in v1.24.0
SetStorage replaces the current storage data with the provided DataMap. This is mainly used for testing or restoring state.