@subetha/proof-of-call 0.1.0 → 0.1.2

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 (3) hide show
  1. package/README.md +23 -10
  2. package/dist/poc.mjs +18 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -25,7 +25,7 @@ Requirements: Node.js 22 or later, on macOS arm64 or Linux arm64 (glibc). Other
25
25
  1. **Install the package.**
26
26
 
27
27
  ```sh
28
- npm install -g @subetha/proof-of-call@0.1.0
28
+ npm install -g @subetha/proof-of-call@0.1.2
29
29
  poc --version
30
30
  ```
31
31
 
@@ -39,7 +39,7 @@ Requirements: Node.js 22 or later, on macOS arm64 or Linux arm64 (glibc). Other
39
39
  | macOS arm64 | `fb330265653d23a8cfbfef05500b408d9e488a7f5d0ba84f2f23f77ac976c92e` | `9f111c3d2c604d39d72916421ae51752154847a3` (`main`) |
40
40
  | Linux arm64 (glibc) | `adf6ab438ca36f4fadbc50f17df35b0511bdfeeebabd794d022b080e5caa522d` | `1213cc51b74f4f46e258ab5f0ae769812bee4bb9` (`9f111c3` plus the Linux build scripts) |
41
41
 
42
- Without a global install, every command also runs as `npx @subetha/proof-of-call@0.1.0 <command>`. Use the same
42
+ Without a global install, every command also runs as `npx @subetha/proof-of-call@0.1.2 <command>`. Use the same
43
43
  package spec each time: the configuration records the absolute path of the binary and its sha256, and `poc mcp`
44
44
  and `poc serve`, when they start on their own, refuse to start when the file at that path is gone or has another
45
45
  sha256 (run `poc setup` again then).
@@ -67,14 +67,22 @@ Requirements: Node.js 22 or later, on macOS arm64 or Linux arm64 (glibc). Other
67
67
 
68
68
  ```sh
69
69
  umask 077
70
+ mkdir -p ~/.config/subetha
70
71
  # one line: your Base Sepolia test key, 0x + 64 hex characters
71
72
  $EDITOR ~/.config/subetha/funding.key
72
73
  # the witness's published shared Router principal: {"principalId": "…", "token": "…"}
73
74
  $EDITOR ~/.config/subetha/router-access.json
74
75
  ```
75
76
 
76
- **Where to get the Router principal:** see the repository README, section "Use the public witness". It is not
77
- repeated here.
77
+ **Where to get the Router principal:** the two values of `router-access.json` for the public witness are published
78
+ in the repository README, section "Use the public witness":
79
+ <https://github.com/subetha-labs/subetha-proof-of-call#use-the-public-witness>. Copy the JSON line from there; it
80
+ is not repeated here.
81
+
82
+ **Test funds:** the address of your funding key needs Base Sepolia test USDC. Circle's testnet faucet gives it:
83
+ <https://faucet.circle.com> (choose USDC on Base Sepolia). `poc setup` prints the payer address to fund. It needs
84
+ no Base Sepolia ETH: the requester only signs a transfer authorization (x402, EIP-3009), and a facilitator
85
+ submits it on chain.
78
86
 
79
87
  4. **Set up**: checks the prerequisites, shows your payer address and the testnet asset, reads
