axiam-sdk 1.0.0-alpha19 → 1.0.0-alpha21
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 +155 -4
- package/dist/amqp/index.d.cts +1 -1
- package/dist/amqp/index.d.ts +1 -1
- package/dist/amqp/index.js +4 -0
- package/dist/amqp/index.js.map +1 -1
- package/dist/amqp/index.mjs +4 -0
- package/dist/amqp/index.mjs.map +1 -1
- package/dist/{authzCore-CcTdIf78.d.ts → authzCore-DtSN59if.d.ts} +2 -2
- package/dist/{authzCore-B7GSd3-t.d.cts → authzCore-DuRI1aJf.d.cts} +2 -2
- package/dist/client-B_FqmZ0i.d.cts +72 -0
- package/dist/client-Dn1fs5MH.d.ts +72 -0
- package/dist/cookieJar-BTDnjjbL.d.cts +122 -0
- package/dist/cookieJar-Cl8Lq9dL.d.ts +122 -0
- package/dist/grpc/index.d.cts +6 -5
- package/dist/grpc/index.d.ts +6 -5
- package/dist/grpc/index.js +178 -4
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +178 -4
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +76 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -4
- package/dist/index.mjs.map +1 -1
- package/dist/jwks-BgojMGC5.d.cts +152 -0
- package/dist/jwks-BgojMGC5.d.ts +152 -0
- package/dist/middleware/index.d.cts +194 -4
- package/dist/middleware/index.d.ts +194 -4
- package/dist/middleware/index.js +1107 -1
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware/index.mjs +1100 -3
- 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 +3 -0
- package/dist/nestjs/index.js.map +1 -1
- package/dist/nestjs/index.mjs +3 -0
- package/dist/nestjs/index.mjs.map +1 -1
- package/dist/node/index.d.cts +50 -113
- package/dist/node/index.d.ts +50 -113
- package/dist/node/index.js +873 -4
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +857 -5
- package/dist/node/index.mjs.map +1 -1
- package/dist/oidcState-BGxqWUun.d.cts +598 -0
- package/dist/oidcState-CkFuCjpM.d.ts +598 -0
- package/dist/rest/index.d.cts +107 -5
- package/dist/rest/index.d.ts +107 -5
- package/dist/rest/index.js +76 -3
- package/dist/rest/index.js.map +1 -1
- package/dist/rest/index.mjs +71 -4
- package/dist/rest/index.mjs.map +1 -1
- package/dist/sensitive-BC_s7Rrd.d.cts +39 -0
- package/dist/sensitive-BC_s7Rrd.d.ts +39 -0
- package/dist/{client-Co_baHgU.d.ts → session-BWUWhhyB.d.cts} +1 -70
- package/dist/{client-CzhzwRGg.d.cts → session-BWUWhhyB.d.ts} +1 -70
- package/package.json +2 -2
- package/dist/jwks-B8dPy2c6.d.cts +0 -36
- package/dist/jwks-B8dPy2c6.d.ts +0 -36
- package/dist/sensitive-CWBH_tHr.d.cts +0 -12
- package/dist/sensitive-CWBH_tHr.d.ts +0 -12
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { L as LoginResult, A as AccessCheck, a as AccessDecision } from './types-BVkMoqLU.cjs';
|
|
2
1
|
import { AxiosInstance } from 'axios';
|
|
3
2
|
|
|
4
3
|
/** A session-scoped single-flight guard closure, as returned by `createRefreshGuard()`. */
|
|
@@ -152,72 +151,4 @@ declare class SharedSession {
|
|
|
152
151
|
isForeignHost(url: string | undefined): boolean;
|
|
153
152
|
}
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
* The main entry point for the AXIAM TypeScript/JavaScript SDK — an
|
|
157
|
-
* isomorphic (browser + Node) REST client for authentication and
|
|
158
|
-
* authorization against an AXIAM server.
|
|
159
|
-
*
|
|
160
|
-
* @remarks
|
|
161
|
-
* `AxiamClient` implements the SDK's cross-language behavioral contract
|
|
162
|
-
* (see `CONTRACT.md` §1–§10): the canonical `login`/`verifyMfa`/`refresh`/
|
|
163
|
-
* `logout`/`checkAccess`/`can`/`batchCheck` method vocabulary (§1), the
|
|
164
|
-
* three-way `AuthError`/`AuthzError`/`NetworkError` taxonomy (§2), automatic
|
|
165
|
-
* CSRF forwarding (§3), the required tenant context (§5), and a per-instance
|
|
166
|
-
* single-flight refresh guard that de-duplicates concurrent token refreshes
|
|
167
|
-
* (§9).
|
|
168
|
-
*
|
|
169
|
-
* A `tenantSlug` or `tenantId` is mandatory at construction — there is no
|
|
170
|
-
* default tenant, and AXIAM is a multi-tenant system where every
|
|
171
|
-
* authenticated call is scoped by the `X-Tenant-ID` header this client
|
|
172
|
-
* injects on every request (§5). Session tokens never appear as a return
|
|
173
|
-
* value or public property anywhere on this class: they arrive exclusively
|
|
174
|
-
* via `httpOnly` cookies set by the server.
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* ```ts
|
|
178
|
-
* const client = new AxiamClient({ baseUrl: 'https://iam.example.com', tenantSlug: 'acme' });
|
|
179
|
-
*
|
|
180
|
-
* const result = await client.login('user@example.com', 'hunter2');
|
|
181
|
-
* if (result.status === 'mfa_required') {
|
|
182
|
-
* await client.verifyMfa(result.mfaToken, '123456');
|
|
183
|
-
* }
|
|
184
|
-
*
|
|
185
|
-
* const decision = await client.checkAccess({ action: 'read', resourceId: 'document:42' });
|
|
186
|
-
* if (!decision.allowed) {
|
|
187
|
-
* throw new Error(decision.reason ?? 'access denied');
|
|
188
|
-
* }
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
declare class AxiamClient {
|
|
192
|
-
/** @internal — exposed for auth.ts/authz.ts method implementations and other transports (D-13). */
|
|
193
|
-
readonly session: SharedSession;
|
|
194
|
-
/**
|
|
195
|
-
* @param options client configuration (§5/§6).
|
|
196
|
-
* @param session optional pre-built session to adopt instead of the default
|
|
197
|
-
* browser `SharedSession`. This is the injection point for the Node
|
|
198
|
-
* persona (SDK-Q05): a Node REST consumer builds a `NodeSession` (cookie
|
|
199
|
-
* jar + CSRF/refresh token sync) via `createNodeClient`/`createNodeSession`
|
|
200
|
-
* from the Node-only `axiam-sdk/node` (or `axiam-sdk/grpc`) subpath and it
|
|
201
|
-
* is adopted here, so httpOnly login/refresh cookies persist. When omitted
|
|
202
|
-
* the browser `SharedSession` is built by default — the Node modules are
|
|
203
|
-
* NEVER statically imported from this browser-safe module, so a `/rest`
|
|
204
|
-
* browser bundle keeps pulling zero Node dependencies (SC#1).
|
|
205
|
-
*/
|
|
206
|
-
constructor(options: AxiamClientOptions, session?: SharedSession);
|
|
207
|
-
/** `POST /api/v1/auth/login` (§1, D-18). */
|
|
208
|
-
login(email: string, password: string): Promise<LoginResult>;
|
|
209
|
-
/** `POST /api/v1/auth/mfa/verify` (§1, D-18). Completes the two-phase flow started by login(). */
|
|
210
|
-
verifyMfa(mfaToken: string, code: string): Promise<LoginResult>;
|
|
211
|
-
/** `POST /api/v1/auth/refresh` (§1). Usually driven reactively by the response interceptor (D-07). */
|
|
212
|
-
refresh(): Promise<void>;
|
|
213
|
-
/** `POST /api/v1/auth/logout` (§1). Clears session csrf/auth state. */
|
|
214
|
-
logout(): Promise<void>;
|
|
215
|
-
/** `POST /api/v1/authz/check` (§1, FND-04). */
|
|
216
|
-
checkAccess(check: AccessCheck): Promise<AccessDecision>;
|
|
217
|
-
/** `can` — alias for checkAccess targeting browser/UI scenarios (§1 note). */
|
|
218
|
-
can(action: string, resourceId: string, scope?: string): Promise<boolean>;
|
|
219
|
-
/** `POST /api/v1/authz/check/batch` (§1). Results preserve input order. */
|
|
220
|
-
batchCheck(checks: AccessCheck[]): Promise<AccessDecision[]>;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export { type AxiamClientOptions as A, SharedSession as S, AxiamClient as a };
|
|
154
|
+
export { type AxiamClientOptions as A, SharedSession as S };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axiam-sdk",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-alpha21",
|
|
4
4
|
"description": "Official TypeScript/JavaScript client SDK for AXIAM IAM",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"esbuild": "^0.28.1",
|
|
155
155
|
"express": "^5.2.1",
|
|
156
156
|
"fastify": "^5.10.0",
|
|
157
|
-
"jsdom": "^
|
|
157
|
+
"jsdom": "^30.0.0",
|
|
158
158
|
"msw": "^2.15.0",
|
|
159
159
|
"reflect-metadata": "^0.2.2",
|
|
160
160
|
"rxjs": "^7.8.2",
|
package/dist/jwks-B8dPy2c6.d.cts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** Verified claims carried by an AXIAM access token (the JWT payload {@link Verifier.verifyAccessToken} returns). */
|
|
2
|
-
interface AxiamClaims {
|
|
3
|
-
/** Subject — user ID (UUID). */
|
|
4
|
-
sub: string;
|
|
5
|
-
/** Tenant ID (UUID). */
|
|
6
|
-
tenant_id: string;
|
|
7
|
-
/** Organization ID (UUID), if present. */
|
|
8
|
-
org_id?: string;
|
|
9
|
-
/** Issuer — the AXIAM authorization server that minted the token. */
|
|
10
|
-
iss: string;
|
|
11
|
-
/** Issued-at time (epoch seconds), if present. */
|
|
12
|
-
iat?: number;
|
|
13
|
-
/** Expiry time (epoch seconds); the verifier rejects the token once it has passed. */
|
|
14
|
-
exp: number;
|
|
15
|
-
/** Unique token ID / session id — needed for logout(). */
|
|
16
|
-
jti?: string;
|
|
17
|
-
/** Token audience — "axiam:user" | "axiam:m2m". */
|
|
18
|
-
aud?: string;
|
|
19
|
-
/** OAuth2 scopes (space-separated). */
|
|
20
|
-
scope?: string;
|
|
21
|
-
}
|
|
22
|
-
/** Path (relative to the client base URL) of the org-wide JWKS endpoint. */
|
|
23
|
-
declare const JWKS_PATH = "/oauth2/jwks";
|
|
24
|
-
/** Verifies an AXIAM access token's EdDSA signature against the org-wide remote JWKS. */
|
|
25
|
-
interface Verifier {
|
|
26
|
-
/** Verify `token` against the cached JWKS (EdDSA only) and return its claims; rejects any invalid/expired/wrong-algorithm token. */
|
|
27
|
-
verifyAccessToken(token: string): Promise<AxiamClaims>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Build a verifier bound to `{baseUrl}/oauth2/jwks`. `jose` is loaded lazily
|
|
31
|
-
* via dynamic `import()` (Pitfall 1 — CJS-safe); the remote JWKS itself is
|
|
32
|
-
* also fetched/cached lazily by `jose`, not eagerly here.
|
|
33
|
-
*/
|
|
34
|
-
declare function createVerifier(baseUrl: string): Verifier;
|
|
35
|
-
|
|
36
|
-
export { type AxiamClaims as A, JWKS_PATH as J, type Verifier as V, createVerifier as c };
|
package/dist/jwks-B8dPy2c6.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/** Verified claims carried by an AXIAM access token (the JWT payload {@link Verifier.verifyAccessToken} returns). */
|
|
2
|
-
interface AxiamClaims {
|
|
3
|
-
/** Subject — user ID (UUID). */
|
|
4
|
-
sub: string;
|
|
5
|
-
/** Tenant ID (UUID). */
|
|
6
|
-
tenant_id: string;
|
|
7
|
-
/** Organization ID (UUID), if present. */
|
|
8
|
-
org_id?: string;
|
|
9
|
-
/** Issuer — the AXIAM authorization server that minted the token. */
|
|
10
|
-
iss: string;
|
|
11
|
-
/** Issued-at time (epoch seconds), if present. */
|
|
12
|
-
iat?: number;
|
|
13
|
-
/** Expiry time (epoch seconds); the verifier rejects the token once it has passed. */
|
|
14
|
-
exp: number;
|
|
15
|
-
/** Unique token ID / session id — needed for logout(). */
|
|
16
|
-
jti?: string;
|
|
17
|
-
/** Token audience — "axiam:user" | "axiam:m2m". */
|
|
18
|
-
aud?: string;
|
|
19
|
-
/** OAuth2 scopes (space-separated). */
|
|
20
|
-
scope?: string;
|
|
21
|
-
}
|
|
22
|
-
/** Path (relative to the client base URL) of the org-wide JWKS endpoint. */
|
|
23
|
-
declare const JWKS_PATH = "/oauth2/jwks";
|
|
24
|
-
/** Verifies an AXIAM access token's EdDSA signature against the org-wide remote JWKS. */
|
|
25
|
-
interface Verifier {
|
|
26
|
-
/** Verify `token` against the cached JWKS (EdDSA only) and return its claims; rejects any invalid/expired/wrong-algorithm token. */
|
|
27
|
-
verifyAccessToken(token: string): Promise<AxiamClaims>;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Build a verifier bound to `{baseUrl}/oauth2/jwks`. `jose` is loaded lazily
|
|
31
|
-
* via dynamic `import()` (Pitfall 1 — CJS-safe); the remote JWKS itself is
|
|
32
|
-
* also fetched/cached lazily by `jose`, not eagerly here.
|
|
33
|
-
*/
|
|
34
|
-
declare function createVerifier(baseUrl: string): Verifier;
|
|
35
|
-
|
|
36
|
-
export { type AxiamClaims as A, JWKS_PATH as J, type Verifier as V, createVerifier as c };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare const NODE_INSPECT_CUSTOM: unique symbol;
|
|
2
|
-
declare class Sensitive<T> {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(value: T);
|
|
5
|
-
/** @internal package-only accessor. Never pass the return value to a log/serialize sink. */
|
|
6
|
-
expose(): T;
|
|
7
|
-
toString(): string;
|
|
8
|
-
toJSON(): string;
|
|
9
|
-
[NODE_INSPECT_CUSTOM](): string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { Sensitive as S };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
declare const NODE_INSPECT_CUSTOM: unique symbol;
|
|
2
|
-
declare class Sensitive<T> {
|
|
3
|
-
#private;
|
|
4
|
-
constructor(value: T);
|
|
5
|
-
/** @internal package-only accessor. Never pass the return value to a log/serialize sink. */
|
|
6
|
-
expose(): T;
|
|
7
|
-
toString(): string;
|
|
8
|
-
toJSON(): string;
|
|
9
|
-
[NODE_INSPECT_CUSTOM](): string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { Sensitive as S };
|