@web-ts-toolkit/express-oidc-vault 0.53.0 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +416 -45
- package/index.d.mts +200 -8
- package/index.d.ts +200 -8
- package/index.js +992 -186
- package/index.mjs +988 -187
- package/package.json +1 -1
- package/wire.d.mts +11 -1
- package/wire.d.ts +11 -1
package/index.d.ts
CHANGED
|
@@ -2,13 +2,72 @@ import { Request, Response, RequestHandler, Router } from 'express';
|
|
|
2
2
|
import { KeyObject } from 'node:crypto';
|
|
3
3
|
import { JWK } from 'jose';
|
|
4
4
|
import { OidcVaultUserProfile, OidcVaultTokenIssueResult, OidcVaultSessionTransport } from './wire.js';
|
|
5
|
-
export { OidcVaultExchangeResult, OidcVaultLoginInitiationInput, OidcVaultLoginInitiationResult, OidcVaultLogoutResult } from './wire.js';
|
|
5
|
+
export { OidcVaultExchangeResult, OidcVaultLoginInitiationInput, OidcVaultLoginInitiationResult, OidcVaultLogoutNavigationInput, OidcVaultLogoutNavigationResult, OidcVaultLogoutResult } from './wire.js';
|
|
6
6
|
|
|
7
7
|
type OidcVaultRouteName = 'login' | 'callback' | 'exchange' | 'refresh' | 'logout' | 'backchannel-logout';
|
|
8
8
|
/** Enabling the option defaults to `optional`; omitting it keeps bearer behavior. */
|
|
9
9
|
type OidcVaultDeviceBindingMode = 'optional' | 'required';
|
|
10
10
|
/** DPoP proof algorithms, independent of the app-local access token's signing algorithm. */
|
|
11
11
|
type OidcVaultDpopAlgorithm = 'ES256' | 'PS256' | 'RS256';
|
|
12
|
+
type OidcVaultDpopOperation = 'login' | 'exchange' | 'refresh' | 'logout' | 'api';
|
|
13
|
+
type OidcVaultDpopDiagnosticStage = 'presentation' | 'preflight' | 'header' | 'key' | 'signature' | 'claims' | 'target' | 'token-hash' | 'binding' | 'freshness' | 'nonce' | 'replay' | 'proof';
|
|
14
|
+
type OidcVaultDpopDiagnosticOutcome = 'accepted' | 'rejected' | 'challenged' | 'ignored';
|
|
15
|
+
type OidcVaultDpopDiagnosticReason = 'check-passed' | 'policy-disabled' | 'proof-absent' | 'proof-required' | 'binding-required' | 'preflight-failed' | 'session-unavailable' | 'target-absent' | 'session-mismatch' | 'origin-rejected' | 'browser-binding-rejected' | 'recognition-rejected' | 'credential-rejected' | 'malformed-proof' | 'unsupported-header' | 'invalid-key' | 'invalid-signature' | 'invalid-claims' | 'target-mismatch' | 'token-hash-mismatch' | 'key-mismatch' | 'invalid-time' | 'proof-too-old' | 'proof-in-future' | 'clock-unavailable' | 'invalid-nonce' | 'nonce-required' | 'nonce-invalid' | 'nonce-disabled' | 'nonce-unavailable' | 'replay-detected' | 'replay-unavailable' | 'proof-accepted';
|
|
16
|
+
/** Opaque correlation only, not authority. SHA-256 of purpose + NUL + identifier; oversized inputs are omitted. */
|
|
17
|
+
interface OidcVaultDiagnosticCorrelation {
|
|
18
|
+
readonly association: 'candidate-session' | 'verified-token' | 'authenticated';
|
|
19
|
+
readonly subjectRef?: string;
|
|
20
|
+
readonly sessionRef?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Each check reports its own provenance, including policy overrides; signature verification alone is not identity authentication. */
|
|
23
|
+
interface OidcVaultDpopVerificationProvenance {
|
|
24
|
+
readonly signature: 'unchecked' | 'verified' | 'failed';
|
|
25
|
+
readonly target: 'unchecked' | 'matched' | 'failed' | 'ignored';
|
|
26
|
+
readonly tokenHash: 'unchecked' | 'not-applicable' | 'matched' | 'failed';
|
|
27
|
+
readonly credentialBinding: 'unchecked' | 'not-applicable' | 'matched' | 'failed';
|
|
28
|
+
readonly freshness: 'unchecked' | 'passed' | 'failed' | 'ignored';
|
|
29
|
+
readonly nonce: 'unchecked' | 'disabled' | 'passed' | 'challenged' | 'failed';
|
|
30
|
+
readonly replay: 'unchecked' | 'reserved' | 'failed' | 'ignored';
|
|
31
|
+
}
|
|
32
|
+
/** A signed timestamp is a claim, not proof of an accurate physical clock. Unsafe millisecond arithmetic is omitted. */
|
|
33
|
+
interface OidcVaultDpopDiagnosticTiming {
|
|
34
|
+
readonly provenance: 'signature-verified';
|
|
35
|
+
readonly iatSeconds: number;
|
|
36
|
+
readonly clock?: 'configured' | 'system' | 'fallback';
|
|
37
|
+
readonly checkedAtMs?: number;
|
|
38
|
+
/** Observed signed-claim age: checkedAtMs - iatSeconds * 1000; negative means a future claim. */
|
|
39
|
+
readonly observedAgeMs?: number;
|
|
40
|
+
}
|
|
41
|
+
/** Fixed-size, server-only allowlist. No errors, request objects, URLs, credentials, keys, proof IDs or raw session identifiers. */
|
|
42
|
+
interface OidcVaultDpopDiagnosticEvent {
|
|
43
|
+
readonly operation: OidcVaultDpopOperation;
|
|
44
|
+
readonly stage: OidcVaultDpopDiagnosticStage;
|
|
45
|
+
readonly outcome: OidcVaultDpopDiagnosticOutcome;
|
|
46
|
+
readonly reason: OidcVaultDpopDiagnosticReason;
|
|
47
|
+
readonly verification: Readonly<OidcVaultDpopVerificationProvenance>;
|
|
48
|
+
readonly timing?: Readonly<OidcVaultDpopDiagnosticTiming>;
|
|
49
|
+
readonly correlation?: Readonly<OidcVaultDiagnosticCorrelation>;
|
|
50
|
+
}
|
|
51
|
+
/** Best-effort, non-blocking invocation in check order. At most 32 pending promises per dispatcher; excess/reentrant calls drop without queue/retry. Throws/rejections are swallowed, never sent to onError. */
|
|
52
|
+
type OidcVaultDpopDiagnosticObserver = (event: OidcVaultDpopDiagnosticEvent) => void | Promise<void>;
|
|
53
|
+
type OidcVaultTokenOperation = 'exchange' | 'refresh';
|
|
54
|
+
/** Generated once after output/response validation, committed store work and cookie preparation, before HTTP writing. Not a delivery receipt. */
|
|
55
|
+
type OidcVaultTokenOutcomeEvent = Readonly<{
|
|
56
|
+
kind: 'token-issued';
|
|
57
|
+
operation: OidcVaultTokenOperation;
|
|
58
|
+
correlation: Readonly<OidcVaultDiagnosticCorrelation>;
|
|
59
|
+
deviceBound: boolean;
|
|
60
|
+
expiresIn: number;
|
|
61
|
+
tokenType?: 'Bearer' | 'DPoP';
|
|
62
|
+
}> | Readonly<{
|
|
63
|
+
kind: 'exchange-succeeded';
|
|
64
|
+
operation: 'exchange';
|
|
65
|
+
correlation: Readonly<OidcVaultDiagnosticCorrelation>;
|
|
66
|
+
deviceBound: boolean;
|
|
67
|
+
tokenIssued: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
/** Same bounded best-effort delivery contract as DPoP observers; token-issued precedes exchange-succeeded. */
|
|
70
|
+
type OidcVaultTokenOutcomeObserver = (event: OidcVaultTokenOutcomeEvent) => void | Promise<void>;
|
|
12
71
|
/**
|
|
13
72
|
* Immutable persisted sender constraint. `jkt` is the canonical RFC 7638
|
|
14
73
|
* SHA-256 JWK thumbprint (43 base64url characters). Store no JWK, private key,
|
|
@@ -318,6 +377,46 @@ declare class OidcVaultStoreConflictError extends Error {
|
|
|
318
377
|
declare class OidcVaultDpopReplayCapacityError extends Error {
|
|
319
378
|
constructor(message?: string);
|
|
320
379
|
}
|
|
380
|
+
/** Dedicated, short-lived logout continuation. No raw ticket or session is persisted. */
|
|
381
|
+
interface OidcVaultLogoutNavigationTicket {
|
|
382
|
+
/** `logout-navigation:v1:` followed by a canonical SHA-256 base64url hash of the configured scope. */
|
|
383
|
+
namespace: string;
|
|
384
|
+
/** Canonical SHA-256 base64url hash of the entire 256-bit `lnt_` ticket. Never the secret itself. */
|
|
385
|
+
ticketHash: string;
|
|
386
|
+
/** Already-built HTTP(S) provider URL, at most 16384 UTF-8 bytes; retained credential material. */
|
|
387
|
+
upstreamLogoutUrl: string;
|
|
388
|
+
createdAt: number;
|
|
389
|
+
expiresAt: number;
|
|
390
|
+
}
|
|
391
|
+
type CreateLogoutNavigationTicketInput = OidcVaultLogoutNavigationTicket;
|
|
392
|
+
interface ConsumeLogoutNavigationTicketInput {
|
|
393
|
+
namespace: string;
|
|
394
|
+
ticketHash: string;
|
|
395
|
+
}
|
|
396
|
+
/** Independent physical-store capacity; no live continuation is evicted. */
|
|
397
|
+
declare class OidcVaultLogoutNavigationCapacityError extends Error {
|
|
398
|
+
constructor(message?: string);
|
|
399
|
+
}
|
|
400
|
+
/** Optional dedicated capability, independent of device binding and replay admission. */
|
|
401
|
+
interface OidcVaultLogoutNavigationStoreProvider extends OidcVaultStoreProvider {
|
|
402
|
+
/**
|
|
403
|
+
* Capture only the five scalar fields before yielding. Create-only: a live
|
|
404
|
+
* collision throws OidcVaultStoreConflictError before capacity rejection,
|
|
405
|
+
* without replacing or extending it. Invalid/expired input throws TypeError.
|
|
406
|
+
* Epochs must be safe Date-range integers, original TTL 1000..120000 ms,
|
|
407
|
+
* and remaining TTL > 0 and <= 120000 ms. Never retry ambiguous backend errors.
|
|
408
|
+
*/
|
|
409
|
+
createLogoutNavigationTicket(input: CreateLogoutNavigationTicketInput): Promise<void>;
|
|
410
|
+
/**
|
|
411
|
+
* Atomically remove and return one detached, valid exact-pair record with
|
|
412
|
+
* expiresAt > storeNow. Invalid input/unknown/spent/malformed/expired returns
|
|
413
|
+
* null; selected malformed/expired records are retired. Backend, clock and
|
|
414
|
+
* accounting failures throw. No read/unconditional-delete implementation.
|
|
415
|
+
* Built-ins reclaim at most 64 unrelated expiries plus the selected record,
|
|
416
|
+
* allocate nothing for unknown identities, and free consumed capacity now.
|
|
417
|
+
*/
|
|
418
|
+
consumeLogoutNavigationTicket(input: ConsumeLogoutNavigationTicketInput): Promise<OidcVaultLogoutNavigationTicket | null>;
|
|
419
|
+
}
|
|
321
420
|
/**
|
|
322
421
|
* Portable store boundary for JSON-compatible plain objects/arrays and scalar
|
|
323
422
|
* values (strings, finite numbers, booleans, null). Built-in providers capture
|
|
@@ -376,6 +475,10 @@ interface OidcVaultStoreProvider {
|
|
|
376
475
|
getSessionRevocationContext?(sessionId: string): Promise<OidcVaultSessionRevocationContext | null>;
|
|
377
476
|
/** Optional opt-in capability; see `OidcVaultDpopReplayStore.reserveDpopProof`. */
|
|
378
477
|
reserveDpopProof?(input: ReserveDpopProofInput): Promise<boolean>;
|
|
478
|
+
/** Optional dedicated logout capability; see OidcVaultLogoutNavigationStoreProvider. */
|
|
479
|
+
createLogoutNavigationTicket?(input: CreateLogoutNavigationTicketInput): Promise<void>;
|
|
480
|
+
/** Optional atomic consume-if-live; not session authentication or revocation. */
|
|
481
|
+
consumeLogoutNavigationTicket?(input: ConsumeLogoutNavigationTicketInput): Promise<OidcVaultLogoutNavigationTicket | null>;
|
|
379
482
|
/**
|
|
380
483
|
* Atomically replace an existing session with a distinct unused `nextSession.sessionId`.
|
|
381
484
|
*
|
|
@@ -499,6 +602,8 @@ interface OidcVaultHooks {
|
|
|
499
602
|
onError?(context: OidcVaultErrorContext): void | Promise<void>;
|
|
500
603
|
}
|
|
501
604
|
interface IssueTokenInput {
|
|
605
|
+
/** Explicit operation, independent of mutable request URLs. */
|
|
606
|
+
operation: OidcVaultTokenOperation;
|
|
502
607
|
/** Owned session data; reserved fingerprint recognition evidence is omitted to keep hashes out of application tokens. */
|
|
503
608
|
session: OidcVaultSession;
|
|
504
609
|
req: Request;
|
|
@@ -528,6 +633,33 @@ interface OidcVaultTokenIssuer {
|
|
|
528
633
|
*/
|
|
529
634
|
issue(input: IssueTokenInput): Promise<OidcVaultTokenIssueResult>;
|
|
530
635
|
}
|
|
636
|
+
/** Local JWT signing algorithms, independent of the DPoP proof allowlist. EdDSA uses Ed25519. */
|
|
637
|
+
type OidcVaultJwtSigningAlgorithm = 'HS256' | 'HS384' | 'HS512' | 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512' | 'ES256' | 'ES384' | 'ES512' | 'EdDSA';
|
|
638
|
+
/** Application-owned JSON claims only. Reserved fields reject at runtime too, including serializer-produced overrides. */
|
|
639
|
+
type OidcVaultJwtAccessTokenClaims = Record<string, unknown> & {
|
|
640
|
+
iss?: never;
|
|
641
|
+
aud?: never;
|
|
642
|
+
iat?: never;
|
|
643
|
+
exp?: never;
|
|
644
|
+
sub?: never;
|
|
645
|
+
cnf?: never;
|
|
646
|
+
};
|
|
647
|
+
/** Captured at construction. No implicit signing key, vault sid, profile/metadata or upstream-token copying. */
|
|
648
|
+
interface OidcVaultJwtAccessTokenIssuerOptions {
|
|
649
|
+
/** Secret bytes, secret/private KeyObject, signing CryptoKey, or secret/private JWK. HMAC requires at least hash-size bits; RSA at least 2048. */
|
|
650
|
+
key: CryptoKey | KeyObject | JWK | Uint8Array;
|
|
651
|
+
algorithm: OidcVaultJwtSigningAlgorithm;
|
|
652
|
+
issuer: string;
|
|
653
|
+
audience: string | string[];
|
|
654
|
+
/** Nonnegative safe-integer seconds; default 300. Zero issues an already-expired JWT without failing vault rotation. */
|
|
655
|
+
lifetimeSeconds?: number;
|
|
656
|
+
/** Nonnegative safe-integer epoch milliseconds; sampled at construction and after mapping before signing. Default Date.now. Arithmetic must remain safe. */
|
|
657
|
+
now?: () => number;
|
|
658
|
+
/** Defaults to the session subject captured before callbacks. Runs before mapClaims; must return a nonblank string. */
|
|
659
|
+
mapSubject?(input: IssueTokenInput): string | Promise<string>;
|
|
660
|
+
/** Explicit application allowlist. Default scope is captured session.scope; override it or omit with scope: undefined. No reserved security claims. */
|
|
661
|
+
mapClaims?(input: IssueTokenInput): OidcVaultJwtAccessTokenClaims | Promise<OidcVaultJwtAccessTokenClaims>;
|
|
662
|
+
}
|
|
531
663
|
interface OidcVaultAccessTokenValidationResult {
|
|
532
664
|
subject: string;
|
|
533
665
|
sessionId?: string;
|
|
@@ -555,7 +687,7 @@ interface OidcVaultAuthContext extends OidcVaultAccessTokenValidationResult {
|
|
|
555
687
|
deviceBinding?: Readonly<OidcVaultVerifiedDpopBinding>;
|
|
556
688
|
}
|
|
557
689
|
interface OidcVaultAccessTokenValidator {
|
|
558
|
-
/** Binding-disabled middleware invokes exactly validate(token), with one argument. Report any known confirmation. */
|
|
690
|
+
/** Binding-disabled middleware invokes exactly validate(token), with one argument. Report any known confirmation. Throw OidcVaultInvalidAccessTokenError for explicit credential rejection; other exceptions never authorize anonymous fallback. */
|
|
559
691
|
validate(token: string): Promise<OidcVaultAccessTokenValidationResult>;
|
|
560
692
|
/** Required at middleware construction when deviceBinding is enabled; called for both Bearer and DPoP. */
|
|
561
693
|
validateWithRequest?(input: OidcVaultAccessTokenRequestInput): Promise<OidcVaultRequestAwareAccessTokenValidationResult>;
|
|
@@ -577,13 +709,20 @@ interface OidcVaultAccessTokenMiddlewareErrorContext {
|
|
|
577
709
|
}
|
|
578
710
|
interface OidcVaultAccessTokenMiddlewareOptions {
|
|
579
711
|
validator: OidcVaultAccessTokenValidator;
|
|
712
|
+
/** Redacted server-only per-check observations; cannot veto authentication. */
|
|
713
|
+
onDpopDiagnostic?: OidcVaultDpopDiagnosticObserver;
|
|
714
|
+
/** Default required. Optional permits absent credentials, independently of deviceBinding.mode. Empty/malformed/duplicate headers are invalid, not missing. */
|
|
715
|
+
authentication?: 'required' | 'optional';
|
|
716
|
+
/** Default reject. Anonymous requires optional authentication and applies only to known credential rejections, never nonce challenges, replay outages, adapter contract/unknown errors or hook vetoes/failures. */
|
|
717
|
+
invalidCredentials?: 'reject' | 'anonymous';
|
|
580
718
|
/** Opt-in API DPoP enforcement; requires validateWithRequest. Omission preserves the one-argument legacy path. */
|
|
581
719
|
deviceBinding?: OidcVaultApiDeviceBindingOptions;
|
|
582
720
|
/**
|
|
583
721
|
* Pre-`next()` veto hook, not a post-commit notification: when it throws,
|
|
584
722
|
* downstream middleware never runs and `req.auth` is detached before the
|
|
585
723
|
* error response is sent. A valid credential plus a failing hook
|
|
586
|
-
* never surfaces as an invalid-token 401:
|
|
724
|
+
* never surfaces as an invalid-token 401: OidcVaultAuthDeniedError provides a
|
|
725
|
+
* public intentional 401/403 denial; a controlled package error from the
|
|
587
726
|
* hook keeps its own status/code/client message (a 401 uses the attempted
|
|
588
727
|
* scheme's challenge, other statuses carry no challenge), while any other hook
|
|
589
728
|
* error becomes a sanitized `500 OIDC_VAULT_AUTH_CONTEXT_FAILED` without
|
|
@@ -599,7 +738,8 @@ interface OidcVaultAccessTokenMiddlewareOptions {
|
|
|
599
738
|
}): void | Promise<void>;
|
|
600
739
|
/**
|
|
601
740
|
* Observes the original error for every API-middleware failure
|
|
602
|
-
* (extraction, validator, proof/nonce/replay, and `onAuthContext`)
|
|
741
|
+
* (extraction, validator, proof/nonce/replay, guards, and `onAuthContext`),
|
|
742
|
+
* including rejected credentials explicitly falling back anonymously, without affecting
|
|
603
743
|
* the sanitized client response. Failures thrown by this observer are
|
|
604
744
|
* swallowed so the original error response is preserved. Replay failures
|
|
605
745
|
* retain the provider diagnostic in non-enumerable error.cause. No request
|
|
@@ -607,6 +747,20 @@ interface OidcVaultAccessTokenMiddlewareOptions {
|
|
|
607
747
|
*/
|
|
608
748
|
onError?(context: OidcVaultAccessTokenMiddlewareErrorContext): void | Promise<void>;
|
|
609
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* Mount authenticate exactly once before routes, then use this same instance's
|
|
752
|
+
* guards. Guards consume private completed Request/Response-scoped evidence;
|
|
753
|
+
* they never verify, reserve a proof or enrich again. req.auth alone (including
|
|
754
|
+
* a copy from another request/instance) grants no authority. Re-entry fails
|
|
755
|
+
* closed. Do not replace/mutate top-level req.auth fields between these handlers;
|
|
756
|
+
* application enrichment belongs in onAuthContext (or application-owned locals).
|
|
757
|
+
*/
|
|
758
|
+
interface OidcVaultAuthenticator {
|
|
759
|
+
readonly authenticate: RequestHandler;
|
|
760
|
+
readonly requireAuth: RequestHandler;
|
|
761
|
+
/** Requires original bound-token confirmation AND accepted original-key proof; an optional unbound proof does not qualify. */
|
|
762
|
+
readonly requireDeviceBinding: RequestHandler;
|
|
763
|
+
}
|
|
610
764
|
interface OidcVaultAuthenticatedRequest extends Request {
|
|
611
765
|
auth?: OidcVaultAuthContext;
|
|
612
766
|
}
|
|
@@ -714,7 +868,20 @@ interface OidcVaultCookieOptions {
|
|
|
714
868
|
*/
|
|
715
869
|
httpOnly?: boolean;
|
|
716
870
|
}
|
|
871
|
+
/** Opt-in proof-authorized local logout followed by one-time headerless browser navigation. */
|
|
872
|
+
interface OidcVaultLogoutNavigationOptions {
|
|
873
|
+
/** Static backend/frontend-origin HTTPS destination (loopback HTTP allowed), <=2048 UTF-8 bytes; no userinfo/fragment/unsafe characters or continuation loop. */
|
|
874
|
+
fallbackRedirectUri: string;
|
|
875
|
+
/** Integer milliseconds, 1000..120000 inclusive; default 60000. Sampled after discovery. */
|
|
876
|
+
ticketTtlMs?: number;
|
|
877
|
+
/** Static printable ASCII deployment label, 1..128 bytes; default default. Effective scope also pins provider, mount and return policy. */
|
|
878
|
+
namespace?: string;
|
|
879
|
+
}
|
|
717
880
|
interface OidcVaultOptions {
|
|
881
|
+
/** Redacted server-only per-check observations; cannot veto or change enforcement. */
|
|
882
|
+
onDpopDiagnostic?: OidcVaultDpopDiagnosticObserver;
|
|
883
|
+
/** Committed local token/exchange outcomes. No credentials or mutable lifecycle context; observers cannot veto. */
|
|
884
|
+
onTokenOutcome?: OidcVaultTokenOutcomeObserver;
|
|
718
885
|
/** Public router mount; default /auth/oidc. DPoP vault proxies must preserve this externally visible path. */
|
|
719
886
|
basePath?: string;
|
|
720
887
|
/** Pinned public callback/proof origin. DPoP requires a static HTTPS origin, with loopback HTTP allowed for development. */
|
|
@@ -744,6 +911,8 @@ interface OidcVaultOptions {
|
|
|
744
911
|
* snapshots/freezes plain options and algorithms and copies nonce bytes.
|
|
745
912
|
*/
|
|
746
913
|
deviceBinding?: OidcVaultDeviceBindingOptions;
|
|
914
|
+
/** Requires configured deviceBinding and both ticket-store methods. Snapshots/freeze return policy, TTL and derived namespace. Originally unbound targets must use ordinary logout. */
|
|
915
|
+
logoutNavigation?: OidcVaultLogoutNavigationOptions;
|
|
747
916
|
/**
|
|
748
917
|
* Separate opt-in recognition policy; omission means no signal capture/check.
|
|
749
918
|
* Enables JSON POST login and its temporary HttpOnly cookie in both session
|
|
@@ -769,7 +938,9 @@ interface OidcVaultOptions {
|
|
|
769
938
|
frontendRedirectUri?: string;
|
|
770
939
|
/**
|
|
771
940
|
* Optional provider-registered HTTP(S) URL used in the upstream end-session
|
|
772
|
-
* redirect.
|
|
941
|
+
* redirect. Consulted for redirected logout (`redirect: true`) and opt-in
|
|
942
|
+
* logout navigation; navigation additionally validates/snapshots its syntax
|
|
943
|
+
* and 2048-byte bound at construction. Local
|
|
773
944
|
* logout never contacts the provider, and redirected logout treats upstream
|
|
774
945
|
* discovery failures or an absent endpoint as best-effort (local
|
|
775
946
|
* `200 { loggedOut: true }`, with `onLogout` still delivered for a live
|
|
@@ -892,8 +1063,10 @@ declare const DEFAULT_AUTHORIZATION_TRANSACTION_TTL_MS: number;
|
|
|
892
1063
|
declare const DEFAULT_EXCHANGE_CODE_TTL_MS: number;
|
|
893
1064
|
declare const DEFAULT_OIDC_VAULT_REQUEST_BODY_LIMIT = "16kb";
|
|
894
1065
|
declare const OIDC_VAULT_URL_ENCODED_PARAMETER_LIMIT = 16;
|
|
895
|
-
declare const OIDC_VAULT_ROUTE_PATHS: Record<OidcVaultRouteName, string>;
|
|
1066
|
+
declare const OIDC_VAULT_ROUTE_PATHS: Record<OidcVaultRouteName | 'logout-navigation', string>;
|
|
896
1067
|
|
|
1068
|
+
/** The handler-only API; defaults remain strict. Use the authenticator factory to compose reusable guards. */
|
|
1069
|
+
declare function createOidcVaultAccessTokenMiddleware(options: OidcVaultAccessTokenMiddlewareOptions): RequestHandler;
|
|
897
1070
|
/**
|
|
898
1071
|
* API authentication from package-root named imports. With deviceBinding
|
|
899
1072
|
* enabled, requires validateWithRequest at construction for BOTH schemes and
|
|
@@ -910,7 +1083,23 @@ declare const OIDC_VAULT_ROUTE_PATHS: Record<OidcVaultRouteName, string>;
|
|
|
910
1083
|
* environment defaults are captured at construction; ignored failures log to
|
|
911
1084
|
* console.warn. Explicit deviceBinding booleans override those defaults.
|
|
912
1085
|
*/
|
|
913
|
-
declare function
|
|
1086
|
+
declare function createOidcVaultAuthenticator(options: OidcVaultAccessTokenMiddlewareOptions): OidcVaultAuthenticator;
|
|
1087
|
+
|
|
1088
|
+
declare class OidcVaultHttpError extends Error {
|
|
1089
|
+
readonly status: number;
|
|
1090
|
+
readonly code: string;
|
|
1091
|
+
readonly clientMessage: string;
|
|
1092
|
+
constructor(status: number, code: string, message: string, clientMessage?: string);
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/** Explicit credential rejection from a trusted custom validator; safe to treat as anonymous only with opt-in fallback. */
|
|
1096
|
+
declare class OidcVaultInvalidAccessTokenError extends OidcVaultHttpError {
|
|
1097
|
+
constructor(message?: string);
|
|
1098
|
+
}
|
|
1099
|
+
/** Intentional onAuthContext veto. The message is public; unexpected exceptions remain sanitized server failures. */
|
|
1100
|
+
declare class OidcVaultAuthDeniedError extends OidcVaultHttpError {
|
|
1101
|
+
constructor(message?: string, status?: 401 | 403);
|
|
1102
|
+
}
|
|
914
1103
|
|
|
915
1104
|
/**
|
|
916
1105
|
* Verify local JWTs with both legacy validate(token) and validateWithRequest.
|
|
@@ -927,6 +1116,9 @@ declare function createOidcVaultAccessTokenMiddleware(options: OidcVaultAccessTo
|
|
|
927
1116
|
*/
|
|
928
1117
|
declare function createOidcVaultJwtAccessTokenValidator(options: OidcVaultJwtAccessTokenValidatorOptions): OidcVaultRequestAwareAccessTokenValidator;
|
|
929
1118
|
|
|
1119
|
+
/** Local signing only. The vault retains output checks/rollback; APIs independently authenticate the result. */
|
|
1120
|
+
declare function createOidcVaultJwtAccessTokenIssuer(options: OidcVaultJwtAccessTokenIssuerOptions): OidcVaultTokenIssuer;
|
|
1121
|
+
|
|
930
1122
|
/**
|
|
931
1123
|
* Normalize the mounted base path for the OIDC router.
|
|
932
1124
|
*/
|
|
@@ -968,4 +1160,4 @@ declare function normalizeOidcVaultBasePath(value?: string): string;
|
|
|
968
1160
|
*/
|
|
969
1161
|
declare function createOidcVaultMiddleware(options: OidcVaultOptions): Router;
|
|
970
1162
|
|
|
971
|
-
export { type AuthorizationTransaction, type AuthorizationTransactionInput, type ConsumeAuthorizationTransactionIfMatchesInput, type ConsumeBackchannelLogoutTokenJtiInput, type ConsumeExchangeCodeIfMatchesInput, DEFAULT_AUTHORIZATION_TRANSACTION_TTL_MS, DEFAULT_EXCHANGE_CODE_TTL_MS, DEFAULT_OIDC_SCOPES, DEFAULT_OIDC_VAULT_BASE_PATH, DEFAULT_OIDC_VAULT_REQUEST_BODY_LIMIT, type DeleteSessionsByLogicalSessionIdInput, type DeleteSessionsByProviderSessionIdInput, type DeleteSessionsBySubjectInput, type ExchangeCodeRecord, type ExchangeCodeRecordInput, type IssueTokenInput, OIDC_VAULT_ROUTE_PATHS, OIDC_VAULT_URL_ENCODED_PARAMETER_LIMIT, type OidcVaultAccessTokenConfirmation, type OidcVaultAccessTokenMiddlewareErrorContext, type OidcVaultAccessTokenMiddlewareOptions, type OidcVaultAccessTokenRequestInput, type OidcVaultAccessTokenValidationResult, type OidcVaultAccessTokenValidator, type OidcVaultApiDeviceBindingOptions, type OidcVaultAuthContext, type OidcVaultAuthenticatedRequest, type OidcVaultBackchannelLogoutResult, type OidcVaultConfig, type OidcVaultConfigMode, type OidcVaultCookieDeploymentMode, type OidcVaultCookieOptions, type OidcVaultCookieSameSite, type OidcVaultDeviceBindingMode, type OidcVaultDeviceBindingOptions, type OidcVaultDeviceBindingStoreProvider, type OidcVaultDpopAlgorithm, type OidcVaultDpopBinding, type OidcVaultDpopNonceOptions, type OidcVaultDpopProofOptions, OidcVaultDpopReplayCapacityError, type OidcVaultDpopReplayStore, type OidcVaultEnv, type OidcVaultErrorContext, type OidcVaultFingerprintRecognitionOptions, type OidcVaultHookContext, type OidcVaultHooks, type OidcVaultJwtAccessTokenValidatorOptions, type OidcVaultOptions, type OidcVaultProviderMetadata, type OidcVaultRecordBindingMatch, type OidcVaultRequestAwareAccessTokenValidationResult, type OidcVaultRequestAwareAccessTokenValidator, type OidcVaultResolvedConfig, type OidcVaultRouteName, type OidcVaultSession, type OidcVaultSessionInput, type OidcVaultSessionRevocationContext, OidcVaultSessionTransport, OidcVaultStoreConflictError, type OidcVaultStoreProvider, OidcVaultTokenIssueResult, type OidcVaultTokenIssuer, type OidcVaultTransactionCookieOptions, OidcVaultUserProfile, type OidcVaultVerifiedDpopBinding, type ReserveDpopProofInput, type RotateSessionInput, createOidcVaultAccessTokenMiddleware, createOidcVaultJwtAccessTokenValidator, createOidcVaultMiddleware, normalizeOidcVaultBasePath, resolveOidcVaultConfig, resolveOidcVaultConfigFromEnv };
|
|
1163
|
+
export { type AuthorizationTransaction, type AuthorizationTransactionInput, type ConsumeAuthorizationTransactionIfMatchesInput, type ConsumeBackchannelLogoutTokenJtiInput, type ConsumeExchangeCodeIfMatchesInput, type ConsumeLogoutNavigationTicketInput, type CreateLogoutNavigationTicketInput, DEFAULT_AUTHORIZATION_TRANSACTION_TTL_MS, DEFAULT_EXCHANGE_CODE_TTL_MS, DEFAULT_OIDC_SCOPES, DEFAULT_OIDC_VAULT_BASE_PATH, DEFAULT_OIDC_VAULT_REQUEST_BODY_LIMIT, type DeleteSessionsByLogicalSessionIdInput, type DeleteSessionsByProviderSessionIdInput, type DeleteSessionsBySubjectInput, type ExchangeCodeRecord, type ExchangeCodeRecordInput, type IssueTokenInput, OIDC_VAULT_ROUTE_PATHS, OIDC_VAULT_URL_ENCODED_PARAMETER_LIMIT, type OidcVaultAccessTokenConfirmation, type OidcVaultAccessTokenMiddlewareErrorContext, type OidcVaultAccessTokenMiddlewareOptions, type OidcVaultAccessTokenRequestInput, type OidcVaultAccessTokenValidationResult, type OidcVaultAccessTokenValidator, type OidcVaultApiDeviceBindingOptions, type OidcVaultAuthContext, OidcVaultAuthDeniedError, type OidcVaultAuthenticatedRequest, type OidcVaultAuthenticator, type OidcVaultBackchannelLogoutResult, type OidcVaultConfig, type OidcVaultConfigMode, type OidcVaultCookieDeploymentMode, type OidcVaultCookieOptions, type OidcVaultCookieSameSite, type OidcVaultDeviceBindingMode, type OidcVaultDeviceBindingOptions, type OidcVaultDeviceBindingStoreProvider, type OidcVaultDiagnosticCorrelation, type OidcVaultDpopAlgorithm, type OidcVaultDpopBinding, type OidcVaultDpopDiagnosticEvent, type OidcVaultDpopDiagnosticObserver, type OidcVaultDpopDiagnosticOutcome, type OidcVaultDpopDiagnosticReason, type OidcVaultDpopDiagnosticStage, type OidcVaultDpopDiagnosticTiming, type OidcVaultDpopNonceOptions, type OidcVaultDpopOperation, type OidcVaultDpopProofOptions, OidcVaultDpopReplayCapacityError, type OidcVaultDpopReplayStore, type OidcVaultDpopVerificationProvenance, type OidcVaultEnv, type OidcVaultErrorContext, type OidcVaultFingerprintRecognitionOptions, type OidcVaultHookContext, type OidcVaultHooks, OidcVaultInvalidAccessTokenError, type OidcVaultJwtAccessTokenClaims, type OidcVaultJwtAccessTokenIssuerOptions, type OidcVaultJwtAccessTokenValidatorOptions, type OidcVaultJwtSigningAlgorithm, OidcVaultLogoutNavigationCapacityError, type OidcVaultLogoutNavigationOptions, type OidcVaultLogoutNavigationStoreProvider, type OidcVaultLogoutNavigationTicket, type OidcVaultOptions, type OidcVaultProviderMetadata, type OidcVaultRecordBindingMatch, type OidcVaultRequestAwareAccessTokenValidationResult, type OidcVaultRequestAwareAccessTokenValidator, type OidcVaultResolvedConfig, type OidcVaultRouteName, type OidcVaultSession, type OidcVaultSessionInput, type OidcVaultSessionRevocationContext, OidcVaultSessionTransport, OidcVaultStoreConflictError, type OidcVaultStoreProvider, OidcVaultTokenIssueResult, type OidcVaultTokenIssuer, type OidcVaultTokenOperation, type OidcVaultTokenOutcomeEvent, type OidcVaultTokenOutcomeObserver, type OidcVaultTransactionCookieOptions, OidcVaultUserProfile, type OidcVaultVerifiedDpopBinding, type ReserveDpopProofInput, type RotateSessionInput, createOidcVaultAccessTokenMiddleware, createOidcVaultAuthenticator, createOidcVaultJwtAccessTokenIssuer, createOidcVaultJwtAccessTokenValidator, createOidcVaultMiddleware, normalizeOidcVaultBasePath, resolveOidcVaultConfig, resolveOidcVaultConfigFromEnv };
|