tokenstore

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package tokenstore provides an in-memory registry of ephemeral runtime tokens. Each registered value is keyed by an opaque token that expires after a fixed TTL, with a background loop reaping expired entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a TTL-bounded registry mapping opaque tokens to their backing values.

func New

func New(ttl time.Duration) *Store

New creates a Store whose tokens expire after ttl and starts its cleanup loop.

func (*Store) Register

func (s *Store) Register(value string) string

Register stores value under a freshly generated token and returns the token.

func (*Store) Revoke

func (s *Store) Revoke(value string)

Revoke removes the first token whose registered value equals value.

func (*Store) Stop

func (s *Store) Stop()

Stop terminates the background cleanup loop. It is safe to call more than once.

func (*Store) Validate

func (s *Store) Validate(token string) string

Validate returns the value registered for token, or an empty string if the token is unknown or has expired.

Jump to

Keyboard shortcuts

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