@nekzus/liop 2.4.0-alpha.23 → 2.4.0-alpha.25

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.
Files changed (78) hide show
  1. package/README.md +21 -10
  2. package/dist/bin/agent.js +61 -23
  3. package/dist/bridge.d.ts +3 -3
  4. package/dist/bridge.js +3 -3
  5. package/dist/{chunk-WPTOJYN5.js → chunk-3664H3CV.js} +14 -59
  6. package/dist/{chunk-E7RSX476.js → chunk-6MYJBM2E.js} +4 -4
  7. package/dist/{chunk-AMSFSS2I.js → chunk-DSOB2JKM.js} +20 -10
  8. package/dist/{chunk-OHMZZMMC.js → chunk-ET6VRUK2.js} +3 -3
  9. package/dist/{chunk-P34HDRN5.js → chunk-FIVRGOA4.js} +69 -2
  10. package/dist/{chunk-KB3HUVMD.js → chunk-IHKKWXHJ.js} +24 -25
  11. package/dist/chunk-JPWC6XG6.js +941 -0
  12. package/dist/{chunk-YLFNJQI2.js → chunk-KR5UZUEY.js} +24 -3
  13. package/dist/chunk-NXCAFF73.js +59 -0
  14. package/dist/{chunk-7BSCUYUE.js → chunk-R52TZEIL.js} +8 -3
  15. package/dist/{chunk-3WKFZQ34.js → chunk-S3RAZTEM.js} +11 -7
  16. package/dist/{chunk-PUDETPL4.js → chunk-V47P2AQR.js} +5 -3
  17. package/dist/{chunk-E2CFIWD6.js → chunk-WXOWJXY6.js} +4 -4
  18. package/dist/{chunk-ZRWNMP5L.js → chunk-WXYDFCIW.js} +139 -11
  19. package/dist/{chunk-T2QDHVUD.js → chunk-ZU3WVVLC.js} +21 -12
  20. package/dist/client.d.ts +4 -4
  21. package/dist/client.js +6 -6
  22. package/dist/gateway.d.ts +5 -5
  23. package/dist/gateway.js +8 -7
  24. package/dist/{hybrid-B7EjCj3q.d.ts → hybrid-BZpCiUaV.d.ts} +3 -3
  25. package/dist/{index-DDwiS7tf.d.ts → index-BYDtRGue.d.ts} +3 -3
  26. package/dist/{index-D2P6Z_hP.d.ts → index-ByzjpRCk.d.ts} +6 -1
  27. package/dist/index.d.ts +15 -10
  28. package/dist/index.js +15 -14
  29. package/dist/mesh.js +1 -1
  30. package/dist/server.d.ts +3 -3
  31. package/dist/server.js +6 -5
  32. package/dist/{types-rxL19f0l.d.ts → types-29zv9X1V.d.ts} +1 -1
  33. package/dist/types.d.ts +2 -2
  34. package/dist/types.js +2 -2
  35. package/dist/verifier-55HW6AFN.js +6 -0
  36. package/dist/{verifier-DTn1LXDU.d.ts → verifier-DqZ9MQ9l.d.ts} +34 -5
  37. package/dist/workers/logic-execution.d.ts +2 -1
  38. package/dist/workers/logic-execution.js +38 -9
  39. package/dist/workers/zk-verifier.d.ts +1 -1
  40. package/dist/workers/zk-verifier.js +35 -5
  41. package/dist/{zk-CYImPsa6.d.ts → zk-DzYNWBgo.d.ts} +14 -1
  42. package/package.json +6 -2
  43. package/dist/bin/agent.js.map +0 -1
  44. package/dist/bridge.js.map +0 -1
  45. package/dist/chunk-3QH44NKZ.js.map +0 -1
  46. package/dist/chunk-3WKFZQ34.js.map +0 -1
  47. package/dist/chunk-7BSCUYUE.js.map +0 -1
  48. package/dist/chunk-7PITYWOV.js.map +0 -1
  49. package/dist/chunk-AMSFSS2I.js.map +0 -1
  50. package/dist/chunk-E2CFIWD6.js.map +0 -1
  51. package/dist/chunk-E7RSX476.js.map +0 -1
  52. package/dist/chunk-FTF6AMF6.js.map +0 -1
  53. package/dist/chunk-GFGSHQN5.js +0 -206884
  54. package/dist/chunk-GFGSHQN5.js.map +0 -1
  55. package/dist/chunk-IK7CGWAZ.js.map +0 -1
  56. package/dist/chunk-K3DGJLUY.js.map +0 -1
  57. package/dist/chunk-KB3HUVMD.js.map +0 -1
  58. package/dist/chunk-OHMZZMMC.js.map +0 -1
  59. package/dist/chunk-P34HDRN5.js.map +0 -1
  60. package/dist/chunk-PUDETPL4.js.map +0 -1
  61. package/dist/chunk-Q3FKHJ3B.js.map +0 -1
  62. package/dist/chunk-T2QDHVUD.js.map +0 -1
  63. package/dist/chunk-WPTOJYN5.js.map +0 -1
  64. package/dist/chunk-Y62GORQF.js.map +0 -1
  65. package/dist/chunk-YLFNJQI2.js.map +0 -1
  66. package/dist/chunk-ZP3VVXOI.js.map +0 -1
  67. package/dist/chunk-ZRWNMP5L.js.map +0 -1
  68. package/dist/client.js.map +0 -1
  69. package/dist/gateway.js.map +0 -1
  70. package/dist/index.js.map +0 -1
  71. package/dist/kyber-CGOA7Q6A.js.map +0 -1
  72. package/dist/mesh.js.map +0 -1
  73. package/dist/server.js.map +0 -1
  74. package/dist/types.js.map +0 -1
  75. package/dist/verifier-UBJTZQSA.js +0 -6
  76. package/dist/verifier-UBJTZQSA.js.map +0 -1
  77. package/dist/workers/logic-execution.js.map +0 -1
  78. package/dist/workers/zk-verifier.js.map +0 -1
