axiam-sdk 1.0.0-beta15 → 1.0.0-beta16

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.
Files changed (48) hide show
  1. package/README.md +230 -10
  2. package/dist/{authzCore-Biyca_Rm.d.ts → authzCore-0fObXIqB.d.ts} +37 -0
  3. package/dist/{authzCore-BZahGkBf.d.cts → authzCore-DJmDAAtw.d.cts} +37 -0
  4. package/dist/browser/index.d.cts +1 -1
  5. package/dist/browser/index.d.ts +1 -1
  6. package/dist/{client-DLapMy-5.d.ts → client-BstRBtp8.d.ts} +471 -29
  7. package/dist/{client-CzVEJTC5.d.cts → client-Dd_XaOtg.d.cts} +471 -29
  8. package/dist/{cookieJar-DIpQK-11.d.ts → cookieJar-D0FxzBQG.d.ts} +1 -1
  9. package/dist/{cookieJar-DoJeU4IN.d.cts → cookieJar-Dvb1Gnwm.d.cts} +1 -1
  10. package/dist/errors-CxqAZsex.d.cts +168 -0
  11. package/dist/errors-CxqAZsex.d.ts +168 -0
  12. package/dist/grpc/index.d.cts +3 -3
  13. package/dist/grpc/index.d.ts +3 -3
  14. package/dist/grpc/index.js +38 -1
  15. package/dist/grpc/index.js.map +1 -1
  16. package/dist/grpc/index.mjs +38 -1
  17. package/dist/grpc/index.mjs.map +1 -1
  18. package/dist/index.d.cts +3 -2
  19. package/dist/index.d.ts +3 -2
  20. package/dist/index.js +39 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +39 -2
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/middleware/index.d.cts +258 -11
  25. package/dist/middleware/index.d.ts +258 -11
  26. package/dist/middleware/index.js +373 -11
  27. package/dist/middleware/index.js.map +1 -1
  28. package/dist/middleware/index.mjs +369 -12
  29. package/dist/middleware/index.mjs.map +1 -1
  30. package/dist/nestjs/index.d.cts +1 -1
  31. package/dist/nestjs/index.d.ts +1 -1
  32. package/dist/nestjs/index.js +9 -3
  33. package/dist/nestjs/index.js.map +1 -1
  34. package/dist/nestjs/index.mjs +9 -3
  35. package/dist/nestjs/index.mjs.map +1 -1
  36. package/dist/node/index.d.cts +2 -2
  37. package/dist/node/index.d.ts +2 -2
  38. package/dist/node/index.js +38 -1
  39. package/dist/node/index.js.map +1 -1
  40. package/dist/node/index.mjs +38 -1
  41. package/dist/node/index.mjs.map +1 -1
  42. package/dist/rest/index.d.cts +5 -170
  43. package/dist/rest/index.d.ts +5 -170
  44. package/dist/rest/index.js +39 -1
  45. package/dist/rest/index.js.map +1 -1
  46. package/dist/rest/index.mjs +39 -2
  47. package/dist/rest/index.mjs.map +1 -1
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # axiam-sdk (TypeScript/JavaScript)
2
2
 
