All checks were successful
Co-authored-by: Jeffrey Smith <jasafpro@gmail.com> Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
18 lines
613 B
Go
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)
|
|
}
|