axiam-sdk 1.0.0-alpha2 → 1.0.0-alpha8
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/dist/{authzCore-CV-Td-V1.d.cts → authzCore-B7GSd3-t.d.cts} +18 -1
- package/dist/{authzCore-xwmCivHH.d.ts → authzCore-CcTdIf78.d.ts} +18 -1
- package/dist/grpc/index.d.cts +1 -1
- package/dist/grpc/index.d.ts +1 -1
- package/dist/grpc/index.js +2 -0
- package/dist/grpc/index.js.map +1 -1
- package/dist/grpc/index.mjs +2 -0
- package/dist/grpc/index.mjs.map +1 -1
- package/dist/{jwks-CX-nhD6A.d.cts → jwks-B8dPy2c6.d.cts} +7 -0
- package/dist/{jwks-CX-nhD6A.d.ts → jwks-B8dPy2c6.d.ts} +7 -0
- package/dist/middleware/index.d.cts +17 -7
- package/dist/middleware/index.d.ts +17 -7
- 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 +6 -2
- package/dist/node/index.d.ts +6 -2
- package/dist/node/index.js +2 -0
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +2 -0
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -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-B8dPy2c6.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Minimal session shape the middleware needs: a JWKS verifier (D-11) and the
|
|
@@ -9,13 +9,18 @@ import { V as Verifier } from './jwks-CX-nhD6A.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. */
|
|
12
13
|
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. */
|
|
13
15
|
tenantHeaderValue: string;
|
|
14
16
|
}
|
|
15
17
|
/** Authenticated identity injected as req.axiamUser / request.axiamUser (§10). */
|
|
16
18
|
interface AxiamIdentity {
|
|
19
|
+
/** The authenticated end user's id (the token's `sub` claim). */
|
|
17
20
|
userId: string;
|
|
21
|
+
/** The tenant the verified token was minted for (the token's `tenant_id` claim). */
|
|
18
22
|
tenantId: string;
|
|
23
|
+
/** Roles derived from the token's space-separated `scope` claim (§10). */
|
|
19
24
|
roles: string[];
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
@@ -37,6 +42,7 @@ declare function authenticateRequest(session: VerifiableSession, token: string):
|
|
|
37
42
|
* itself, so this module pulls in no axios/grpc dependency.
|
|
38
43
|
*/
|
|
39
44
|
interface AuthzChecker {
|
|
45
|
+
/** Issue a single access check for the authenticated end user (`subjectId`, §11.2.2). Satisfied structurally by `AxiamClient.checkAccess`. */
|
|
40
46
|
checkAccess(check: AccessCheck): Promise<AccessDecision>;
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
@@ -48,11 +54,14 @@ interface AuthzChecker {
|
|
|
48
54
|
* not per-request, when it is absent.
|
|
49
55
|
*/
|
|
50
56
|
interface AuthzVerifiableSession extends VerifiableSession {
|
|
57
|
+
/** Authz transport required by `requireAccess`/`requireAccessHook` (validated by {@link assertAuthzClient}); unused by `requireAuth`/`requireRole`. */
|
|
51
58
|
authzClient?: AuthzChecker;
|
|
52
59
|
}
|
|
53
60
|
/** Marker produced by {@link fromParam} — resolve the resource id from a named path/route parameter. */
|
|
54
61
|
interface ResourceParamRef {
|
|
62
|
+
/** Discriminant marking the path/route-parameter resolution strategy (§11.2.3.b). */
|
|
55
63
|
readonly kind: 'param';
|
|
64
|
+
/** The path/route parameter name the resource id is read from. */
|
|
56
65
|
readonly name: string;
|
|
57
66
|
}
|
|
58
67
|
/**
|
|
@@ -92,6 +101,7 @@ interface RequireAccessOptions {
|
|
|
92
101
|
}
|
|
93
102
|
/** Minimal logger seam for the §11.2.8 debug-only denial/error log (mirrors `amqp/consumer.ts`'s `ConsumeLogger`). */
|
|
94
103
|
interface AuthzLogger {
|
|
104
|
+
/** Emit a debug-only denial/error record (§11.2.8) — receives `action`/`resourceId` context, never the token. */
|
|
95
105
|
debug(event: string, message: string, context?: Record<string, unknown>): void;
|
|
96
106
|
}
|
|
97
107
|
/**
|
|
@@ -103,17 +113,24 @@ interface AuthzLogger {
|
|
|
103
113
|
declare function assertAuthzClient(session: AuthzVerifiableSession): AuthzChecker;
|
|
104
114
|
/** Standardized JSON error body shape (§10/§11 — `{ error, message }`). */
|
|
105
115
|
interface ErrorBody {
|
|
116
|
+
/** Stable machine-readable error code (e.g. `authentication_failed`, `authorization_denied`). */
|
|
106
117
|
error: string;
|
|
118
|
+
/** Human-readable explanation; never contains token material. */
|
|
107
119
|
message: string;
|
|
108
120
|
}
|
|
109
121
|
/** 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). */
|
|
110
122
|
type CheckOutcome = {
|
|
123
|
+
/** The check passed — the caller proceeds to the handler. */
|
|
111
124
|
kind: 'allowed';
|
|
112
125
|
} | {
|
|
126
|
+
/** The check was evaluated and denied (`allowed: false` or a server 403) → HTTP 403. */
|
|
113
127
|
kind: 'denied';
|
|
128
|
+
/** Denial message surfaced in the 403 body. */
|
|
114
129
|
message: string;
|
|
115
130
|
} | {
|
|
131
|
+
/** The authz transport failed — fail-closed → HTTP 503, never an allow. */
|
|
116
132
|
kind: 'unavailable';
|
|
133
|
+
/** Failure message surfaced in the 503 body. */
|
|
117
134
|
message: string;
|
|
118
135
|
};
|
|
119
136
|
/**
|
|
@@ -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-B8dPy2c6.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Minimal session shape the middleware needs: a JWKS verifier (D-11) and the
|
|
@@ -9,13 +9,18 @@ import { V as Verifier } from './jwks-CX-nhD6A.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. */
|
|
12
13
|
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. */
|
|
13
15
|
tenantHeaderValue: string;
|
|
14
16
|
}
|
|
15
17
|
/** Authenticated identity injected as req.axiamUser / request.axiamUser (§10). */
|
|
16
18
|
interface AxiamIdentity {
|
|
19
|
+
/** The authenticated end user's id (the token's `sub` claim). */
|
|
17
20
|
userId: string;
|
|
21
|
+
/** The tenant the verified token was minted for (the token's `tenant_id` claim). */
|
|
18
22
|
tenantId: string;
|
|
23
|
+
/** Roles derived from the token's space-separated `scope` claim (§10). */
|
|
19
24
|
roles: string[];
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
@@ -37,6 +42,7 @@ declare function authenticateRequest(session: VerifiableSession, token: string):
|
|
|
37
42
|
* itself, so this module pulls in no axios/grpc dependency.
|
|
38
43
|
*/
|
|
39
44
|
interface AuthzChecker {
|
|
45
|
+
/** Issue a single access check for the authenticated end user (`subjectId`, §11.2.2). Satisfied structurally by `AxiamClient.checkAccess`. */
|
|
40
46
|
checkAccess(check: AccessCheck): Promise<AccessDecision>;
|
|
41
47
|
}
|
|
42
48
|
/**
|
|
@@ -48,11 +54,14 @@ interface AuthzChecker {
|
|
|
48
54
|
* not per-request, when it is absent.
|
|
49
55
|
*/
|
|
50
56
|
interface AuthzVerifiableSession extends VerifiableSession {
|
|
57
|
+
/** Authz transport required by `requireAccess`/`requireAccessHook` (validated by {@link assertAuthzClient}); unused by `requireAuth`/`requireRole`. */
|
|
51
58
|
authzClient?: AuthzChecker;
|
|
52
59
|
}
|
|
53
60
|
/** Marker produced by {@link fromParam} — resolve the resource id from a named path/route parameter. */
|
|
54
61
|
interface ResourceParamRef {
|
|
62
|
+
/** Discriminant marking the path/route-parameter resolution strategy (§11.2.3.b). */
|
|
55
63
|
readonly kind: 'param';
|
|
64
|
+
/** The path/route parameter name the resource id is read from. */
|
|
56
65
|
readonly name: string;
|
|
57
66
|
}
|
|
58
67
|
/**
|
|
@@ -92,6 +101,7 @@ interface RequireAccessOptions {
|
|
|
92
101
|
}
|
|
93
102
|
/** Minimal logger seam for the §11.2.8 debug-only denial/error log (mirrors `amqp/consumer.ts`'s `ConsumeLogger`). */
|
|
94
103
|
interface AuthzLogger {
|
|
104
|
+
/** Emit a debug-only denial/error record (§11.2.8) — receives `action`/`resourceId` context, never the token. */
|
|
95
105
|
debug(event: string, message: string, context?: Record<string, unknown>): void;
|
|
96
106
|
}
|
|
97
107
|
/**
|
|
@@ -103,17 +113,24 @@ interface AuthzLogger {
|
|
|
103
113
|
declare function assertAuthzClient(session: AuthzVerifiableSession): AuthzChecker;
|
|
104
114
|
/** Standardized JSON error body shape (§10/§11 — `{ error, message }`). */
|
|
105
115
|
interface ErrorBody {
|
|
116
|
+
/** Stable machine-readable error code (e.g. `authentication_failed`, `authorization_denied`). */
|
|
106
117
|
error: string;
|
|
118
|
+
/** Human-readable explanation; never contains token material. */
|
|
107
119
|
message: string;
|
|
108
120
|
}
|
|
109
121
|
/** 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). */
|
|
110
122
|
type CheckOutcome = {
|
|
123
|
+
/** The check passed — the caller proceeds to the handler. */
|
|
111
124
|
kind: 'allowed';
|
|
112
125
|
} | {
|
|
126
|
+
/** The check was evaluated and denied (`allowed: false` or a server 403) → HTTP 403. */
|
|
113
127
|
kind: 'denied';
|
|
128
|
+
/** Denial message surfaced in the 403 body. */
|
|
114
129
|
message: string;
|
|
115
130
|
} | {
|
|
131
|
+
/** The authz transport failed — fail-closed → HTTP 503, never an allow. */
|
|
116
132
|
kind: 'unavailable';
|
|
133
|
+
/** Failure message surfaced in the 503 body. */
|
|
117
134
|
message: string;
|
|
118
135
|
};
|
|
119
136
|
/**
|
package/dist/grpc/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ 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-B8dPy2c6.cjs';
|
|
7
7
|
import 'tough-cookie';
|
|
8
8
|
import '../client-CAeQw1a-.cjs';
|
|
9
9
|
import 'axios';
|
package/dist/grpc/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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-B8dPy2c6.js';
|
|
7
7
|
import 'tough-cookie';
|
|
8
8
|
import '../client-BPg9kfKV.js';
|
|
9
9
|
import 'axios';
|
package/dist/grpc/index.js
CHANGED
|
@@ -838,7 +838,9 @@ function createVerifier(baseUrl) {
|
|
|
838
838
|
|
|
839
839
|
// src/node/session.ts
|
|
840
840
|
var NodeSession = class extends SharedSession {
|
|
841
|
+
/** Manages the access/refresh token pair backing this session. */
|
|
841
842
|
tokenManager;
|
|
843
|
+
/** Local JWKS verifier for validating access tokens without a server round-trip. */
|
|
842
844
|
jwksVerifier;
|
|
843
845
|
#jar;
|
|
844
846
|
constructor(options, base, tokenManager, jwksVerifier, jar) {
|