axiam-sdk 1.0.0-alpha12 → 1.0.0-alpha2
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 +4 -38
- package/dist/{authzCore-B7GSd3-t.d.cts → authzCore-CV-Td-V1.d.cts} +1 -18
- package/dist/{authzCore-CcTdIf78.d.ts → authzCore-xwmCivHH.d.ts} +1 -18
- package/dist/{client-Co_baHgU.d.ts → client-BPg9kfKV.d.ts} +0 -73
- package/dist/{client-CzhzwRGg.d.cts → client-CAeQw1a-.d.cts} +0 -73
- package/dist/grpc/index.d.cts +2 -6
- package/dist/grpc/index.d.ts +2 -6
- package/dist/grpc/index.js +14 -183
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +14 -183
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -133
- package/dist/index.mjs.map +1 -1
- package/dist/{jwks-B8dPy2c6.d.cts → jwks-CX-nhD6A.d.cts} +0 -7
- package/dist/{jwks-B8dPy2c6.d.ts → jwks-CX-nhD6A.d.ts} +0 -7
- package/dist/middleware/index.d.cts +7 -17
- package/dist/middleware/index.d.ts +7 -17
- package/dist/middleware/index.js.map +1 -1
- 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.map +1 -1
- package/dist/nestjs/index.mjs.map +1 -1
- package/dist/node/index.d.cts +3 -22
- package/dist/node/index.d.ts +3 -22
- package/dist/node/index.js +11 -166
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +11 -166
- package/dist/node/index.mjs.map +1 -1
- package/dist/rest/index.d.cts +1 -1
- package/dist/rest/index.d.ts +1 -1
- package/dist/rest/index.js +10 -133
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +10 -133
- package/dist/rest/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Official TypeScript/JavaScript client SDK for [AXIAM](https://github.com/ilpanic
|
|
|
17
17
|
|
|
18
18
|
## Contract conformance
|
|
19
19
|
|
|
20
|
-
This SDK conforms to CONTRACT.md §1–§11
|
|
20
|
+
This SDK conforms to CONTRACT.md §1–§11.
|
|
21
21
|
|
|
22
22
|
See [`CONTRACT.md`](./CONTRACT.md) for the full cross-language behavioral contract.
|
|
23
23
|
|
|
@@ -58,43 +58,11 @@ import { AxiamClient } from 'axiam-sdk';
|
|
|
58
58
|
const client = new AxiamClient({
|
|
59
59
|
baseUrl: 'https://iam.example.com',
|
|
60
60
|
tenantSlug: 'acme',
|
|
61
|
-
// Organization context is required for login/refresh — a tenant slug is only
|
|
62
|
-
// unique within an organization (CONTRACT.md §5.1). Pass orgSlug (or orgId).
|
|
63
|
-
orgSlug: 'acme',
|
|
64
61
|
// customCa is optional — PEM-encoded CA cert for self-signed dev environments (§6)
|
|
65
62
|
// customCa: pemString,
|
|
66
63
|
});
|
|
67
64
|
```
|
|
68
65
|
|
|
69
|
-
### mTLS / client certificates (Node only)
|
|
70
|
-
|
|
71
|
-
For IoT devices and service accounts authenticated by **mutual TLS** (CONTRACT.md §6.1),
|
|
72
|
-
pass a PEM client-certificate chain and its PEM private key. The identity is presented on
|
|
73
|
-
**both** the REST and gRPC transports of the same client. Presenting a client certificate
|
|
74
|
-
**never** relaxes server verification — strict TLS stays on.
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
import { readFileSync } from 'node:fs';
|
|
78
|
-
import { AxiamClient } from 'axiam-sdk';
|
|
79
|
-
|
|
80
|
-
const client = new AxiamClient({
|
|
81
|
-
baseUrl: 'https://iam.example.com',
|
|
82
|
-
tenantSlug: 'acme',
|
|
83
|
-
orgSlug: 'acme', // organization context required for login/refresh (CONTRACT.md §5.1)
|
|
84
|
-
clientCert: readFileSync('device.crt', 'utf8'), // PEM certificate chain
|
|
85
|
-
clientKey: readFileSync('device.key', 'utf8'), // PEM private key (PKCS#8 or PKCS#1)
|
|
86
|
-
// customCa: readFileSync('ca.crt', 'utf8'), // optional server-trust CA (§6)
|
|
87
|
-
});
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
- `clientCert` and `clientKey` are **all-or-nothing** — providing exactly one throws at
|
|
91
|
-
construction, and each is validated to be PEM-shaped (as `customCa` is).
|
|
92
|
-
- The private key is secret material: it is passed straight to the Node TLS stack and is
|
|
93
|
-
never retained on a public property, logged, or serialized (CONTRACT.md §7).
|
|
94
|
-
- **Node only.** Browsers cannot present a client certificate from JavaScript, so the
|
|
95
|
-
browser build validates the PEM shape then ignores `clientCert`/`clientKey` — exactly as
|
|
96
|
-
it already ignores `customCa`.
|
|
97
|
-
|
|
98
66
|
## Usage per persona
|
|
99
67
|
|
|
100
68
|
### Browser — login + authz (`axiam-sdk` / `axiam-sdk/rest`)
|
|
@@ -102,7 +70,7 @@ const client = new AxiamClient({
|
|
|
102
70
|
```typescript
|
|
103
71
|
import { AxiamClient } from 'axiam-sdk';
|
|
104
72
|
|
|
105
|
-
const client = new AxiamClient({ baseUrl: 'https://iam.example.com', tenantSlug: 'acme'
|
|
73
|
+
const client = new AxiamClient({ baseUrl: 'https://iam.example.com', tenantSlug: 'acme' });
|
|
106
74
|
|
|
107
75
|
const result = await client.login(email, password);
|
|
108
76
|
switch (result.status) {
|
|
@@ -343,10 +311,8 @@ try {
|
|
|
343
311
|
- Token-carrying values are wrapped in `Sensitive<T>` — `toString()`/`toJSON()`/
|
|
344
312
|
`util.inspect` all redact to `[SENSITIVE]`; the raw value is only reachable via an
|
|
345
313
|
explicit accessor (CONTRACT.md §7).
|
|
346
|
-
- Strict TLS verification is always on; the only
|
|
347
|
-
|
|
348
|
-
- Optional mutual TLS (mTLS): a PEM `clientCert`/`clientKey` client identity (Node only) is
|
|
349
|
-
presented on both REST and gRPC without ever relaxing server verification (CONTRACT.md §6.1).
|
|
314
|
+
- Strict TLS verification is always on; the only escape hatch is the constructor's
|
|
315
|
+
`customCa` option for self-signed development environments (CONTRACT.md §6).
|
|
350
316
|
- AMQP messages are HMAC-SHA256 verified before your handler ever sees them; verification
|
|
351
317
|
failures are nacked without requeue (CONTRACT.md §8).
|
|
352
318
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as AccessCheck, a as AccessDecision } from './types-BVkMoqLU.cjs';
|
|
2
|
-
import { V as Verifier } from './jwks-
|
|
2
|
+
import { V as Verifier } from './jwks-CX-nhD6A.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Minimal session shape the middleware needs: a JWKS verifier (D-11) and the
|
|
@@ -9,18 +9,13 @@ import { V as Verifier } from './jwks-B8dPy2c6.cjs';
|
|
|
9
9
|
* DIFFERENT tenant in the same org.
|
|
10
10
|
*/
|
|
11
11
|
interface VerifiableSession {
|
|
12
|
-
/** Local JWKS verifier (D-11) — validates the token's EdDSA signature against the org-wide cached JWKS, offline on a cache hit. */
|
|
13
12
|
jwksVerifier: Verifier;
|
|
14
|
-
/** The tenant this resource server is configured for (CR-03); a validly-signed token minted for a different tenant in the same org is rejected. */
|
|
15
13
|
tenantHeaderValue: string;
|
|
16
14
|
}
|
|
17
15
|
/** Authenticated identity injected as req.axiamUser / request.axiamUser (§10). */
|
|
18
16
|
interface AxiamIdentity {
|
|
19
|
-
/** The authenticated end user's id (the token's `sub` claim). */
|
|
20
17
|
userId: string;
|
|
21
|
-
/** The tenant the verified token was minted for (the token's `tenant_id` claim). */
|
|
22
18
|
tenantId: string;
|
|
23
|
-
/** Roles derived from the token's space-separated `scope` claim (§10). */
|
|
24
19
|
roles: string[];
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
@@ -42,7 +37,6 @@ declare function authenticateRequest(session: VerifiableSession, token: string):
|
|
|
42
37
|
* itself, so this module pulls in no axios/grpc dependency.
|
|
43
38
|
*/
|
|
44
39
|
interface AuthzChecker {
|
|
45
|
-
/** Issue a single access check for the authenticated end user (`subjectId`, §11.2.2). Satisfied structurally by `AxiamClient.checkAccess`. */
|
|
46
40
|
checkAccess(check: AccessCheck): Promise<AccessDecision>;
|
|
47
41
|
}
|
|
48
42
|
/**
|
|
@@ -54,14 +48,11 @@ interface AuthzChecker {
|
|
|
54
48
|
* not per-request, when it is absent.
|
|
55
49
|
*/
|
|
56
50
|
interface AuthzVerifiableSession extends VerifiableSession {
|
|
57
|
-
/** Authz transport required by `requireAccess`/`requireAccessHook` (validated by {@link assertAuthzClient}); unused by `requireAuth`/`requireRole`. */
|
|
58
51
|
authzClient?: AuthzChecker;
|
|
59
52
|
}
|
|
60
53
|
/** Marker produced by {@link fromParam} — resolve the resource id from a named path/route parameter. */
|
|
61
54
|
interface ResourceParamRef {
|
|
62
|
-
/** Discriminant marking the path/route-parameter resolution strategy (§11.2.3.b). */
|
|
63
55
|
readonly kind: 'param';
|
|
64
|
-
/** The path/route parameter name the resource id is read from. */
|
|
65
56
|
readonly name: string;
|
|
66
57
|
}
|
|
67
58
|
/**
|
|
@@ -101,7 +92,6 @@ interface RequireAccessOptions {
|
|
|
101
92
|
}
|
|
102
93
|
/** Minimal logger seam for the §11.2.8 debug-only denial/error log (mirrors `amqp/consumer.ts`'s `ConsumeLogger`). */
|
|
103
94
|
interface AuthzLogger {
|
|
104
|
-
/** Emit a debug-only denial/error record (§11.2.8) — receives `action`/`resourceId` context, never the token. */
|
|
105
95
|
debug(event: string, message: string, context?: Record<string, unknown>): void;
|
|
106
96
|
}
|
|
107
97
|
/**
|
|
@@ -113,24 +103,17 @@ interface AuthzLogger {
|
|
|
113
103
|
declare function assertAuthzClient(session: AuthzVerifiableSession): AuthzChecker;
|
|
114
104
|
/** Standardized JSON error body shape (§10/§11 — `{ error, message }`). */
|
|
115
105
|
interface ErrorBody {
|
|
116
|
-
/** Stable machine-readable error code (e.g. `authentication_failed`, `authorization_denied`). */
|
|
117
106
|
error: string;
|
|
118
|
-
/** Human-readable explanation; never contains token material. */
|
|
119
107
|
message: string;
|
|
120
108
|
}
|
|
121
109
|
/** The outcome of an `evaluateAccess` call — one arm per §11.2.5's error-mapping table (the 401/400 arms are handled by callers before this is ever invoked). */
|
|
122
110
|
type CheckOutcome = {
|
|
123
|
-
/** The check passed — the caller proceeds to the handler. */
|
|
124
111
|
kind: 'allowed';
|
|
125
112
|
} | {
|
|
126
|
-
/** The check was evaluated and denied (`allowed: false` or a server 403) → HTTP 403. */
|
|
127
113
|
kind: 'denied';
|
|
128
|
-
/** Denial message surfaced in the 403 body. */
|
|
129
114
|
message: string;
|
|
130
115
|
} | {
|
|
131
|
-
/** The authz transport failed — fail-closed → HTTP 503, never an allow. */
|
|
132
116
|
kind: 'unavailable';
|
|
133
|
-
/** Failure message surfaced in the 503 body. */
|
|
134
117
|
message: string;
|
|
135
118
|
};
|
|
136
119
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { A as AccessCheck, a as AccessDecision } from './types-BVkMoqLU.js';
|
|
2
|
-
import { V as Verifier } from './jwks-
|
|
2
|
+
import { V as Verifier } from './jwks-CX-nhD6A.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Minimal session shape the middleware needs: a JWKS verifier (D-11) and the
|
|
@@ -9,18 +9,13 @@ import { V as Verifier } from './jwks-B8dPy2c6.js';
|
|
|
9
9
|
* DIFFERENT tenant in the same org.
|
|
10
10
|
*/
|
|
11
11
|
interface VerifiableSession {
|
|
12
|
-
/** Local JWKS verifier (D-11) — validates the token's EdDSA signature against the org-wide cached JWKS, offline on a cache hit. */
|
|
13
12
|
jwksVerifier: Verifier;
|
|
14
|
-
/** The tenant this resource server is configured for (CR-03); a validly-signed token minted for a different tenant in the same org is rejected. */
|
|
15
13
|
tenantHeaderValue: string;
|
|
16
14
|
}
|
|
17
15
|
/** Authenticated identity injected as req.axiamUser / request.axiamUser (§10). */
|
|
18
16
|
interface AxiamIdentity {
|
|
19
|
-
/** The authenticated end user's id (the token's `sub` claim). */
|
|
20
17
|
userId: string;
|
|
21
|
-
/** The tenant the verified token was minted for (the token's `tenant_id` claim). */
|
|
22
18
|
tenantId: string;
|
|
23
|
-
/** Roles derived from the token's space-separated `scope` claim (§10). */
|
|
24
19
|
roles: string[];
|
|
25
20
|
}
|
|
26
21
|
/**
|
|
@@ -42,7 +37,6 @@ declare function authenticateRequest(session: VerifiableSession, token: string):
|
|
|
42
37
|
* itself, so this module pulls in no axios/grpc dependency.
|
|
43
38
|
*/
|
|
44
39
|
interface AuthzChecker {
|
|
45
|
-
/** Issue a single access check for the authenticated end user (`subjectId`, §11.2.2). Satisfied structurally by `AxiamClient.checkAccess`. */
|
|
46
40
|
checkAccess(check: AccessCheck): Promise<AccessDecision>;
|
|
47
41
|
}
|
|
48
42
|
/**
|
|
@@ -54,14 +48,11 @@ interface AuthzChecker {
|
|
|
54
48
|
* not per-request, when it is absent.
|
|
55
49
|
*/
|
|
56
50
|
interface AuthzVerifiableSession extends VerifiableSession {
|
|
57
|
-
/** Authz transport required by `requireAccess`/`requireAccessHook` (validated by {@link assertAuthzClient}); unused by `requireAuth`/`requireRole`. */
|
|
58
51
|
authzClient?: AuthzChecker;
|
|
59
52
|
}
|
|
60
53
|
/** Marker produced by {@link fromParam} — resolve the resource id from a named path/route parameter. */
|
|
61
54
|
interface ResourceParamRef {
|
|
62
|
-
/** Discriminant marking the path/route-parameter resolution strategy (§11.2.3.b). */
|
|
63
55
|
readonly kind: 'param';
|
|
64
|
-
/** The path/route parameter name the resource id is read from. */
|
|
65
56
|
readonly name: string;
|
|
66
57
|
}
|
|
67
58
|
/**
|
|
@@ -101,7 +92,6 @@ interface RequireAccessOptions {
|
|
|
101
92
|
}
|
|
102
93
|
/** Minimal logger seam for the §11.2.8 debug-only denial/error log (mirrors `amqp/consumer.ts`'s `ConsumeLogger`). */
|
|
103
94
|
interface AuthzLogger {
|
|
104
|
-
/** Emit a debug-only denial/error record (§11.2.8) — receives `action`/`resourceId` context, never the token. */
|
|
105
95
|
debug(event: string, message: string, context?: Record<string, unknown>): void;
|
|
106
96
|
}
|
|
107
97
|
/**
|
|
@@ -113,24 +103,17 @@ interface AuthzLogger {
|
|
|
113
103
|
declare function assertAuthzClient(session: AuthzVerifiableSession): AuthzChecker;
|
|
114
104
|
/** Standardized JSON error body shape (§10/§11 — `{ error, message }`). */
|
|
115
105
|
interface ErrorBody {
|
|
116
|
-
/** Stable machine-readable error code (e.g. `authentication_failed`, `authorization_denied`). */
|
|
117
106
|
error: string;
|
|
118
|
-
/** Human-readable explanation; never contains token material. */
|
|
119
107
|
message: string;
|
|
120
108
|
}
|
|
121
109
|
/** The outcome of an `evaluateAccess` call — one arm per §11.2.5's error-mapping table (the 401/400 arms are handled by callers before this is ever invoked). */
|
|
122
110
|
type CheckOutcome = {
|
|
123
|
-
/** The check passed — the caller proceeds to the handler. */
|
|
124
111
|
kind: 'allowed';
|
|
125
112
|
} | {
|
|
126
|
-
/** The check was evaluated and denied (`allowed: false` or a server 403) → HTTP 403. */
|
|
127
113
|
kind: 'denied';
|
|
128
|
-
/** Denial message surfaced in the 403 body. */
|
|
129
114
|
message: string;
|
|
130
115
|
} | {
|
|
131
|
-
/** The authz transport failed — fail-closed → HTTP 503, never an allow. */
|
|
132
116
|
kind: 'unavailable';
|
|
133
|
-
/** Failure message surfaced in the 503 body. */
|
|
134
117
|
message: string;
|
|
135
118
|
};
|
|
136
119
|
/**
|
|
@@ -21,42 +21,8 @@ interface AxiamClientOptions {
|
|
|
21
21
|
tenantSlug?: string;
|
|
22
22
|
/** Tenant UUID. At least one of tenantSlug/tenantId is required at runtime. */
|
|
23
23
|
tenantId?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Human-readable organization identifier (CONTRACT.md §5). Optional at
|
|
26
|
-
* construction, but the server REQUIRES an org context on login — a tenant
|
|
27
|
-
* slug is only unique *within* an organization — so a client that omits both
|
|
28
|
-
* `orgSlug` and `orgId` will fail login with a 400/401. Forwarded as
|
|
29
|
-
* `org_slug` in the login body. Mutually exclusive with {@link orgId}
|
|
30
|
-
* (if both are given, `orgId` wins, mirroring how `tenantSlug`/`tenantId`
|
|
31
|
-
* resolve).
|
|
32
|
-
*/
|
|
33
|
-
orgSlug?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Organization UUID (CONTRACT.md §5). Optional at construction (see
|
|
36
|
-
* {@link orgSlug}). When supplied it is forwarded as `org_id` on login and
|
|
37
|
-
* used to build the `refresh` body; otherwise the resolved organization UUID
|
|
38
|
-
* is decoded from the authenticated session's access-token `org_id` claim
|
|
39
|
-
* after the first successful login. Mutually exclusive with {@link orgSlug}.
|
|
40
|
-
*/
|
|
41
|
-
orgId?: string;
|
|
42
24
|
/** PEM-encoded custom CA certificate, for self-signed/dev environments (§6). */
|
|
43
25
|
customCa?: string;
|
|
44
|
-
/**
|
|
45
|
-
* PEM-encoded client-certificate chain for mutual TLS (§6.1). Presented to
|
|
46
|
-
* the server to authenticate an IoT device / service account. MUST be
|
|
47
|
-
* provided together with {@link AxiamClientOptions.clientKey}. Node only —
|
|
48
|
-
* ignored in the browser (browsers cannot present a client certificate from
|
|
49
|
-
* JS). Presenting a client certificate NEVER relaxes server verification.
|
|
50
|
-
*/
|
|
51
|
-
clientCert?: string;
|
|
52
|
-
/**
|
|
53
|
-
* PEM-encoded private key (PKCS#8 or PKCS#1) matching {@link
|
|
54
|
-
* AxiamClientOptions.clientCert} (§6.1). Secret material: it is passed
|
|
55
|
-
* straight to the Node TLS stack and is never retained on a public property,
|
|
56
|
-
* logged, or serialized (§7). MUST be provided together with `clientCert`.
|
|
57
|
-
* Node only — ignored in the browser.
|
|
58
|
-
*/
|
|
59
|
-
clientKey?: string;
|
|
60
26
|
/** Connection timeout in milliseconds. Defaults to DEFAULT_CONNECT_TIMEOUT_MS. */
|
|
61
27
|
connectTimeoutMs?: number;
|
|
62
28
|
/** Request timeout in milliseconds. Defaults to DEFAULT_REQUEST_TIMEOUT_MS. */
|
|
@@ -75,28 +41,6 @@ declare class SharedSession {
|
|
|
75
41
|
readonly baseUrl: string;
|
|
76
42
|
/** The resolved tenant identifier (`tenantSlug` or `tenantId`) injected as the `X-Tenant-ID` header on every same-origin request (§5.2). */
|
|
77
43
|
readonly tenantHeaderValue: string;
|
|
78
|
-
/** Configured tenant UUID (`AxiamClientOptions.tenantId`), if the client was built with the UUID form. */
|
|
79
|
-
readonly tenantId: string | undefined;
|
|
80
|
-
/** Configured tenant slug (`AxiamClientOptions.tenantSlug`), if the client was built with the slug form. */
|
|
81
|
-
readonly tenantSlug: string | undefined;
|
|
82
|
-
/** Configured organization UUID (`AxiamClientOptions.orgId`), if supplied (§5). */
|
|
83
|
-
readonly orgId: string | undefined;
|
|
84
|
-
/** Configured organization slug (`AxiamClientOptions.orgSlug`), if supplied (§5). */
|
|
85
|
-
readonly orgSlug: string | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Resolved tenant UUID used to build the `refresh` body (`RefreshRequest`
|
|
88
|
-
* requires the UUID form, not a slug). Seeded from `orgId`/`tenantId` config
|
|
89
|
-
* when the UUID was supplied, then updated from the access-token `tenant_id`
|
|
90
|
-
* claim after each successful login/refresh (Node persona only — the browser
|
|
91
|
-
* cannot read the httpOnly access-token cookie).
|
|
92
|
-
*/
|
|
93
|
-
resolvedTenantId: string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Resolved organization UUID used to build the `refresh` body. Seeded from
|
|
96
|
-
* `orgId` config, then updated from the access-token `org_id` claim after a
|
|
97
|
-
* successful login (Node persona). Mirrors the Rust SDK's `resolved_org_id`.
|
|
98
|
-
*/
|
|
99
|
-
resolvedOrgId: string | undefined;
|
|
100
44
|
/** Mutable CSRF token store — populated by the request/response interceptors (D-05). */
|
|
101
45
|
csrfToken: string | undefined;
|
|
102
46
|
/** Set true once a successful login/verifyMfa has completed. */
|
|
@@ -113,23 +57,6 @@ declare class SharedSession {
|
|
|
113
57
|
*/
|
|
114
58
|
readonly refreshGuard: RefreshGuard;
|
|
115
59
|
constructor(options: AxiamClientOptions, axiosInstance: AxiosInstance, tenantHeaderValue: string);
|
|
116
|
-
/**
|
|
117
|
-
* Build the `POST /api/v1/auth/refresh` request body (§1). The server's
|
|
118
|
-
* `RefreshRequest` requires both `tenant_id` and `org_id` as UUIDs, so this
|
|
119
|
-
* emits the resolved UUIDs — from the access-token claims after login, or
|
|
120
|
-
* from UUID-form construction options as a fallback. Fields that could not
|
|
121
|
-
* be resolved are omitted (the server then answers with a clear 400), rather
|
|
122
|
-
* than sending a slug where a UUID is required.
|
|
123
|
-
*/
|
|
124
|
-
buildRefreshBody(): Record<string, string>;
|
|
125
|
-
/**
|
|
126
|
-
* Build the `POST /api/v1/auth/login` request body (§1/§5). Carries the
|
|
127
|
-
* configured tenant and organization identifiers (UUID or slug form) in
|
|
128
|
-
* addition to the credentials — the server resolves the workspace from the
|
|
129
|
-
* body, not the `X-Tenant-ID` header, and rejects a login that omits org
|
|
130
|
-
* context. Undefined identifiers are omitted.
|
|
131
|
-
*/
|
|
132
|
-
buildLoginBody(email: string, password: string): Record<string, string>;
|
|
133
60
|
/**
|
|
134
61
|
* Optional session-level hook invoked by rest/auth.ts after a successful
|
|
135
62
|
* login()/verifyMfa() (CR-01, D-05). The base SharedSession (browser
|
|
@@ -21,42 +21,8 @@ interface AxiamClientOptions {
|
|
|
21
21
|
tenantSlug?: string;
|
|
22
22
|
/** Tenant UUID. At least one of tenantSlug/tenantId is required at runtime. */
|
|
23
23
|
tenantId?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Human-readable organization identifier (CONTRACT.md §5). Optional at
|
|
26
|
-
* construction, but the server REQUIRES an org context on login — a tenant
|
|
27
|
-
* slug is only unique *within* an organization — so a client that omits both
|
|
28
|
-
* `orgSlug` and `orgId` will fail login with a 400/401. Forwarded as
|
|
29
|
-
* `org_slug` in the login body. Mutually exclusive with {@link orgId}
|
|
30
|
-
* (if both are given, `orgId` wins, mirroring how `tenantSlug`/`tenantId`
|
|
31
|
-
* resolve).
|
|
32
|
-
*/
|
|
33
|
-
orgSlug?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Organization UUID (CONTRACT.md §5). Optional at construction (see
|
|
36
|
-
* {@link orgSlug}). When supplied it is forwarded as `org_id` on login and
|
|
37
|
-
* used to build the `refresh` body; otherwise the resolved organization UUID
|
|
38
|
-
* is decoded from the authenticated session's access-token `org_id` claim
|
|
39
|
-
* after the first successful login. Mutually exclusive with {@link orgSlug}.
|
|
40
|
-
*/
|
|
41
|
-
orgId?: string;
|
|
42
24
|
/** PEM-encoded custom CA certificate, for self-signed/dev environments (§6). */
|
|
43
25
|
customCa?: string;
|
|
44
|
-
/**
|
|
45
|
-
* PEM-encoded client-certificate chain for mutual TLS (§6.1). Presented to
|
|
46
|
-
* the server to authenticate an IoT device / service account. MUST be
|
|
47
|
-
* provided together with {@link AxiamClientOptions.clientKey}. Node only —
|
|
48
|
-
* ignored in the browser (browsers cannot present a client certificate from
|
|
49
|
-
* JS). Presenting a client certificate NEVER relaxes server verification.
|
|
50
|
-
*/
|
|
51
|
-
clientCert?: string;
|
|
52
|
-
/**
|
|
53
|
-
* PEM-encoded private key (PKCS#8 or PKCS#1) matching {@link
|
|
54
|
-
* AxiamClientOptions.clientCert} (§6.1). Secret material: it is passed
|
|
55
|
-
* straight to the Node TLS stack and is never retained on a public property,
|
|
56
|
-
* logged, or serialized (§7). MUST be provided together with `clientCert`.
|
|
57
|
-
* Node only — ignored in the browser.
|
|
58
|
-
*/
|
|
59
|
-
clientKey?: string;
|
|
60
26
|
/** Connection timeout in milliseconds. Defaults to DEFAULT_CONNECT_TIMEOUT_MS. */
|
|
61
27
|
connectTimeoutMs?: number;
|
|
62
28
|
/** Request timeout in milliseconds. Defaults to DEFAULT_REQUEST_TIMEOUT_MS. */
|
|
@@ -75,28 +41,6 @@ declare class SharedSession {
|
|
|
75
41
|
readonly baseUrl: string;
|
|
76
42
|
/** The resolved tenant identifier (`tenantSlug` or `tenantId`) injected as the `X-Tenant-ID` header on every same-origin request (§5.2). */
|
|
77
43
|
readonly tenantHeaderValue: string;
|
|
78
|
-
/** Configured tenant UUID (`AxiamClientOptions.tenantId`), if the client was built with the UUID form. */
|
|
79
|
-
readonly tenantId: string | undefined;
|
|
80
|
-
/** Configured tenant slug (`AxiamClientOptions.tenantSlug`), if the client was built with the slug form. */
|
|
81
|
-
readonly tenantSlug: string | undefined;
|
|
82
|
-
/** Configured organization UUID (`AxiamClientOptions.orgId`), if supplied (§5). */
|
|
83
|
-
readonly orgId: string | undefined;
|
|
84
|
-
/** Configured organization slug (`AxiamClientOptions.orgSlug`), if supplied (§5). */
|
|
85
|
-
readonly orgSlug: string | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Resolved tenant UUID used to build the `refresh` body (`RefreshRequest`
|
|
88
|
-
* requires the UUID form, not a slug). Seeded from `orgId`/`tenantId` config
|
|
89
|
-
* when the UUID was supplied, then updated from the access-token `tenant_id`
|
|
90
|
-
* claim after each successful login/refresh (Node persona only — the browser
|
|
91
|
-
* cannot read the httpOnly access-token cookie).
|
|
92
|
-
*/
|
|
93
|
-
resolvedTenantId: string | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Resolved organization UUID used to build the `refresh` body. Seeded from
|
|
96
|
-
* `orgId` config, then updated from the access-token `org_id` claim after a
|
|
97
|
-
* successful login (Node persona). Mirrors the Rust SDK's `resolved_org_id`.
|
|
98
|
-
*/
|
|
99
|
-
resolvedOrgId: string | undefined;
|
|
100
44
|
/** Mutable CSRF token store — populated by the request/response interceptors (D-05). */
|
|
101
45
|
csrfToken: string | undefined;
|
|
102
46
|
/** Set true once a successful login/verifyMfa has completed. */
|
|
@@ -113,23 +57,6 @@ declare class SharedSession {
|
|
|
113
57
|
*/
|
|
114
58
|
readonly refreshGuard: RefreshGuard;
|
|
115
59
|
constructor(options: AxiamClientOptions, axiosInstance: AxiosInstance, tenantHeaderValue: string);
|
|
116
|
-
/**
|
|
117
|
-
* Build the `POST /api/v1/auth/refresh` request body (§1). The server's
|
|
118
|
-
* `RefreshRequest` requires both `tenant_id` and `org_id` as UUIDs, so this
|
|
119
|
-
* emits the resolved UUIDs — from the access-token claims after login, or
|
|
120
|
-
* from UUID-form construction options as a fallback. Fields that could not
|
|
121
|
-
* be resolved are omitted (the server then answers with a clear 400), rather
|
|
122
|
-
* than sending a slug where a UUID is required.
|
|
123
|
-
*/
|
|
124
|
-
buildRefreshBody(): Record<string, string>;
|
|
125
|
-
/**
|
|
126
|
-
* Build the `POST /api/v1/auth/login` request body (§1/§5). Carries the
|
|
127
|
-
* configured tenant and organization identifiers (UUID or slug form) in
|
|
128
|
-
* addition to the credentials — the server resolves the workspace from the
|
|
129
|
-
* body, not the `X-Tenant-ID` header, and rejects a login that omits org
|
|
130
|
-
* context. Undefined identifiers are omitted.
|
|
131
|
-
*/
|
|
132
|
-
buildLoginBody(email: string, password: string): Record<string, string>;
|
|
133
60
|
/**
|
|
134
61
|
* Optional session-level hook invoked by rest/auth.ts after a successful
|
|
135
62
|
* login()/verifyMfa() (CR-01, D-05). The base SharedSession (browser
|
package/dist/grpc/index.d.cts
CHANGED
|
@@ -3,9 +3,9 @@ import { Interceptor } from '@grpc/grpc-js';
|
|
|
3
3
|
import { NodeSession } from '../node/index.cjs';
|
|
4
4
|
export { ACCESS_COOKIE, CSRF_COOKIE, REFRESH_COOKIE, TokenManager, createJar, createNodeClient, createNodeSession, extractCookieValue, wrapAxios } from '../node/index.cjs';
|
|
5
5
|
import { a as AccessDecision } from '../types-BVkMoqLU.cjs';
|
|
6
|
-
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-
|
|
6
|
+
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CX-nhD6A.cjs';
|
|
7
7
|
import 'tough-cookie';
|
|
8
|
-
import '../client-
|
|
8
|
+
import '../client-CAeQw1a-.cjs';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import '../sensitive-CWBH_tHr.cjs';
|
|
11
11
|
|
|
@@ -95,10 +95,6 @@ declare class AuthzGrpcClient {
|
|
|
95
95
|
baseUrl: string;
|
|
96
96
|
customCa?: string;
|
|
97
97
|
allowInsecure?: boolean;
|
|
98
|
-
/** PEM client-certificate chain for mutual TLS (§6.1); pair with `clientKey`. */
|
|
99
|
-
clientCert?: string;
|
|
100
|
-
/** PEM private key for mutual TLS (§6.1); pair with `clientCert`. Secret (§7). */
|
|
101
|
-
clientKey?: string;
|
|
102
98
|
}, clientFactory?: AuthorizationServiceClientFactory);
|
|
103
99
|
/** `CheckAccess` over gRPC (SC#2 Node half). UNAUTHENTICATED triggers exactly one shared-guard refresh + one retry (§9.3). */
|
|
104
100
|
checkAccess(request: CheckAccessRequest): Promise<AccessDecision>;
|
package/dist/grpc/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { Interceptor } from '@grpc/grpc-js';
|
|
|
3
3
|
import { NodeSession } from '../node/index.js';
|
|
4
4
|
export { ACCESS_COOKIE, CSRF_COOKIE, REFRESH_COOKIE, TokenManager, createJar, createNodeClient, createNodeSession, extractCookieValue, wrapAxios } from '../node/index.js';
|
|
5
5
|
import { a as AccessDecision } from '../types-BVkMoqLU.js';
|
|
6
|
-
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-
|
|
6
|
+
export { A as AxiamClaims, J as JWKS_PATH, V as Verifier, c as createVerifier } from '../jwks-CX-nhD6A.js';
|
|
7
7
|
import 'tough-cookie';
|
|
8
|
-
import '../client-
|
|
8
|
+
import '../client-BPg9kfKV.js';
|
|
9
9
|
import 'axios';
|
|
10
10
|
import '../sensitive-CWBH_tHr.js';
|
|
11
11
|
|
|
@@ -95,10 +95,6 @@ declare class AuthzGrpcClient {
|
|
|
95
95
|
baseUrl: string;
|
|
96
96
|
customCa?: string;
|
|
97
97
|
allowInsecure?: boolean;
|
|
98
|
-
/** PEM client-certificate chain for mutual TLS (§6.1); pair with `clientKey`. */
|
|
99
|
-
clientCert?: string;
|
|
100
|
-
/** PEM private key for mutual TLS (§6.1); pair with `clientCert`. Secret (§7). */
|
|
101
|
-
clientKey?: string;
|
|
102
98
|
}, clientFactory?: AuthorizationServiceClientFactory);
|
|
103
99
|
/** `CheckAccess` over gRPC (SC#2 Node half). UNAUTHENTICATED triggers exactly one shared-guard refresh + one retry (§9.3). */
|
|
104
100
|
checkAccess(request: CheckAccessRequest): Promise<AccessDecision>;
|