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:9

Properties

PropertyModifierTypeDescriptionDefined in
algorithm?readonly"RS256" | "RS384" | "RS512" | "ES256" | "ES384"Asymmetric only, the same list jwtAuthenticator accepts; default "RS256".testing/src/jwt.ts:13
audiencereadonlystring-testing/src/jwt.ts:11
issuerreadonlystring-testing/src/jwt.ts:10

SignOptions

ts
type SignOptions = object;

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

Properties

PropertyModifierTypeDescriptionDefined in
audience?readonlystring-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:17

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.