This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/store/ticket_iface.go
Jeffrey Smith 3d4228f868
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-sqlite (push) Successful in 2m46s
CI/CD / test-go-pg (push) Successful in 2m47s
CI/CD / build-and-deploy (push) Successful in 26s
Feat v0.6.3 dead code sweep (#38)
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
2026-03-31 12:37:47 +00:00

18 lines
613 B
Go

package store
import "context"
// TicketStore manages short-lived, single-use WebSocket auth tickets.
type TicketStore interface {
// Issue creates a single-use ticket for the given user.
// Returns the opaque ticket ID (128-bit hex).
Issue(ctx context.Context, userID string) (string, error)
// Validate atomically consumes a ticket and returns the user ID.
// Returns ("", false) if the ticket is invalid, expired, or already consumed.
Validate(ctx context.Context, ticketID string) (string, bool)
// Reap removes expired tickets. Returns the count deleted.
Reap(ctx context.Context) (int, error)
}