@passflow/core 0.14.1 → 0.16.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2751 -1196
- package/dist/index.mjs.map +1 -1
- package/dist/lib/api/auth.d.ts +17 -2
- package/dist/lib/api/auth.d.ts.map +1 -1
- package/dist/lib/api/axios-client.d.ts +47 -2
- package/dist/lib/api/axios-client.d.ts.map +1 -1
- package/dist/lib/api/index.d.ts +1 -0
- package/dist/lib/api/index.d.ts.map +1 -1
- package/dist/lib/api/model.d.ts +67 -2
- package/dist/lib/api/model.d.ts.map +1 -1
- package/dist/lib/api/upgrade.d.ts +39 -0
- package/dist/lib/api/upgrade.d.ts.map +1 -0
- package/dist/lib/index.d.ts +4 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/interceptors/fetch-registry.d.ts +96 -0
- package/dist/lib/interceptors/fetch-registry.d.ts.map +1 -0
- package/dist/lib/passflow.d.ts +103 -1
- package/dist/lib/passflow.d.ts.map +1 -1
- package/dist/lib/services/auth-service.d.ts +51 -2
- package/dist/lib/services/auth-service.d.ts.map +1 -1
- package/dist/lib/upgrade/acr.d.ts +85 -0
- package/dist/lib/upgrade/acr.d.ts.map +1 -0
- package/dist/lib/upgrade/axios-adapter.d.ts +81 -0
- package/dist/lib/upgrade/axios-adapter.d.ts.map +1 -0
- package/dist/lib/upgrade/challenge.d.ts +158 -3
- package/dist/lib/upgrade/challenge.d.ts.map +1 -1
- package/dist/lib/upgrade/client.d.ts +29 -0
- package/dist/lib/upgrade/client.d.ts.map +1 -0
- package/dist/lib/upgrade/controller.d.ts +366 -25
- package/dist/lib/upgrade/controller.d.ts.map +1 -1
- package/dist/lib/upgrade/core.d.ts +353 -0
- package/dist/lib/upgrade/core.d.ts.map +1 -0
- package/dist/lib/upgrade/errors.d.ts +208 -0
- package/dist/lib/upgrade/errors.d.ts.map +1 -0
- package/dist/lib/upgrade/facade.d.ts +183 -0
- package/dist/lib/upgrade/facade.d.ts.map +1 -0
- package/dist/lib/upgrade/fetch-adapter.d.ts +30 -0
- package/dist/lib/upgrade/fetch-adapter.d.ts.map +1 -0
- package/dist/lib/upgrade/index.d.ts +15 -0
- package/dist/lib/upgrade/index.d.ts.map +1 -1
- package/dist/lib/upgrade/markers.d.ts +64 -0
- package/dist/lib/upgrade/markers.d.ts.map +1 -0
- package/dist/lib/upgrade/replay.d.ts +132 -0
- package/dist/lib/upgrade/replay.d.ts.map +1 -0
- package/dist/lib/upgrade/select.d.ts.map +1 -1
- package/dist/lib/upgrade/session.d.ts +72 -0
- package/dist/lib/upgrade/session.d.ts.map +1 -0
- package/dist/lib/upgrade/snapshot.d.ts +196 -0
- package/dist/lib/upgrade/snapshot.d.ts.map +1 -0
- package/dist/lib/upgrade/transport.d.ts +69 -0
- package/dist/lib/upgrade/transport.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passflow.d.ts","sourceRoot":"","sources":["../../lib/passflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAGhB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,6BAA6B,EAClC,KAAK,cAAc,EAEnB,4BAA4B,EAC5B,KAAK,uCAAuC,EAC5C,KAAK,mCAAmC,EACxC,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,yCAAyC,EAC9C,KAAK,iCAAiC,EACtC,KAAK,qCAAqC,EAC1C,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAI7B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,K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,OAAO;IAI9B;;;;;;;;;;OAUG;IACH,qBAAqB,IAAI,IAAI;CAG9B"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AuthAPI, PassflowAuthorizationResponse, PassflowFederatedAuthExtendedPayload, PassflowFederatedAuthPayload, PassflowPasskeyAuthenticateStartPayload, PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInCompletePayload, PassflowPasswordlessSignInPayload, PassflowSendPasswordResetEmailPayload, PassflowSignInPayload, PassflowSignUpPayload, PassflowSuccessResponse, PassflowValidationResponse, TokenExchangeConfig } from '../api';
|
|
1
|
+
import { AuthAPI, PassflowAuthorizationResponse, PassflowFederatedAuthExtendedPayload, PassflowFederatedAuthPayload, PassflowPasskeyAuthenticateStartPayload, PassflowPasskeyRegisterStartPayload, PassflowPasswordlessResponse, PassflowPasswordlessSignInCompletePayload, PassflowPasswordlessSignInPayload, PassflowSendPasswordResetEmailPayload, PassflowSignInPayload, PassflowSignUpPayload, PassflowSuccessResponse, PassflowValidationResponse, TokenExchangeConfig, type UpgradeRefreshField } from '../api';
|
|
2
2
|
import { DeviceService } from '../device';
|
|
3
3
|
import { type PlatformAdapter } from '../platform';
|
|
4
4
|
import { StorageManager } from '../storage';
|
|
5
5
|
import { PassflowStore } from '../store';
|
|
6
6
|
import { ParsedTokens, Tokens } from '../types';
|
|
7
|
+
import { type UpgradeSessionPin } from '../upgrade/session';
|
|
7
8
|
import { TokenCacheService } from './token-cache-service';
|
|
8
9
|
/**
|
|
9
10
|
* Service for handling authentication related functionality
|
|
@@ -54,7 +55,55 @@ export declare class AuthService {
|
|
|
54
55
|
passwordlessSignIn(payload: PassflowPasswordlessSignInPayload): Promise<PassflowPasswordlessResponse>;
|
|
55
56
|
passwordlessSignInComplete(payload: PassflowPasswordlessSignInCompletePayload): Promise<PassflowValidationResponse>;
|
|
56
57
|
logOut(): Promise<void>;
|
|
57
|
-
|
|
58
|
+
/**
|
|
59
|
+
* The session and user identity this client currently holds, or `undefined`
|
|
60
|
+
* when none is readable.
|
|
61
|
+
*
|
|
62
|
+
* Read from the stored access token's claims, which is the same source every
|
|
63
|
+
* other client-side session fact comes from. In a delivery mode that keeps
|
|
64
|
+
* the access token out of reach — a cookie-mode or BFF session — there is
|
|
65
|
+
* nothing to read and the answer is `undefined`.
|
|
66
|
+
*/
|
|
67
|
+
readSessionPin(): UpgradeSessionPin | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Refuses to APPLY tokens that belong to a different principal (§13.4
|
|
70
|
+
* revision 6 / H2).
|
|
71
|
+
*
|
|
72
|
+
* Called immediately before the rotated tokens are written, which is the only
|
|
73
|
+
* place the check cannot be bypassed: the epoch guard around `prepare` and
|
|
74
|
+
* `commit` runs before the server call, and token application happens after
|
|
75
|
+
* it returns, so a logout and re-login in between let user A's flight write
|
|
76
|
+
* over user B's session.
|
|
77
|
+
*
|
|
78
|
+
* It throws `UpgradeSessionChangedError`, so the elevation terminates as
|
|
79
|
+
* §13.3's `session changed mid-flight` on every surface — the outcome class
|
|
80
|
+
* itself, not a transport failure that happens to carry the kind: this is the
|
|
81
|
+
* only entry point into token application, so a caller holding the promise
|
|
82
|
+
* directly (`AuthService.refreshToken`) must see the same `code` a waiter
|
|
83
|
+
* behind the controller does. It does NOT invalidate
|
|
84
|
+
* anything: `setSessionInvalid()` runs off a positive allow-list elsewhere,
|
|
85
|
+
* and the live user is never logged out as a side effect of someone else's
|
|
86
|
+
* abandoned flight. Fail-closed on token application, fail-open on session
|
|
87
|
+
* state — two different axes.
|
|
88
|
+
*/
|
|
89
|
+
private assertSessionPin;
|
|
90
|
+
/**
|
|
91
|
+
* Refreshes the session, optionally committing an assurance upgrade.
|
|
92
|
+
*
|
|
93
|
+
* This is the ONLY token-storing path for all four delivery modes, which is
|
|
94
|
+
* why the upgrade commit goes through here rather than posting to
|
|
95
|
+
* `/auth/refresh` directly: it saves the rotated tokens, updates the cache and
|
|
96
|
+
* emits `Refresh`. Bypassing it would elevate the session on the server and
|
|
97
|
+
* leave the client holding stale tokens — everything looks fine until the next
|
|
98
|
+
* request 401s.
|
|
99
|
+
*
|
|
100
|
+
* An upgrade commit changes the error handling in one specific way: a 4xx is
|
|
101
|
+
* NOT treated as a dead session. The server answers a wrong code with a 401,
|
|
102
|
+
* and tearing the session down there is the logout-at-step-up defect. The
|
|
103
|
+
* upgrade transport classifies those failures and invalidates the session
|
|
104
|
+
* itself when the 401 turns out to be a genuine expiry.
|
|
105
|
+
*/
|
|
106
|
+
refreshToken(upgrade?: UpgradeRefreshField, pin?: UpgradeSessionPin): Promise<PassflowAuthorizationResponse>;
|
|
58
107
|
sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload): Promise<PassflowSuccessResponse>;
|
|
59
108
|
resetPassword(newPassword: string, scopes?: string[]): Promise<PassflowAuthorizationResponse>;
|
|
60
109
|
passkeyRegister(payload: PassflowPasskeyRegisterStartPayload): Promise<PassflowAuthorizationResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-service.d.ts","sourceRoot":"","sources":["../../../lib/services/auth-service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,6BAA6B,EAE7B,oCAAoC,EACpC,4BAA4B,EAC5B,uCAAuC,EACvC,mCAAmC,EACnC,4BAA4B,EAC5B,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,EACrC,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"auth-service.d.ts","sourceRoot":"","sources":["../../../lib/services/auth-service.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,6BAA6B,EAE7B,oCAAoC,EACpC,4BAA4B,EAC5B,uCAAuC,EACvC,mCAAmC,EACnC,4BAA4B,EAC5B,yCAAyC,EACzC,iCAAiC,EACjC,qCAAqC,EACrC,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,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B,CAAC,OAAO,EAAE,oCAAoC,GAAG,MAAM;IAsBvE,sBAAsB,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC;IAwClF,yBAAyB,CAAC,OAAO,EAAE,4BAA4B,GAAG,IAAI;IAStE,eAAe,CAAC,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,MAAM;IA0BhH,YAAY,CAAC,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,IAAI;IAa3G;;;OAGG;IACH,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO;IAgCpD;;OAEG;IACG,kBAAkB,CAAC,SAAS,UAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0BxE;;;;OAIG;IACG,SAAS,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CA0CjE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one implementation of "what level does this `acr_values` string demand".
|
|
3
|
+
*
|
|
4
|
+
* `challenge.ts` and `select.ts` both import it, so there is exactly one answer
|
|
5
|
+
* in this package (§13.2.1b). It is consistent with the Go model *where the Go
|
|
6
|
+
* model parses a single value* (`Level("2") === 2`) and deliberately diverges
|
|
7
|
+
* where Go parses a list as a scalar: `token_acr.go`'s `Level()` is
|
|
8
|
+
* `strconv.Atoi` over the whole string, so `Level("2 3")` is 0 — the weakest
|
|
9
|
+
* possible reading of the stronger demand, which inverts channel precedence in
|
|
10
|
+
* exactly the third-party interop case the precedence rule exists for.
|
|
11
|
+
*
|
|
12
|
+
* ## The lexical contract
|
|
13
|
+
*
|
|
14
|
+
* `acr_values` is a space-delimited list of values the server will accept (OIDC
|
|
15
|
+
* Core §3.1.2.1, RFC 9470 §3), and satisfying ANY listed value suffices. So the
|
|
16
|
+
* bar to clear is the list's MINIMUM participating level — the weakest value
|
|
17
|
+
* that satisfies the server, which is by definition what it is demanding.
|
|
18
|
+
*
|
|
19
|
+
* A token PARTICIPATES iff the whole token is decimal digits (`/^[0-9]+$/`).
|
|
20
|
+
* `"02"` participates as 2, matching `strconv.Atoi`. Everything else does not:
|
|
21
|
+
* `"2gold"`, `"gold"`, `"2.0"`, `"-1"`, `"+2"`, `"1e2"`, `"urn:example:gold"`,
|
|
22
|
+
* the empty token. Two deliberate narrowings:
|
|
23
|
+
*
|
|
24
|
+
* - **Whole-token only.** `Number.parseInt("2gold", 10)` reads 2, which would
|
|
25
|
+
* contradict the rule that opaque values do not participate — and would let
|
|
26
|
+
* a hostile or buggy channel smuggle a bar out of a value nobody meant as a
|
|
27
|
+
* level.
|
|
28
|
+
* - **Negatives excluded**, even though `strconv.Atoi` accepts them. A
|
|
29
|
+
* negative assurance level has no meaning in the Passflow scale or in OIDC,
|
|
30
|
+
* and admitting one would hand an attacker a bar below every real level.
|
|
31
|
+
*
|
|
32
|
+
* Every non-negative integer is in domain. Passflow's scale is 0..3, but a
|
|
33
|
+
* third-party server may legally demand 4; the SDK never refuses a demand
|
|
34
|
+
* client-side (§13.4) — it ranks factors for the highest bar it knows and lets
|
|
35
|
+
* the server's verdict on the replay decide.
|
|
36
|
+
*
|
|
37
|
+
* ## "unknown" is not zero, and zero is not absent
|
|
38
|
+
*
|
|
39
|
+
* An opaque issuer-defined value (`urn:…`, `"gold"`) is legal OIDC and is NOT a
|
|
40
|
+
* level at all: scoring it 0 would make it the weakest possible requirement, so
|
|
41
|
+
* the other channel would always win and the anti-downgrade rule would itself
|
|
42
|
+
* produce a downgrade. A literal `"0"`, by contrast, IS a participating level
|
|
43
|
+
* that happens to demand nothing — OIDC defines `acr` 0 as authentication not
|
|
44
|
+
* meeting even ISO/IEC 29115 level 1, so a server listing it is stating it
|
|
45
|
+
* accepts unelevated authentication. Same net contribution (no constraint),
|
|
46
|
+
* different diagnostics.
|
|
47
|
+
*/
|
|
48
|
+
/** What an `acr_values` list demands, plus what it discarded getting there. */
|
|
49
|
+
export type AcrReading = {
|
|
50
|
+
/**
|
|
51
|
+
* The bar this list demands: the minimum participating level, when that is a
|
|
52
|
+
* real constraint. `undefined` means this list contributes no `acr`
|
|
53
|
+
* constraint — it was absent, every token was non-participating, or the
|
|
54
|
+
* minimum participating level was `0`.
|
|
55
|
+
*/
|
|
56
|
+
level?: number;
|
|
57
|
+
/** The raw list, verbatim, when one was present at all. */
|
|
58
|
+
raw?: string;
|
|
59
|
+
/** True when a list was present but no token participated (`"urn:example:gold"`). */
|
|
60
|
+
unorderable: boolean;
|
|
61
|
+
/** True when the minimum participating level was `0` — a demand of nothing. */
|
|
62
|
+
zero: boolean;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Parses one `acr_values` token. Returns `undefined` for every value that does
|
|
66
|
+
* not participate, which is the only distinction the comparator needs.
|
|
67
|
+
*/
|
|
68
|
+
export declare const parseAcrToken: (token: string) => number | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Reduces an `acr_values` list to the bar it demands.
|
|
71
|
+
*
|
|
72
|
+
* The reducer is `min` over participating tokens; the cross-channel comparator
|
|
73
|
+
* (`challenge.ts`) then takes the `max` over per-channel minima, which is the
|
|
74
|
+
* monotonic lattice join and therefore can never resolve below a correctly
|
|
75
|
+
* parsed channel.
|
|
76
|
+
*/
|
|
77
|
+
export declare const readAcrValues: (raw: string | undefined | null) => AcrReading;
|
|
78
|
+
/**
|
|
79
|
+
* The level an `acr_values` list demands, or `undefined` for no constraint.
|
|
80
|
+
*
|
|
81
|
+
* The convenience form `select.ts` wants: it ranks factors and has no use for
|
|
82
|
+
* the diagnostics.
|
|
83
|
+
*/
|
|
84
|
+
export declare const requiredAcrLevel: (raw: string | undefined | null) => number | undefined;
|
|
85
|
+
//# sourceMappingURL=acr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"acr.d.ts","sourceRoot":"","sources":["../../../lib/upgrade/acr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAKH,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,WAAW,EAAE,OAAO,CAAC;IACrB,+EAA+E;IAC/E,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAKF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAAM,GAAG,SACmB,CAAC;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,UA8B9D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,MAAM,GAAG,SAAqC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The AXIOS adapter over `handleChallenge`. Two of the four surfaces use it.
|
|
3
|
+
*
|
|
4
|
+
* **NO LOGIC IN AN ADAPTER.** It builds a `ChallengeContext` from an
|
|
5
|
+
* `AxiosError` and settles through `settleAxiosOutcome`; it parses no
|
|
6
|
+
* challenge, compares no bar, decides no scope, counts no retry and chooses no
|
|
7
|
+
* error class. The replay-once guard in particular is NOT here: the replay goes
|
|
8
|
+
* back through `request(config)` and re-enters this very interceptor, so the
|
|
9
|
+
* guard has to be surface-independent, and it is — the core reads and writes
|
|
10
|
+
* `markers.replayed`, and this file only says where that marker lives (on the
|
|
11
|
+
* request config, where axios hands it back unchanged).
|
|
12
|
+
*
|
|
13
|
+
* ## Why the parameter is structurally typed
|
|
14
|
+
*
|
|
15
|
+
* `ResponseInterceptorHost` is declared by us and satisfied by any axios
|
|
16
|
+
* instance. We never name axios' own types in the signature, so a customer on a
|
|
17
|
+
* different axios major — or on a fetch-based client that mimics the
|
|
18
|
+
* interceptor API — attaches without a type error, and this package's axios
|
|
19
|
+
* version is not a constraint on theirs.
|
|
20
|
+
*
|
|
21
|
+
* ## Why it is the error interceptor
|
|
22
|
+
*
|
|
23
|
+
* axios' own contract, expressed in `validateStatus`, is that a non-2xx
|
|
24
|
+
* response rejects, so a 401/403 arrives as an `AxiosError`. Resolving a
|
|
25
|
+
* declined step-up would invert that contract: every caller's post-`await`
|
|
26
|
+
* success path would run after the user clicked "Not now".
|
|
27
|
+
*/
|
|
28
|
+
import { type AbortView, type UpgradeInterceptorOptionsSource } from './core';
|
|
29
|
+
/**
|
|
30
|
+
* The only thing we require of a client: that it lets us add and remove a
|
|
31
|
+
* response interceptor. Duck-typed deliberately — see the module comment.
|
|
32
|
+
*/
|
|
33
|
+
export type ResponseInterceptorHost = {
|
|
34
|
+
interceptors: {
|
|
35
|
+
response: {
|
|
36
|
+
use(onFulfilled?: (value: any) => any, onRejected?: (error: any) => any): number;
|
|
37
|
+
eject(id: number): void;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
/** Re-issues a request from a config. Supplied by whoever owns the client. */
|
|
42
|
+
export type AxiosReissue = (config: AxiosConfigLike) => Promise<unknown>;
|
|
43
|
+
/** The subset of `AxiosRequestConfig` this adapter reads. */
|
|
44
|
+
export type AxiosConfigLike = {
|
|
45
|
+
url?: string;
|
|
46
|
+
baseURL?: string;
|
|
47
|
+
method?: string;
|
|
48
|
+
data?: unknown;
|
|
49
|
+
headers?: unknown;
|
|
50
|
+
/**
|
|
51
|
+
* The caller's own signal, forwarded to the core untouched. Typed as the
|
|
52
|
+
* core's `AbortView` so an `AbortSignal`'s listener pair types through: that
|
|
53
|
+
* pair is what lets the core settle this caller at abort time while a proof
|
|
54
|
+
* is still pending (REQ-C12). A plain `{ aborted }` object is still accepted,
|
|
55
|
+
* and then the core reads the flag after the elevation as it always did.
|
|
56
|
+
*/
|
|
57
|
+
signal?: AbortView;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The rejection handler itself: an `AxiosError` in, a replayed response or a
|
|
61
|
+
* tagged rejection out.
|
|
62
|
+
*
|
|
63
|
+
* Shared by `attachUpgradeAuth` (the customer's own instance) and by the SDK's
|
|
64
|
+
* internal seam, so both surfaces settle from the same table.
|
|
65
|
+
*/
|
|
66
|
+
export declare const createAxiosUpgradeHandler: (source: UpgradeInterceptorOptionsSource, reissue: AxiosReissue) => (error: unknown) => Promise<unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Attaches step-up handling to a client the developer already owns, MUTATING
|
|
69
|
+
* it, and returns a disposer that ejects exactly the interceptor it added.
|
|
70
|
+
*
|
|
71
|
+
* It returns the disposer rather than the instance on purpose: it mutates, and
|
|
72
|
+
* returning the instance would invite `const api = attachAuth(axios.create())`
|
|
73
|
+
* and read as if it had built something. The disposer is also what a React
|
|
74
|
+
* effect needs.
|
|
75
|
+
*
|
|
76
|
+
* `reissue` defaults to the host's own `request`, duck-typed, so the replay
|
|
77
|
+
* goes back through the customer's interceptors, `baseURL` and adapter rather
|
|
78
|
+
* than through some instance of ours.
|
|
79
|
+
*/
|
|
80
|
+
export declare const attachUpgradeAuth: (host: ResponseInterceptorHost, source: UpgradeInterceptorOptionsSource, reissue?: AxiosReissue) => (() => void);
|
|
81
|
+
//# sourceMappingURL=axios-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axios-adapter.d.ts","sourceRoot":"","sources":["../../../lib/upgrade/axios-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,KAAK,SAAS,EAGd,KAAK,+BAA+B,EAIrC,MAAM,QAAQ,CAAC;AAMhB;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,YAAY,EAAE;QACZ,QAAQ,EAAE;YAER,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,EAAE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,GAAG,MAAM,CAAC;YACjF,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;SACzB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEzE,6DAA6D;AAC7D,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAsMF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACnC,QAAQ,+BAA+B,EAAE,SAAS,YAAY,MACxD,OAAO,OAAO,KAAG,OAAO,CAAC,OAAO,CActC,CAAC;AAEJ;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,uBAAuB,EAC7B,QAAQ,+BAA+B,EACvC,UAAU,YAAY,KACrB,CAAC,MAAM,IAAI,CAiBb,CAAC"}
|
|
@@ -28,13 +28,70 @@ export declare const UPGRADE_REQUIRED = "upgrade_required";
|
|
|
28
28
|
* valid — it means "re-prove a factor" without further qualification.
|
|
29
29
|
*/
|
|
30
30
|
export type UpgradeChallenge = {
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Required authentication context class (`acr`), e.g. `'2'`.
|
|
33
|
+
*
|
|
34
|
+
* After a two-channel merge this is the raw list of the channel that SET THE
|
|
35
|
+
* BAR, with the header preferred on a numeric tie. A channel that contributed
|
|
36
|
+
* no level never supplies it — showing `"2gold"` as the bar would
|
|
37
|
+
* misrepresent what the server demanded.
|
|
38
|
+
*/
|
|
32
39
|
acrValues?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The parsed bar: `max` over each channel's `min` participating level
|
|
42
|
+
* (§13.2.1a). `undefined` means unknown or unconstrained on this axis.
|
|
43
|
+
*
|
|
44
|
+
* Optional, and absent from the single-channel parsers' output, so
|
|
45
|
+
* `parseChallengeHeader` / `parseChallengeBody` keep the exact shape they
|
|
46
|
+
* ship with. `readUpgradeChallenge` always sets it when a level was parsed.
|
|
47
|
+
*/
|
|
48
|
+
requiredLevel?: number;
|
|
33
49
|
/** Maximum permitted age of the authentication event, in seconds. */
|
|
34
50
|
maxAge?: number;
|
|
35
51
|
/** The status that carried the challenge: 401 (protected resource) or 403 (session exchange). */
|
|
36
52
|
status: number;
|
|
53
|
+
/**
|
|
54
|
+
* Every channel that PARSED AS A CHALLENGE in any field — not only the
|
|
55
|
+
* channels that won a comparison. An opaque header contributes no constraint
|
|
56
|
+
* yet must still be counted, because only something that saw and discarded it
|
|
57
|
+
* can report it. `length === 2` means "both channels carried a challenge".
|
|
58
|
+
*
|
|
59
|
+
* Set by `readUpgradeChallenge`; absent from the single-channel parsers.
|
|
60
|
+
*/
|
|
61
|
+
channels?: ChallengeChannel[];
|
|
37
62
|
};
|
|
63
|
+
/** Which wire channel a challenge was read from. */
|
|
64
|
+
export type ChallengeChannel = 'header' | 'body';
|
|
65
|
+
/**
|
|
66
|
+
* `max_age` has three outcomes, not two, so it gets a three-valued return.
|
|
67
|
+
*
|
|
68
|
+
* - **absent** — the field was not sent. Silent; it contributes nothing and
|
|
69
|
+
* there is nothing to report.
|
|
70
|
+
* - **invalid** — `<= 0`, or non-numeric. It contributes nothing AND raises
|
|
71
|
+
* `'zero-constraint-ignored'`, because a literal `0` cannot be both "absent"
|
|
72
|
+
* and "invalid" while the parser is required to tell them apart.
|
|
73
|
+
* - **valid** — a positive number of seconds.
|
|
74
|
+
*
|
|
75
|
+
* Treating `0` as invalid is a deliberate narrowing of RFC 9470 §3, which
|
|
76
|
+
* permits `max_age=0` as a maximally strict freshness demand. Two reasons: this
|
|
77
|
+
* parser already accepted only values `> 0` before §13, so preserving zero
|
|
78
|
+
* would be a behaviour change on a shipped parser rather than a gap in it; and
|
|
79
|
+
* under "smaller positive wins" a literal `0` from a buggy serializer or a
|
|
80
|
+
* hostile body would force re-proof on EVERY request — an unauthenticated
|
|
81
|
+
* denial-of-service against the user's own session. Recorded as a known
|
|
82
|
+
* deviation so a later reader does not "fix" it.
|
|
83
|
+
*/
|
|
84
|
+
export type MaxAgeReading = {
|
|
85
|
+
kind: 'absent';
|
|
86
|
+
} | {
|
|
87
|
+
kind: 'invalid';
|
|
88
|
+
raw: unknown;
|
|
89
|
+
} | {
|
|
90
|
+
kind: 'valid';
|
|
91
|
+
value: number;
|
|
92
|
+
};
|
|
93
|
+
/** Reads `max_age` into its three outcomes. See `MaxAgeReading`. */
|
|
94
|
+
export declare const parseMaxAge: (raw: unknown) => MaxAgeReading;
|
|
38
95
|
/**
|
|
39
96
|
* Reads a upgrade challenge out of a `WWW-Authenticate` header, or returns
|
|
40
97
|
* `undefined` when the header is absent or describes some other failure.
|
|
@@ -50,9 +107,107 @@ export declare const parseChallengeHeader: (header: string | undefined | null, s
|
|
|
50
107
|
* even though it also sets the standard header.
|
|
51
108
|
*/
|
|
52
109
|
export declare const parseChallengeBody: (body: unknown, status: number) => UpgradeChallenge | undefined;
|
|
110
|
+
/** The bar a challenge demanded, or an elevation reached, on both axes. */
|
|
111
|
+
export type AssuranceBar = {
|
|
112
|
+
/** The raw winning `acr_values` list, for display and diagnostics. */
|
|
113
|
+
acrValues?: string;
|
|
114
|
+
/** The parsed bar. `undefined` = unknown, or not constrained on this axis. */
|
|
115
|
+
level?: number;
|
|
116
|
+
/** The freshness constraint, when that is what was demanded. */
|
|
117
|
+
maxAge?: number;
|
|
118
|
+
};
|
|
119
|
+
/** The reasons the SDK can decline to act on a challenge, or act on a suspect one. */
|
|
120
|
+
export type UpgradeDiagnosticReason = 'no-channel' | 'header-required-but-absent' | 'channels-disagree' | 'channels-unorderable' | 'zero-constraint-ignored' | 'challenge-out-of-scope' | 'elevated-insufficient' | 'replay-unsupported';
|
|
121
|
+
/**
|
|
122
|
+
* One diagnostic record.
|
|
123
|
+
*
|
|
124
|
+
* A diagnostic is the only observable signal of the response-rewriting and the
|
|
125
|
+
* misconfiguration this design warns about, so it routes through a callback
|
|
126
|
+
* whose DEFAULT sink is `console.warn` — never `debug`, which is invisible in
|
|
127
|
+
* every default configuration. A deployment where step-up silently never fires
|
|
128
|
+
* must be distinguishable from one where it was never required.
|
|
129
|
+
*/
|
|
130
|
+
export type UpgradeDiagnostic = {
|
|
131
|
+
status: number;
|
|
132
|
+
/**
|
|
133
|
+
* The request's URL. The parser does not know it — it is handed a status, a
|
|
134
|
+
* header reader and a body — so it emits `''` and the core, which owns the
|
|
135
|
+
* request context, fills it in before forwarding to the sink.
|
|
136
|
+
*/
|
|
137
|
+
url: string;
|
|
138
|
+
reason: UpgradeDiagnosticReason;
|
|
139
|
+
detail?: {
|
|
140
|
+
obtained?: AssuranceBar;
|
|
141
|
+
required?: AssuranceBar;
|
|
142
|
+
/** Raw channel inputs, including values discarded as unorderable. */
|
|
143
|
+
header?: string;
|
|
144
|
+
body?: string;
|
|
145
|
+
/** Which field was discarded, for `'zero-constraint-ignored'`. */
|
|
146
|
+
field?: 'acr_values' | 'max_age';
|
|
147
|
+
/** Which operation, for per-waiter reasons. */
|
|
148
|
+
method?: string;
|
|
149
|
+
/** A human-readable sentence naming the fix. The default sink prints it. */
|
|
150
|
+
message?: string;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
/** Where diagnostics go. `console.warn` is the default sink, not the only one. */
|
|
154
|
+
export type UpgradeDiagnosticSink = (diagnostic: UpgradeDiagnostic) => void;
|
|
155
|
+
/** What `readUpgradeChallenge` is given. The CALLER decides whether reading the body is in scope. */
|
|
156
|
+
export type ChallengeInput = {
|
|
157
|
+
status: number;
|
|
158
|
+
getHeader: (name: string) => string | undefined | null;
|
|
159
|
+
/** Pre-read. Omit it — do not pass `undefined` lazily — when the body must not be read. */
|
|
160
|
+
body?: unknown;
|
|
161
|
+
};
|
|
162
|
+
export type ChallengeReadOptions = {
|
|
163
|
+
/**
|
|
164
|
+
* `'header'` takes the challenge from the header ONLY: the body is not read
|
|
165
|
+
* for challenge purposes at all, and a 401/403 with no parseable header is a
|
|
166
|
+
* non-challenge. For an integrator whose compliance rule names RFC 9470, or
|
|
167
|
+
* who does not consider a third-party server's body authoritative. Two
|
|
168
|
+
* intended consequences: a strictly stronger body is ignored, and since no
|
|
169
|
+
* body is resolved the disagreement diagnostic never fires.
|
|
170
|
+
*
|
|
171
|
+
* There is deliberately no `'body'` value. Excluding a third-party API's
|
|
172
|
+
* standard header is what `shouldIntercept` is for, and a `'body'` setting
|
|
173
|
+
* would mandate a non-standard channel, which §13.1a forbids.
|
|
174
|
+
*/
|
|
175
|
+
requireChallengeChannel?: 'header';
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* What a parse found, and what it had to discard finding it.
|
|
179
|
+
*
|
|
180
|
+
* A pure parser returning its findings beats a sink parameter: it is
|
|
181
|
+
* side-effect-free and directly testable against a fixture corpus, and
|
|
182
|
+
* `'channels-disagree'`, `'zero-constraint-ignored'` and
|
|
183
|
+
* `'channels-unorderable'` are knowable ONLY inside the parse — the shipped
|
|
184
|
+
* parser discarded them before returning, which is why they could not be
|
|
185
|
+
* surfaced at all.
|
|
186
|
+
*/
|
|
187
|
+
export type ChallengeReading = {
|
|
188
|
+
challenge?: UpgradeChallenge;
|
|
189
|
+
/** `[]` when there is nothing to report. Never `undefined`. */
|
|
190
|
+
diagnostics: UpgradeDiagnostic[];
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Reads a step-up challenge from both channels at once, merging them field-wise
|
|
194
|
+
* and reporting everything it discarded.
|
|
195
|
+
*
|
|
196
|
+
* The additive sibling of `parseUpgradeChallenge`, which keeps its shipped
|
|
197
|
+
* three-parameter signature and delegates here. It keeps the `getHeader`
|
|
198
|
+
* callback form — the reason the function works from both the fetch surface and
|
|
199
|
+
* the axios surface, where `AxiosError.response` hands back a plain object
|
|
200
|
+
* rather than a DOM `Headers`.
|
|
201
|
+
*/
|
|
202
|
+
export declare const readUpgradeChallenge: (input: ChallengeInput, options?: ChallengeReadOptions) => ChallengeReading;
|
|
53
203
|
/**
|
|
54
|
-
* Resolves a upgrade challenge from a response,
|
|
55
|
-
*
|
|
204
|
+
* Resolves a upgrade challenge from a response, from either channel.
|
|
205
|
+
*
|
|
206
|
+
* The SHIPPED export: same name, same three parameters, same return, published
|
|
207
|
+
* in `@passflow/core@0.14.1`. It is now a thin delegate over
|
|
208
|
+
* `readUpgradeChallenge`, so there is one merge rule rather than two parsers
|
|
209
|
+
* that can drift — but it discards the diagnostics, which is why a caller that
|
|
210
|
+
* needs them (the core) calls the sibling directly.
|
|
56
211
|
*
|
|
57
212
|
* Returns `undefined` for every response that is not a upgrade challenge —
|
|
58
213
|
* including ordinary `401`s, which callers must keep treating as "session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../../lib/upgrade/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../../lib/upgrade/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,mFAAmF;AACnF,eAAO,MAAM,gCAAgC,qCAA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,CAAC;IAC7B,+DAA+D;IAC/D,WAAW,EAAE,iBAAiB,EAAE,CAAC;CAClC,CAAC;AAqBF;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,cAAc,EAAE,UAAU,oBAAoB,KAAG,gBAsG5F,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,MAAM,EACd,WAAW,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,IAAI,EACtD,OAAO,OAAO,KACb,gBAAgB,GAAG,SAAwE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createClient` — the greenfield surface, for a developer with no HTTP client
|
|
3
|
+
* of their own.
|
|
4
|
+
*
|
|
5
|
+
* It is **not a fourth code path**: it is `axios.create(config)` followed by the
|
|
6
|
+
* axios adapter, which is why it cannot drift from `attachAuth`. The attach is
|
|
7
|
+
* passed in rather than imported so this module holds no scope, no controller
|
|
8
|
+
* and no options — only the constructor.
|
|
9
|
+
*
|
|
10
|
+
* It also costs no new dependency: `axios` is already a hard dependency of this
|
|
11
|
+
* package. This is the one place axios' own types are deliberately back on the
|
|
12
|
+
* public surface — `attachAuth`'s structural `ResponseInterceptorHost` exists to
|
|
13
|
+
* avoid exactly that, and the asymmetry is the point: a developer asking us to
|
|
14
|
+
* BUILD their client has accepted axios, while one handing us their own must not
|
|
15
|
+
* be pinned to our major.
|
|
16
|
+
*/
|
|
17
|
+
import { type AxiosInstance, type CreateAxiosDefaults } from 'axios';
|
|
18
|
+
import type { ResponseInterceptorHost } from './axios-adapter';
|
|
19
|
+
/**
|
|
20
|
+
* axios' own create options plus nothing of ours, so `baseURL`, `headers`,
|
|
21
|
+
* `timeout`, `adapter` and interceptor ordering all stay the customer's.
|
|
22
|
+
*
|
|
23
|
+
* A `baseURL` is NOT read as a declared backend: that would be the derived
|
|
24
|
+
* interception model through a side door. An un-declared `baseURL` gets a
|
|
25
|
+
* `'challenge-out-of-scope'` diagnostic naming `backend` as the fix.
|
|
26
|
+
*/
|
|
27
|
+
export type CreateClientConfig = CreateAxiosDefaults;
|
|
28
|
+
export declare const createUpgradeClient: (config: CreateClientConfig | undefined, attachAuth: (host: ResponseInterceptorHost) => () => void) => AxiosInstance;
|
|
29
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../lib/upgrade/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAc,EAAE,KAAK,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAErD,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,kBAAkB,GAAG,SAAS,EACtC,YAAY,CAAC,IAAI,EAAE,uBAAuB,KAAK,MAAM,IAAI,KACxD,aAIF,CAAC"}
|