@adrianhall/cloudflare-toolkit
@adrianhall/cloudflare-toolkit / lib/testing / signDevJwt
Function: signDevJwt()
signDevJwt(
options?):Promise<string>
Defined in: src/lib/auth-internal/jwt.ts:97
Create a signed JWT that mimics a Cloudflare Access token.
The type claim is set to "dev" so that the verification layer can distinguish locally-issued tokens from real Access tokens.
Parameters
email
string
The user's email address (becomes the email claim).
options?
Optional overrides.
audience?
string | string[]
aud claim to set on the token. Pass an array to mint a single developer session that satisfies several path-specific Access-application audiences at once (e.g. cloudflareAccessPlugin's login flow issuing one token that can traverse every role-specific page a dev-configured PathPolicy[] protects). When omitted, no aud claim is set at all — matching prior behavior for callers that don't validate audience.
lifetime?
number
Token lifetime in seconds (default 86400 / 24 h).
secret?
string
HMAC signing secret (default DEFAULT_DEV_SECRET).
sub?
string
Subject claim. When provided it is used verbatim; when omitted a random UUID is generated (matching the shape of a real Cloudflare Access sub) instead of an email-derived value.
Returns
Promise<string>