axiam-sdk-wasm 1.0.0-alpha36 → 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 +55 -8
- package/axiam_sdk_wasm.d.ts +4 -2
- package/axiam_sdk_wasm_bg.js +4 -2
- package/axiam_sdk_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,9 +7,11 @@ npm install axiam-sdk-wasm
|
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
await
|
|
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
|
|
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
|
-
|
|
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
|
-
-
|
|
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
|
|
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
|
package/axiam_sdk_wasm.d.ts
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* native SDK exposes.
|
|
9
9
|
*
|
|
10
10
|
* ```js
|
|
11
|
-
*
|
|
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");
|
package/axiam_sdk_wasm_bg.js
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* native SDK exposes.
|
|
6
6
|
*
|
|
7
7
|
* ```js
|
|
8
|
-
*
|
|
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");
|
package/axiam_sdk_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED