Skip to content

@btravstack/testing


@btravstack/testing / jwt

jwt ​

Type Aliases ​

LocalIssuer ​

ts
type LocalIssuer = object;

Defined in: testing/src/jwt.ts:23

Properties ​

PropertyModifierTypeDescriptionDefined in
audiencereadonlystring-testing/src/jwt.ts:29
closereadonly() => AsyncResult<void, never>-testing/src/jwt.ts:31
issuerreadonlystring-testing/src/jwt.ts:28
jwkreadonlyJWKThe public key as served, with kid/alg/use already set.testing/src/jwt.ts:27
jwksreadonlystringhttp://127.0.0.1:<port>/jwks.json — served on ANY path, so a caller need not match it exactly.testing/src/jwt.ts:25
signreadonly(claims?, options?) => AsyncResult<string, never>-testing/src/jwt.ts:30

LocalIssuerOptions ​

ts
type LocalIssuerOptions = object;

Defined in: testing/src/jwt.ts:10

Properties ​

PropertyModifierTypeDefined in
audiencereadonlystringtesting/src/jwt.ts:12
issuerreadonlystringtesting/src/jwt.ts:11

SignOptions ​

ts
type SignOptions = object;

Defined in: testing/src/jwt.ts:15

Properties ​

PropertyModifierTypeDescriptionDefined in
audience?readonlystring | readonly string[]One or several recipients, including intentionally broad tokens for negative tests.testing/src/jwt.ts:18
expiresIn?readonlystring | false"5m" by default; false mints a token with no exp at all.testing/src/jwt.ts:20
issuer?readonlystring-testing/src/jwt.ts:16

Functions ​

localIssuer() ​

ts
function localIssuer(options): AsyncResult<LocalIssuer, never>;

Defined in: testing/src/jwt.ts:42

A real JWKS endpoint and a matching signer, for a test that wants a genuine fetch and a genuine verify rather than a double for either.

The whole LocalIssuer is minted from one call: a key pair, a node:http listener answering the JWKS on any path, and sign closing over the private key. close() stops the listener; nothing else needs tearing down.

Parameters ​

ParameterType
optionsLocalIssuerOptions

Returns ​

AsyncResult<LocalIssuer, never>

Released under the MIT License.