NewRefreshTokenStore (redis/refresh_token_store.go)

paca · services/api/internal/repository/redis/refresh_token_store.go · go · Apache-2.0
database

Package redis provides Redis-backed implementations for token management.

// Source: https://github.com/Paca-AI/paca | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Package redis provides Redis-backed implementations for token management.
package redis

import (
	"context"
	"fmt"
	"time"

	"github.com/redis/go-redis/v9"
)

const (
	refreshUsedPrefix   = "refresh:used:"
	refreshFamilyPrefix = "refresh:family:"
)

// RefreshTokenStore manages refresh-token rotation state in Redis.
// It tracks per-token first-use timestamps and maintains per-family revocation
// flags, enabling reuse detection with a configurable grace period.
type RefreshTokenStore struct {
	client *redis.Client
}

// NewRefreshTokenStore returns a RefreshTokenStore backed by the give

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key