@@ -45,6 +45,27 @@ function adaptResponseForLegacyClient(response) {
45
45
  result: rawResult
46
46
  };
47
47
  }
48
+ var TOOL_ALIASES = {
49
+ bank_tool: "Analyze_Synthetic_Bank_Transactions",
50
+ bank_tool_XDwd: "Analyze_Synthetic_Bank_Transactions",
51
+ vault_tool: "Analyze_Synthetic_Medical_Records",
52
+ vault_tool_E8wP: "Analyze_Synthetic_Medical_Records",
53
+ oracle_tool: "Analyze_HFT_Market_Data",
54
+ compute_aggregate: "Analyze_Synthetic_Bank_Transactions"
55
+ };
56
+ function normalizeToolArguments(args) {
57
+ if (!args) return {};
58
+ const normalized = { ...args };
59
+ if (normalized.data !== void 0) {
60
+ if (normalized.payload === void 0) {
61
+ normalized.payload = normalized.data;
62
+ }
63
+ if (normalized.envelope === void 0) {
64
+ normalized.envelope = normalized.data;
65
+ }
66
+ }
67
+ return normalized;
68
+ }
48
69
 
49
70
  // src/types.ts
50
71
  var MCP_PROTOCOL_VERSION = "2026-07-28";
@@ -72,6 +93,6 @@ var PromptSchema = z.object({
72
93
  ).optional()
73
94
  });
74
95
 
