axiam-sdk 1.0.0-beta17 → 1.1.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 +401 -26
- package/dist/amqp/index.d.cts +1 -1
- package/dist/amqp/index.d.ts +1 -1
- package/dist/amqp/index.js +6 -1
- package/dist/amqp/index.js.map +1 -1
- package/dist/amqp/index.mjs +6 -1
- package/dist/amqp/index.mjs.map +1 -1
- package/dist/{authzCore-BpXRhTLF.d.cts → authzCore-BQfX9qxN.d.cts} +1 -1
- package/dist/{authzCore-BxCr9i1y.d.ts → authzCore-BlSHwGnW.d.ts} +1 -1
- package/dist/browser/index.d.cts +3 -3
- package/dist/browser/index.d.ts +3 -3
- package/dist/{client-D3BOv0PD.d.cts → client-7ZKtfXW-.d.cts} +2778 -91
- package/dist/{client-CX7MwFct.d.ts → client-Putxo-yi.d.ts} +2778 -91
- package/dist/{cookieJar-B4bMYc7_.d.ts → cookieJar-Cw6Zdeec.d.ts} +3 -3
- package/dist/{cookieJar-Uh-6shG1.d.cts → cookieJar-DkGcIr-i.d.cts} +3 -3
- package/dist/errors-CtP_lviy.d.cts +93 -0
- package/dist/errors-DMIlw2lN.d.cts +101 -0
- package/dist/errors-DMIlw2lN.d.ts +101 -0
- package/dist/errors-VpViVRSx.d.ts +93 -0
- package/dist/grpc/index.d.cts +7 -7
- package/dist/grpc/index.d.ts +7 -7
- package/dist/grpc/index.js +2126 -204
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +2126 -204
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2251 -204
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2217 -205
- package/dist/index.mjs.map +1 -1
- package/dist/{jwks-DmERws3k.d.cts → jwks-BR55d7-Z.d.cts} +1 -1
- package/dist/{jwks-DmERws3k.d.ts → jwks-BR55d7-Z.d.ts} +1 -1
- package/dist/middleware/index.d.cts +11 -9
- package/dist/middleware/index.d.ts +11 -9
- package/dist/middleware/index.js +591 -24
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +590 -26
- package/dist/middleware/index.mjs.map +1 -1
- package/dist/nestjs/index.d.cts +2 -2
- package/dist/nestjs/index.d.ts +2 -2
- package/dist/nestjs/index.js +6 -1
- package/dist/nestjs/index.js.map +1 -1
- package/dist/nestjs/index.mjs +6 -1
- package/dist/nestjs/index.mjs.map +1 -1
- package/dist/node/index.d.cts +307 -7
- package/dist/node/index.d.ts +307 -7
- package/dist/node/index.js +3181 -254
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +3168 -256
- package/dist/node/index.mjs.map +1 -1
- package/dist/{oidcState-E8Z5dXgQ.d.cts → oidcState-Cz6erz0g.d.cts} +406 -12
- package/dist/{oidcState-D9o_JxmM.d.ts → oidcState-zGt6VU6v.d.ts} +406 -12
- package/dist/rest/index.d.cts +129 -11
- package/dist/rest/index.d.ts +129 -11
- package/dist/rest/index.js +2251 -204
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +2217 -205
- package/dist/rest/index.mjs.map +1 -1
- package/dist/{session-Bsn9t50R.d.cts → session-BmjEMowX.d.cts} +1 -1
- package/dist/{session-BuqKS5nx.d.ts → session-CeG6P9GO.d.ts} +1 -1
- package/dist/{telemetry-DrGqL4kb.d.cts → telemetry--0DwnNjV.d.cts} +24 -2
- package/dist/{telemetry-DrGqL4kb.d.ts → telemetry--0DwnNjV.d.ts} +24 -2
- package/package.json +6 -3
- package/dist/errors-CxqAZsex.d.cts +0 -168
- package/dist/errors-CxqAZsex.d.ts +0 -168
package/README.md
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
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. -->
|
|
8
3
|
[](https://github.com/ilpanich/axiam-typescript-sdk/actions/workflows/sdk-ci-typescript.yml)
|
|
9
4
|
[](https://coveralls.io/github/ilpanich/axiam-typescript-sdk?branch=main)
|
|
10
|
-
[](https://www.npmjs.com/package/axiam-sdk)
|
|
11
6
|
[](https://ilpanich.github.io/axiam-typescript-sdk/)
|
|
12
7
|
[](LICENSE)
|
|
13
8
|
|
|
@@ -18,19 +13,114 @@ Official TypeScript/JavaScript client SDK for [AXIAM](https://github.com/ilpanic
|
|
|
18
13
|
## Package identity
|
|
19
14
|
|
|
20
15
|
- **npm package:** `axiam-sdk`
|
|
21
|
-
- **Registry:** [npmjs.com/package/axiam-sdk](https://www.npmjs.com/package/axiam-sdk) —
|
|
16
|
+
- **Registry:** [npmjs.com/package/axiam-sdk](https://www.npmjs.com/package/axiam-sdk) — stable releases on the `latest` dist-tag, following [semantic versioning](https://semver.org/)
|
|
22
17
|
- **Source:** [github.com/ilpanich/axiam-typescript-sdk](https://github.com/ilpanich/axiam-typescript-sdk)
|
|
23
18
|
- **License:** Apache-2.0
|
|
24
19
|
- **Node:** `>=22` — see [Supported Node versions](#supported-node-versions)
|
|
25
20
|
|
|
26
21
|
## Contract conformance
|
|
27
22
|
|
|
28
|
-
This SDK conforms to **contract 1.
|
|
29
|
-
§20, §21, §22, §23, §24, §25, §26, §27, §28
|
|
23
|
+
This SDK conforms to **contract 1.62**: CONTRACT.md §1–§13 and §12.7, §14, §15, §17, §19,
|
|
24
|
+
§20, §21, §22, §23, §24, §25, §26, §27 (with §27.6.2), §28, §28.12, §29, §30, §31, §32, §33 and §36,
|
|
25
|
+
with §32.7 and §33.2 signed (including §6.1 mTLS client certificates, the
|
|
30
26
|
§10.1 minimum local-verification set, the §12 OIDC/SSO relying-party helpers, and the §13
|
|
31
|
-
`verifyWebhook` signature verifier). §12 is implemented in full at its 1.38 shape: all
|
|
27
|
+
`verifyWebhook` signature verifier). Manifest pruning: not offered in any namespace (§27.10). §12 is implemented in full at its 1.38 shape: all
|
|
32
28
|
**thirteen** operations, including the four public "Sign in with X" entry points.
|
|
33
29
|
|
|
30
|
+
### Contract 1.62 — the 1.1.0 release (§34.6)
|
|
31
|
+
|
|
32
|
+
Contract 1.62 accompanies the 1.1.0 platform release; this SDK's release of it is **1.1.0**
|
|
33
|
+
(release 1.0.1 was never tagged, so contract 1.61 below ships in the same release). Every item of
|
|
34
|
+
§34.6 that names TypeScript, and what this SDK does:
|
|
35
|
+
|
|
36
|
+
| Item | Rule | What this SDK does |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| (l) the `network` namespace | §36 | `client.network`: twelve operations (202 in 29 namespaces in all) — `listSegments`/`listSegmentsAll`, `createSegment`, `getSegment`, `replaceSegment`, `deleteSegment(id, version)`, `listProfiles`/`listProfilesAll`, `createProfile`, `getProfile`, `replaceProfile`, `deleteProfile(segmentId, version)`, `getPolicy`, `replacePolicy`. Every write carries the version you read, exactly as given, and is never retried; a `409` is a `ConflictError` whose `reasonCode` is the body's `reason_code`; a `403` is an `AuthzError` carrying `action` and `resourceId`. The decision route `POST /network/decide` is not SDK work and has no method. |
|
|
39
|
+
| (n), (u), (v), (w) `network` in a manifest | §27.6.2 | `ManagementManifest.network` — `policy`, `segments[]` (key: site + kind + name, `kind` the wire spelling `access`/`quarantine`), `profiles[]` (key: its segment). Ordered policy, segments, profiles; drift judged on the read (a clamped timeout, `filterIds` as a set); duplicate natural keys and a repeated Filter-Id refused at `plan` with zero wire calls; `Update`s are version-conditional full replacements; a `409` stops the apply and `failure(report).reasonCode` names it. **No pruning**: like every namespace here, `network` is never deleted from. |
|
|
40
|
+
| (e) the change-taking form | §32.2 | `ssfStreamInputWith(stream, changes)` sends `events_requested` and `expected_updated_at` as read and cuts `events_requested` to a lowered `events_allowed`. `ssfStreamInputFrom` stays, and its documentation names the caller's duty. |
|
|
41
|
+
| (f) an assigned `null` is "none" | §27.11 rule 5, §32.2 | `user_id` on `certificates.generate`/`signCsr` and `expected_updated_at` on `ssf` and `scimTargets` writes: a `null` is dropped from the body, never sent. |
|
|
42
|
+
| (g) `expected_updated_at` is the server's string | §32.2 | Already held: `SsfStream.updated_at` is the response's own string and both converters send it unchanged. |
|
|
43
|
+
| (h) the three meanings at the call site | §32.2 | The TSDoc of `ssf.updateStream` states them. |
|
|
44
|
+
| (i) the request `user_id` is an untyped string | §27.11 rule 5 | Already held: `user_id?: string \| null` on both requests; the response `Certificate.user_id` stays as it was. |
|
|
45
|
+
| (m), (t) the device grant authenticates its client | §14.1 rule 2 | `deviceAuthorize` and each `devicePoll` send a configured `clientSecret` as `client_secret` in the form body (never `Authorization: Basic`) and an mTLS client presents its certificate; a public client sends none and is not refused; the poll sends `client_id`; a `401 invalid_client` is an `OAuthProtocolError`, made once, outside the §9 refresh guard. `private_key_jwt` client authentication and DPoP proof generation are not implemented by this SDK. |
|
|
46
|
+
| (a)–(d), (k), (p)–(s) | | Informative or no SDK work: nothing to do (`CibaPendingList` stays unmodelled). |
|
|
47
|
+
|
|
48
|
+
**SemVer.** A contract record may add a member or widen a type in a **minor** release; a removal
|
|
49
|
+
waits for **2.0.0**. 1.1.0 is a minor release: the one source-level break it records (the manifest
|
|
50
|
+
`Target` union gains three members) is of the additive kind, and it is named in the CHANGELOG.
|
|
51
|
+
|
|
52
|
+
### Contract 1.61 — the 1.0.1 fields (§34.5), released in 1.1.0
|
|
53
|
+
|
|
54
|
+
Contract 1.61 is additive and clarifying: no route, no operation, one new optional member on
|
|
55
|
+
each of three models, and rules about what a read-modify-write sends. What changed here:
|
|
56
|
+
|
|
57
|
+
| Row | Rule | What this SDK does |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `Certificate.user_id` | §27.11 rule 5 | `user_id?: string \| null` on `Certificate` and `GeneratedCertificate`: a UUID, `null` and an absent member all decode, the last two meaning "no account named"; never coalesced to a nil UUID or taken from `metadata`. On `CreateCertificateRequest` and `SignCertificateCsrRequest` it is sent exactly as given when you set it and the key is absent when you do not; the SDK does not judge the value (the server answers `400`). |
|
|
60
|
+
| `SsfStreamInput.expected_updated_at` | §32.2, §32.3 rule 4 | Optional; sent exactly as the stream's `updated_at` was read (not re-formatted) and absent when unset. `ssfStreamInputFrom` fills it with the read's `updated_at`, so a stream written since (the receiver's pause or narrowing included) answers `409` (`ConflictError`, never retried). |
|
|
61
|
+
| `events_requested` on update | §32.2 | Absent resets the stream to every allowed event, `[]` is stored as the receiver's "none", a list is stored as given. `ssfStreamInputFrom` always sends the list it read, `[]` as `[]`; if you lower `events_allowed` yourself, cut `events_requested` to it. |
|
|
62
|
+
| `CibaPendingList.total_pending`, `truncated` | §33.3 rule 16 | Not modelled: the type belongs to the console's `GET /api/v1/ciba/requests` route, which no registry operation returns and no SDK drives. |
|
|
63
|
+
|
|
64
|
+
### Contract 1.60 — the answers to #588 and the release wave (§34.4)
|
|
65
|
+
|
|
66
|
+
Contract 1.60 changes no route; it answers the questions the 1.59 ports raised (§34.4
|
|
67
|
+
A1 – B9, C-1 – C-16) and adds the 1.0.0 release wave's members. Every §34.4 row assigned to
|
|
68
|
+
TypeScript:
|
|
69
|
+
|
|
70
|
+
| Row | Rule | What this SDK does |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| A3 | §32.7 step 4, P6 | A failed cold-cache fill and a failed expiry refresh of the SSF key cache count toward the once-a-minute limit; the cache expires after ten minutes (`JWKS_CACHE_MAX_AGE_MS`). |
|
|
73
|
+
| B1, C-1 | §32.7 step 9, P3, P4 | A replay store that cannot answer (a throw, a rejection, any answer but `true`/`false`) gives no verdict: `verifySet` raises `NetworkError`, the store's failure on `cause`, and `poll` leaves the SET unjudged. A `SetRefusedError` thrown from inside a store is wrapped too, so no store failure carries a reason code. |
|
|
74
|
+
| C-3, C-4 | P1, §19.1 | After the replay store fails in a `poll` batch it is not asked again: every later SET that verifies is unjudged, one that fails verification is still refused. A `poll` that returns with SETs unjudged emits the §19 `ssfUnjudged` event (count and category, `key_fetch` or `replay_store`; no `jti`). |
|
|
75
|
+
| §15.2 rule 9 | §15 | The `actor_token` is the same client's `client_credentials` token. |
|
|
76
|
+
| §8 minimal profile | §8 | A broker confirm is not evidence that AXIAM saw a message. |
|
|
77
|
+
| §31 `expected_updated_at` | §31.3 rule 4 | On `ScimTargetInput`, sent exactly as given and only when set; `scimTargetInputFrom` carries the read's `updated_at`, so a read-modify-write of a target written since is `409`. |
|
|
78
|
+
| §27.15 `window_minutes` | §27.15 note 1 | On the `notificationRules` models, sent as given (never clamped) and only when set. |
|
|
79
|
+
| §27.15 `allow_sha1_signatures`, `idp_metadata_signing_cert_pem` | notes 6, 7 | On the three federation configuration models, sent only when set; a response without `allow_sha1_signatures` (a server before 1.0.0) reads `false`. |
|
|
80
|
+
| §27.15 note 8 | §27.4 rule 5 | `federation.updateConfig`: each of the ten nullable members of `UpdateFederationConfigRequest` is cleared by `null` and left unchanged when `undefined`, and the body carries exactly the members you set. |
|
|
81
|
+
| §12.1 refresh `scope` | §12.1 | An `oidcRefresh` result's `scope` is the refresh response's, which may be narrower than the grant's. |
|
|
82
|
+
| §21.5 discovery | §21.5, §12.1 | `OidcConfiguration` carries the four revocation and introspection auth members, all optional; a document without them decodes. |
|
|
83
|
+
|
|
84
|
+
### Contract 1.59 — the Phase 23 ports review (§34)
|
|
85
|
+
|
|
86
|
+
Contract 1.59 changes no wire shape; it clarifies §28.12 and §29 – §33 (§34.2 P1 – P12) and
|
|
87
|
+
lists what the review of this SDK found (follow-up F-59-02). What changed here:
|
|
88
|
+
|
|
89
|
+
| Row | Rule | What changed |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| R-18 | §30.5, §31.5, §32.5, §7 rule 1 | A management write that fails with a `5xx` or a transport error no longer carries its request — and so its `bind_secret`, `credential`, `authorization_header`, or §27.5 secret — in `NetworkError.cause`: the cause is rebuilt from an allow-list of diagnostics. |
|
|
92
|
+
| R-1 | §32.7, P1 | `SsfReceiver.poll` returns the SETs it judged and leaves one it could not judge unrecorded, listed in `unjudged`; it never keeps a `jti` it does not return. |
|
|
93
|
+
| R-7 | §32.7, P7 | The SSF section says `poll` is retried on `408` and `429`, as it always was. |
|
|
94
|
+
| R-20 | §29.5, §31.2, P12.1 | Every `directory`, `saml`, `scimTargets` and `ssf` response keeps only the members its type declares, at every depth; an unknown union arm keeps only its `type`. |
|
|
95
|
+
| R-23 | §28.12.2 rule 4, P12.4 | `updateClientRegistration` sends no list the read lacked, and a list of an unexpected shape as read; `redirect_uris`, `grant_types` and `response_types` are optional on `ClientRegistration`. |
|
|
96
|
+
| R-28 | §27.4 rule 5, §29.2, §21.3.1 | Generated docs no longer call every replacement body all-required or every all-optional type sparse; seven mTLS aliases, not six. |
|
|
97
|
+
| §33.8 t8 | §33.7 rule 5, P8 | `cibaPoll` retries a `5xx` whatever its body, `500 {"error":"server_error"}` included. |
|
|
98
|
+
|
|
99
|
+
The choice P1 leaves open: `poll` takes the second form — return what was judged, leave the
|
|
100
|
+
unjudged unrecorded and list their `jti`s — and, when it accepted nothing, records nothing and
|
|
101
|
+
throws the failure (the first form's outcome).
|
|
102
|
+
|
|
103
|
+
### Contracts 1.53 – 1.58
|
|
104
|
+
|
|
105
|
+
| Section | What ships | Where |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| §28.12 RFC 7592 client configuration (1.53) | `readClientRegistration`, `updateClientRegistration`, `deleteClientRegistration`, `ClientRegistration` | `AxiamClient` (see [below](#rfc-7592-client-configuration-contract-153-2812)) |
|
|
108
|
+
| §30 directory configuration (1.54) | the `directory` namespace, explicit-`null` sparse update, `setDirectoryConfigFrom` | `client.directory` |
|
|
109
|
+
| §29 SAML service-provider registration (1.55) | the `saml` namespace, `parseSpMetadataFromUrl` / `FromXml`, `samlServiceProviderInputFrom` | `client.saml` |
|
|
110
|
+
| §32 SSF stream registration (1.56) | the `ssf` namespace, `ssfStreamInputFrom`, `ssfStreamInputWith` (1.62) | `client.ssf` |
|
|
111
|
+
| §32.7 SSF receiver helper (1.56) | `SsfReceiver.verifySet` / `.poll` | `axiam-sdk/node` |
|
|
112
|
+
| §31 outbound SCIM targets (1.57) | the `scim_targets` namespace, `scimTargetInputFrom` | `client.scimTargets` |
|
|
113
|
+
| §33 CIBA, and §33.2's signed form (1.58) | `cibaInitiate`, `cibaPoll`, `cibaAwait`, `cibaHandlePing`, `CibaRequestSigner` (PS256, ES256, EdDSA) | `OidcClient` (`axiam-sdk/node`) |
|
|
114
|
+
| §21.3.1 vector A amended (1.58) | `mtls_endpoint_aliases.backchannel_authentication_endpoint`, the seventh alias | `OidcConfiguration` |
|
|
115
|
+
|
|
116
|
+
**Not shipped, and why:** nothing in these sections is declined. Two placement notes:
|
|
117
|
+
`SsfReceiver` is Node-only (it verifies Ed25519 signatures with `node:crypto`), and the CIBA
|
|
118
|
+
helpers live on the Node-only `OidcClient` with the rest of §12, as §33.6 asks ("the handle
|
|
119
|
+
that already carries `oidc_exchange` and `device_authorize`"). A CIBA client authenticates
|
|
120
|
+
by `clientSecret` (`client_secret_post`) or by the session's §6.1 client certificate
|
|
121
|
+
(`tls_client_auth`); this SDK has no `private_key_jwt` client authentication (§21.8 is
|
|
122
|
+
informative), so a CIBA client registered for `private_key_jwt` cannot use these helpers.
|
|
123
|
+
|
|
34
124
|
### Contract 1.51 — the dogfooding remediation
|
|
35
125
|
|
|
36
126
|
| Item | Status |
|
|
@@ -53,7 +143,7 @@ browser bundle pulls in no Node-only code. §12.2 forbids splitting them across
|
|
|
53
143
|
the four operations contract 1.38 adds are on `OidcClient` too, with the nine that preceded
|
|
54
144
|
them, even though three of them need no Node-only code at all.
|
|
55
145
|
|
|
56
|
-
§27 is implemented **in full**, both halves: the
|
|
146
|
+
§27 is implemented **in full**, both halves: the 202-operation imperative surface *and*
|
|
57
147
|
the §27.6 declarative manifest with its §27.7 `defineManifest` and decorator forms. The
|
|
58
148
|
contract asks an SDK that ships only one half to say which; this one ships both.
|
|
59
149
|
|
|
@@ -62,8 +152,8 @@ Express middleware and the Fastify plugin — with all three operations, the
|
|
|
62
152
|
`resourceMetadataUrl` guard option and §28.9's five required tests. This SDK is §28.10's
|
|
63
153
|
reference implementation: it lands first and the ten ports are read against it.
|
|
64
154
|
|
|
65
|
-
§12.7, §14, §15, §17, §19, §20, §21, §22, §23, §24, §25, §26, §27
|
|
66
|
-
than folded into the range because they landed after this SDK already claimed §1–§13:
|
|
155
|
+
§12.7, §14, §15, §17, §19, §20, §21, §22, §23, §24, §25, §26, §27, §28, §28.12, §29, §30,
|
|
156
|
+
§31, §32, §32.7, §33 and §33.2 signed are named rather than folded into the range because they landed after this SDK already claimed §1–§13:
|
|
67
157
|
widening the range silently would turn a statement that was true when written into a
|
|
68
158
|
different claim without anyone editing it.
|
|
69
159
|
|
|
@@ -125,13 +215,14 @@ See [`CONTRACT.md`](./CONTRACT.md) for the full cross-language behavioral contra
|
|
|
125
215
|
## Install
|
|
126
216
|
|
|
127
217
|
```bash
|
|
128
|
-
npm install axiam-sdk
|
|
218
|
+
npm install axiam-sdk@^1.1.0
|
|
129
219
|
```
|
|
130
220
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
221
|
+
From 1.0.0 the SDK is stable and follows semantic versioning: a breaking change to its
|
|
222
|
+
public API waits for the next major version. A contract record may add a member or widen a
|
|
223
|
+
type in a **minor** release (a new management namespace, an optional request member, a wider
|
|
224
|
+
union); **a removal waits for 2.0.0**. Releases are published on npm's `latest`
|
|
225
|
+
dist-tag, so a bare `npm install axiam-sdk` resolves the newest one.
|
|
135
226
|
|
|
136
227
|
## Supported Node versions
|
|
137
228
|
|
|
@@ -303,6 +394,7 @@ name wherever the document publishes one:
|
|
|
303
394
|
| `revoke` | `revocation_endpoint` |
|
|
304
395
|
| `deviceAuthorize` | `device_authorization_endpoint` |
|
|
305
396
|
| `oidcPar` | `pushed_authorization_request_endpoint` |
|
|
397
|
+
| `cibaInitiate` | `backchannel_authentication_endpoint` |
|
|
306
398
|
|
|
307
399
|
Three things this deliberately does **not** do:
|
|
308
400
|
|
|
@@ -310,8 +402,11 @@ Three things this deliberately does **not** do:
|
|
|
310
402
|
terminates mutual TLS on the issuer's own host", so the conventional endpoints keep
|
|
311
403
|
being used. A deployment running `client_auth = optional` on one listener serves both
|
|
312
404
|
populations there and correctly publishes nothing.
|
|
313
|
-
- **No alias is ever synthesised.** Only the
|
|
314
|
-
|
|
405
|
+
- **No alias is ever synthesised.** Only the seven endpoints CONTRACT.md §21.3.1's vector
|
|
406
|
+
aliases can be — `token_endpoint`, `introspection_endpoint`, `revocation_endpoint`,
|
|
407
|
+
`device_authorization_endpoint`, `pushed_authorization_request_endpoint`,
|
|
408
|
+
`userinfo_endpoint` and CIBA's `backchannel_authentication_endpoint` — never
|
|
409
|
+
`authorization_endpoint`, `end_session_endpoint` or `jwks_uri`. The
|
|
315
410
|
first two are front-channel and the third is public key material; sending a browser to
|
|
316
411
|
an mTLS host raises a native certificate-chooser dialog most users cannot answer.
|
|
317
412
|
- **`issuer` does not move.** It is an identifier, not an endpoint. §12.4 rule 3 still
|
|
@@ -541,6 +636,16 @@ into production, where it turns TLS into an expensive no-op against precisely
|
|
|
541
636
|
the attacker TLS exists to stop. `caCert` covers the legitimate reason people
|
|
542
637
|
reach for one.
|
|
543
638
|
|
|
639
|
+
#### Minimal profile (contract 1.60, §8)
|
|
640
|
+
|
|
641
|
+
A server running in the **minimal profile** (`AXIAM__AMQP__ENABLED=false`) reads no AMQP
|
|
642
|
+
queue: it does not consume `axiam.authz.request` or `axiam.audit.events`, whatever a broker
|
|
643
|
+
holds. **A broker confirm is not evidence that AXIAM saw a message** — a publisher confirm, or
|
|
644
|
+
the broker's `basic.ack` of a publish, means only that the broker accepted it, never that
|
|
645
|
+
AXIAM decided the request or recorded the event. This SDK does not treat one as such. Against
|
|
646
|
+
a minimal-profile server use REST or gRPC; `GET /health` reports `profile: minimal` and lists
|
|
647
|
+
`amqp_authz` and `amqp_audit_ingestion` under `unavailable`.
|
|
648
|
+
|
|
544
649
|
### Node — reactors, AMQP extension actors (`axiam-sdk/amqp`, CONTRACT.md §22)
|
|
545
650
|
|
|
546
651
|
A **reactor** is an external process that subscribes to named hook events on the AMQP bus and
|
|
@@ -1605,9 +1710,13 @@ RFC 8693 — a service holding a user's token exchanging it for a *narrower* one
|
|
|
1605
1710
|
calling the next service.
|
|
1606
1711
|
|
|
1607
1712
|
```ts
|
|
1713
|
+
// Delegation: the actor token is THIS client's own client_credentials token (§15.2 rule 9).
|
|
1714
|
+
const actor = await oidc.loginClientCredentials();
|
|
1715
|
+
|
|
1608
1716
|
const exchanged = await oidc.tokenExchange({
|
|
1609
1717
|
subjectToken: new Sensitive(userToken),
|
|
1610
1718
|
subjectTokenType: ACCESS_TOKEN_TYPE, // required (§15.1), no default
|
|
1719
|
+
actorToken: actor.accessToken, // omit it and you ask for impersonation instead
|
|
1611
1720
|
scopes: ['orders:read'],
|
|
1612
1721
|
audience: 'orders-service',
|
|
1613
1722
|
});
|
|
@@ -1617,6 +1726,14 @@ Most of what this method does is refuse to be helpful, and each refusal is delib
|
|
|
1617
1726
|
|
|
1618
1727
|
- **No default `actorToken`.** Omitting it asks for *impersonation*; the SDK will not
|
|
1619
1728
|
quietly substitute the client's own session token and turn that into a delegation.
|
|
1729
|
+
- **The actor token must have been issued to the exchanging client** (contract 1.60,
|
|
1730
|
+
§15.2 rule 9). The usual actor is the exchanging client's own `client_credentials` token
|
|
1731
|
+
(`loginClientCredentials()` above): its `sub` — and so the issued token's `act.sub` — is
|
|
1732
|
+
the client's `client_id`. One issued to another client, a console sign-in or a service
|
|
1733
|
+
account is answered `400 invalid_request` (`actor_token was not issued to the exchanging
|
|
1734
|
+
client`), which the SDK surfaces unchanged: no retry, no dropping the actor token to
|
|
1735
|
+
impersonate instead, no substituting a token of its own. You obtain and pass the actor
|
|
1736
|
+
token; the SDK supplies none.
|
|
1620
1737
|
- **No auto-narrowing after `invalid_scope`.** The server refuses rather than silently
|
|
1621
1738
|
narrowing precisely so the caller finds out here.
|
|
1622
1739
|
- **No refresh token, ever** — `ExchangedToken` has no such field, so there is nothing to
|
|
@@ -2099,6 +2216,231 @@ just failed to authenticate, so both must stay readable. The corollary is the on
|
|
|
2099
2216
|
matters — **no part of the presented credential reaches either of them**, in any parameter,
|
|
2100
2217
|
any header, any body or any log line the guard writes on the 401 path.
|
|
2101
2218
|
|
|
2219
|
+
## RFC 7592 client configuration (contract 1.53, §28.12)
|
|
2220
|
+
|
|
2221
|
+
A client that registered itself through `POST /oauth2/register` (RFC 7591) received, once,
|
|
2222
|
+
a `registration_client_uri` and a `registration_access_token`. With them it reads, replaces
|
|
2223
|
+
and deletes **its own** registration:
|
|
2224
|
+
|
|
2225
|
+
```ts
|
|
2226
|
+
const token = new Sensitive(storedRegistrationToken);
|
|
2227
|
+
const current = await client.readClientRegistration(registrationClientUri, token);
|
|
2228
|
+
|
|
2229
|
+
// An update is a FULL replacement: start from the read, change what you mean.
|
|
2230
|
+
current.client_name = 'Agent v2';
|
|
2231
|
+
const updated = await client.updateClientRegistration(registrationClientUri, token, current);
|
|
2232
|
+
await persist(updated.registration_access_token!); // the ONLY valid token from now on
|
|
2233
|
+
|
|
2234
|
+
await client.deleteClientRegistration(registrationClientUri, updated.registration_access_token!);
|
|
2235
|
+
```
|
|
2236
|
+
|
|
2237
|
+
- The URI is used **verbatim** (its `tenant_id` query included), and only at this client's
|
|
2238
|
+
configured origin: another scheme, host or port — or `http` unless `baseUrl` is `http` on a
|
|
2239
|
+
loopback host — is refused locally with a `ValidationError` before any request.
|
|
2240
|
+
- The token travels in `Authorization: Bearer` only, on a session-free transport: no SDK
|
|
2241
|
+
cookie, access token or CSRF header rides along, redirects are not followed, and a `401`
|
|
2242
|
+
never refreshes the SDK's session. (A browser follows redirects itself; use these
|
|
2243
|
+
server-side.)
|
|
2244
|
+
- `ClientRegistration` keeps every member it does not model in `extra`, so a read passed to
|
|
2245
|
+
an update round-trips them; the SDK drops `registration_access_token`,
|
|
2246
|
+
`registration_client_uri`, `client_secret_expires_at`, `client_id_issued_at` and
|
|
2247
|
+
`client_secret` from the body and sets `client_id`. Both secrets are `Sensitive`.
|
|
2248
|
+
- **Update and delete are never retried**; persist the rotated token before anything else.
|
|
2249
|
+
The read follows §16, but never retries a `4xx` other than `408`/`429`.
|
|
2250
|
+
- A body with `error` is an `OAuthProtocolError` at any status (`invalid_token`,
|
|
2251
|
+
`invalid_client_metadata`, …); a `204` on delete resolves.
|
|
2252
|
+
|
|
2253
|
+
## Directory, SAML, SSF and SCIM targets (§29 – §32)
|
|
2254
|
+
|
|
2255
|
+
Four management namespaces, generated like every other (§27), with the call-site rules the
|
|
2256
|
+
contract makes an SDK repeat in their TSDoc. Every write is issued once; reads retry.
|
|
2257
|
+
|
|
2258
|
+
```ts
|
|
2259
|
+
import { Sensitive, setDirectoryConfigFrom, parseSpMetadataFromUrl,
|
|
2260
|
+
samlServiceProviderInputFrom, ssfStreamInputFrom, ssfStreamInputWith,
|
|
2261
|
+
scimTargetInputFrom } from 'axiam-sdk';
|
|
2262
|
+
|
|
2263
|
+
// §30 directory — a sparse update: undefined keeps, null CLEARS.
|
|
2264
|
+
await client.directory.update({ group_filter: null }); // sends {"group_filter":null}
|
|
2265
|
+
await client.directory.update({ enabled: false }); // sends {"enabled":false}
|
|
2266
|
+
// Moving the connection (url, start_tls, bind_dn, trust_anchors_pem) requires the secret
|
|
2267
|
+
// again — the SDK holds no copy (§30.3 rule 2).
|
|
2268
|
+
await client.directory.update({ url: 'ldaps://dc2.corp.example', bind_secret: new Sensitive(secret) });
|
|
2269
|
+
// set() is a replacement: start from a read (bind_secret absent keeps the stored one).
|
|
2270
|
+
const config = setDirectoryConfigFrom(await client.directory.get());
|
|
2271
|
+
await client.directory.set({ ...config, sync_interval_secs: 900 });
|
|
2272
|
+
|
|
2273
|
+
// §29 SAML — parse a draft (stores nothing), review it, create from it.
|
|
2274
|
+
const draft = await client.saml.parseSpMetadata(parseSpMetadataFromUrl('https://sp.example/metadata'));
|
|
2275
|
+
const sp = await client.saml.createServiceProvider(draft.service_provider);
|
|
2276
|
+
const body = samlServiceProviderInputFrom(await client.saml.getServiceProvider(sp.id));
|
|
2277
|
+
await client.saml.updateServiceProvider(sp.id, { ...body, display_name: 'Payroll (EU)' });
|
|
2278
|
+
|
|
2279
|
+
// §32 SSF and §31 SCIM targets — read-modify-write; the secret is left absent (kept).
|
|
2280
|
+
const stream = ssfStreamInputFrom(await client.ssf.getStream(streamId));
|
|
2281
|
+
await client.ssf.updateStream(streamId, { ...stream, description: 'rotated' });
|
|
2282
|
+
// Lowering events_allowed? The change-taking form cuts events_requested for you (§32.2, 1.62),
|
|
2283
|
+
// and sends events_requested and expected_updated_at exactly as read.
|
|
2284
|
+
const read = await client.ssf.getStream(streamId);
|
|
2285
|
+
await client.ssf.updateStream(streamId, ssfStreamInputWith(read, { events_allowed: [onlyThisOne] }));
|
|
2286
|
+
const target = scimTargetInputFrom(await client.scimTargets.get(targetId));
|
|
2287
|
+
await client.scimTargets.update(targetId, { ...target, push_groups: true });
|
|
2288
|
+
```
|
|
2289
|
+
|
|
2290
|
+
- `bind_secret`, `authorization_header` and `credential` are `Sensitive` and write-only. A
|
|
2291
|
+
response that (wrongly) carries one of them — or `private_key_pem` on a SAML credential —
|
|
2292
|
+
has it dropped before it reaches you, so it surfaces in no rendering.
|
|
2293
|
+
- `parseSpMetadata` needs **exactly one** of `metadata_url` / `metadata_xml`: both or
|
|
2294
|
+
neither is a local `ValidationError`.
|
|
2295
|
+
- Enums and the `ScimTargetAuth` / `ScimTargetScope` unions are open: an unknown value
|
|
2296
|
+
decodes. An unknown `auth.type` / `scope.type` is refused before it is sent back.
|
|
2297
|
+
- `getIdp` is never cached: readiness changes with every credential write.
|
|
2298
|
+
- **`events_requested` has three meanings on an update** (§32.2): absent *resets* the stream
|
|
2299
|
+
to every event of `events_allowed`; `[]` is stored as the receiver's "none"; a list is
|
|
2300
|
+
stored as given and refused (`400`) outside `events_allowed`. `ssfStreamInputFrom` sends the
|
|
2301
|
+
list it read — cutting it to a lowered `events_allowed` is then your duty;
|
|
2302
|
+
`ssfStreamInputWith(stream, changes)` does the cut.
|
|
2303
|
+
- An assigned `null` is "none" for `user_id` (certificate requests) and `expected_updated_at`
|
|
2304
|
+
(`ssf`, `scimTargets`): the key is omitted and `null` is never sent (§27.11 rule 5).
|
|
2305
|
+
|
|
2306
|
+
## SSF receiver (`axiam-sdk/node`, contract 1.56, §32.7)
|
|
2307
|
+
|
|
2308
|
+
For a relying party that **receives** AXIAM's Security Event Tokens. Node-only.
|
|
2309
|
+
|
|
2310
|
+
```ts
|
|
2311
|
+
import { SsfReceiver, SetRefusedError, setErrFromReason, createOidcClient } from 'axiam-sdk/node';
|
|
2312
|
+
|
|
2313
|
+
const receiver = new SsfReceiver(client, {
|
|
2314
|
+
issuer: 'https://iam.example.com/t/<tenant-uuid>',
|
|
2315
|
+
audience: 'https://rp.example.com',
|
|
2316
|
+
jwksUri: 'https://iam.example.com/oauth2/jwks', // or discoveryUrl
|
|
2317
|
+
accessTokenProvider: async () =>
|
|
2318
|
+
(await oidc.loginClientCredentials({ scope: 'ssf.manage' })).accessToken,
|
|
2319
|
+
// replayWindowMs defaults to (and may not go below) seven days; replayStore is pluggable.
|
|
2320
|
+
});
|
|
2321
|
+
|
|
2322
|
+
// Push (RFC 8935): verify, then answer 202 — or 400 {"err": …} on a refusal.
|
|
2323
|
+
try {
|
|
2324
|
+
handle(await receiver.verifySet(rawBody));
|
|
2325
|
+
res.status(202).end();
|
|
2326
|
+
} catch (e) {
|
|
2327
|
+
if (e instanceof SetRefusedError) res.status(400).json(setErrFromReason(e.reason));
|
|
2328
|
+
else throw e; // a NetworkError: the JWKS could not be fetched — not a verdict on the SET
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
// Poll (RFC 8936): acknowledge what you processed, refuse what failed, on the NEXT call.
|
|
2332
|
+
let ack: string[] = [];
|
|
2333
|
+
let setErrs = {};
|
|
2334
|
+
for (;;) {
|
|
2335
|
+
const { events, refused, moreAvailable } = await receiver.poll(streamId, { ack, setErrs });
|
|
2336
|
+
for (const event of events) await handle(event);
|
|
2337
|
+
// A `replayed` SET was accepted earlier: acknowledge it, do not report it (§34.2 P2).
|
|
2338
|
+
ack = [...events.map((e) => e.jti), ...refused.filter((r) => r.reason === 'replayed').map((r) => r.jti)];
|
|
2339
|
+
setErrs = Object.fromEntries(
|
|
2340
|
+
refused.filter((r) => r.reason !== 'replayed').map((r) => [r.jti, setErrFromReason(r.reason)]),
|
|
2341
|
+
);
|
|
2342
|
+
// `unjudged` SETs are neither: the transmitter offers them again.
|
|
2343
|
+
if (!moreAvailable) await sleep(1000);
|
|
2344
|
+
}
|
|
2345
|
+
```
|
|
2346
|
+
|
|
2347
|
+
`verifySet` checks, in order: three base64url parts, `typ` `secevent+jwt`, `alg` `EdDSA`, the
|
|
2348
|
+
`kid` in the configured JWKS (one forced refetch on a miss, at most once a minute), the
|
|
2349
|
+
signature, `iss`, `aud`, the SET claim rules (no `exp`/`sub`; `jti`, `iat`, `sub_id`; one
|
|
2350
|
+
event) and replay. A refusal is a `SetRefusedError` (an `AuthError`) with a typed `reason`;
|
|
2351
|
+
`pushErrorCode` maps `malformed`, `invalid_type` and `replayed` to `invalid_request`, the
|
|
2352
|
+
others to themselves. **A SET that verifies has been recorded**: acknowledge it once
|
|
2353
|
+
processed, or a re-offer reads as `replayed`. **`poll` never keeps a `jti` it does not
|
|
2354
|
+
return** (contract 1.59, §34.2 P1): a SET it cannot judge — the JWKS or discovery fetch
|
|
2355
|
+
failed, or the replay store threw — is left unrecorded and listed by `jti` in `unjudged`
|
|
2356
|
+
(neither acknowledge nor refuse it; the transmitter offers it again), while the SETs judged
|
|
2357
|
+
in the same batch are returned as usual. When a poll accepts no SET at all it records
|
|
2358
|
+
nothing and throws that failure instead. Once the replay store fails in a batch it is not
|
|
2359
|
+
asked again for that batch: every later SET that verifies is unjudged as well, and `poll`
|
|
2360
|
+
emits the §19 `ssfUnjudged` telemetry event when it returns with any SET unjudged
|
|
2361
|
+
(contract 1.60). The default `MemoryReplayStore` is per process and
|
|
2362
|
+
**unbounded in count** — an entry leaves only when its window expires (§34.2 P4); a
|
|
2363
|
+
`ReplayStore` has three answers — `true` (not seen, now recorded), `false` (seen) and
|
|
2364
|
+
**cannot answer**, which is a throw or a rejection (contract 1.60, §34.2 P4). A store that
|
|
2365
|
+
cannot answer gives **no verdict**: `verifySet` raises a `NetworkError` with no reason code
|
|
2366
|
+
(it is never a `SetRefusedError`, and never read as `replayed`, which `poll` would have you
|
|
2367
|
+
acknowledge), and `poll` lists the SET in `unjudged`, records nothing for it and does not
|
|
2368
|
+
acknowledge it, so the transmitter offers it again. Never answer `false` for "I do not know";
|
|
2369
|
+
an answer that is neither `true` nor `false` is treated as cannot-answer. The key set is
|
|
2370
|
+
cached for ten minutes (`JWKS_CACHE_MAX_AGE_MS`; contract 1.60 requires no more than ten), so a key
|
|
2371
|
+
the transmitter removed stops verifying; filling an empty or expired cache is not a refetch,
|
|
2372
|
+
but a **failed** fetch counts toward the once-a-minute limit: after a failed fill a SET inside
|
|
2373
|
+
the minute makes no fetch and is left unjudged (§34.2 P6). A SET refused as `replayed` was accepted by this
|
|
2374
|
+
receiver on an earlier poll: acknowledge it in `ack` rather than reporting it in `setErrs`
|
|
2375
|
+
(§34.2 P2). `poll` never acknowledges anything itself, is not retried on a `4xx` other than
|
|
2376
|
+
`408` and `429` — which §16 retries, as it does a transport failure and a `5xx` — and sends
|
|
2377
|
+
no SDK cookie or session token.
|
|
2378
|
+
|
|
2379
|
+
## CIBA (`axiam-sdk/node`, contract 1.58, §33)
|
|
2380
|
+
|
|
2381
|
+
Client-initiated backchannel authentication: ask AXIAM to authenticate a user **on another
|
|
2382
|
+
device**, then collect the tokens. On `OidcClient`; the client always authenticates, by
|
|
2383
|
+
`clientSecret` or a §6.1 client certificate.
|
|
2384
|
+
|
|
2385
|
+
```ts
|
|
2386
|
+
import { createOidcClient, isAccessDenied, isExpiredToken, CibaRequestSigner } from 'axiam-sdk/node';
|
|
2387
|
+
|
|
2388
|
+
// Poll mode.
|
|
2389
|
+
const initiated = await oidc.cibaInitiate({
|
|
2390
|
+
scope: 'openid profile',
|
|
2391
|
+
loginHint: 'ada@example.com', // exactly one of loginHint / idTokenHint
|
|
2392
|
+
bindingMessage: 'W4SCT', // show the same code to your user
|
|
2393
|
+
});
|
|
2394
|
+
try {
|
|
2395
|
+
const tokens = await oidc.cibaAwait(initiated); // honours interval and slow_down; stops at expires_in
|
|
2396
|
+
} catch (e) {
|
|
2397
|
+
if (isAccessDenied(e)) { /* the user refused */ }
|
|
2398
|
+
else if (isExpiredToken(e)) { /* nobody answered in time */ }
|
|
2399
|
+
else throw e;
|
|
2400
|
+
}
|
|
2401
|
+
```
|
|
2402
|
+
|
|
2403
|
+
**Ping mode** — AXIAM calls your notification endpoint; answer at once, then poll once:
|
|
2404
|
+
|
|
2405
|
+
```ts
|
|
2406
|
+
const notificationToken = new Sensitive(randomBytes(32).toString('base64url'));
|
|
2407
|
+
const initiated = await oidc.cibaInitiate({
|
|
2408
|
+
scope: 'openid', loginHint: 'ada', delivery: { mode: 'ping', clientNotificationToken: notificationToken },
|
|
2409
|
+
});
|
|
2410
|
+
|
|
2411
|
+
app.post('/ciba/notify', express.raw({ type: '*/*' }), async (req, res) => {
|
|
2412
|
+
let authReqId;
|
|
2413
|
+
try {
|
|
2414
|
+
authReqId = oidc.cibaHandlePing(req.rawHeaders, req.body, notificationToken); // no I/O
|
|
2415
|
+
} catch {
|
|
2416
|
+
return res.status(401).end();
|
|
2417
|
+
}
|
|
2418
|
+
res.status(204).end(); // answer first: AXIAM retries a slow ping
|
|
2419
|
+
const tokens = await oidc.cibaPoll({ authReqId }); // the outcome: tokens, access_denied, expired_token
|
|
2420
|
+
});
|
|
2421
|
+
// No ping after expires_in / 2? Fall back to oidc.cibaAwait(initiated).
|
|
2422
|
+
```
|
|
2423
|
+
|
|
2424
|
+
**Signed form** (a client registered with `backchannel_authentication_request_signing_alg`;
|
|
2425
|
+
required of a `fapi2` CIBA client):
|
|
2426
|
+
|
|
2427
|
+
```ts
|
|
2428
|
+
const signer = await CibaRequestSigner.create('EdDSA', new Sensitive(privateKeyPkcs8Pem), 'key-1');
|
|
2429
|
+
await oidc.cibaInitiate({ scope: 'openid', loginHint: 'ada', bindingMessage: 'W4SCT', signer });
|
|
2430
|
+
// The form carries client authentication and `request` only; every member is inside the JWT.
|
|
2431
|
+
```
|
|
2432
|
+
|
|
2433
|
+
- `cibaInitiate` is **never retried** — each accepted call may notify a person. A success
|
|
2434
|
+
proves nothing about the user: AXIAM answers an unknown, locked and real user alike.
|
|
2435
|
+
- `cibaPoll` surfaces every protocol answer as an `OAuthProtocolError` and retries only
|
|
2436
|
+
transport failures, `408`, a bodiless `429` and a `5xx` — whatever its body, so the server's
|
|
2437
|
+
own `500 {"error":"server_error"}` is retried and never ends `cibaAwait` (§34.2 P8). Store its tokens before anything else:
|
|
2438
|
+
a request is redeemed once. Neither helper adopts the tokens as the client's credential.
|
|
2439
|
+
- `authReqId`, `clientNotificationToken`, the signing key and the `request` JWT are
|
|
2440
|
+
`Sensitive` / never rendered. `CibaRequestSigner` supports PS256, ES256 and EdDSA, signs
|
|
2441
|
+
under exactly the algorithm given, and refuses a key that cannot (a probe signature).
|
|
2442
|
+
- `cibaAwait` takes an injectable `clock` (`{ now(), sleep(ms) }`) for tests.
|
|
2443
|
+
|
|
2102
2444
|
## Client quality-of-life (CONTRACT.md §16–§19)
|
|
2103
2445
|
|
|
2104
2446
|
### Retry policy (§16)
|
|
@@ -2161,7 +2503,9 @@ const client = new AxiamClient({
|
|
|
2161
2503
|
- **Path templates, not URLs**, so a metric label cannot become a cardinality bomb.
|
|
2162
2504
|
|
|
2163
2505
|
One `requestStart`/`requestEnd` pair is emitted **per attempt**, so you can count real wire
|
|
2164
|
-
calls.
|
|
2506
|
+
calls. `SsfReceiver.poll` also emits `ssfUnjudged` when it returns leaving SETs unjudged
|
|
2507
|
+
(contract 1.60), one per failure category with a count, so an outage it cannot raise is
|
|
2508
|
+
still visible. See [`examples/telemetry-hook.ts`](examples/telemetry-hook.ts), including the
|
|
2165
2509
|
OpenTelemetry mapping.
|
|
2166
2510
|
|
|
2167
2511
|
### Decision memo (§17) — opt-in, off by default
|
|
@@ -2196,7 +2540,7 @@ entries are keyed by subject rather than by session.
|
|
|
2196
2540
|
Everything above assumes a populated tenant. `login` signs a user in,
|
|
2197
2541
|
`checkAccess` asks about a resource, `verifyWebhook` checks a delivery signature — and
|
|
2198
2542
|
none of them can create the user, declare the resource or register the webhook. The
|
|
2199
|
-
management surface is the part that can: **
|
|
2543
|
+
management surface is the part that can: **202 operations across 29 namespaces**,
|
|
2200
2544
|
generated from `management-registry.json`, which is the whole server API minus what other
|
|
2201
2545
|
contract sections own and minus organization creation and deletion (§27.0 keeps those out
|
|
2202
2546
|
of reach of a client library on purpose).
|
|
@@ -2209,8 +2553,8 @@ const role = await client.roles.get(roleId);
|
|
|
2209
2553
|
await client.roles.assignToUser(roleId, { user_id: userId });
|
|
2210
2554
|
```
|
|
2211
2555
|
|
|
2212
|
-
Operations hang off **namespace handles** rather than the client.
|
|
2213
|
-
`list` and
|
|
2556
|
+
Operations hang off **namespace handles** rather than the client. Nineteen namespaces have a
|
|
2557
|
+
`list` and nineteen a `get`, so flattening them would need a disambiguating prefix invented
|
|
2214
2558
|
once per operation — and would bury the eight §1 methods most callers want under five times
|
|
2215
2559
|
as many they do not. Acquiring a handle performs no I/O. `client.management.users` is the
|
|
2216
2560
|
same handle as `client.users`, for call sites that read better with the namespace spelled
|
|
@@ -2307,7 +2651,7 @@ back.
|
|
|
2307
2651
|
|
|
2308
2652
|
### Declarative manifests (§27.6, §27.7)
|
|
2309
2653
|
|
|
2310
|
-
Calling
|
|
2654
|
+
Calling 202 operations one at a time is rarely what an application wants. What it does at
|
|
2311
2655
|
start-up, in a migration, or in a test fixture is assert a shape:
|
|
2312
2656
|
|
|
2313
2657
|
```ts
|
|
@@ -2345,7 +2689,7 @@ actions that would reconcile the tenant.
|
|
|
2345
2689
|
a tenant that also holds hand-made state.
|
|
2346
2690
|
- **Applying twice converges**: the second plan is all `no-change`. That is what makes
|
|
2347
2691
|
re-running after a failure safe.
|
|
2348
|
-
- **There is no transaction** across
|
|
2692
|
+
- **There is no transaction** across 202 independent HTTP endpoints, and `ApplyReport` does
|
|
2349
2693
|
not pretend there is. If step 12 of 30 fails, steps 1–11 have happened; the report says
|
|
2350
2694
|
which, execution stops rather than continuing blindly, and there is no `rollback` —
|
|
2351
2695
|
because this SDK could not honour one.
|
|
@@ -2417,6 +2761,37 @@ under neither: `AxiamResource(spec)(Documents)` is exactly what the `@` syntax d
|
|
|
2417
2761
|
|
|
2418
2762
|
`@AxiamServiceAccount({ key, name, roles })` (contract 1.51) joins the set the same way.
|
|
2419
2763
|
|
|
2764
|
+
#### The `network` namespace in a manifest (§27.6.2, contract 1.62)
|
|
2765
|
+
|
|
2766
|
+
```ts
|
|
2767
|
+
const desired = defineManifest({
|
|
2768
|
+
network: {
|
|
2769
|
+
policy: { sessionTimeoutMaxSecs: 7200 }, // a singleton: the tenant's cap
|
|
2770
|
+
segments: [
|
|
2771
|
+
{ key: 'staff', site: 'hq', kind: 'access', name: 'staff', vlanId: 20, rank: 1,
|
|
2772
|
+
filterIds: ['acl-a', 'acl-b'] },
|
|
2773
|
+
],
|
|
2774
|
+
profiles: [{ segment: 'staff', sessionTimeoutSecs: 3600, filterId: 'acl-a' }],
|
|
2775
|
+
},
|
|
2776
|
+
});
|
|
2777
|
+
const report = await client.manifest.apply(desired);
|
|
2778
|
+
const failed = failure(report); // failed?.reasonCode: 'stale_version', 'duplicate_vlan', …
|
|
2779
|
+
```
|
|
2780
|
+
|
|
2781
|
+
- A segment is keyed by **site + kind + name**, `kind` being the wire spelling (`access` or
|
|
2782
|
+
`quarantine`); a profile by **its segment**; the policy is a singleton. The order is policy,
|
|
2783
|
+
segments, profiles. The namespace is human-only: a service-account token meets `401`.
|
|
2784
|
+
- Every stated member is compared with the value **as the read returns it**: a profile's
|
|
2785
|
+
effective (clamped) timeout, and `filterIds` as a *set* (a reorder is `no-change`; a name
|
|
2786
|
+
listed twice is refused by `plan` and `apply` with no request made). A timeout stated above
|
|
2787
|
+
the tenant's cap is an `update` the server refuses with `403`; `apply` reports it and stops.
|
|
2788
|
+
- An `update` is a full, version-conditional replacement built from the read: members you
|
|
2789
|
+
did not state are carried, a stated `null` is left out, and a profile's `segment_version`
|
|
2790
|
+
is the version of this apply's own segment write when there was one. Nothing is retried or
|
|
2791
|
+
re-read: a `409` is that action's failure, and `outcome.reasonCode` names it.
|
|
2792
|
+
- **No pruning.** As for every other namespace here, `apply` never deletes; this SDK has no
|
|
2793
|
+
prune option for `network` either (§27.10).
|
|
2794
|
+
|
|
2420
2795
|
### Examples
|
|
2421
2796
|
|
|
2422
2797
|
- [`examples/management-basics.ts`](examples/management-basics.ts) — the imperative surface
|
package/dist/amqp/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as Sensitive } from '../sensitive-BC_s7Rrd.cjs';
|
|
2
2
|
import { ConsumeMessage } from 'amqplib';
|
|
3
3
|
import { ConnectionOptions } from 'node:tls';
|
|
4
|
-
import { T as TelemetryHook, a as TelemetryDispatcher } from '../telemetry
|
|
4
|
+
import { T as TelemetryHook, a as TelemetryDispatcher } from '../telemetry--0DwnNjV.cjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Compute the hex-encoded HMAC-SHA256 of `payloadJson` using `key`.
|
package/dist/amqp/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { S as Sensitive } from '../sensitive-BC_s7Rrd.js';
|
|
2
2
|
import { ConsumeMessage } from 'amqplib';
|
|
3
3
|
import { ConnectionOptions } from 'node:tls';
|
|
4
|
-
import { T as TelemetryHook, a as TelemetryDispatcher } from '../telemetry
|
|
4
|
+
import { T as TelemetryHook, a as TelemetryDispatcher } from '../telemetry--0DwnNjV.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Compute the hex-encoded HMAC-SHA256 of `payloadJson` using `key`.
|
package/dist/amqp/index.js
CHANGED
|
@@ -15,7 +15,12 @@ var AxiamError = class extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
var NetworkError = class _NetworkError extends AxiamError {
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* What is safe to keep of the underlying transport error: its name, message,
|
|
20
|
+
* code and status, and the response's status, body and allow-listed headers
|
|
21
|
+
* (§2, X-3). Never the request — its body or its headers — which may carry a
|
|
22
|
+
* write-only secret (contract 1.59 R-18).
|
|
23
|
+
*/
|
|
19
24
|
cause;
|
|
20
25
|
constructor(message, cause) {
|
|
21
26
|
super(message);
|