80
88
  `GET <witness>/v1/witness` and shows the witness identity it will trust (its Router recipient address, executor
@@ -84,11 +92,15 @@ Requirements: Node.js 22 or later, on macOS arm64 or Linux arm64 (glibc). Other
84
92
 
85
93
  ```sh
86
94
  poc setup \
87
- --witness https://<witness origin> \
95
+ --witness https://witness.subethalabs.com \
88
96
  --funding-key-file ~/.config/subetha/funding.key \
89
- --router-access-file ~/.config/subetha/router-access.json
97
+ --router-access-file ~/.config/subetha/router-access.json \
98
+ --ens-rpc-url https://ethereum-sepolia-rpc.publicnode.com
90
99
  ```
91
100
 
101
+ `https://witness.subethalabs.com` is SubEtha's public witness; another witness has another origin and its own
102
+ access values. `--ens-rpc-url` is needed to hire workers by ENS name (more on it below).
103
+
92
104
  Setup says which binary it uses: `the prebuilt binary of the npm package … is used`, with its sha256 marked
93
105
  `(the pinned SubEtha build)`. It finds the SRS at the default location of `poc fetch-srs`; `--srs <file>` (or
94
106
  `DELIVERY_SRS_DAT`) names another one.
@@ -104,7 +116,8 @@ Requirements: Node.js 22 or later, on macOS arm64 or Linux arm64 (glibc). Other
104
116
  with `--delivery-bin <path>` (or switch with `--use-packaged-delivery`).
105
117
 
106
118
  To hire workers by ENS name, also give a Sepolia JSON-RPC endpoint: `--ens-rpc-url https://<sepolia rpc>` (https,
107
- no credentials in the URL's user part), and optionally `--ens-universal-resolver <address>` to override the Sepolia
119
+ no credentials in the URL's user part; one public endpoint that needs no key is
120
+ `https://ethereum-sepolia-rpc.publicnode.com`), and optionally `--ens-universal-resolver <address>` to override the Sepolia
108
121
  Universal Resolver. Setup shows only the RPC's origin. The URL is kept in `config.json` (mode 600); if it carries an
109
122
  API key you would rather not store, leave it out and set `ENS_RPC_URL` (and `ENS_UNIVERSAL_RESOLVER`) in the MCP
110
123
  server's environment instead: `poc mcp` uses those when set, else the values from setup. There is no default RPC
@@ -116,7 +129,7 @@ Requirements: Node.js 22 or later, on macOS arm64 or Linux arm64 (glibc). Other
116
129
  ```sh
117
130
  claude mcp add subetha-requester -- poc mcp
118
131
  # without a global install:
119
- claude mcp add subetha-requester -- npx -y @subetha/proof-of-call@0.1.0 mcp
132
+ claude mcp add subetha-requester -- npx -y @subetha/proof-of-call@0.1.2 mcp
120
133
  ```
121
134
 
122
135
  ### Alternative: your own build of the `delivery` binary
@@ -152,8 +165,8 @@ pinned build.
152
165
  ```sh
153
166
  git clone https://github.com/subetha-labs/subetha-proof-of-call.git && cd subetha-proof-of-call
154
167
  npm ci
155
- cd packages/toolkit && npm pack # builds dist/poc.mjs and writes subetha-proof-of-call-0.1.0.tgz
156
- npm install -g ./subetha-proof-of-call-0.1.0.tgz
168
+ cd packages/toolkit && npm pack # builds dist/poc.mjs and writes subetha-proof-of-call-0.1.2.tgz
169
+ npm install -g ./subetha-proof-of-call-0.1.2.tgz
157
170
  ```
158
171
 
159
172
  ## Commands
package/dist/poc.mjs CHANGED
@@ -2570,6 +2570,13 @@ var DISCLOSURES = Object.freeze([
2570
2570
  "The worker reads the API's plaintext response.",
2571
2571
  "The worker holds the released payment header; it could use it outside the verified session (the loss is bounded to this one call)."
2572
2572
  ]);
2573
+ var WITNESS_DISCLOSURES = Object.freeze([
2574
+ DISCLOSURES[0],
2575
+ DISCLOSURES[1],
2576
+ "Proxy TLS mode: the witness's Verifier connects to the Provider and relays ciphertext between the witness's executor and the Provider; the claim trusts the witness and its network path to the Provider.",
2577
+ "The witness's executor reads the API request and its plaintext response while it runs the session. The worker receives nothing during the session; it receives the response afterwards, once this requester has verified the proof and decrypted its own copy.",
2578
+ "The witness holds the released payment header for this one call; the worker never receives it."
2579
+ ]);
2573
2580
  var ATTEST_MARGIN_MS = 6e4;
2574
2581
  function isRecord7(value) {
2575
2582
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -2660,7 +2667,7 @@ async function planCall(deps, options) {
2660
2667
  log2(`requester: refused before any payment: ${decision.reason}`);
2661
2668
  return { ok: false, stage: "policy", reason: decision.reason, signed: false };
2662
2669
  }
2663
- for (const line of DISCLOSURES) log2(`requester: disclosure: ${line}`);
2670
+ for (const line of transport.kind === "witness" ? WITNESS_DISCLOSURES : DISCLOSURES) log2(`requester: disclosure: ${line}`);
2664
2671
  const { ownerKey, ...subject } = quote;
2665
2672
  writePrivateJson(path6.join(callDir, "quote.json"), subject);
2666
2673
  writePrivateJson(path6.join(callDir, "owner.json"), { ownerKey });
@@ -3675,7 +3682,7 @@ function recordedCalls(home, ledger) {
3675
3682
  const verdict = readJson(path8.join(dir, "verdict.json"));
3676
3683
  const decided = isRecord9(verdict) && verdict["orderId"] === line.orderId && verdict["callNumber"] === line.callNumber ? verdict : void 0;
3677
3684
  const ledgerVerdict = ledger.filter((entry) => entry.type === "call_verdict" && entry.callNumber === line.callNumber && entry.orderId === line.orderId);
3678
- const verified = decided?.["verified"] === true && decided["unverifiedReason"] === null && ledgerVerdict.some((entry) => entry.verified);
3685
+ const verified = decided?.["verified"] === true && decided["unverifiedReason"] === null && ledgerVerdict.some((entry) => entry.verified === true);
3679
3686
  const router = isRecord9(decided?.["router"]) ? decided["router"] : void 0;
3680
3687
  const local = isRecord9(decided?.["local"]) ? decided["local"] : void 0;
3681
3688
  const response = verified ? readBounded(path8.join(dir, "response.bin"), MAX_RESPONSE_BYTES) : void 0;
@@ -5754,7 +5761,7 @@ ${String(stderr)}
5754
5761
  }
5755
5762
 
5756
5763
  // src/pins.ts
5757
- var TOOLKIT_VERSION = "0.1.0";
5764
+ var TOOLKIT_VERSION = "0.1.2";
5758
5765
  var ROUTER_SOURCE = Object.freeze({
5759
5766
  repository: "https://github.com/subetha-labs/subetha-router.git",
5760
5767
  /** `main` after PR #236 (zktls: publish the source of the delivery binary). */
@@ -8671,6 +8678,10 @@ import { existsSync as existsSync17 } from "node:fs";
8671
8678
  import { createConnection } from "node:net";
8672
8679
  import path22 from "node:path";
8673
8680
  var SOCKET_FILE = "serve.sock";
8681
+ function socketPathProblem(socketPath) {
8682
+ const bytes = Buffer.byteLength(socketPath);
8683
+ return bytes < 104 ? void 0 : `the data directory path is probably too long for the service's local socket (${socketPath} is ${bytes} bytes; local socket paths are limited to about 104 bytes on macOS and 108 on Linux): choose a shorter data directory (--data-dir, or POC_DATA_DIR)`;
8684
+ }
8674
8685
  var MAX_LINE_BYTES = 4 * 1024 * 1024;
8675
8686
  var REQUEST_TIMEOUT_MS = 12e4;
8676
8687
  function socketPathOf(dataDir) {
@@ -9170,9 +9181,11 @@ async function runServe(dataDir, env) {
9170
9181
  let handle;
9171
9182
  try {
9172
9183
  handle = await startServe({ dataDir, core, log: log2, ...prepared.resolve === void 0 ? {} : { resolve: prepared.resolve } });
9173
- } catch {
9184
+ } catch (error) {
9174
9185
  opened.budget.close();
9175
- return die("could not open the local socket in the data directory");
9186
+ const code = typeof error === "object" && error !== null && typeof error.code === "string" ? ` (${error.code})` : "";
9187
+ const tooLong = socketPathProblem(socketPathOf(dataDir));
9188
+ return die(`could not open the local socket in the data directory${code}${tooLong === void 0 ? "" : `: ${tooLong}`}`);
9176
9189
  }
9177
9190
  log2.write(`poc serve ${TOOLKIT_VERSION} running (${prepared.summary}); pid ${process.pid}`);
9178
9191
  let ending = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subetha/proof-of-call",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "SubEtha Proof of Call requester toolkit: hire an agent, pay its API calls through the SubEtha Router with your own key, and verify each call with zkTLS before you decrypt it (Base Sepolia test funds only)",
5
5
  "type": "module",
6
6
  "license": "MIT",