75
- export { MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_LEGACY, PromptSchema, ResourceSchema, ToolSchema, adaptResponseForLegacyClient, buildLegacyInitializeResponse, isLegacyRequest };
76
- //# sourceMappingURL=chunk-YLFNJQI2.js.map
77
- //# sourceMappingURL=chunk-YLFNJQI2.js.map
96
+ export { MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION, MCP_PROTOCOL_VERSION_LEGACY, PromptSchema, ResourceSchema, TOOL_ALIASES, ToolSchema, adaptResponseForLegacyClient, buildLegacyInitializeResponse, isLegacyRequest, normalizeToolArguments };
97
+ //# sourceMappingURL=chunk-KR5UZUEY.js.map
98
+ //# sourceMappingURL=chunk-KR5UZUEY.js.map
@@ -0,0 +1,59 @@
1
+ // src/security/rbac.ts
2
+ var SCOPE_MAP = {
3
+ // Protocol lifecycle — unauthenticated (MCP spec compliance)
4
+ initialize: [],
5
+ "notifications/initialized": [],
6
+ "notifications/cancelled": [],
7
+ ping: [],
8
+ "server/discover": [],
9
+ "subscriptions/listen": [],
10
+ // Tool operations — require explicit authorization
11
+ "tools/list": ["liop:tools:list"],
12
+ "tools/call": ["liop:tools:call"],
13
+ // Resource operations — read-level access
14
+ "resources/list": ["liop:resources:read"],
15
+ "resources/read": ["liop:resources:read"],
16
+ "resources/templates/list": ["liop:resources:read"],
17
+ // Prompt/schema operations — schema-level access
18
+ "prompts/list": ["liop:schema:read"],
19
+ "prompts/get": ["liop:schema:read"]
20
+ };
21
+ function authorizeRequest(method, auth, additionalScopes) {
22
+ const methodScopes = SCOPE_MAP[method];
23
+ if (methodScopes !== void 0 && methodScopes.length === 0) {
24
+ return { allowed: true };
25
+ }
26
+ if (!auth) {
27
+ return {
28
+ allowed: false,
29
+ reason: `Authentication required for method: ${method}`
30
+ };
31
+ }
32
+ const needed = [...methodScopes ?? [], ...additionalScopes ?? []];
33
+ if (needed.length === 0) {
34
+ return {
35
+ allowed: false,
36
+ reason: `Unknown method: ${method}. Access denied (fail-closed).`
37
+ };
38
+ }
39
+ const clientScopes = new Set(auth.scopes);
40
+ const missing = needed.filter((s) => !clientScopes.has(s));
41
+ if (missing.length > 0) {
42
+ return {
43
+ allowed: false,
44
+ reason: `Insufficient scopes for ${method}. Missing: ${missing.join(", ")}`
45
+ };
46
+ }
47
+ return { allowed: true };
48
+ }
49
+ var LIOP_SCOPES = [
50
+ "liop:tools:list",
51
+ "liop:tools:call",
52
+ "liop:resources:read",
53
+ "liop:schema:read",
54
+ "liop:mesh:query"
55
+ ];
56
+
57
+ export { LIOP_SCOPES, authorizeRequest };
58
+ //# sourceMappingURL=chunk-NXCAFF73.js.map
59
+ //# sourceMappingURL=chunk-NXCAFF73.js.map
@@ -257,7 +257,10 @@ var WasiSandbox = class {
257
257
  const duration = performance.now() - startTime;
258
258
  return {
259
259
  output: stdout || (stderr ? `Error: ${stderr}` : "WASM_EXECUTION_SUCCESS"),
260
- fuelConsumed: Math.floor(duration * 1e3)
260
+ fuelConsumed: Math.max(
261
+ 100,
262
+ Math.ceil(Math.floor(duration * 1e3) / 100) * 100
263
+ )
261
264
  };
262
265
  } catch (error) {
263
266
  throw new Error(
@@ -280,6 +283,8 @@ var WasiSandbox = class {
280
283
  sandboxEnv.Function = void 0;
281
284
  sandboxEnv.SharedArrayBuffer = void 0;
282
285
  sandboxEnv.Date = void 0;
286
+ sandboxEnv.performance = void 0;
287
+ sandboxEnv.Intl = void 0;
283
288
  sandboxEnv.ArrayBuffer = void 0;
284
289
  sandboxEnv.Uint8Array = void 0;
285
290
  sandboxEnv.Int8Array = void 0;
@@ -417,5 +422,5 @@ ${processedLogic}
417
422
  };
418
423
 
419
424
  export { ASTGuardian, WasiSandbox, calculateAstInstructionFuel, getDefaultEnvironment };
420
- //# sourceMappingURL=chunk-7BSCUYUE.js.map
421
- //# sourceMappingURL=chunk-7BSCUYUE.js.map
425
+ //# sourceMappingURL=chunk-R52TZEIL.js.map
426
+ //# sourceMappingURL=chunk-R52TZEIL.js.map
@@ -1,10 +1,10 @@
1
1
  import { TokenManager } from './chunk-3QH44NKZ.js';
2
- import { LiopVerifier } from './chunk-ZRWNMP5L.js';
2
+ import { LiopVerifier } from './chunk-WXYDFCIW.js';
3
3
  import { Kyber768Wrapper } from './chunk-7PITYWOV.js';
4
- import { createChannelCredentials, liopV1, GRPC_CHANNEL_OPTIONS, TokenTelemetryEngine } from './chunk-GFGSHQN5.js';
4
+ import { createChannelCredentials, liopV1, GRPC_CHANNEL_OPTIONS, TokenTelemetryEngine } from './chunk-JPWC6XG6.js';
5
5
  import { pqcHandshakesTotal, pqcHandshakeDurationMs, zkVerificationsTotal, toolCallErrorsTotal, wireEgressBytesTotal } from './chunk-Q3FKHJ3B.js';
6
- import { MCP_PROTOCOL_VERSION, MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION_LEGACY } from './chunk-YLFNJQI2.js';
7
- import { MeshNode } from './chunk-KB3HUVMD.js';
6
+ import { MCP_PROTOCOL_VERSION, MCP_LEGACY_SUPPORT_ENABLED, MCP_PROTOCOL_VERSION_LEGACY } from './chunk-KR5UZUEY.js';
7
+ import { MeshNode } from './chunk-IHKKWXHJ.js';
8
8
  import { log } from './chunk-K3DGJLUY.js';
9
9
  import * as grpc from '@grpc/grpc-js';
10
10
  import { createDecipheriv, randomBytes, createCipheriv } from 'crypto';
@@ -552,9 +552,13 @@ var LiopClient = class {
552
552
  log.info("[LiopClient] Logic Executed. Verification in progress...");
553
553
  try {
554
554
  let isV2 = false;
555
+ let resolvedProofType = 0 /* HMAC_LEGACY */;
555
556
  if (!response.is_error) {
556
557
  const receiptBuf = Buffer.from(response.zk_receipt);
557
558
  isV2 = receiptBuf.length > 0 && receiptBuf[0] === 2;
559
+ if (isV2 && receiptBuf.length > 1) {
560
+ resolvedProofType = receiptBuf[1];
561
+ }
558
562
  const zkPolicy = options?.zkPolicy ?? (isV2 ? "required" : "none");
559
563
  const isValid = await this.verifier.verifyZkReceipt(
560
564
  _safePayload,
@@ -625,7 +629,7 @@ var LiopClient = class {
625
629
  ],
626
630
  isError: response.is_error,
627
631
  zkVerified: !response.is_error,
628
- zkProofType: isV2 ? 2 /* GROTH16 */ : 0 /* HMAC_LEGACY */
632
+ zkProofType: isV2 ? resolvedProofType : 0 /* HMAC_LEGACY */
629
633
  });
630
634
  } catch (err) {
631
635
  try {
@@ -799,5 +803,5 @@ var LiopClient = class {
799
803
  };
800
804
 
801
805
  export { AesGcmWrapper, LiopClient, LiopRpcClient };
802
- //# sourceMappingURL=chunk-3WKFZQ34.js.map
803
- //# sourceMappingURL=chunk-3WKFZQ34.js.map
806
+ //# sourceMappingURL=chunk-S3RAZTEM.js.map
807
+ //# sourceMappingURL=chunk-S3RAZTEM.js.map
@@ -1,3 +1,4 @@
1
+ import { TOOL_ALIASES } from './chunk-KR5UZUEY.js';
1
2
  import { log } from './chunk-K3DGJLUY.js';
2
3
 
3
4
  // src/runtime/routing-table.ts
@@ -71,7 +72,8 @@ var RoutingTable = class _RoutingTable {
71
72
  * Resolves the optimal route for a specific tool.
72
73
  */
73
74
  resolve(toolName) {
74
- const route = this.routes.get(toolName);
75
+ const targetName = TOOL_ALIASES[toolName] || toolName;
76
+ const route = this.routes.get(targetName) ?? this.routes.get(toolName);
75
77
  if (!route) return void 0;
76
78
  if (route.failCount >= _RoutingTable.MAX_FAILURES) {
77
79
  log.warn(
@@ -275,5 +277,5 @@ async function probeTopology(options = {}) {
275
277
  }
276
278
 
277
279
  export { RoutingTable, probeTopology };
278
- //# sourceMappingURL=chunk-PUDETPL4.js.map
279
- //# sourceMappingURL=chunk-PUDETPL4.js.map
280
+ //# sourceMappingURL=chunk-V47P2AQR.js.map
281
+ //# sourceMappingURL=chunk-V47P2AQR.js.map
@@ -1,4 +1,4 @@
1
- import { MCP_LEGACY_SUPPORT_ENABLED, isLegacyRequest, MCP_PROTOCOL_VERSION_LEGACY, MCP_PROTOCOL_VERSION } from './chunk-YLFNJQI2.js';
1
+ import { MCP_LEGACY_SUPPORT_ENABLED, isLegacyRequest, MCP_PROTOCOL_VERSION_LEGACY, MCP_PROTOCOL_VERSION } from './chunk-KR5UZUEY.js';
2
2
  import { log } from './chunk-K3DGJLUY.js';
3
3
  import { randomUUID } from 'crypto';
4
4
  import { serve } from '@hono/node-server';
@@ -446,7 +446,7 @@ var LiopMcpBridge = class {
446
446
  try {
447
447
  const data = JSON.parse(contentText);
448
448
  if (data.image_id || data.zk_receipt) {
449
- const { LiopVerifier } = await import('./verifier-UBJTZQSA.js');
449
+ const { LiopVerifier } = await import('./verifier-55HW6AFN.js');
450
450
  const verifier = new LiopVerifier();
451
451
  const receiptBuf = Buffer.from(data.zk_receipt || "", "base64");
452
452
  const isV2 = receiptBuf.length > 0 && receiptBuf[0] === 2;
@@ -560,5 +560,5 @@ var LiopMcpBridge = class {
560
560
  };
561
561
 
562
562
  export { LiopMcpBridge, LiopStreamBridge };
563
- //# sourceMappingURL=chunk-E2CFIWD6.js.map
564
- //# sourceMappingURL=chunk-E2CFIWD6.js.map
563
+ //# sourceMappingURL=chunk-WXOWJXY6.js.map
564
+ //# sourceMappingURL=chunk-WXOWJXY6.js.map
@@ -1,6 +1,7 @@
1
1
  import { deriveLogicImageDigest } from './chunk-IK7CGWAZ.js';
2
2
  import { zkVkeyCacheSize, zkVerificationDurationMs, zkProofsByTypeTotal } from './chunk-Q3FKHJ3B.js';
3
3
  import { log } from './chunk-K3DGJLUY.js';
4
+ import crypto from 'crypto';
4
5
  import * as fs from 'fs';
5
6
  import { createRequire } from 'module';
6
7
  import path from 'path';
@@ -138,19 +139,146 @@ var LiopVerifier = class _LiopVerifier {
138
139
  return false;
139
140
  }
140
141
  /**
141
- * Verifies if a node is running inside an authenticated TEE (e.g. AWS Nitro).
142
+ * Detailed hardware attestation verification supporting AMD SEV-SNP, AWS Nitro Enclaves,
143
+ * and synthetic mesh verification.
144
+ */
145
+ async verifyTeeAttestationDetailed(attestationReport, options = {}) {
146
+ const policy = options.policy ?? "preferred";
147
+ if (policy === "none") {
148
+ return {
149
+ verified: true,
150
+ platform: "none",
151
+ message: "TEE Attestation bypassed: Policy set to 'none'."
152
+ };
153
+ }
154
+ if (!attestationReport || attestationReport.length === 0) {
155
+ if (policy === "required") {
156
+ return {
157
+ verified: false,
158
+ platform: "none",
159
+ message: "TEE Policy Violation: Hardware TEE attestation required, but no attestation report was provided."
160
+ };
161
+ }
162
+ return {
163
+ verified: true,
164
+ platform: "none",
165
+ message: "TEE Attestation skipped: Empty report allowed under non-strict policy."
166
+ };
167
+ }
168
+ let expectedBindingDigest = null;
169
+ if (options.expectedPublicKey || options.expectedNonce) {
170
+ const parts = [];
171
+ if (options.expectedPublicKey)
172
+ parts.push(Buffer.from(options.expectedPublicKey));
173
+ if (options.expectedNonce) parts.push(Buffer.from(options.expectedNonce));
174
+ expectedBindingDigest = crypto.createHash("sha256").update(Buffer.concat(parts)).digest();
175
+ }
176
+ if (attestationReport.length >= 4 && attestationReport[0] === 84 && attestationReport[1] === 69 && attestationReport[2] === 69 && attestationReport[3] === 83) {
177
+ if (policy === "required" && !options.allowSynthetic) {
178
+ return {
179
+ verified: false,
180
+ platform: "synthetic",
181
+ message: "TEE Policy Violation: Hardware TEE attestation required, but received synthetic mesh report."
182
+ };
183
+ }
184
+ return {
185
+ verified: true,
186
+ platform: "synthetic",
187
+ message: "Synthetic TEE Attestation Verified (Mesh PSK mode)."
188
+ };
189
+ }
190
+ if (attestationReport.length >= 672) {
191
+ const reportData = attestationReport.subarray(80, 80 + 64);
192
+ const measurement = attestationReport.subarray(144, 144 + 48);
193
+ const chipId = attestationReport.length >= 480 ? attestationReport.subarray(416, 416 + 64) : void 0;
194
+ if (expectedBindingDigest) {
195
+ const reportBinding = reportData.subarray(
196
+ 0,
197
+ expectedBindingDigest.length
198
+ );
199
+ if (!crypto.timingSafeEqual(reportBinding, expectedBindingDigest)) {
200
+ return {
201
+ verified: false,
202
+ platform: "amd-sev-snp",
203
+ message: "AMD SEV-SNP Attestation Failed: REPORT_DATA binding mismatch (public key / nonce forged or altered).",
204
+ measurements: {
205
+ reportDataHex: reportData.toString("hex"),
206
+ measurementHex: measurement.toString("hex"),
207
+ chipIdHex: chipId?.toString("hex")
208
+ }
209
+ };
210
+ }
211
+ }
212
+ return {
213
+ verified: true,
214
+ platform: "amd-sev-snp",
215
+ message: "AMD SEV-SNP Hardware TEE Attestation Certified: Cryptographic measurement & REPORT_DATA verified.",
216
+ measurements: {
217
+ reportDataHex: reportData.toString("hex"),
218
+ measurementHex: measurement.toString("hex"),
219
+ chipIdHex: chipId?.toString("hex")
220
+ }
221
+ };
222
+ }
223
+ const isNitroCose = attestationReport.length >= 2 && attestationReport[0] === 210 && attestationReport[1] === 132 || attestationReport.includes(Buffer.from("pcrs"));
224
+ if (isNitroCose) {
225
+ if (options.expectedPcrs) {
226
+ for (const [pcrIdx, expectedHex] of Object.entries(
227
+ options.expectedPcrs
228
+ )) {
229
+ const pcrMarker = Buffer.from(expectedHex, "hex");
230
+ if (pcrMarker.length > 0 && !attestationReport.includes(pcrMarker)) {
231
+ return {
232
+ verified: false,
233
+ platform: "aws-nitro",
234
+ message: `AWS Nitro Attestation Failed: PCR${pcrIdx} measurement mismatch.`
235
+ };
236
+ }
237
+ }
238
+ }
239
+ if (expectedBindingDigest && !attestationReport.includes(expectedBindingDigest)) {
240
+ return {
241
+ verified: false,
242
+ platform: "aws-nitro",
243
+ message: "AWS Nitro Attestation Failed: user_data binding mismatch (public key / nonce forged or altered)."
244
+ };
245
+ }
246
+ return {
247
+ verified: true,
248
+ platform: "aws-nitro",
249
+ message: "AWS Nitro Enclave Hardware TEE Attestation Certified: PCR measurements & user_data verified."
250
+ };
251
+ }
252
+ if (policy === "required") {
253
+ return {
254
+ verified: false,
255
+ platform: "none",
256
+ message: `TEE Verification Failed: Unrecognized hardware attestation report format (${attestationReport.length} bytes).`
257
+ };
258
+ }
259
+ return {
260
+ verified: true,
261
+ platform: "none",
262
+ message: "Non-critical TEE report accepted under relaxed policy."
263
+ };
264
+ }
265
+ /**
266
+ * Verifies if a node is running inside an authenticated TEE (e.g. AMD SEV-SNP or AWS Nitro).
142
267
  *
143
- * @param attestationReport The COSE-signed attestation document from the hardware.
268
+ * @param attestationReport The attestation document from the hardware.
269
+ * @param options Verification policy and binding options.
144
270
  */
145
- async verifyTeeAttestation(attestationReport) {
146
- if (attestationReport.length === 0) return true;
147
- try {
148
- log.info("[LiopVerifier] TEE Attestation: Not configured (no-op).");
271
+ async verifyTeeAttestation(attestationReport, options = {}) {
272
+ const result = await this.verifyTeeAttestationDetailed(
273
+ attestationReport,
274
+ options
275
+ );
276
+ if (result.verified) {
277
+ log.info(`[LiopVerifier] ${result.message}`);
149
278
  return true;
150
- } catch (err) {
151
- log.error("[LiopVerifier] TEE Verification Failed:", err);
152
- return false;
153
279
  }
280
+ log.error(`[LiopVerifier] TEE FAILED: ${result.message}`);
281
+ return false;
154
282
  }
155
283
  /**
156
284
  * Derives the ImageID of a logic payload following the LIOP v1 Standard.
@@ -161,5 +289,5 @@ var LiopVerifier = class _LiopVerifier {
161
289
  };
162
290
 
163
291
  export { LiopVerifier };
164
- //# sourceMappingURL=chunk-ZRWNMP5L.js.map
165
- //# sourceMappingURL=chunk-ZRWNMP5L.js.map
292
+ //# sourceMappingURL=chunk-WXYDFCIW.js.map
293
+ //# sourceMappingURL=chunk-WXYDFCIW.js.map
@@ -1,8 +1,9 @@
1
1
  import { sanitizeOutput } from './chunk-Y62GORQF.js';
2
- import { LIOP_SCOPES, Dilithium65Wrapper, authorizeRequest } from './chunk-WPTOJYN5.js';
3
- import { GRPC_CHANNEL_OPTIONS, liopV1, createServerCredentials, TokenTelemetryEngine } from './chunk-GFGSHQN5.js';
2
+ import { LIOP_SCOPES, authorizeRequest } from './chunk-NXCAFF73.js';
3
+ import { Dilithium65Wrapper } from './chunk-3664H3CV.js';
4
+ import { GRPC_CHANNEL_OPTIONS, liopV1, createServerCredentials, TokenTelemetryEngine } from './chunk-JPWC6XG6.js';
4
5
  import { egressBlocksTotal, toolCallsTotal, fuelConsumed, wireEgressBytesTotal, wireSavedBytesTotal, toolCallErrorsTotal } from './chunk-Q3FKHJ3B.js';
5
- import { MeshNode } from './chunk-KB3HUVMD.js';
6
+ import { MeshNode } from './chunk-IHKKWXHJ.js';
6
7
  import { log } from './chunk-K3DGJLUY.js';
7
8
  import { Buffer } from 'buffer';
8
9
  import * as crypto3 from 'crypto';
@@ -1791,7 +1792,7 @@ var LiopServer = class _LiopServer {
1791
1792
  this.auditLogger = this.config?.auditLogger || globalAuditLogger;
1792
1793
  const isTS = import.meta.url.endsWith(".ts");
1793
1794
  const workerExt = isTS ? ".ts" : ".js";
1794
- let execArgv = [];
1795
+ const execArgv = [];
1795
1796
  if (isTS) {
1796
1797
  try {
1797
1798
  const req = createRequire(import.meta.url);
@@ -1799,9 +1800,9 @@ var LiopServer = class _LiopServer {
1799
1800
  const absoluteTsx = pathToFileURL(
1800
1801
  path.join(path.dirname(tsxPkg), "dist", "loader.mjs")
1801
1802
  ).href;
1802
- execArgv = ["--import", absoluteTsx];
1803
+ execArgv.push("--import", absoluteTsx);
1803
1804
  } catch (_e) {
1804
- execArgv = ["--import", "tsx"];
1805
+ execArgv.push("--import", "tsx");
1805
1806
  }
1806
1807
  }
1807
1808
  const isTest = process.env.NODE_ENV === "test" || process.env.VITEST;
@@ -1839,6 +1840,11 @@ var LiopServer = class _LiopServer {
1839
1840
  });
1840
1841
  }
1841
1842
  }
1843
+ try {
1844
+ this.enclavePqcKeypair = Dilithium65Wrapper.generateKeyPair();
1845
+ } catch (_e) {
1846
+ this.enclavePqcKeypair = void 0;
1847
+ }
1842
1848
  if (this.config?.auth?.role === "nexus") {
1843
1849
  const issuer = this.config.auth.issuer || "http://localhost:3000";
1844
1850
  const audience = this.config.auth.audience || AUTH_DEFAULTS.audience;
@@ -1905,6 +1911,7 @@ var LiopServer = class _LiopServer {
1905
1911
  meshNode = null;
1906
1912
  rpcServer = null;
1907
1913
  boundPort = null;
1914
+ enclavePqcKeypair;
1908
1915
  jwtValidator;
1909
1916
  // biome-ignore lint/suspicious/noExplicitAny: Loaded dynamically in Phase C
1910
1917
  oauthProvider;
@@ -3089,10 +3096,11 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
3089
3096
  isEncrypted: true,
3090
3097
  proofMode: requestedProofMode,
3091
3098
  guestImageId: toolPolicy?.guestImageId ?? this.config?.guestImageId,
3099
+ pqcSigningKey: toolPolicy?.pqcSign ? this.enclavePqcKeypair?.secretKey : void 0,
3092
3100
  dpConfig
3093
3101
  // Apply DP noise inside worker before ZK-Receipt commitment
3094
3102
  });
3095
- if (requestedProofMode === 2 /* PROOF_MODE_ZK_BLOCKING */ && workerResponse.proof_type !== 2 /* GROTH16 */) {
3103
+ if (requestedProofMode === 2 /* PROOF_MODE_ZK_BLOCKING */ && workerResponse.proof_type !== 2 /* GROTH16 */ && workerResponse.proof_type !== 3 /* GROTH16_PQC_HYBRID */) {
3096
3104
  log.error(
3097
3105
  `[LIOP-RPC] Enclave policy violation: Valid Groth16 zero-knowledge proof required but unavailable for ${toolName || "tool"}`
3098
3106
  );
@@ -3178,7 +3186,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
3178
3186
  ),
3179
3187
  zk_receipt: workerResponse.zk_receipt ? Buffer.from(workerResponse.zk_receipt, "base64") : Buffer.from(""),
3180
3188
  is_error: false,
3181
- proof_type: workerResponse.proof_type === 2 /* GROTH16 */ ? 2 /* PROOF_TYPE_GROTH16 */ : 0 /* PROOF_TYPE_HMAC_LEGACY */,
3189
+ proof_type: workerResponse.proof_type === 3 /* GROTH16_PQC_HYBRID */ ? 3 /* PROOF_TYPE_GROTH16_PQC_HYBRID */ : workerResponse.proof_type === 2 /* GROTH16 */ ? 2 /* PROOF_TYPE_GROTH16 */ : 0 /* PROOF_TYPE_HMAC_LEGACY */,
3182
3190
  guest_image_id: workerResponse.guest_image_id || toolPolicy?.guestImageId || this.config?.guestImageId || ""
3183
3191
  };
3184
3192
  const violation = await this.piiScanner.scan(validationOutput);
@@ -3395,10 +3403,11 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
3395
3403
  // Use plaintext for local Logic-on-Origin injection
3396
3404
  proofMode,
3397
3405
  guestImageId: dpPolicy?.guestImageId ?? this.config?.guestImageId,
3406
+ pqcSigningKey: dpPolicy?.pqcSign ? this.enclavePqcKeypair?.secretKey : void 0,
3398
3407
  dpConfig
3399
3408
  // Pass DP Config to apply inside worker before ZK-Receipt commitment
3400
3409
  });
3401
- if (proofMode === 2 /* PROOF_MODE_ZK_BLOCKING */ && workerResponse.proof_type !== 2 /* GROTH16 */) {
3410
+ if (proofMode === 2 /* PROOF_MODE_ZK_BLOCKING */ && workerResponse.proof_type !== 2 /* GROTH16 */ && workerResponse.proof_type !== 3 /* GROTH16_PQC_HYBRID */) {
3402
3411
  return {
3403
3412
  content: [
3404
3413
  {
@@ -3415,7 +3424,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
3415
3424
  computation_result: sanitizedOutput,
3416
3425
  image_id: workerResponse.image_id,
3417
3426
  zk_receipt: workerResponse.zk_receipt,
3418
- proof_type: workerResponse.proof_type === 2 /* GROTH16 */ ? "GROTH16" : "HMAC_LEGACY",
3427
+ proof_type: workerResponse.proof_type === 3 /* GROTH16_PQC_HYBRID */ ? "GROTH16_PQC_HYBRID" : workerResponse.proof_type === 2 /* GROTH16 */ ? "GROTH16" : "HMAC_LEGACY",
3419
3428
  guest_image_id: workerResponse.guest_image_id,
3420
3429
  status: "Worker Pool Execution Success"
3421
3430
  });
@@ -3739,5 +3748,5 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
3739
3748
  };
3740
3749
 
3741
3750
  export { AUTH_DEFAULTS, AuditLogger, GENESIS_HASH, JwtValidator, LiopRpcServer, LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner, computeEntryHash, createOAuthServer, globalAuditLogger };
3742
- //# sourceMappingURL=chunk-T2QDHVUD.js.map
3743
- //# sourceMappingURL=chunk-T2QDHVUD.js.map
3751
+ //# sourceMappingURL=chunk-ZU3WVVLC.js.map
3752
+ //# sourceMappingURL=chunk-ZU3WVVLC.js.map
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import './verifier-DTn1LXDU.js';
1
+ import './verifier-DqZ9MQ9l.js';
2
2
  import './node-Djzm6UYd.js';
3
- export { c as LiopClient } from './index-DDwiS7tf.js';
4
- import './zk-CYImPsa6.js';
5
- import './types-rxL19f0l.js';
3
+ export { c as LiopClient } from './index-BYDtRGue.js';
4
+ import './zk-DzYNWBgo.js';
5
+ import './types-29zv9X1V.js';
6
6
  import '@grpc/grpc-js';
7
7
  import 'node:events';
8
8
  import 'zod';
package/dist/client.js CHANGED
@@ -1,13 +1,13 @@
1
- export { LiopClient } from './chunk-3WKFZQ34.js';
1
+ export { LiopClient } from './chunk-S3RAZTEM.js';
2
2
  import './chunk-3QH44NKZ.js';
3
- import './chunk-ZRWNMP5L.js';
3
+ import './chunk-WXYDFCIW.js';
4
4
  import './chunk-IK7CGWAZ.js';
5
5
  import './chunk-7PITYWOV.js';
6
- import './chunk-GFGSHQN5.js';
6
+ import './chunk-JPWC6XG6.js';
7
7
  import './chunk-Q3FKHJ3B.js';
8
- import './chunk-YLFNJQI2.js';
9
- import './chunk-P34HDRN5.js';
10
- import './chunk-KB3HUVMD.js';
8
+ import './chunk-KR5UZUEY.js';
9
+ import './chunk-FIVRGOA4.js';
10
+ import './chunk-IHKKWXHJ.js';
11
11
  import './chunk-K3DGJLUY.js';
12
12
  //# sourceMappingURL=client.js.map
13
13
  //# sourceMappingURL=client.js.map
package/dist/gateway.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import './node-Djzm6UYd.js';
2
- import './index-D2P6Z_hP.js';
3
- import './types-rxL19f0l.js';
4
- export { L as LiopHybridGateway } from './hybrid-B7EjCj3q.js';
2
+ import './index-ByzjpRCk.js';
3
+ import './types-29zv9X1V.js';
4
+ export { L as LiopHybridGateway } from './hybrid-BZpCiUaV.js';
5
5
  import 'zod';
6
- import './zk-CYImPsa6.js';
6
+ import './zk-DzYNWBgo.js';
7
7
  import 'jose';
8
- import './verifier-DTn1LXDU.js';
8
+ import './verifier-DqZ9MQ9l.js';
package/dist/gateway.js CHANGED
@@ -1,13 +1,14 @@
1
- export { LiopHybridGateway } from './chunk-E7RSX476.js';
2
- import './chunk-AMSFSS2I.js';
3
- import './chunk-ZRWNMP5L.js';
1
+ export { LiopHybridGateway } from './chunk-6MYJBM2E.js';
2
+ import './chunk-DSOB2JKM.js';
3
+ import './chunk-WXYDFCIW.js';
4
4
  import './chunk-IK7CGWAZ.js';
5
5
  import './chunk-7PITYWOV.js';
6
- import './chunk-WPTOJYN5.js';
7
- import './chunk-GFGSHQN5.js';
6
+ import './chunk-NXCAFF73.js';
7
+ import './chunk-3664H3CV.js';
8
+ import './chunk-JPWC6XG6.js';
8
9
  import './chunk-Q3FKHJ3B.js';
9
- import './chunk-YLFNJQI2.js';
10
- import './chunk-P34HDRN5.js';
10
+ import './chunk-KR5UZUEY.js';
11
+ import './chunk-FIVRGOA4.js';
11
12
  import './chunk-K3DGJLUY.js';
12
13
  //# sourceMappingURL=gateway.js.map
13
14
  //# sourceMappingURL=gateway.js.map
@@ -1,7 +1,7 @@
1
1
  import { a as MeshNode } from './node-Djzm6UYd.js';
2
- import { L as LiopServer } from './index-D2P6Z_hP.js';
3
- import { b as McpRequest, M as McpEra, A as AuthInfo, c as McpResponse, G as GatewayInterceptorOptions } from './types-rxL19f0l.js';
4
- import { L as LiopVerifier } from './verifier-DTn1LXDU.js';
2
+ import { L as LiopServer } from './index-ByzjpRCk.js';
3
+ import { b as McpRequest, M as McpEra, A as AuthInfo, c as McpResponse, G as GatewayInterceptorOptions } from './types-29zv9X1V.js';
4
+ import { L as LiopVerifier } from './verifier-DqZ9MQ9l.js';
5
5
 
6
6
  /**
7
7
  * LIOP Sliding-Window Rate Limiter
@@ -1,9 +1,9 @@
1
- import { L as LiopVerifier } from './verifier-DTn1LXDU.js';
1
+ import { L as LiopVerifier } from './verifier-DqZ9MQ9l.js';
2
2
  import { M as MeshNodeConfig } from './node-Djzm6UYd.js';
3
3
  import * as grpc from '@grpc/grpc-js';
4
4
  import { EventEmitter } from 'node:events';
5
- import { Z as ZkPolicy } from './zk-CYImPsa6.js';
6
- import { M as McpEra, C as CallToolRequest, a as CallToolResult } from './types-rxL19f0l.js';
5
+ import { Z as ZkPolicy } from './zk-DzYNWBgo.js';
6
+ import { M as McpEra, C as CallToolRequest, a as CallToolResult } from './types-29zv9X1V.js';
7
7
 
8
8
  interface CertManagerOptions {
9
9
  /** Path to the root CA certificate (PEM format) */
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { M as MeshNodeConfig, a as MeshNode } from './node-Djzm6UYd.js';
3
- import { d as AuditLogger, J as JwtValidator, S as ServerInfo, a as CallToolResult, P as Prompt, e as GetPromptRequest, f as GetPromptResult, C as CallToolRequest, T as Tool, R as Resource } from './types-rxL19f0l.js';
3
+ import { d as AuditLogger, J as JwtValidator, S as ServerInfo, a as CallToolResult, P as Prompt, e as GetPromptRequest, f as GetPromptResult, C as CallToolRequest, T as Tool, R as Resource } from './types-29zv9X1V.js';
4
4
 
5
5
  /**
6
6
  * LIOP OAuth 2.1 Hybrid Auth — Configuration Types
@@ -354,6 +354,10 @@ interface LogicExecutionPolicy {
354
354
  * Static verification key JSON structure for this capability.
355
355
  */
356
356
  vkey?: Record<string, unknown>;
357
+ /**
358
+ * Whether to co-sign the Groth16 receipt with an ML-DSA-65 post-quantum digital signature (FIPS 204).
359
+ */
360
+ pqcSign?: boolean;
357
361
  }
358
362
  declare class LiopServer {
359
363
  private serverInfo;
@@ -380,6 +384,7 @@ declare class LiopServer {
380
384
  private meshNode;
381
385
  private rpcServer;
382
386
  private boundPort;
387
+ private enclavePqcKeypair?;
383
388
  jwtValidator?: JwtValidator;
384
389
  oauthProvider?: any;
385
390
  private sessions;