3
+ <!-- Track the CURRENT channel's dist-tag, not `latest`: releases are prereleases and
4
+ the publish job keeps those off `latest` (see "Release / versioning"), so a plain
5
+ `npm/v/axiam-sdk` badge reports whatever was last published to `latest` — today
6
+ 1.0.0-alpha28, dozens of releases stale. Move `beta` below to `rc`, then drop it
7
+ entirely, as the channel advances. -->
3
8
  [![CI](https://github.com/ilpanich/axiam-typescript-sdk/actions/workflows/sdk-ci-typescript.yml/badge.svg?branch=main)](https://github.com/ilpanich/axiam-typescript-sdk/actions/workflows/sdk-ci-typescript.yml)
4
9
  [![Coverage Status](https://coveralls.io/repos/github/ilpanich/axiam-typescript-sdk/badge.svg?branch=main)](https://coveralls.io/github/ilpanich/axiam-typescript-sdk?branch=main)
5
- [![npm](https://img.shields.io/npm/v/axiam-sdk.svg)](https://www.npmjs.com/package/axiam-sdk)
10
+ [![npm](https://img.shields.io/npm/v/axiam-sdk/beta?label=npm%20beta)](https://www.npmjs.com/package/axiam-sdk)
6
11
  [![Docs](https://img.shields.io/badge/docs-TypeDoc-blue.svg)](https://ilpanich.github.io/axiam-typescript-sdk/)
7
12
  [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8
13
 
@@ -13,16 +18,16 @@ Official TypeScript/JavaScript client SDK for [AXIAM](https://github.com/ilpanic
13
18
  ## Package identity
14
19
 
15
20
  - **npm package:** `axiam-sdk`
16
- - **Registry:** [npmjs.com/package/axiam-sdk](https://www.npmjs.com/package/axiam-sdk) _(reserved, not yet published)_
21
+ - **Registry:** [npmjs.com/package/axiam-sdk](https://www.npmjs.com/package/axiam-sdk) — published as prereleases, under the `alpha`/`beta` dist-tags
17
22
  - **Source:** [github.com/ilpanich/axiam-typescript-sdk](https://github.com/ilpanich/axiam-typescript-sdk)
18
23
  - **License:** Apache-2.0
19
24
  - **Node:** `>=22` — see [Supported Node versions](#supported-node-versions)
20
25
 
21
26
  ## Contract conformance
22
27
 
23
- This SDK conforms to **contract 1.42**: CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19,
24
- §20, §21, §22, §23, §24, §25, §26, §27 (including §6.1 mTLS client certificates, the §10.1
25
- minimum local-verification set, the §12 OIDC/SSO relying-party helpers, and the §13
28
+ This SDK conforms to **contract 1.50**: CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19,
29
+ §20, §21, §22, §23, §24, §25, §26, §27, §28 (including §6.1 mTLS client certificates, the
30
+ §10.1 minimum local-verification set, the §12 OIDC/SSO relying-party helpers, and the §13
26
31
  `verifyWebhook` signature verifier). §12 is implemented in full at its 1.38 shape: all
27
32
  **thirteen** operations, including the four public "Sign in with X" entry points.
28
33
 
@@ -36,10 +41,15 @@ them, even though three of them need no Node-only code at all.
36
41
  the §27.6 declarative manifest with its §27.7 `defineManifest` and decorator forms. The
37
42
  contract asks an SDK that ships only one half to say which; this one ships both.
38
43
 
39
- §12.7, §14, §15, §22, §24, §25, §26 and §27 are named rather than folded into the range
40
- because they landed after this SDK already claimed §1–§13: widening the range silently
41
- would turn a statement that was true when written into a different claim without anyone
42
- editing it.
44
+ §28 (MCP resource-server helpers) is implemented on **both** framework surfaces — the
45
+ Express middleware and the Fastify plugin — with all three operations, the
46
+ `resourceMetadataUrl` guard option and §28.9's five required tests. This SDK is §28.10's
47
+ reference implementation: it lands first and the ten ports are read against it.
48
+
49
+ §12.7, §14, §15, §22, §24, §25, §26, §27 and §28 are named rather than folded into the
50
+ range because they landed after this SDK already claimed §1–§13: widening the range
51
+ silently would turn a statement that was true when written into a different claim without
52
+ anyone editing it.
43
53
 
44
54
  ### §10.1 minimum local-verification set
45
55
 
@@ -74,9 +84,14 @@ See [`CONTRACT.md`](./CONTRACT.md) for the full cross-language behavioral contra
74
84
  ## Install
75
85
 
76
86
  ```bash
77
- npm install axiam-sdk
87
+ npm install axiam-sdk@beta
78
88
  ```
79
89
 
90
+ Every release so far is a prerelease, and the publish job files each one under its
91
+ channel's dist-tag (`beta` today) rather than `latest` — so name the channel, or pin an
92
+ exact version. A bare `npm install axiam-sdk` resolves `latest`, which no prerelease
93
+ moves.
94
+
80
95
  ## Supported Node versions
81
96
 
82
97
  | | Version | Why this one |
@@ -1705,6 +1720,211 @@ like a stale one — and accepts a `tolerance` override plus a `now` injection s
1705
1720
  failure always raises the typed `WebhookVerifyError` (never a generic exception whose message
1706
1721
  could leak the expected signature).
1707
1722
 
1723
+ ## MCP resource-server helpers (`axiam-sdk/middleware`, CONTRACT.md §28)
1724
+
1725
+ The resource-server half of the Model Context Protocol authorization handshake: publish the
1726
+ RFC 9728 document that tells an MCP client which authorization server guards this resource,
1727
+ and put the RFC 6750 `WWW-Authenticate` challenge on the 401 that starts its discovery.
1728
+
1729
+ **AXIAM is the authorization server and implements none of this.** Your MCP server is the
1730
+ resource server, and this is its side. Nothing here talks to AXIAM, performs any network I/O
1731
+ or touches the SDK client's own session — all three operations are pure local computation,
1732
+ like `oidcBegin` and `umaParseChallenge`. The *client* half — parsing a challenge, fetching
1733
+ a document, deciding whether to trust the authorization server it names — is deliberately
1734
+ not in the SDK: a helper that read a 401 and acted on it would send a credential to whatever
1735
+ host the 401 asked it to.
1736
+
1737
+ **It is opt-in and off by default.** With `resourceMetadataUrl` unset, every guard behaves
1738
+ byte-for-byte as it did before §28 existed: no header on any response, no status changed, no
1739
+ body changed.
1740
+
1741
+ ### The whole integration
1742
+
1743
+ ```ts
1744
+ import express from 'express';
1745
+ import { createVerifier } from 'axiam-sdk/node';
1746
+ import {
1747
+ axiamMiddleware,
1748
+ protectedResourceMetadata,
1749
+ serveProtectedResourceMetadata,
1750
+ } from 'axiam-sdk/middleware';
1751
+
1752
+ // 1. Describe the resource server. Validated here, at construction — before any
1753
+ // route exists and before any request is served.
1754
+ const metadata = protectedResourceMetadata({
1755
+ resource: 'https://mcp.example.com/mcp',
1756
+ authorizationServers: ['https://axiam.example.com'],
1757
+ scopesSupported: ['mcp:read', 'mcp:tools'],
1758
+ });
1759
+
1760
+ // 2. Configure the guard FROM that value rather than by retyping the strings —
1761
+ // retyping is how the guard and the document come to disagree. The session
1762
+ // is the same plain `VerifiableSession` literal §10.4's feed is attached to.
1763
+ const session = {
1764
+ jwksVerifier: createVerifier('https://axiam.example.com'),
1765
+ tenantHeaderValue: TENANT_UUID,
1766
+ expectedAudience: metadata.document.resource, // https://mcp.example.com/mcp
1767
+ resourceMetadataUrl: metadata.metadataUrl, // https://mcp.example.com/.well-known/…/mcp
1768
+ };
1769
+
1770
+ const app = express();
1771
+ app.use(axiamMiddleware(session));
1772
+
1773
+ // 3. Publish the document. Passing `session` is what lets the SDK check that
1774
+ // the three strings agree; it throws at startup if they do not.
1775
+ serveProtectedResourceMetadata(app, metadata, session);
1776
+
1777
+ app.post('/mcp', handler);
1778
+ ```
1779
+
1780
+ Fastify is the same three calls — `axiamPlugin(session)` instead of `axiamMiddleware`, and
1781
+ the Fastify instance instead of the Express app. `serveProtectedResourceMetadata` takes
1782
+ either.
1783
+
1784
+ A request with no credential now gets what it needs to go and get one:
1785
+
1786
+ ```http
1787
+ HTTP/1.1 401 Unauthorized
1788
+ WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource/mcp"
1789
+ Content-Type: application/json
1790
+
1791
+ {"error":"authentication_failed","message":"..."}
1792
+ ```
1793
+
1794
+ and the document it points at answers without a credential:
1795
+
1796
+ ```json
1797
+ {
1798
+ "resource": "https://mcp.example.com/mcp",
1799
+ "authorization_servers": ["https://axiam.example.com"],
1800
+ "scopes_supported": ["mcp:read", "mcp:tools"],
1801
+ "bearer_methods_supported": ["header"]
1802
+ }
1803
+ ```
1804
+
1805
+ **The path is derived from the resource, not chosen.** RFC 9728 §3.1 inserts
1806
+ `/.well-known/oauth-protected-resource` between the authority and the path, so
1807
+ `https://mcp.example.com/mcp` publishes at `/.well-known/oauth-protected-resource/mcp` and
1808
+ `https://mcp.example.com` at the bare well-known path. A trailing slash is carried through
1809
+ rather than trimmed — it is part of the identifier the client compares, and two resources
1810
+ that differ only by it are two resources. Exactly one route is registered; a deployment
1811
+ fronting several resources calls the helper once per resource.
1812
+
1813
+ **You do not have to order the routes.** Where the guard is mounted globally it exempts the
1814
+ document's path itself, from the `resourceMetadataUrl` it was configured with — which is the
1815
+ only thing that works on Fastify, where a `preHandler` hook applies to every route in its
1816
+ context no matter when it was registered.
1817
+
1818
+ ### Announcing yourself obliges you to check
1819
+
1820
+ **`expectedAudience` is mandatory once `resourceMetadataUrl` is set**, and every guard
1821
+ factory refuses the configuration at construction, naming both options. A resource server
1822
+ that publishes *"tokens for me carry this `aud`"* and then does not check `aud` has published
1823
+ a claim it does not honour — and a token minted for a **different** MCP server opens it. That
1824
+ is the confusion RFC 8707 exists to prevent, so it is impossible to configure rather than
1825
+ merely discouraged:
1826
+
1827
+ ```ts
1828
+ axiamMiddleware({ jwksVerifier, tenantHeaderValue, resourceMetadataUrl: metadata.metadataUrl });
1829
+ // ValidationError: resourceMetadataUrl: requires expectedAudience to be set on the
1830
+ // same session (CONTRACT.md §28.5 rule 2) — …
1831
+ ```
1832
+
1833
+ With both set, a token carrying `aud: "axiam:user"` — a perfectly valid AXIAM token that
1834
+ simply was not minted for this resource — is a 401, exactly like a token minted for
1835
+ `https://other.example.com/mcp`.
1836
+
1837
+ ### The 403 that asks for a scope
1838
+
1839
+ One class of 403 carries a challenge, and only one: a `requireAccess`/`requireAccessHook`
1840
+ that **named a scope** whose decision came back `allowed: false` with `reasonCode:
1841
+ "no_grant"`.
1842
+
1843
+ ```ts
1844
+ app.post('/mcp/tools', requireAccess(session, 'mcp:invoke', 'tools', { scope: 'mcp:tools' }), handler);
1845
+ ```
1846
+
1847
+ ```http
1848
+ HTTP/1.1 403 Forbidden
1849
+ WWW-Authenticate: Bearer error="insufficient_scope", scope="mcp:tools", resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource/mcp"
1850
+ Content-Type: application/json
1851
+
1852
+ {"error":"authorization_denied","message":"..."}
1853
+ ```
1854
+
1855
+ `insufficient_scope` is in the header and `authorization_denied` is in the body, and they are
1856
+ not two spellings of one thing: the body is the §11 error taxonomy, unchanged, and the header
1857
+ is the RFC 6750 hint. The scope named is the one the route asked for, **verbatim** — never
1858
+ synthesised, never derived from `action`/`resource`, never substituted from the document's
1859
+ `scopes_supported`, because where a deployment's AXIAM resource-scope names and its OAuth
1860
+ scope names differ, that mapping is the operator's decision and the SDK cannot see it.
1861
+
1862
+ Every other 403 carries no header at all: a `requireAccess` with no `scope` argument, a
1863
+ `requireRole` failure, a CSRF refusal, and — the one that matters — a decision whose
1864
+ `reasonCode` is `denied_by_rule`. `no_grant` means *ask for more*, which is what a challenge
1865
+ invites a client to do; `denied_by_rule` means *an administrator has already decided*, and
1866
+ challenging on it would send an MCP client all the way around the authorization loop to
1867
+ arrive at the identical 403. An absent or unrecognised `reasonCode` is not eligible either.
1868
+
1869
+ Where a route also carries a `umaChallenge` (§20.3), the UMA challenge wins: it is per-route
1870
+ opt-in and carries a live ticket for the exact authority just refused, where this one is the
1871
+ generic hint. Only one `WWW-Authenticate` value is ever emitted.
1872
+
1873
+ ### The challenge says only what RFC 6750 can say
1874
+
1875
+ Expired, not yet valid, wrong tenant, wrong audience, bad signature, `alg` confusion, a `cnf`
1876
+ the guard could not satisfy, a `sid` in the §10.4 revocation feed — all of them are
1877
+ `invalid_token`, indistinguishably. The SDK's own guard never emits an `error_description`,
1878
+ and adds nothing to the response that tells them apart. It is a 401 to an unauthenticated
1879
+ stranger: every distinction it draws is an oracle.
1880
+
1881
+ `bearerChallenge` exists for the challenge you build yourself, for your own 400, and it takes
1882
+ `errorDescription` for that reason alone. It **refuses rather than escapes**: RFC 6750
1883
+ restricts every parameter to a character set that cannot contain `"` or `\`, so a value
1884
+ needing an escape is a value that does not belong in a challenge.
1885
+
1886
+ ```ts
1887
+ bearerChallenge({
1888
+ resourceMetadataUrl: metadata.metadataUrl,
1889
+ error: 'invalid_request',
1890
+ errorDescription: 'The access token is malformed',
1891
+ scope: 'mcp:read mcp:tools',
1892
+ });
1893
+ // Bearer error="invalid_request", error_description="The access token is malformed",
1894
+ // scope="mcp:read mcp:tools", resource_metadata="https://mcp.example.com/.well-known/…/mcp"
1895
+
1896
+ bearerChallenge({ resourceMetadataUrl: metadata.metadataUrl, errorDescription: 'he said "no"' });
1897
+ // ValidationError — never a challenge containing \"
1898
+ ```
1899
+
1900
+ ### Validation refuses; it never repairs
1901
+
1902
+ Every §28.2 rule is checked by `protectedResourceMetadata` itself, and a violation throws
1903
+ `ValidationError` (§2's taxonomy, unchanged — §28 adds no error type). Nothing is normalised,
1904
+ trimmed, lowercased or re-encoded to make it pass: that would publish a document describing a
1905
+ resource server that does not exist. The rules, in one list:
1906
+
1907
+ | Member | Rule |
1908
+ |---|---|
1909
+ | `resource` | absolute URI with a scheme and an authority, **no query and no fragment**; a trailing slash is significant |
1910
+ | any URL | `https`, except on `127.0.0.1`, `[::1]` or `localhost` — there is no flag, env var or debug build that widens this |
1911
+ | `authorizationServers` | at least one entry, each an issuer **verbatim** (no `?tenant_id=`), no query, no fragment, no duplicates |
1912
+ | `scopesSupported` | RFC 6749 `NQCHAR` tokens, order preserved, no duplicates; an empty list **omits the member** |
1913
+ | `bearerMethodsSupported` | exactly `["header"]` — this SDK's guard reads a bearer credential from the `Authorization` header alone |
1914
+ | `resourceDocumentation` | an absolute URL, query and fragment permitted; omitted when absent, never `null` |
1915
+
1916
+ **Nothing in the document may come from a request.** `resource` and `authorizationServers`
1917
+ are configuration, and this SDK offers no option to build either from the `Host` header, the
1918
+ `Forwarded`/`X-Forwarded-*` family or the request URL. A document assembled from the request
1919
+ is a document an attacker can point at an authorization server of their choosing — the whole
1920
+ handshake redirected with one header.
1921
+
1922
+ Nothing in §28 is wrapped in `Sensitive<T>`, and that is a rule rather than an omission: the
1923
+ document is published unauthenticated to the world and the challenge goes to a caller who has
1924
+ just failed to authenticate, so both must stay readable. The corollary is the one that
1925
+ matters — **no part of the presented credential reaches either of them**, in any parameter,
1926
+ any header, any body or any log line the guard writes on the 401 path.
1927
+
1708
1928
  ## Client quality-of-life (CONTRACT.md §16–§19)
1709
1929
 
1710
1930
  ### Retry policy (§16)
@@ -39,6 +39,33 @@ interface VerifiableSession {
39
39
  * `"axiam:user"`. Populated from `AxiamClientOptions.expectedAudience`.
40
40
  */
41
41
  expectedAudience?: string;
42
+ /**
43
+ * CONTRACT.md §28.5 (contract 1.48) — the URL of this resource server's RFC
44
+ * 9728 protected-resource metadata document.
45
+ *
46
+ * Unset by default, and **setting it is what turns §28 on**. With it unset
47
+ * every guard built from this session behaves byte-for-byte as it did before
48
+ * §28 existed: no `WWW-Authenticate` header on any response, no status
49
+ * changed, no body changed.
50
+ *
51
+ * With it set, the guard's 401s carry §28.4's challenge, a
52
+ * `require_access`/`requireAccessHook` denial that named a scope and came
53
+ * back `no_grant` carries `insufficient_scope`, and the path this URL names
54
+ * is served without authentication so the document can start the handshake
55
+ * it exists to start.
56
+ *
57
+ * **{@link VerifiableSession.expectedAudience} becomes mandatory.** Every
58
+ * guard factory refuses the configuration at construction — before the first
59
+ * request — when this is set and that is not, and the refusal names both. A
60
+ * resource server that publishes "tokens for me carry this `aud`" and then
61
+ * does not check `aud` is opened by a token minted for a different resource
62
+ * server, which is the confusion RFC 8707 exists to prevent.
63
+ *
64
+ * Feed it from `protectedResourceMetadata(...).metadataUrl` rather than by
65
+ * retyping the string — retyping is how the guard and the document come to
66
+ * disagree.
67
+ */
68
+ resourceMetadataUrl?: string;
42
69
  /**
43
70
  * CONTRACT.md §10.4 (contract 1.44) — the optional session-revocation feed.
44
71
  *
@@ -238,6 +265,16 @@ type CheckOutcome = {
238
265
  * when minting failed — the denial stands either way.
239
266
  */
240
267
  challenge?: string;
268
+ /**
269
+ * The decision's `reason_code` (§11 rule 9), surfaced verbatim so the
270
+ * caller can apply §28.5 rule 5 — `no_grant` is the one denial a bearer
271
+ * challenge may invite a client to retry, and `denied_by_rule` is not.
272
+ *
273
+ * Absent when the decision carried none, and absent on the `AuthzError`
274
+ * arm: a server 403 names no reason code, and §11 rule 9 requires an
275
+ * absent one to leave the outcome alone.
276
+ */
277
+ reasonCode?: string;
241
278
  } | {
242
279
  /** The authz transport failed — fail-closed → HTTP 503, never an allow. */
243
280
  kind: 'unavailable';
@@ -39,6 +39,33 @@ interface VerifiableSession {
39
39
  * `"axiam:user"`. Populated from `AxiamClientOptions.expectedAudience`.
40
40
  */
41
41
  expectedAudience?: string;
42
+ /**
43
+ * CONTRACT.md §28.5 (contract 1.48) — the URL of this resource server's RFC
44
+ * 9728 protected-resource metadata document.
45
+ *
46
+ * Unset by default, and **setting it is what turns §28 on**. With it unset
47
+ * every guard built from this session behaves byte-for-byte as it did before
48
+ * §28 existed: no `WWW-Authenticate` header on any response, no status
49
+ * changed, no body changed.
50
+ *
51
+ * With it set, the guard's 401s carry §28.4's challenge, a
52
+ * `require_access`/`requireAccessHook` denial that named a scope and came
53
+ * back `no_grant` carries `insufficient_scope`, and the path this URL names
54
+ * is served without authentication so the document can start the handshake
55
+ * it exists to start.
56
+ *
57
+ * **{@link VerifiableSession.expectedAudience} becomes mandatory.** Every
58
+ * guard factory refuses the configuration at construction — before the first
59
+ * request — when this is set and that is not, and the refusal names both. A
60
+ * resource server that publishes "tokens for me carry this `aud`" and then
61
+ * does not check `aud` is opened by a token minted for a different resource
62
+ * server, which is the confusion RFC 8707 exists to prevent.
63
+ *
64
+ * Feed it from `protectedResourceMetadata(...).metadataUrl` rather than by
65
+ * retyping the string — retyping is how the guard and the document come to
66
+ * disagree.
67
+ */
68
+ resourceMetadataUrl?: string;
42
69
  /**
43
70
  * CONTRACT.md §10.4 (contract 1.44) — the optional session-revocation feed.
44
71
  *
@@ -238,6 +265,16 @@ type CheckOutcome = {
238
265
  * when minting failed — the denial stands either way.
239
266
  */
240
267
  challenge?: string;
268
+ /**
269
+ * The decision's `reason_code` (§11 rule 9), surfaced verbatim so the
270
+ * caller can apply §28.5 rule 5 — `no_grant` is the one denial a bearer
271
+ * challenge may invite a client to retry, and `denied_by_rule` is not.
272
+ *
273
+ * Absent when the decision carried none, and absent on the `AuthzError`
274
+ * arm: a server 403 names no reason code, and §11 rule 9 requires an
275
+ * absent one to leave the outcome alone.
276
+ */
277
+ reasonCode?: string;
241
278
  } | {
242
279
  /** The authz transport failed — fail-closed → HTTP 503, never an allow. */
243
280
  kind: 'unavailable';
@@ -1,4 +1,4 @@
1
- import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-CzVEJTC5.cjs';
1
+ import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-Dd_XaOtg.cjs';
2
2
  import { S as Sensitive } from '../sensitive-BC_s7Rrd.cjs';
3
3
  import { L as LoginResult } from '../types-zXSpiQM-.cjs';
4
4
  export { W as WebauthnFailure, c as classifyWebauthnError, w as webauthnErrorMessage } from '../webauthnErrors-fLgfOflO.cjs';
@@ -1,4 +1,4 @@
1
- import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-DLapMy-5.js';
1
+ import { A as AxiamClient, W as WebauthnWorkspace, a as WebauthnLoginResult, b as WebauthnCredential } from '../client-BstRBtp8.js';
2
2
  import { S as Sensitive } from '../sensitive-BC_s7Rrd.js';
3
3
  import { L as LoginResult } from '../types-BOX-6Srv.js';
4
4
  export { W as WebauthnFailure, c as classifyWebauthnError, w as webauthnErrorMessage } from '../webauthnErrors-fLgfOflO.js';