@nekzus/liop 2.0.0-alpha.25 → 2.0.0-alpha.26
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/bin/agent.js +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-ISKM7EAL.js → chunk-AKTU6ZMX.js} +2 -2
- package/dist/{chunk-ISKM7EAL.js.map → chunk-AKTU6ZMX.js.map} +1 -1
- package/dist/{chunk-GD6EOKYV.js → chunk-BDQZURCS.js} +9 -9
- package/dist/chunk-BDQZURCS.js.map +1 -0
- package/dist/{chunk-LJQF6ULT.js → chunk-GFRRQ2EB.js} +3 -3
- package/dist/{chunk-LJQF6ULT.js.map → chunk-GFRRQ2EB.js.map} +1 -1
- package/dist/{chunk-F7B6B4XS.js → chunk-GYK2HORK.js} +3 -3
- package/dist/{chunk-F7B6B4XS.js.map → chunk-GYK2HORK.js.map} +1 -1
- package/dist/chunk-SW53FNSN.js +2 -0
- package/dist/chunk-SW53FNSN.js.map +1 -0
- package/dist/{chunk-ALLOYPMN.js → chunk-YTIMVS2I.js} +3 -3
- package/dist/{chunk-ALLOYPMN.js.map → chunk-YTIMVS2I.js.map} +1 -1
- package/dist/client.js +1 -1
- package/dist/gateway.js +1 -1
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/dist/verifier-Z26UC7M4.js +2 -0
- package/dist/{verifier-6M7GY4TW.js.map → verifier-Z26UC7M4.js.map} +1 -1
- package/dist/workers/logic-execution.d.ts +7 -6
- package/dist/workers/logic-execution.js +1 -1
- package/dist/workers/logic-execution.js.map +1 -1
- package/dist/workers/zk-verifier.d.ts +4 -4
- package/dist/workers/zk-verifier.js +1 -1
- package/dist/workers/zk-verifier.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-GD6EOKYV.js.map +0 -1
- package/dist/chunk-UVTEJYHN.js +0 -2
- package/dist/chunk-UVTEJYHN.js.map +0 -1
- package/dist/verifier-6M7GY4TW.js +0 -2
package/dist/chunk-UVTEJYHN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b}from'./chunk-ANFXJGMP.js';import {a}from'./chunk-S6RJHZV2.js';import*as u from'fs';import {createRequire}from'module';import s from'path';import {fileURLToPath,pathToFileURL}from'url';import {Piscina}from'piscina';var P=fileURLToPath(import.meta.url),m=s.dirname(P),c=class f{static zkWorkerPool=null;getZkPool(){if(!f.zkWorkerPool){let e=import.meta.url.endsWith(".ts"),i=e?".ts":".js",o=[];if(e)try{let p=createRequire(import.meta.url).resolve("tsx/package.json");o=["--import",pathToFileURL(s.join(s.dirname(p),"dist","loader.mjs")).href];}catch{o=["--import","tsx"];}let t=[s.resolve(m,`./workers/zk-verifier${i}`),s.resolve(m,`../workers/zk-verifier${i}`)],a=t.find(r=>u.existsSync(r))||t[1];f.zkWorkerPool=new Piscina({filename:a,minThreads:1,maxThreads:2,idleTimeout:3e4,execArgv:o});}return f.zkWorkerPool}async verifyZkReceipt(e,i,o,t){let a$1=this.getZkPool();if(!a$1)throw new Error("Worker pool initialization failed");let r=await a$1.run({action:"verify_receipt",logicPayload:new Uint8Array(e),remoteImageIdHex:i,zkReceipt:new Uint8Array(o),sessionSecret:t?new Uint8Array(t):void 0});return r.verified?(a.info(`[LiopVerifier] ${r.message}`),true):(a.error(`[LiopVerifier] FAILED: ${r.message}`),false)}async verifyTeeAttestation(e){if(e.length===0)return true;try{return a.info("[LiopVerifier] TEE Attestation: Not configured (no-op)."),!0}catch(i){return a.error("[LiopVerifier] TEE Verification Failed:",i),false}}deriveImageId(e){return b(e)}};export{c as a};//# sourceMappingURL=chunk-UVTEJYHN.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-UVTEJYHN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/crypto/verifier.ts"],"names":["__filename","fileURLToPath","__dirname","path","LiopVerifier","_LiopVerifier","isTS","workerExt","execArgv","tsxPkg","createRequire","pathToFileURL","workerPaths","workerFilename","p","Piscina","logicPayload","remoteImageIdHex","zkReceipt","sessionSecret","pool","result","log","attestationReport","err","deriveLogicImageDigest"],"mappings":"gOAQA,IAAMA,CAAAA,CAAaC,aAAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAC1CC,CAAAA,CAAYC,CAAAA,CAAK,OAAA,CAAQH,CAAU,CAAA,CAS5BI,CAAAA,CAAN,MAAMC,CAAa,CAEzB,OAAe,YAAA,CAA+B,IAAA,CAEtC,SAAA,EAAY,CACnB,GAAI,CAACA,CAAAA,CAAa,YAAA,CAAc,CAC/B,IAAMC,CAAAA,CAAO,MAAA,CAAA,IAAA,CAAY,GAAA,CAAI,QAAA,CAAS,KAAK,CAAA,CACrCC,CAAAA,CAAYD,CAAAA,CAAO,KAAA,CAAQ,KAAA,CAE7BE,CAAAA,CAAqB,EAAC,CAC1B,GAAIF,CAAAA,CACH,GAAI,CAEH,IAAMG,CAAAA,CADMC,aAAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CACtB,OAAA,CAAQ,kBAAkB,CAAA,CAI7CF,CAAAA,CAAW,CAAC,UAAA,CAHQG,aAAAA,CACnBR,CAAAA,CAAK,IAAA,CAAKA,CAAAA,CAAK,OAAA,CAAQM,CAAM,CAAA,CAAG,MAAA,CAAQ,YAAY,CACrD,CAAA,CAAE,IACiC,EACpC,CAAA,KAAa,CACZD,CAAAA,CAAW,CAAC,UAAA,CAAY,KAAK,EAC9B,CAID,IAAMI,CAAAA,CAAc,CACnBT,CAAAA,CAAK,OAAA,CAAQD,CAAAA,CAAW,CAAA,qBAAA,EAAwBK,CAAS,CAAA,CAAE,CAAA,CAC3DJ,CAAAA,CAAK,OAAA,CAAQD,CAAAA,CAAW,CAAA,sBAAA,EAAyBK,CAAS,CAAA,CAAE,CAC7D,CAAA,CAEMM,CAAAA,CACLD,CAAAA,CAAY,IAAA,CAAME,CAAAA,EAAS,CAAA,CAAA,UAAA,CAAWA,CAAC,CAAC,CAAA,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A,CAAM,yCAAA,CAA2CE,CAAG,CAAA,CACjD,KACR,CACD,CAKO,aAAA,CAAcR,CAAAA,CAA8B,CAClD,OAAOS,CAAAA,CAAuBT,CAAY,CAC3C,CACD","file":"chunk-UVTEJYHN.js","sourcesContent":["import * as fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath, pathToFileURL } from \"node:url\";\nimport { Piscina } from \"piscina\";\nimport { log } from \"../utils/logger.js\";\nimport { deriveLogicImageDigest } from \"./logic-image-id.js\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\n/**\n * LIOP Tier-0 Industrial Verifier\n *\n * This engine is responsible for the trustless verification of remote logic execution.\n * It validates both the integrity of the code (ZkImageID) and the mathematical proof\n * of its execution (ZkSeal), as well as hardware-level attestation (TEE).\n */\nexport class LiopVerifier {\n\t// Singleton Worker Pool for heavy ZK verification\n\tprivate static zkWorkerPool: Piscina | null = null;\n\n\tprivate getZkPool() {\n\t\tif (!LiopVerifier.zkWorkerPool) {\n\t\t\tconst isTS = import.meta.url.endsWith(\".ts\");\n\t\t\tconst workerExt = isTS ? \".ts\" : \".js\";\n\n\t\t\tlet execArgv: string[] = [];\n\t\t\tif (isTS) {\n\t\t\t\ttry {\n\t\t\t\t\tconst req = createRequire(import.meta.url);\n\t\t\t\t\tconst tsxPkg = req.resolve(\"tsx/package.json\");\n\t\t\t\t\tconst absoluteTsx = pathToFileURL(\n\t\t\t\t\t\tpath.join(path.dirname(tsxPkg), \"dist\", \"loader.mjs\"),\n\t\t\t\t\t).href;\n\t\t\t\t\texecArgv = [\"--import\", absoluteTsx];\n\t\t\t\t} catch (_e) {\n\t\t\t\t\texecArgv = [\"--import\", \"tsx\"];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Support both flat dist/ and original src/ structure\n\t\t\tconst workerPaths = [\n\t\t\t\tpath.resolve(__dirname, `./workers/zk-verifier${workerExt}`), // Flat dist/ (tsup)\n\t\t\t\tpath.resolve(__dirname, `../workers/zk-verifier${workerExt}`), // Original src/\n\t\t\t];\n\n\t\t\tconst workerFilename =\n\t\t\t\tworkerPaths.find((p) => fs.existsSync(p)) || workerPaths[1];\n\n\t\t\tLiopVerifier.zkWorkerPool = new Piscina({\n\t\t\t\tfilename: workerFilename,\n\t\t\t\tminThreads: 1,\n\t\t\t\tmaxThreads: 2, // Minimal footprint since verification is fast compared to generation\n\t\t\t\tidleTimeout: 30000,\n\t\t\t\texecArgv,\n\t\t\t});\n\t\t}\n\t\treturn LiopVerifier.zkWorkerPool;\n\t}\n\n\t/**\n\t * Verifies a Zero-Knowledge Receipt from a remote LIOP node via Worker Pool.\n\t *\n\t * @param logicPayload The raw WASM or JS logic that was sent to the provider.\n\t * @param remoteImageIdHex The ImageID reported by the provider (must match our local calculation).\n\t * @param zkReceipt The mathematical proof (Seal + Journal) from the zkVM.\n\t */\n\tpublic async verifyZkReceipt(\n\t\tlogicPayload: Buffer,\n\t\tremoteImageIdHex: string,\n\t\tzkReceipt: Buffer,\n\t\tsessionSecret?: Buffer,\n\t): Promise<boolean> {\n\t\tconst pool = this.getZkPool();\n\t\tif (!pool) throw new Error(\"Worker pool initialization failed\");\n\t\tconst result = await pool.run({\n\t\t\taction: \"verify_receipt\",\n\t\t\tlogicPayload: new Uint8Array(logicPayload),\n\t\t\tremoteImageIdHex,\n\t\t\tzkReceipt: new Uint8Array(zkReceipt),\n\t\t\tsessionSecret: sessionSecret ? new Uint8Array(sessionSecret) : undefined,\n\t\t});\n\n\t\tif (result.verified) {\n\t\t\tlog.info(`[LiopVerifier] ${result.message}`);\n\t\t\treturn true;\n\t\t}\n\n\t\tlog.error(`[LiopVerifier] FAILED: ${result.message}`);\n\t\treturn false;\n\t}\n\n\t/**\n\t * Verifies if a node is running inside an authenticated TEE (e.g. AWS Nitro).\n\t *\n\t * @param attestationReport The COSE-signed attestation document from the hardware.\n\t */\n\tpublic async verifyTeeAttestation(\n\t\tattestationReport: Buffer,\n\t): Promise<boolean> {\n\t\tif (attestationReport.length === 0) return true; // Optional in Mesh Alpha\n\n\t\ttry {\n\t\t\t// Architecture for AWS Nitro Enclaves:\n\t\t\t// 1. Decode CBOR/COSE\n\t\t\t// 2. Verify Signature against AWS Nitro Root CA\n\t\t\t// 3. Compare PCRs\n\t\t\tlog.info(\"[LiopVerifier] TEE Attestation: Not configured (no-op).\");\n\t\t\treturn true;\n\t\t} catch (err) {\n\t\t\tlog.error(\"[LiopVerifier] TEE Verification Failed:\", err);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * Derives the ImageID of a logic payload following the LIOP v1 Standard.\n\t */\n\tpublic deriveImageId(logicPayload: Buffer): Buffer {\n\t\treturn deriveLogicImageDigest(logicPayload);\n\t}\n}\n"]}
|