axiam-sdk-wasm 1.0.0-alpha35 → 1.0.0-alpha37

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 CHANGED
@@ -7,9 +7,11 @@ npm install axiam-sdk-wasm
7
7
  ```
8
8
 
9
9
  ```js
10
- import init, { AxiamWasmClient } from "axiam-sdk-wasm";
11
-
12
- await init(); // loads the .wasm module
10
+ // The published package is wasm-pack's `bundler` target: webpack, Vite,
11
+ // Rollup and esbuild instantiate the module for you, so there is no `init()`
12
+ // to await. A `web`-target build, which you make yourself, does have one —
13
+ // see "Building from source".
14
+ import { AxiamWasmClient } from "axiam-sdk-wasm";
13
15
 
14
16
  const client = new AxiamWasmClient(
15
17
  "https://axiam.example", // base URL
@@ -17,7 +19,7 @@ const client = new AxiamWasmClient(
17
19
  "default", // tenant slug
18
20
  );
19
21
 
20
- // OPAQUE login — the password never leaves the browser.
22
+ // OPAQUE login (RFC 9807) — the password never leaves the browser.
21
23
  await client.loginOpaque("alice", "correct horse battery staple");
22
24
 
23
25
  if (await client.can("documents:read", "3f8a…-uuid")) {
@@ -25,6 +27,34 @@ if (await client.can("documents:read", "3f8a…-uuid")) {
25
27
  }
26
28
  ```
27
29
 
30
+ 1.0.0 has not shipped: every release so far is a prerelease, and the API can
31
+ still change between them. Until it does, `latest` names the newest prerelease,
32
+ so the install line above is the one to use — pin the exact version in
33
+ `package.json` if you would rather choose when to move.
34
+
35
+ ## Coming from 1.0.0-alpha31 or earlier?
36
+
37
+ Those releases spoke **SRP-6a**. AXIAM replaced SRP with **OPAQUE (RFC 9807)**
38
+ in 1.0.0-alpha34 and removed SRP from the platform entirely, so the three
39
+ methods that named it are gone rather than deprecated:
40
+
41
+ | alpha31 and earlier | now |
42
+ |---|---|
43
+ | `loginSrp(user, password)` | `loginOpaque(user, password)` |
44
+ | `srpEnrollment(identity, password, group, kdf, iterations, …)` | `await opaqueEnrollment(password)` |
45
+ | `srpAvailable()` | `opaqueAvailable()` |
46
+
47
+ `opaqueEnrollment` is asynchronous and takes only a password. It is
48
+ asynchronous because a registration record is sealed under the server's
49
+ oblivious PRF, so there is no offline computation that produces a valid one —
50
+ it performs a `register/start` round trip. It takes no identity because the
51
+ server names the credential identifier, which removes the alpha31 failure mode
52
+ where enrolling with an email produced a verifier no login could satisfy.
53
+
54
+ This is a server-side break too, not only an SDK rename: an SRP verifier cannot
55
+ be converted into an OPAQUE record, so accounts re-enroll. See CONTRACT.md §23
56
+ and the CHANGELOG for the full account.
57
+
28
58
  ## Which package do I want?
29
59
 
30
60
  This is **not** a replacement for [`axiam-sdk`](https://www.npmjs.com/package/axiam-sdk),
@@ -39,19 +69,24 @@ the TypeScript SDK. They are different trade-offs:
39
69
  | Shares code with | itself | the Rust server and SDK |
40
70
 
41
71
  Reach for this one when you want the *same* implementation the Rust SDK and
42
- the AXIAM server run — the OPAQUE implementation, the JWKS verifier, the decision memo
72
+ the AXIAM server run — the OPAQUE implementation, the token handling, the decision memo
43
73
  are literally the same compiled code, not a second implementation that has to be
44
74
  kept in agreement. Reach for the TypeScript SDK when payload size matters, which
45
75
  for most web applications it does.
46
76
 
47
77
  ## What is in it
48
78
 
49
- Everything the Rust SDK's REST surface offers:
79
+ The whole exported surface, which is the REST surface a browser can use:
50
80
 
81
+ - `new AxiamWasmClient(baseUrl, orgSlug, tenantSlug)`, and `close()`
51
82
  - `login`, `loginOpaque`, `verifyMfa`, `refresh`, `logout`
52
83
  - `checkAccess`, `can`, `batchCheck` (with the client-side decision memo)
53
84
  - `opaqueEnrollment`, `opaqueAvailable`
54
- - local JWKS verification and the §12 OIDC relying-party helpers
85
+ - `sdkVersion()`, module-level
86
+
87
+ `axiam_sdk_wasm.d.ts` ships with the package and documents each of them; that
88
+ file is generated from the Rust doc comments, so it cannot drift from the code
89
+ it describes.
55
90
 
56
91
  ## What is not, and why
57
92
 
@@ -60,6 +95,7 @@ Everything the Rust SDK's REST surface offers:
60
95
  | gRPC | A browser has no sockets |
61
96
  | AMQP, the reactor runtime | Same |
62
97
  | Actix middleware / route guards | They guard a server; there is no server here |
98
+ | Local JWKS verification, the §12 OIDC relying-party helpers | Compiled into the module but not exported across the wasm boundary: session tokens arrive as `HttpOnly` cookies, so page script never holds a token to verify locally |
63
99
  | mTLS (`with_client_cert`) | The browser picks the client certificate, not page script |
64
100
  | Custom CA roots (`with_custom_ca`) | The browser owns the trust store |
65
101
  | Request timeouts, redirect policy | `fetch` exposes neither |
@@ -96,7 +132,7 @@ AXIAM, not against AXIAM. Do not tell your users otherwise.
96
132
 
97
133
  `loginOpaque` runs the tenant's KDF — Argon2id at 19 MiB by default. That is tens
98
134
  to hundreds of milliseconds of synchronous work, and the cost is the point: it
99
- is what makes a stolen verifier expensive to attack offline. In a page that must
135
+ is what makes a stolen record expensive to attack offline. In a page that must
100
136
  stay responsive, run this module in a Web Worker.
101
137
 
102
138
  ## Building from source
@@ -111,6 +147,17 @@ wasm-pack build --target nodejs --out-dir pkg-node --release
111
147
  node scripts/wasm-smoke.mjs pkg-node
112
148
  ```
113
149
 
150
+ The `web` target is the one that exports a default `init()`, because nothing
151
+ instantiates the module for you there:
152
+
153
+ ```js
154
+ import init, { AxiamWasmClient } from "./pkg-web/axiam_sdk_wasm.js";
155
+
156
+ await init(); // loads the .wasm module
157
+ ```
158
+
159
+ `examples/browser-opaque-login.html` is a runnable page built on that target.
160
+
114
161
  The smoke test is not optional ceremony. It imports the built artifact and
115
162
  runs a complete OPAQUE exchange *through* it, because "wasm-pack
116
163
  succeeded" is not evidence that the module works — see the `wasm-opt` note in
@@ -8,9 +8,11 @@
8
8
  * native SDK exposes.
9
9
  *
10
10
  * ```js
11
- * import init, { AxiamWasmClient } from "axiam-sdk-wasm";
11
+ * // The npm package is wasm-pack's `bundler` target, which a bundler
12
+ * // instantiates for you — there is no `init()` to await. A `web`-target
13
+ * // build exports a default `init()` that must be awaited first.
14
+ * import { AxiamWasmClient } from "axiam-sdk-wasm";
12
15
  *
13
- * await init();
14
16
  * const client = new AxiamWasmClient("https://axiam.example", "acme", "default");
15
17
  * await client.loginOpaque("alice", "correct horse battery staple");
16
18
  * const decision = await client.can("documents:read", "doc-42");
@@ -5,9 +5,11 @@
5
5
  * native SDK exposes.
6
6
  *
7
7
  * ```js
8
- * import init, { AxiamWasmClient } from "axiam-sdk-wasm";
8
+ * // The npm package is wasm-pack's `bundler` target, which a bundler
9
+ * // instantiates for you — there is no `init()` to await. A `web`-target
10
+ * // build exports a default `init()` that must be awaited first.
11
+ * import { AxiamWasmClient } from "axiam-sdk-wasm";
9
12
  *
10
- * await init();
11
13
  * const client = new AxiamWasmClient("https://axiam.example", "acme", "default");
12
14
  * await client.loginOpaque("alice", "correct horse battery staple");
13
15
  * const decision = await client.can("documents:read", "doc-42");
@@ -679,12 +681,12 @@ export function __wbg_versions_276b2795b1c6a219(arg0) {
679
681
  return ret;
680
682
  }
681
683
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
682
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 520, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
684
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 521, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
683
685
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_cb9419483d5fb0a0___convert__closures_____invoke___wasm_bindgen_cb9419483d5fb0a0___JsValue__core_f0fd674eaa06beef___result__Result_____wasm_bindgen_cb9419483d5fb0a0___JsError___true_);
684
686
  return ret;
685
687
  }
686
688
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
687
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 164, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
689
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 171, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
688
690
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_cb9419483d5fb0a0___convert__closures_____invoke_______true_);
689
691
  return ret;
690
692
  }
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "axiam-sdk-wasm",
3
3
  "type": "module",
4
4
  "description": "Browser (WebAssembly) build of the official AXIAM IAM client SDK",
5
- "version": "1.0.0-alpha35",
5
+ "version": "1.0.0-alpha37",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",