Skip to content

Function: mintDelegationToken()

ts
function mintDelegationToken(
   scope, 
   ttlSeconds, 
   secret, 
   issuer?, 
   carryOverState?, 
   store?, 
traceparent?): Promise<string>;

Defined in: packages/core/src/handoff/DelegationToken.ts:129

Mint a signed HMAC-SHA256 delegation token.

If carryOverState exceeds 2 KB, the state is persisted in store and only the resulting state_id UUID is embedded in the token.

Parameters

ParameterTypeDefault valueDescription
scopestringundefinedScope identifier (e.g. 'finance')
ttlSecondsnumberundefinedToken lifetime in seconds
secretstringundefinedHMAC signing secret (minimum 32 chars recommended)
issuerstring'vurb-gateway'Issuer identifier (gateway URL or name)
carryOverState?Record<string, unknown>undefinedOptional semantic context to carry to the upstream
store?HandoffStateStoreundefinedRequired when carryOverState may exceed 2 KB
traceparent?stringundefinedW3C traceparent for distributed tracing

Returns

Promise<string>

Signed token string: base64url(claims).base64url(sig)