axiam-sdk 1.0.0-alpha31 → 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 +87 -47
- package/dist/{client-Dz_AJfW7.d.cts → client-BI8psWTI.d.cts} +54 -66
- package/dist/{client-Cai8IhUV.d.ts → client-BLxvE44W.d.ts} +54 -66
- package/dist/{cookieJar-Dk9eqU4i.d.cts → cookieJar-CtSD0jwR.d.cts} +1 -1
- package/dist/{cookieJar-z_5x601f.d.ts → cookieJar-b1B10RCK.d.ts} +1 -1
- package/dist/grpc/index.d.cts +3 -3
- package/dist/grpc/index.d.ts +3 -3
- package/dist/grpc/index.js +174 -237
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +174 -237
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +174 -236
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +172 -235
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +174 -237
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +174 -237
- package/dist/node/index.mjs.map +1 -1
- package/dist/rest/index.d.cts +45 -2
- package/dist/rest/index.d.ts +45 -2
- package/dist/rest/index.js +174 -236
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +172 -235
- package/dist/rest/index.mjs.map +1 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
Official TypeScript/JavaScript client SDK for [AXIAM](https://github.com/ilpanich/axiam) — Access eXtended Identity and Authorization Management.
|
|
10
10
|
|
|
11
|
+
**Platform documentation:** <https://ilpanich.github.io/axiam/> — getting started, the authorization model, the OAuth2/OIDC surface, and the operations guides. This README covers the SDK; the site covers the server it talks to.
|
|
12
|
+
|
|
11
13
|
## Package identity
|
|
12
14
|
|
|
13
15
|
- **npm package:** `axiam-sdk`
|
|
@@ -707,78 +709,116 @@ strings.
|
|
|
707
709
|
|
|
708
710
|
See `examples/express-oidc-login.ts` for a complete, runnable example.
|
|
709
711
|
|
|
710
|
-
##
|
|
712
|
+
## OPAQUE (CONTRACT.md §23)
|
|
711
713
|
|
|
712
|
-
`
|
|
713
|
-
and a
|
|
714
|
-
|
|
714
|
+
`loginOpaque` proves the password without sending it. What crosses the wire is
|
|
715
|
+
a blinded group element and a MAC, neither useful without the account's
|
|
716
|
+
registration record **and** the tenant's OPRF seed.
|
|
715
717
|
|
|
716
718
|
```ts
|
|
717
|
-
|
|
718
|
-
const result = await client.loginSrp('alice', 'correct horse battery staple');
|
|
719
|
+
const result = await client.loginOpaque('alice', 'correct horse battery staple');
|
|
719
720
|
```
|
|
720
721
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
722
|
+
It takes the same arguments as `login` and returns the same `LoginResult`, MFA
|
|
723
|
+
branch included, so switching a tenant to OPAQUE needs no change to how the
|
|
724
|
+
result is handled.
|
|
725
|
+
|
|
726
|
+
### Falling back — and when not to
|
|
727
|
+
|
|
728
|
+
Fall back to `login()` when the tenant does not offer OPAQUE, or when this
|
|
729
|
+
installation cannot perform it. Both are a `NetworkError`, deliberately **not**
|
|
730
|
+
an `AuthError`, so neither can be mistaken for a bad password:
|
|
724
731
|
|
|
725
732
|
```ts
|
|
726
733
|
let result;
|
|
727
734
|
try {
|
|
728
|
-
result = await client.
|
|
735
|
+
result = await client.loginOpaque(user, password);
|
|
729
736
|
} catch (err) {
|
|
730
|
-
if (err instanceof NetworkError
|
|
731
|
-
|
|
732
|
-
} else {
|
|
733
|
-
throw err;
|
|
734
|
-
}
|
|
737
|
+
if (!(err instanceof NetworkError)) throw err; // <- not a fallback case
|
|
738
|
+
result = await client.login(user, password);
|
|
735
739
|
}
|
|
736
740
|
```
|
|
737
741
|
|
|
742
|
+
The `if` is the important line. **Any other error is a failed login**, and
|
|
743
|
+
retrying it over `login()` would hand the plaintext to a server that just
|
|
744
|
+
failed to prove it holds the record.
|
|
745
|
+
|
|
746
|
+
### What this buys, and what it does not
|
|
747
|
+
|
|
748
|
+
OPAQUE closes holes TLS 1.3 does not:
|
|
749
|
+
|
|
750
|
+
- a TLS-terminating reverse proxy, ingress controller, CDN or service mesh sees
|
|
751
|
+
every plaintext password today; under OPAQUE it sees a blinded group element;
|
|
752
|
+
- an accidental request-body log, a heap dump or a crash reporter can no longer
|
|
753
|
+
capture a plaintext password, because the server never has one;
|
|
754
|
+
- **a stolen record database is not offline-crackable on its own.** Recovering a
|
|
755
|
+
password additionally requires the tenant's OPRF seed, encrypted at rest
|
|
756
|
+
separately. This is the property SRP could not offer, and the main reason
|
|
757
|
+
AXIAM replaced it.
|
|
758
|
+
|
|
759
|
+
It does **not** protect against a compromised AXIAM server, and in a browser it
|
|
760
|
+
does not protect against AXIAM serving malicious JavaScript.
|
|
761
|
+
|
|
738
762
|
### Enrolment
|
|
739
763
|
|
|
740
|
-
The server cannot
|
|
741
|
-
|
|
764
|
+
The server cannot build a record — it never sees the plaintext — so one has to
|
|
765
|
+
be sent with any request that sets a password:
|
|
742
766
|
|
|
743
767
|
```ts
|
|
744
|
-
const
|
|
745
|
-
|
|
746
|
-
password: 'new password',
|
|
747
|
-
group: 'rfc5054_4096',
|
|
748
|
-
kdf: 'argon2id',
|
|
749
|
-
});
|
|
750
|
-
// send `srp` as the request's `srp` field
|
|
768
|
+
const opaque = await client.opaqueEnrollment(newPassword);
|
|
769
|
+
// send `opaque` as the request body's `opaque` field
|
|
751
770
|
```
|
|
752
771
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
772
|
+
One argument, where the SRP verifier this replaces took four. There is no
|
|
773
|
+
`identity` — a record binds to a credential identifier the server chooses, so
|
|
774
|
+
enrolling against an email can no longer produce something no login can satisfy,
|
|
775
|
+
and a later rename cannot invalidate it — and no group or KDF, because the
|
|
776
|
+
server names them in its `register/start` response and this call honours what
|
|
777
|
+
it names.
|
|
757
778
|
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
`identity` field and why `loginSrp` uses that rather than what was typed.
|
|
762
|
-
Enrolling against an email produces a verifier no login can satisfy.
|
|
779
|
+
It is `async` because that response has to be fetched: OPAQUE's envelope is
|
|
780
|
+
sealed under the server's oblivious PRF, so there is no offline computation that
|
|
781
|
+
produces a valid record. The SRP verifier needed no network at all.
|
|
763
782
|
|
|
764
|
-
|
|
765
|
-
19 MiB by default, tens to hundreds of milliseconds. That cost is what makes a
|
|
766
|
-
stolen verifier expensive to attack offline. In a browser, consider a Web
|
|
767
|
-
Worker.
|
|
783
|
+
### This SDK does not implement OPAQUE
|
|
768
784
|
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
785
|
+
CONTRACT.md §23.1 forbids it. SRP was hand-written eleven times because it is
|
|
786
|
+
modular arithmetic every language has; OPAQUE needs an oblivious PRF,
|
|
787
|
+
`hash_to_curve`, `expand_message_xmd`, an envelope construction and a
|
|
788
|
+
three-message AKE. `core/srp.ts` — 419 lines of it — is replaced by a loader
|
|
789
|
+
around `@axiam/opaque-wasm`, the WebAssembly build of the same implementation
|
|
790
|
+
the AXIAM server links and every other SDK binds.
|
|
774
791
|
|
|
775
792
|
### Runtime requirements
|
|
776
793
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
794
|
+
`@axiam/opaque-wasm` is an **optional peer dependency**:
|
|
795
|
+
|
|
796
|
+
```bash
|
|
797
|
+
npm install @axiam/opaque-wasm
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
Optional, because an installation that never touches the OPAQUE path should not
|
|
801
|
+
be made to carry a WebAssembly module. When it is absent, `opaqueAvailable()`
|
|
802
|
+
resolves to `false` and `loginOpaque` rejects with a `NetworkError` — reporting
|
|
803
|
+
rather than throwing at login time is what §23.1 asks of an SDK whose native
|
|
804
|
+
artifact did not load, and it is why the fallback above works unchanged.
|
|
805
|
+
|
|
806
|
+
```ts
|
|
807
|
+
if (!(await client.opaqueAvailable())) {
|
|
808
|
+
// use login() — this installation cannot do OPAQUE
|
|
809
|
+
}
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
It is imported lazily and memoized, so a consumer who never calls OPAQUE does
|
|
813
|
+
not pay the wasm payload at module-load time, and two concurrent logins do not
|
|
814
|
+
instantiate it twice.
|
|
815
|
+
|
|
816
|
+
### Cost
|
|
817
|
+
|
|
818
|
+
`loginOpaque` runs the tenant's key-stretching function: Argon2id at 19 MiB and
|
|
819
|
+
t=2 by default, tens to hundreds of milliseconds of synchronous work. That cost
|
|
820
|
+
is the point — it is what makes a stolen record expensive to attack even by
|
|
821
|
+
someone holding the OPRF seed. In a browser, consider a Web Worker.
|
|
782
822
|
|
|
783
823
|
## Device authorization grant (`axiam-sdk/node`, CONTRACT.md §14)
|
|
784
824
|
|
|
@@ -176,69 +176,42 @@ declare function delayMs(attempt: number, retryAfterMs: number | undefined, frac
|
|
|
176
176
|
*/
|
|
177
177
|
declare function withRetry<T>(fn: (attempt: number) => Promise<T>, options: RetryOptions): Promise<T>;
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
iterations: number;
|
|
189
|
-
/** Argon2id lane count; absent for PBKDF2. */
|
|
190
|
-
parallelism?: number;
|
|
191
|
-
/**
|
|
192
|
-
* The 32-byte enrolment salt, lowercase hex. Freshly generated per enrolment
|
|
193
|
-
* (§23.3 rule 11): a reused salt would make every verifier in a tenant
|
|
194
|
-
* attackable with one precomputation.
|
|
195
|
-
*/
|
|
196
|
-
salt: string;
|
|
197
|
-
/**
|
|
198
|
-
* `v = g^x mod N`, lowercase hex. The only password-derived value the server
|
|
199
|
-
* ever receives, and computationally infeasible to invert.
|
|
200
|
-
*/
|
|
201
|
-
verifier: string;
|
|
202
|
-
}
|
|
203
|
-
/** Options for {@link srpEnrollment}. */
|
|
204
|
-
interface SrpEnrollmentOptions {
|
|
179
|
+
/**
|
|
180
|
+
* A completed enrolment, to send with any request that sets a password.
|
|
181
|
+
*
|
|
182
|
+
* Two fields, where the SRP verifier it replaces had seven. The server chose
|
|
183
|
+
* the credential identifier, the ciphersuite and the costs and sealed them into
|
|
184
|
+
* `opaque_session` — which is why a client cannot name any of them, and why it
|
|
185
|
+
* cannot enrol a record against somebody else's account.
|
|
186
|
+
*/
|
|
187
|
+
interface OpaqueEnrollment {
|
|
205
188
|
/**
|
|
206
|
-
* The
|
|
207
|
-
*
|
|
189
|
+
* The `opaque_session` from `register/start`, echoed **verbatim**.
|
|
190
|
+
*
|
|
191
|
+
* Opaque sealed server state carrying the credential identifier, the
|
|
192
|
+
* ciphersuite and the costs. Do not parse, cache, or reuse it across
|
|
193
|
+
* exchanges (§23.4 rule 8) — it is valid for 120 seconds.
|
|
208
194
|
*/
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
|
|
212
|
-
/** From the tenant's policy (`GET /api/v1/auth/me`, or the reset context). */
|
|
213
|
-
group: string;
|
|
214
|
-
/** The KDF the tenant enrols under: `argon2id` or `pbkdf2_sha256`. */
|
|
215
|
-
kdf: string;
|
|
216
|
-
/** KDF cost; defaults to AXIAM's own for the chosen KDF when omitted. */
|
|
217
|
-
iterations?: number;
|
|
218
|
-
/** Argon2id memory cost in KiB; ignored for PBKDF2. */
|
|
219
|
-
memoryKib?: number;
|
|
220
|
-
/** Argon2id lane count; ignored for PBKDF2. */
|
|
221
|
-
parallelism?: number;
|
|
195
|
+
opaque_session: string;
|
|
196
|
+
/** Lowercase-hex serialized RFC 9807 `RegistrationRecord`. */
|
|
197
|
+
registration_record: string;
|
|
222
198
|
}
|
|
223
199
|
/**
|
|
224
|
-
*
|
|
225
|
-
* (user creation, change-password, reset completion).
|
|
200
|
+
* Build a registration record for `password`, to send with any request that
|
|
201
|
+
* sets one (user creation, change-password, reset completion).
|
|
226
202
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
declare function srpEnrollment(options: SrpEnrollmentOptions): Promise<SrpEnrollment>;
|
|
232
|
-
/**
|
|
233
|
-
* Whether this SDK build can perform SRP.
|
|
203
|
+
* This performs a `register/start` round trip, which the SRP verifier it
|
|
204
|
+
* replaces did not need: OPAQUE's envelope is sealed under the server's
|
|
205
|
+
* oblivious PRF, so there is no offline computation that produces a valid
|
|
206
|
+
* record.
|
|
234
207
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
208
|
+
* Note the absence of an `identity` argument. The SRP version required the
|
|
209
|
+
* account's canonical username, and passing an email produced a verifier no
|
|
210
|
+
* login could ever satisfy. A record binds to a credential identifier the
|
|
211
|
+
* server chooses, so there is nothing here to get wrong — and a later rename
|
|
212
|
+
* cannot invalidate it.
|
|
240
213
|
*/
|
|
241
|
-
declare function
|
|
214
|
+
declare function opaqueEnrollment(client: AxiamClient, password: string): Promise<OpaqueEnrollment>;
|
|
242
215
|
|
|
243
216
|
/**
|
|
244
217
|
* The main entry point for the AXIAM TypeScript/JavaScript SDK — an
|
|
@@ -332,21 +305,36 @@ declare class AxiamClient {
|
|
|
332
305
|
/** `POST /api/v1/auth/login` (§1, D-18). */
|
|
333
306
|
login(email: string, password: string): Promise<LoginResult>;
|
|
334
307
|
/**
|
|
335
|
-
*
|
|
308
|
+
* OPAQUE login (§23) — the password never leaves this process.
|
|
336
309
|
*
|
|
337
310
|
* Returns the same `LoginResult` as {@link login}, including the
|
|
338
311
|
* `mfa_required` branch, so one result handler serves both. Rejects with a
|
|
339
|
-
* `NetworkError` naming
|
|
340
|
-
* fall back to {@link login} rather than mistaking it for a bad password.
|
|
312
|
+
* `NetworkError` naming OPAQUE when the tenant has it disabled, so a caller
|
|
313
|
+
* can fall back to {@link login} rather than mistaking it for a bad password.
|
|
314
|
+
*
|
|
315
|
+
* **Only that case may fall back.** Any other rejection is a failed login,
|
|
316
|
+
* and retrying it over {@link login} would hand the plaintext to a server
|
|
317
|
+
* that just failed to prove it holds the record.
|
|
341
318
|
*/
|
|
342
|
-
|
|
319
|
+
loginOpaque(usernameOrEmail: string, password: string): Promise<LoginResult>;
|
|
343
320
|
/**
|
|
344
|
-
*
|
|
345
|
-
* (§23). The server cannot
|
|
321
|
+
* Build an OPAQUE registration record to send with any request that sets a
|
|
322
|
+
* password (§23). The server cannot build one — it never sees the plaintext.
|
|
323
|
+
*
|
|
324
|
+
* Asynchronous because it performs a `register/start` round trip: the
|
|
325
|
+
* envelope is sealed under the server's oblivious PRF, so unlike the SRP
|
|
326
|
+
* verifier this replaces there is no offline computation that produces a
|
|
327
|
+
* valid record.
|
|
328
|
+
*/
|
|
329
|
+
opaqueEnrollment(password: string): Promise<OpaqueEnrollment>;
|
|
330
|
+
/**
|
|
331
|
+
* Whether this installation can perform OPAQUE (§23.2).
|
|
332
|
+
*
|
|
333
|
+
* Asynchronous, and genuinely able to answer `false`: `@axiam/opaque-wasm` is
|
|
334
|
+
* an optional peer dependency, so an installation that skipped it reports
|
|
335
|
+
* rather than throwing at login time.
|
|
346
336
|
*/
|
|
347
|
-
|
|
348
|
-
/** Whether this runtime can perform SRP (§23.1). Always true here. */
|
|
349
|
-
srpAvailable(): boolean;
|
|
337
|
+
opaqueAvailable(): Promise<boolean>;
|
|
350
338
|
/** `POST /api/v1/auth/mfa/verify` (§1, D-18). Completes the two-phase flow started by login(). */
|
|
351
339
|
verifyMfa(mfaToken: string, code: string): Promise<LoginResult>;
|
|
352
340
|
/** `POST /api/v1/auth/refresh` (§1). Usually driven reactively by the response interceptor (D-07). */
|
|
@@ -361,4 +349,4 @@ declare class AxiamClient {
|
|
|
361
349
|
batchCheck(checks: AccessCheck[]): Promise<AccessDecision[]>;
|
|
362
350
|
}
|
|
363
351
|
|
|
364
|
-
export { AxiamClient as A, BASE_DELAY_MS as B, DecisionMemo as D, type FinishRequest as F, MAX_ATTEMPTS as M, type
|
|
352
|
+
export { AxiamClient as A, BASE_DELAY_MS as B, DecisionMemo as D, type FinishRequest as F, MAX_ATTEMPTS as M, type OpaqueEnrollment as O, type RetryOptions as R, TelemetryReporter as T, MAX_DELAY_MS as a, MAX_TTL_MS as b, backoffMs as c, delayMs as d, memoKey as m, opaqueEnrollment as o, withRetry as w };
|
|
@@ -176,69 +176,42 @@ declare function delayMs(attempt: number, retryAfterMs: number | undefined, frac
|
|
|
176
176
|
*/
|
|
177
177
|
declare function withRetry<T>(fn: (attempt: number) => Promise<T>, options: RetryOptions): Promise<T>;
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
iterations: number;
|
|
189
|
-
/** Argon2id lane count; absent for PBKDF2. */
|
|
190
|
-
parallelism?: number;
|
|
191
|
-
/**
|
|
192
|
-
* The 32-byte enrolment salt, lowercase hex. Freshly generated per enrolment
|
|
193
|
-
* (§23.3 rule 11): a reused salt would make every verifier in a tenant
|
|
194
|
-
* attackable with one precomputation.
|
|
195
|
-
*/
|
|
196
|
-
salt: string;
|
|
197
|
-
/**
|
|
198
|
-
* `v = g^x mod N`, lowercase hex. The only password-derived value the server
|
|
199
|
-
* ever receives, and computationally infeasible to invert.
|
|
200
|
-
*/
|
|
201
|
-
verifier: string;
|
|
202
|
-
}
|
|
203
|
-
/** Options for {@link srpEnrollment}. */
|
|
204
|
-
interface SrpEnrollmentOptions {
|
|
179
|
+
/**
|
|
180
|
+
* A completed enrolment, to send with any request that sets a password.
|
|
181
|
+
*
|
|
182
|
+
* Two fields, where the SRP verifier it replaces had seven. The server chose
|
|
183
|
+
* the credential identifier, the ciphersuite and the costs and sealed them into
|
|
184
|
+
* `opaque_session` — which is why a client cannot name any of them, and why it
|
|
185
|
+
* cannot enrol a record against somebody else's account.
|
|
186
|
+
*/
|
|
187
|
+
interface OpaqueEnrollment {
|
|
205
188
|
/**
|
|
206
|
-
* The
|
|
207
|
-
*
|
|
189
|
+
* The `opaque_session` from `register/start`, echoed **verbatim**.
|
|
190
|
+
*
|
|
191
|
+
* Opaque sealed server state carrying the credential identifier, the
|
|
192
|
+
* ciphersuite and the costs. Do not parse, cache, or reuse it across
|
|
193
|
+
* exchanges (§23.4 rule 8) — it is valid for 120 seconds.
|
|
208
194
|
*/
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
|
|
212
|
-
/** From the tenant's policy (`GET /api/v1/auth/me`, or the reset context). */
|
|
213
|
-
group: string;
|
|
214
|
-
/** The KDF the tenant enrols under: `argon2id` or `pbkdf2_sha256`. */
|
|
215
|
-
kdf: string;
|
|
216
|
-
/** KDF cost; defaults to AXIAM's own for the chosen KDF when omitted. */
|
|
217
|
-
iterations?: number;
|
|
218
|
-
/** Argon2id memory cost in KiB; ignored for PBKDF2. */
|
|
219
|
-
memoryKib?: number;
|
|
220
|
-
/** Argon2id lane count; ignored for PBKDF2. */
|
|
221
|
-
parallelism?: number;
|
|
195
|
+
opaque_session: string;
|
|
196
|
+
/** Lowercase-hex serialized RFC 9807 `RegistrationRecord`. */
|
|
197
|
+
registration_record: string;
|
|
222
198
|
}
|
|
223
199
|
/**
|
|
224
|
-
*
|
|
225
|
-
* (user creation, change-password, reset completion).
|
|
200
|
+
* Build a registration record for `password`, to send with any request that
|
|
201
|
+
* sets one (user creation, change-password, reset completion).
|
|
226
202
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
|
|
231
|
-
declare function srpEnrollment(options: SrpEnrollmentOptions): Promise<SrpEnrollment>;
|
|
232
|
-
/**
|
|
233
|
-
* Whether this SDK build can perform SRP.
|
|
203
|
+
* This performs a `register/start` round trip, which the SRP verifier it
|
|
204
|
+
* replaces did not need: OPAQUE's envelope is sealed under the server's
|
|
205
|
+
* oblivious PRF, so there is no offline computation that produces a valid
|
|
206
|
+
* record.
|
|
234
207
|
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
208
|
+
* Note the absence of an `identity` argument. The SRP version required the
|
|
209
|
+
* account's canonical username, and passing an email produced a verifier no
|
|
210
|
+
* login could ever satisfy. A record binds to a credential identifier the
|
|
211
|
+
* server chooses, so there is nothing here to get wrong — and a later rename
|
|
212
|
+
* cannot invalidate it.
|
|
240
213
|
*/
|
|
241
|
-
declare function
|
|
214
|
+
declare function opaqueEnrollment(client: AxiamClient, password: string): Promise<OpaqueEnrollment>;
|
|
242
215
|
|
|
243
216
|
/**
|
|
244
217
|
* The main entry point for the AXIAM TypeScript/JavaScript SDK — an
|
|
@@ -332,21 +305,36 @@ declare class AxiamClient {
|
|
|
332
305
|
/** `POST /api/v1/auth/login` (§1, D-18). */
|
|
333
306
|
login(email: string, password: string): Promise<LoginResult>;
|
|
334
307
|
/**
|
|
335
|
-
*
|
|
308
|
+
* OPAQUE login (§23) — the password never leaves this process.
|
|
336
309
|
*
|
|
337
310
|
* Returns the same `LoginResult` as {@link login}, including the
|
|
338
311
|
* `mfa_required` branch, so one result handler serves both. Rejects with a
|
|
339
|
-
* `NetworkError` naming
|
|
340
|
-
* fall back to {@link login} rather than mistaking it for a bad password.
|
|
312
|
+
* `NetworkError` naming OPAQUE when the tenant has it disabled, so a caller
|
|
313
|
+
* can fall back to {@link login} rather than mistaking it for a bad password.
|
|
314
|
+
*
|
|
315
|
+
* **Only that case may fall back.** Any other rejection is a failed login,
|
|
316
|
+
* and retrying it over {@link login} would hand the plaintext to a server
|
|
317
|
+
* that just failed to prove it holds the record.
|
|
341
318
|
*/
|
|
342
|
-
|
|
319
|
+
loginOpaque(usernameOrEmail: string, password: string): Promise<LoginResult>;
|
|
343
320
|
/**
|
|
344
|
-
*
|
|
345
|
-
* (§23). The server cannot
|
|
321
|
+
* Build an OPAQUE registration record to send with any request that sets a
|
|
322
|
+
* password (§23). The server cannot build one — it never sees the plaintext.
|
|
323
|
+
*
|
|
324
|
+
* Asynchronous because it performs a `register/start` round trip: the
|
|
325
|
+
* envelope is sealed under the server's oblivious PRF, so unlike the SRP
|
|
326
|
+
* verifier this replaces there is no offline computation that produces a
|
|
327
|
+
* valid record.
|
|
328
|
+
*/
|
|
329
|
+
opaqueEnrollment(password: string): Promise<OpaqueEnrollment>;
|
|
330
|
+
/**
|
|
331
|
+
* Whether this installation can perform OPAQUE (§23.2).
|
|
332
|
+
*
|
|
333
|
+
* Asynchronous, and genuinely able to answer `false`: `@axiam/opaque-wasm` is
|
|
334
|
+
* an optional peer dependency, so an installation that skipped it reports
|
|
335
|
+
* rather than throwing at login time.
|
|
346
336
|
*/
|
|
347
|
-
|
|
348
|
-
/** Whether this runtime can perform SRP (§23.1). Always true here. */
|
|
349
|
-
srpAvailable(): boolean;
|
|
337
|
+
opaqueAvailable(): Promise<boolean>;
|
|
350
338
|
/** `POST /api/v1/auth/mfa/verify` (§1, D-18). Completes the two-phase flow started by login(). */
|
|
351
339
|
verifyMfa(mfaToken: string, code: string): Promise<LoginResult>;
|
|
352
340
|
/** `POST /api/v1/auth/refresh` (§1). Usually driven reactively by the response interceptor (D-07). */
|
|
@@ -361,4 +349,4 @@ declare class AxiamClient {
|
|
|
361
349
|
batchCheck(checks: AccessCheck[]): Promise<AccessDecision[]>;
|
|
362
350
|
}
|
|
363
351
|
|
|
364
|
-
export { AxiamClient as A, BASE_DELAY_MS as B, DecisionMemo as D, type FinishRequest as F, MAX_ATTEMPTS as M, type
|
|
352
|
+
export { AxiamClient as A, BASE_DELAY_MS as B, DecisionMemo as D, type FinishRequest as F, MAX_ATTEMPTS as M, type OpaqueEnrollment as O, type RetryOptions as R, TelemetryReporter as T, MAX_DELAY_MS as a, MAX_TTL_MS as b, backoffMs as c, delayMs as d, memoKey as m, opaqueEnrollment as o, withRetry as w };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CookieJar } from 'tough-cookie';
|
|
2
2
|
import { S as SharedSession, A as AxiamClientOptions, N as NodeTlsOptions } from './session-CMgYRxLP.cjs';
|
|
3
|
-
import { A as AxiamClient } from './client-
|
|
3
|
+
import { A as AxiamClient } from './client-BI8psWTI.cjs';
|
|
4
4
|
import { S as Sensitive } from './sensitive-BC_s7Rrd.cjs';
|
|
5
5
|
import { V as Verifier } from './jwks-CSXHo3DS.cjs';
|
|
6
6
|
import { AxiosInstance } from 'axios';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CookieJar } from 'tough-cookie';
|
|
2
2
|
import { S as SharedSession, A as AxiamClientOptions, N as NodeTlsOptions } from './session-BJHqprWm.js';
|
|
3
|
-
import { A as AxiamClient } from './client-
|
|
3
|
+
import { A as AxiamClient } from './client-BLxvE44W.js';
|
|
4
4
|
import { S as Sensitive } from './sensitive-BC_s7Rrd.js';
|
|
5
5
|
import { V as Verifier } from './jwks-CSXHo3DS.js';
|
|
6
6
|
import { AxiosInstance } from 'axios';
|
package/dist/grpc/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
2
|
import { Interceptor } from '@grpc/grpc-js';
|
|
3
|
-
import { N as NodeSession } from '../cookieJar-
|
|
4
|
-
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-
|
|
3
|
+
import { N as NodeSession } from '../cookieJar-CtSD0jwR.cjs';
|
|
4
|
+
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-CtSD0jwR.cjs';
|
|
5
5
|
import { a as AccessDecision } from '../types-CO10Ainw.cjs';
|
|
6
6
|
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CSXHo3DS.cjs';
|
|
7
7
|
import 'tough-cookie';
|
|
8
8
|
import '../session-CMgYRxLP.cjs';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import '../telemetry-DrGqL4kb.cjs';
|
|
11
|
-
import '../client-
|
|
11
|
+
import '../client-BI8psWTI.cjs';
|
|
12
12
|
import '../sensitive-BC_s7Rrd.cjs';
|
|
13
13
|
|
|
14
14
|
/**
|
package/dist/grpc/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as grpc from '@grpc/grpc-js';
|
|
2
2
|
import { Interceptor } from '@grpc/grpc-js';
|
|
3
|
-
import { N as NodeSession } from '../cookieJar-
|
|
4
|
-
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-
|
|
3
|
+
import { N as NodeSession } from '../cookieJar-b1B10RCK.js';
|
|
4
|
+
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-b1B10RCK.js';
|
|
5
5
|
import { a as AccessDecision } from '../types-CO10Ainw.js';
|
|
6
6
|
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CSXHo3DS.js';
|
|
7
7
|
import 'tough-cookie';
|
|
8
8
|
import '../session-BJHqprWm.js';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import '../telemetry-DrGqL4kb.js';
|
|
11
|
-
import '../client-
|
|
11
|
+
import '../client-BLxvE44W.js';
|
|
12
12
|
import '../sensitive-BC_s7Rrd.js';
|
|
13
13
|
|
|
14
14
|
/**
|