Tickets
One-time tickets: HMAC-signed claims with an expiry and an id that can be spent once (kept in memory until it expires).
Type Parameters
Section titled “Type Parameters”C extends object = Record<string, unknown>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Tickets<
C>(secret,ttlSec?):Tickets<C>
Parameters
Section titled “Parameters”secret
Section titled “secret”string | Buffer<ArrayBufferLike>
ttlSec?
Section titled “ttlSec?”number = 30
Returns
Section titled “Returns”Tickets<C>
Properties
Section titled “Properties”ttlSec
Section titled “ttlSec”
readonlyttlSec:number
Methods
Section titled “Methods”issue()
Section titled “issue()”issue(
claims):string
Parameters
Section titled “Parameters”claims
Section titled “claims”C
Returns
Section titled “Returns”string
take()
Section titled “take()”take(
ticket):C|null
The claims of a valid, unexpired, unused ticket; taking it spends it.
Parameters
Section titled “Parameters”ticket
Section titled “ticket”unknown
Returns
Section titled “Returns”C | null