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
package/dist/node/index.d.ts
CHANGED
|
@@ -1,123 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import
|
|
1
|
+
export { A as ACCESS_COOKIE, C as CSRF_COOKIE, N as NodeSession, R as REFRESH_COOKIE, T as TokenManager, c as createJar, a as createNodeClient, b as createNodeSession, e as extractCookieValue, w as wrapAxios } from '../cookieJar-Cl8Lq9dL.js';
|
|
2
|
+
export { A as AxiamClaims, I as ID_TOKEN_ALG, a as IdTokenClaims, b as IdTokenExpectations, c as IdTokenVerifier, J as JWKS_PATH, d as JwksVerifier, M as MAX_CLOCK_SKEW_SEC, V as Verifier, e as createJwksVerifier, f as createVerifier } from '../jwks-BgojMGC5.js';
|
|
3
|
+
export { A as AuthorizationRequest, D as DISCOVERY_PATH, I as IntrospectParams, a as IntrospectionResult, L as LoginClientCredentialsParams, M as MIN_DISCOVERY_TTL_MS, b as MemoryOidcStateStore, O as OIDC_STATE_TTL_MS, c as OidcBeginParams, d as OidcClient, e as OidcClientOptions, f as OidcConfiguration, g as OidcExchangeParams, h as OidcRefreshParams, i as OidcStateEntry, j as OidcStateStore, k as OidcTokenSet, R as RevokeParams, S as SSO_CALLBACK_PATH, l as SSO_START_PATH, m as SsoCompleteParams, n as SsoCompleteResult, o as SsoStartParams, p as SsoStartResult, q as createOidcClient, r as normalizeOrigin } from '../oidcState-CkFuCjpM.js';
|
|
4
|
+
import { S as Sensitive } from '../sensitive-BC_s7Rrd.js';
|
|
5
|
+
import 'tough-cookie';
|
|
6
|
+
import '../session-BWUWhhyB.js';
|
|
7
|
+
import 'axios';
|
|
8
|
+
import '../client-Dn1fs5MH.js';
|
|
7
9
|
import '../types-BVkMoqLU.js';
|
|
8
10
|
|
|
9
|
-
/** Tracks the access/refresh token pair for a Node session, kept in sync with the cookie jar after each REST call/refresh. */
|
|
10
|
-
declare class TokenManager {
|
|
11
|
-
#private;
|
|
12
|
-
constructor(jar: CookieJar, baseUrl: string, tenantId?: string);
|
|
13
|
-
/**
|
|
14
|
-
* Synchronous, best-effort read of the last-known access token. Returns
|
|
15
|
-
* `null` if no token has been cached yet (no request/refresh has
|
|
16
|
-
* completed since construction, or `syncFromJar()` was never called).
|
|
17
|
-
*/
|
|
18
|
-
cachedAccessToken(): Sensitive<string> | null;
|
|
19
|
-
/**
|
|
20
|
-
* Async read of the current `axiam_refresh` cookie value from the jar,
|
|
21
|
-
* wrapped in Sensitive<T>. Queried against the refresh endpoint's URL
|
|
22
|
-
* since the cookie is path-scoped to `/api/v1/auth/refresh` (not visible
|
|
23
|
-
* at the bare base URL).
|
|
24
|
-
*/
|
|
25
|
-
refreshTokenValue(): Promise<Sensitive<string> | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Refresh the in-memory cached access token from the jar. Call this after
|
|
28
|
-
* every REST request/refresh so the synchronous gRPC-interceptor fast-path
|
|
29
|
-
* (`cachedAccessToken()`) stays current (Pitfall 3).
|
|
30
|
-
*/
|
|
31
|
-
syncFromJar(): Promise<void>;
|
|
32
|
-
/** The resolved tenant identifier (slug or UUID form), if known. */
|
|
33
|
-
tenantId(): string | undefined;
|
|
34
|
-
/** Set/update the resolved tenant identifier (e.g. after decoding the access token's tenant_id claim). */
|
|
35
|
-
setTenantId(tenantId: string): void;
|
|
36
|
-
/**
|
|
37
|
-
* Best-effort decode of the `tenant_id`/`org_id` claims out of the cached
|
|
38
|
-
* access token, WITHOUT signature verification. Used only to populate the
|
|
39
|
-
* `refresh` request body (`RefreshRequest` requires both UUIDs) — never as a
|
|
40
|
-
* trust decision: the actual credential is the httpOnly `axiam_access` cookie
|
|
41
|
-
* the server verifies, and the server re-derives the authoritative `org_id`
|
|
42
|
-
* from the tenant on refresh (see crates/axiam-api-rest handlers/auth.rs),
|
|
43
|
-
* so echoing these values back carries no security weight. A malformed or
|
|
44
|
-
* absent token yields an empty result (the caller then keeps whatever UUIDs
|
|
45
|
-
* were resolved from construction options).
|
|
46
|
-
*/
|
|
47
|
-
claimsFromCachedToken(): {
|
|
48
|
-
tenantId?: string;
|
|
49
|
-
orgId?: string;
|
|
50
|
-
};
|
|
51
|
-
/** Clear all cached token state (used by logout()). */
|
|
52
|
-
clear(): void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Node-only {@link SharedSession} adding a {@link TokenManager} and a JWKS {@link Verifier} for local (offline) access-token verification. */
|
|
56
|
-
declare class NodeSession extends SharedSession {
|
|
57
|
-
#private;
|
|
58
|
-
/** Manages the access/refresh token pair backing this session. */
|
|
59
|
-
readonly tokenManager: TokenManager;
|
|
60
|
-
/** Local JWKS verifier for validating access tokens without a server round-trip. */
|
|
61
|
-
readonly jwksVerifier: Verifier;
|
|
62
|
-
constructor(options: AxiamClientOptions, base: SharedSession, tokenManager: TokenManager, jwksVerifier: Verifier, jar: CookieJar);
|
|
63
|
-
/**
|
|
64
|
-
* Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
|
|
65
|
-
* session's per-instance `refreshGuard` (inherited from SharedSession) by
|
|
66
|
-
* both REST's reactive interceptor (rest/interceptors.ts) and gRPC's
|
|
67
|
-
* callWithRefresh — since `refreshGuard` is scoped to THIS session
|
|
68
|
-
* instance (CR-02, D-13), both transports share exactly one in-flight
|
|
69
|
-
* refresh for this session regardless of which one triggers it, while
|
|
70
|
-
* remaining fully independent from any other session's guard.
|
|
71
|
-
*/
|
|
72
|
-
doRefresh: () => Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Session-level hook (CR-01, D-05) invoked by rest/auth.ts after a
|
|
75
|
-
* successful login()/verifyMfa(). Refreshes the cached access token (so
|
|
76
|
-
* the gRPC interceptor's synchronous fast-path is current immediately
|
|
77
|
-
* after login) and reads the `axiam_csrf` cookie out of the jar into
|
|
78
|
-
* `session.csrfToken`, mirroring TokenManager.syncFromJar()'s pattern.
|
|
79
|
-
*/
|
|
80
|
-
onAuthenticated: () => Promise<void>;
|
|
81
|
-
}
|
|
82
|
-
/** Build the Node persona's session: REST SharedSession + cookie jar + TokenManager + JWKS verifier. */
|
|
83
|
-
declare function createNodeSession(options: AxiamClientOptions): NodeSession;
|
|
84
11
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
* correctly under Node.
|
|
12
|
+
* The only PKCE code-challenge method this SDK emits (RFC 7636 §4.2,
|
|
13
|
+
* CONTRACT.md §12.1 rule 3). `plain` is intentionally absent.
|
|
14
|
+
*/
|
|
15
|
+
declare const CODE_CHALLENGE_METHOD_S256 = "S256";
|
|
16
|
+
/**
|
|
17
|
+
* Entropy, in bytes, of a generated `state` / `nonce` / `code_verifier`.
|
|
92
18
|
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* built from the same `NodeSession`.
|
|
19
|
+
* §12.1 rule 1 requires at least 16 bytes (128 bits) and RECOMMENDS 32;
|
|
20
|
+
* rule 2 RECOMMENDS 32 bytes for the verifier, which base64url-encodes to
|
|
21
|
+
* exactly 43 characters — the minimum RFC 7636 §4.1 length, drawn only from
|
|
22
|
+
* the unreserved set `[A-Za-z0-9-._~]`.
|
|
98
23
|
*/
|
|
99
|
-
declare
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
24
|
+
declare const CSPRNG_BYTES = 32;
|
|
25
|
+
/**
|
|
26
|
+
* Generate a URL-safe random token: `bytes` CSPRNG bytes, base64url-encoded
|
|
27
|
+
* **without** padding (RFC 4648 §5 — Node's `'base64url'` encoding never
|
|
28
|
+
* emits `=`).
|
|
29
|
+
*
|
|
30
|
+
* Used for both `state` and `nonce`, which §12.3 rule 2 classes as
|
|
31
|
+
* **non-secret**: they are returned as plain strings, are echoed through the
|
|
32
|
+
* browser's address bar by construction, and are safe to log.
|
|
33
|
+
*/
|
|
34
|
+
declare function randomUrlSafeToken(bytes?: number): string;
|
|
109
35
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
36
|
+
* Generate a fresh PKCE `code_verifier` (RFC 7636 §4.1): 32 CSPRNG bytes
|
|
37
|
+
* base64url-encoded without padding, i.e. 43 characters from the unreserved
|
|
38
|
+
* set.
|
|
39
|
+
*
|
|
40
|
+
* Returned already wrapped in {@link Sensitive} — §12.5 makes the verifier
|
|
41
|
+
* secret **for its whole lifetime**, including while it sits in the
|
|
42
|
+
* `AuthorizationRequest` handed back to the caller and in any
|
|
43
|
+
* `OidcStateStore` entry.
|
|
114
44
|
*/
|
|
115
|
-
declare function
|
|
45
|
+
declare function generateCodeVerifier(): Sensitive<string>;
|
|
116
46
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
47
|
+
* Derive the PKCE `code_challenge` from a verifier:
|
|
48
|
+
* `BASE64URL-ENCODE(SHA256(ASCII(code_verifier)))`, unpadded
|
|
49
|
+
* (RFC 7636 §4.2, CONTRACT.md §12.1 rule 3).
|
|
50
|
+
*
|
|
51
|
+
* The verifier is hashed as ASCII exactly as the RFC specifies. Verified
|
|
52
|
+
* against the RFC 7636 Appendix B test vector in
|
|
53
|
+
* `test/node/oidcPkce.test.ts`, which every SDK must carry (§12.1 rule 3).
|
|
54
|
+
*
|
|
55
|
+
* The challenge is a one-way digest and is **not** secret — it travels in the
|
|
56
|
+
* authorization URL — so it is returned as a plain string.
|
|
120
57
|
*/
|
|
121
|
-
declare function
|
|
58
|
+
declare function computeCodeChallenge(codeVerifier: string): string;
|
|
122
59
|
|
|
123
|
-
export {
|
|
60
|
+
export { CODE_CHALLENGE_METHOD_S256, CSPRNG_BYTES, computeCodeChallenge, generateCodeVerifier, randomUrlSafeToken };
|