@odatano/nightgate-mcp 0.5.1 → 0.7.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@odatano/nightgate-mcp` are documented in this file.
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+ The server compatibility table in the README says which NIGHTGATE each
7
+ version needs.
8
+
9
+ ## [0.7.0] - 2026-09-20
10
+
11
+ ### Changed (breaking)
12
+
13
+ - **One connection env for both ODATANO MCP servers.** `ODATANO_ACCESS_URL`
14
+ (default `https://api.odatano.dev`, the gateway), `ODATANO_ACCESS_KEY`
15
+ (the `oda_…` key, or an `ngat_…` grant / other bearer against a direct
16
+ instance) and `ODATANO_ACCESS_USER` / `ODATANO_ACCESS_PASSWORD` (basic
17
+ auth for a direct instance) replace `NIGHTGATE_BASE_URL`,
18
+ `NIGHTGATE_TOKEN`, `NIGHTGATE_USERNAME` and `NIGHTGATE_PASSWORD`; the old
19
+ names are not read any more. `@odatano/core-mcp` 0.3.0 reads the same
20
+ four, so an `.mcp.json` needs one key for both chains and no URL. The
21
+ other `NIGHTGATE_*` variables (network, seed, indexer, zk-config, proof
22
+ server, timeout, service path) are unchanged.
23
+ - **Gateway error bodies reach the agent.** The ODATANO ACCESS gateway
24
+ answers with `{ error: "<text>", ...detail }`; the client now keeps the
25
+ text as the message and hands the detail (`unitsLeft`, `price`, the
26
+ `topup` hint, `products`, `validUntil`, `retryAfterSeconds` from
27
+ `Retry-After`) through to the tool error, so a 402 says how to top up
28
+ instead of "request failed with HTTP 402".
29
+ - **The hosted API is the documented default.** README: quick start with a
30
+ key from api.odatano.dev first, sponsoring through the gateway's platform
31
+ pool, own instance second; the server warns at startup when the gateway
32
+ is the target and no key is set. Server version constant follows the
33
+ package.
34
+
35
+ ## [0.6.1] - 2026-09-19
36
+
37
+ ### Changed
38
+
39
+ - **The ODATANO ACCESS key (`oda_…`) is the documented credential.**
40
+ `api.nightgate.dev` is the ODATANO ACCESS gateway since 2026-09-18: it
41
+ meters the key in units, swaps in the NIGHTGATE agent grant underneath and
42
+ fronts ODATANO with the same key. Set `NIGHTGATE_BASE_URL=https://api.nightgate.dev`
43
+ and `NIGHTGATE_TOKEN=oda_…`; the key goes as a plain `Authorization: Bearer`.
44
+ Get one at `POST https://api.odatano.dev/keys` (x402), from a giveaway
45
+ code, or by signing in at the console. A raw `ngat_…` agent grant
46
+ (`x-agent-token`) still works against a direct NIGHTGATE instance. No code
47
+ change: the client already sent a prefix-less token as a bearer.
48
+ - `.env.example` and README updated accordingly; this changelog added and
49
+ shipped with the package.
50
+
51
+ ## [0.6.0] - 2026-09
52
+
53
+ ### Changed (breaking)
54
+
55
+ - **Vault lineage 4: every record is keyed by attester AND payload**
56
+ (NIGHTGATE >= 0.24.0). `verify_attestation` takes `attesterId` +
57
+ `payloadHash` (or a bound `documentId`), `verify_predicate` takes
58
+ `attesterId`, the `prove_*` tools accept an optional `attesterId` (the
59
+ record the claim is proven against), `anchor_document` is one plain attest
60
+ and returns `attesterId`.
61
+ - `prepare_anchor_commitment` and `commit_document_anchor` are gone: nothing
62
+ is left to guard, no identity can take over another attester's record.
63
+ - Local building needs `@odatano/nightgate-tx` >= 0.6.0; the proof calls
64
+ take `recordKey` or `payloadHash` (+ `attesterId`). Against a 0.23.x server
65
+ the verify calls fail with 400 (unknown parameter).
66
+
67
+ ## [0.5.1] - 2026-08-23
68
+
69
+ ### Added
70
+
71
+ - **32-slot vault.** Schema and opening take 16 or 32 entries, `allowedMask`
72
+ up to 32 bits, `k` up to 32; the vacuity guard is checked against the
73
+ schema instead of a fixed all-ones constant. Target it with
74
+ `compiledArtifactRef: 'attestation-vault-32'` (NIGHTGATE >= 0.19.0 for
75
+ width 32). A 16-slot setup keeps working against any 0.18.x server.
76
+ - Local ZK claims: field and document proofs can be built in-process.
77
+
78
+ ## [0.5.0] - 2026-08-19
79
+
80
+ ### Added
81
+
82
+ - **Parallel sponsoring channel:** `sponsor_unbound_transaction` with the
83
+ platform pool id (NIGHTGATE >= 0.18.0; 404 against older servers).
84
+ - **Local transaction building** for agents: `build_sponsorable_transaction`
85
+ and `get_attester_identity` via the optional `@odatano/nightgate-tx`
86
+ >= 0.2.0 txbuilder, driven by `NIGHTGATE_SEED_HEX` (never a tool argument).
87
+
88
+ ## [0.3.0] - 2026-08-16
89
+
90
+ ### Added
91
+
92
+ - Cross-root document proofs and guarded anchoring (`prepare_anchor_commitment`
93
+ / `commit_document_anchor`, removed again in 0.6.0).
94
+
95
+ ## [0.2.0] - 2026-08-10
96
+
97
+ ### Added
98
+
99
+ - Membership and equality proof tools; README documents the tool set and the
100
+ server compatibility table.
101
+
102
+ ## [0.1.0] - 2026-08-07
103
+
104
+ ### Added
105
+
106
+ - Initial MCP server: attestation, verification and job tools over the
107
+ NIGHTGATE OData API, agent-grant (`ngat_…`) or basic auth.
package/README.md CHANGED
@@ -1,3 +1,10 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/nightgate-mcp-logo.svg">
4
+ <img src="https://cdn.jsdelivr.net/npm/@odatano/brand@1/logos/nightgate-mcp-logo-on-light.svg" alt="NIGHTGATE MCP" height="84">
5
+ </picture>
6
+ </p>
7
+
1
8
  # @odatano/nightgate-mcp
2
9
 
3
10
  [![npm](https://img.shields.io/npm/v/@odatano/nightgate-mcp)](https://www.npmjs.com/package/@odatano/nightgate-mcp)
@@ -15,36 +22,89 @@ Wallet lifecycle (connect, send, deploy) is deliberately not exposed; writing
15
22
  without a wallet session works through fee sponsoring (build locally, a
16
23
  sponsor pays).
17
24
 
25
+ ## Quick start: the hosted API
26
+
27
+ The usual way to run this server is against the hosted ODATANO ACCESS
28
+ gateway at [api.odatano.dev](https://api.odatano.dev): no node, no plugin,
29
+ no wallet session of your own. One `oda_…` key covers Midnight (this server)
30
+ and Cardano (`@odatano/core-mcp`).
31
+
32
+ 1. Get a key at [api.odatano.dev](https://api.odatano.dev): sign in with a
33
+ Cardano wallet (the first key comes with free calls), redeem a giveaway
34
+ code, or buy a pack with tADA over x402 (`POST /keys`). The console shows
35
+ the key once, together with a ready `.mcp.json`.
36
+ 2. Put the key in your MCP client's config:
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "nightgate": {
42
+ "command": "npx",
43
+ "args": ["-y", "@odatano/nightgate-mcp"],
44
+ "env": { "ODATANO_ACCESS_KEY": "oda_..." }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ or, with Claude Code: `claude mcp add nightgate --env ODATANO_ACCESS_KEY=oda_... -- npx -y @odatano/nightgate-mcp`
51
+
52
+ 3. That is all: the gateway is the default URL. It sends the key as
53
+ `Authorization: Bearer`, swaps in the NIGHTGATE agent grant underneath
54
+ (sponsored writes on the platform pool included) and meters the key per
55
+ call; the verify lane and the prover keys under `/zk-config` are free.
56
+ The hosted NIGHTGATE runs on Midnight **preprod** today.
57
+
58
+ What the gateway does not offer, the key cannot reach: agent grants, wallet
59
+ sessions, contract deployment, dust registration and the sponsor pool status
60
+ answer 403 there; this server never calls them. A 402 from the gateway
61
+ (units exhausted) reaches the agent with the top-up hint.
62
+
18
63
  ## Requirements
19
64
 
20
- - Node.js >= 20
21
- - A running NIGHTGATE instance, see the compatibility matrix below
65
+ - Node.js >= 20 (`npx` fetches the server, nothing to install)
66
+ - For `build_sponsorable_transaction`: `@odatano/nightgate-tx` installed next
67
+ to the server and `NIGHTGATE_SEED_HEX` set (see the sponsoring section)
22
68
 
23
- ## Compatibility
69
+ ## Writing on-chain: fee sponsoring
24
70
 
25
- Pick the MCP line that matches your NIGHTGATE server. The pairing is not
26
- cosmetic: from NIGHTGATE 0.16.0 on, content-tree leaves are SALTED, so every
27
- field proof must carry its slot salt. An older MCP omits it and the server
28
- rejects the call with 400.
71
+ An agent does not need a wallet session of its own to write on-chain. Through
72
+ the gateway the key already carries a grant for `sponsorUnboundTransaction`
73
+ and `sponsorFinalizedTransaction` on the platform sponsor pool; against a
74
+ direct instance the grant is the `ngat_…` token. The flow is:
29
75
 
30
- | MCP | NIGHTGATE | Notes |
31
- |---|---|---|
32
- | **0.5.1** | **>= 0.19.0** for width 32 | Current. Accepts the 32-slot vault: schema and opening take 16 or 32 entries, `allowedMask` up to 32 bits, `k` up to 32, and the vacuity guard is checked against the SCHEMA instead of a fixed all-ones constant. Target it with `compiledArtifactRef: 'attestation-vault-32'`. Everything else is unchanged, so a 16-slot setup keeps working against any 0.18.x server. |
33
- | 0.5.x | >= 0.18.0 | Adds the parallel sponsoring channel (`sponsor_unbound_transaction`, platform pool id) and LOCAL transaction building (`build_sponsorable_transaction`, `get_attester_identity`) via the optional `@odatano/nightgate-tx` >= 0.2.0 txbuilder; `sponsor_unbound_transaction` 404s against older servers. |
34
- | 0.4.x | >= 0.17.0 | Cross-server fee sponsoring, serial channel only (`sponsor_finalized_transaction`), custom-token identity (`derive_token_type`). |
35
- | 0.3.x | >= 0.16.0 (0.16.2 recommended) | Cross-root proofs, guarded anchoring, schema ids, per-field salts. Does NOT work against 0.15.x and older, which know no salt parameters. |
36
- | 0.2.x | 0.15.x | Bytes equality and set membership on unsalted leaves. Against 0.16.0 and newer every field proof fails with "fieldSalt is required". |
37
- | 0.1.x | 0.14.x | Anchoring, numeric field predicates, disclosure, agent provenance. |
76
+ 1. `build_sponsorable_transaction`: build, prove and sign the contract call
77
+ LOCALLY (the MCP server wraps the
78
+ [`@odatano/nightgate-tx`](https://www.npmjs.com/package/@odatano/nightgate-tx)
79
+ txbuilder; install it next to the MCP server, it is an optional peer
80
+ dependency because it carries the Midnight SDK). The seed comes from
81
+ `NIGHTGATE_SEED_HEX` in the server environment, the attestation secret is
82
+ derived from it, nothing secret leaves the machine; the result is ~7 KB of
83
+ base64 and the effect will carry this builder's attester id
84
+ (`get_attester_identity`). Proving runs in-process (20-60 s) or on a proof
85
+ server (`NIGHTGATE_PROOF_SERVER_URL`). Without the package or the seed the
86
+ tool answers with a clear error; an agent can still hand in bytes built
87
+ elsewhere with the txbuilder directly.
88
+ 2. `sponsor_unbound_transaction` with the operator's sponsor session id, or
89
+ the platform pool id `00000000-0000-0000-0000-706f6f6c0000` when the host
90
+ runs a sponsor pool (the server picks a free pool sponsor and fails over).
91
+ 3. Poll `get_job_status` with the `sessionId` the sponsor call RETURNED, then
92
+ `verify_attestation` to read it back crawler-free.
93
+
94
+ One sponsor wallet serves several agents at once (parallel channel, 0.18.0).
95
+ A job that ends `failed` with `CHAIN_EXECUTION_FAILED` landed on-chain but its
96
+ call did not apply (two calls on the same contract in one block): build again
97
+ against the current state and sponsor again; never resubmit the same bytes.
98
+ On a direct host behind transport auth set `ODATANO_ACCESS_USER` /
99
+ `ODATANO_ACCESS_PASSWORD` next to the token, the two combine.
38
100
 
39
- The verification tools are the exception: they only read live contract state
40
- and keep working across the whole range, they simply cannot express the
41
- newer claim kinds on an older server.
42
101
 
43
- ## Getting a NIGHTGATE instance
102
+ ## Run your own instance (optional)
44
103
 
45
- The fastest way is the official Docker image; no Node setup, no host app
46
- (published from the NIGHTGATE repo on every release, details in its
47
- `docs/docker.md`):
104
+ Point `ODATANO_ACCESS_URL` at any NIGHTGATE host app instead of the gateway
105
+ (see the compatibility table below for the version pairing). The fastest way
106
+ is the official Docker image; no Node setup, no host app (published from the
107
+ NIGHTGATE repo on every release, details in its `docs/docker.md`):
48
108
 
49
109
  ```bash
50
110
  docker run -d --name nightgate -p 4004:4004 \
@@ -60,64 +120,53 @@ auth (`nightgate` / your password), persists its database in the
60
120
  is needed to start. Point this MCP server at it with:
61
121
 
62
122
  ```bash
63
- NIGHTGATE_BASE_URL=http://localhost:4004
64
- NIGHTGATE_USERNAME=nightgate
65
- NIGHTGATE_PASSWORD=change-me
123
+ ODATANO_ACCESS_URL=http://localhost:4004
124
+ ODATANO_ACCESS_USER=nightgate
125
+ ODATANO_ACCESS_PASSWORD=change-me
66
126
  ```
67
127
 
68
128
  For agent operation, create a scoped grant once (as the operator, e.g. via
69
129
  curl against `createAgentGrant`) and hand the returned `ngat_...` token to
70
- the agent as `NIGHTGATE_TOKEN`; the write tools are then limited to the
71
- grant's allowlist, budget and pinned session.
130
+ the agent as `ODATANO_ACCESS_KEY`; the write tools are then limited to the
131
+ grant's allowlist, budget and pinned session. Any CAP app using the
132
+ `@odatano/nightgate` plugin works too, e.g. the NIGHTGATE repo itself via
133
+ `npm run dev`.
72
134
 
73
- ### Agents on a hosted NIGHTGATE (fee sponsoring)
74
-
75
- An agent does not need a wallet session of its own to write on-chain. With a
76
- grant that allows `sponsorUnboundTransaction` (or `sponsorFinalizedTransaction`)
77
- the flow is:
135
+ ## Compatibility
78
136
 
79
- 1. `build_sponsorable_transaction`: build, prove and sign the contract call
80
- LOCALLY (the MCP server wraps the
81
- [`@odatano/nightgate-tx`](https://www.npmjs.com/package/@odatano/nightgate-tx)
82
- txbuilder; install it next to the MCP server, it is an optional peer
83
- dependency because it carries the Midnight SDK). The seed comes from
84
- `NIGHTGATE_SEED_HEX` in the server environment, the attestation secret is
85
- derived from it, nothing secret leaves the machine; the result is ~7 KB of
86
- base64 and the effect will carry this builder's attester id
87
- (`get_attester_identity`). Proving runs in-process (20-60 s) or on a proof
88
- server (`NIGHTGATE_PROOF_SERVER_URL`). Without the package or the seed the
89
- tool answers with a clear error; an agent can still hand in bytes built
90
- elsewhere with the txbuilder directly.
91
- 2. `sponsor_unbound_transaction` with the operator's sponsor session id, or
92
- the platform pool id `00000000-0000-0000-0000-706f6f6c0000` when the host
93
- runs a sponsor pool (the server picks a free pool sponsor and fails over).
94
- 3. Poll `get_job_status` with the `sessionId` the sponsor call RETURNED, then
95
- `verify_attestation` to read it back crawler-free.
137
+ Pick the MCP line that matches your NIGHTGATE server. The pairing is not
138
+ cosmetic: from NIGHTGATE 0.16.0 on, content-tree leaves are SALTED, so every
139
+ field proof must carry its slot salt. An older MCP omits it and the server
140
+ rejects the call with 400.
96
141
 
97
- One sponsor wallet serves several agents at once (parallel channel, 0.18.0).
98
- A job that ends `failed` with `CHAIN_EXECUTION_FAILED` landed on-chain but its
99
- call did not apply (two calls on the same contract in one block): build again
100
- against the current state and sponsor again; never resubmit the same bytes.
101
- On a host behind transport auth set `NIGHTGATE_USERNAME`/`NIGHTGATE_PASSWORD`
102
- next to the token, the two combine.
142
+ | MCP | NIGHTGATE | Notes |
143
+ |---|---|---|
144
+ | **0.6.0** | **>= 0.24.0** | Current. Vault lineage 4 keys every record by attester AND payload: `verify_attestation` takes `attesterId` + `payloadHash` (or a bound `documentId`), `verify_predicate` takes `attesterId`, the `prove_*` tools accept an optional `attesterId` (the record the claim is proven against), `anchor_document` is one plain attest and returns `attesterId`. `prepare_anchor_commitment` and `commit_document_anchor` are gone (nothing to guard: no identity can take over another attester's record). Local building needs `@odatano/nightgate-tx` >= 0.6.0; the proof calls take `recordKey` or `payloadHash` (+ `attesterId`). Against a 0.23.x server the verify calls fail with 400 (unknown parameter). |
145
+ | 0.5.1 | >= 0.19.0 for width 32 | Accepts the 32-slot vault: schema and opening take 16 or 32 entries, `allowedMask` up to 32 bits, `k` up to 32, and the vacuity guard is checked against the SCHEMA instead of a fixed all-ones constant. Target it with `compiledArtifactRef: 'attestation-vault-32'`. Everything else is unchanged, so a 16-slot setup keeps working against any 0.18.x server. |
146
+ | 0.5.x | >= 0.18.0 | Adds the parallel sponsoring channel (`sponsor_unbound_transaction`, platform pool id) and LOCAL transaction building (`build_sponsorable_transaction`, `get_attester_identity`) via the optional `@odatano/nightgate-tx` >= 0.2.0 txbuilder; `sponsor_unbound_transaction` 404s against older servers. |
147
+ | 0.4.x | >= 0.17.0 | Cross-server fee sponsoring, serial channel only (`sponsor_finalized_transaction`), custom-token identity (`derive_token_type`). |
148
+ | 0.3.x | >= 0.16.0 (0.16.2 recommended) | Cross-root proofs, guarded anchoring, schema ids, per-field salts. Does NOT work against 0.15.x and older, which know no salt parameters. |
149
+ | 0.2.x | 0.15.x | Bytes equality and set membership on unsalted leaves. Against 0.16.0 and newer every field proof fails with "fieldSalt is required". |
150
+ | 0.1.x | 0.14.x | Anchoring, numeric field predicates, disclosure, agent provenance. |
103
151
 
104
- Alternatively any CAP app using the `@odatano/nightgate` plugin works,
105
- e.g. the NIGHTGATE repo itself via `npm run dev`.
152
+ The verification tools are the exception: they only read live contract state
153
+ and keep working across the whole range, they simply cannot express the
154
+ newer claim kinds on an older server.
106
155
 
107
- ## Setup
156
+ ## Development setup
108
157
 
109
158
  ```bash
110
159
  npm install
111
160
  npm run build
112
161
  ```
113
162
 
114
- Configuration is environment-driven:
163
+ Configuration is environment-driven (the same variables in an MCP client's `env` block):
115
164
 
116
165
  | Variable | Default | Purpose |
117
166
  |---|---|---|
118
- | `NIGHTGATE_BASE_URL` | `http://localhost:4004` | NIGHTGATE host app |
119
- | `NIGHTGATE_USERNAME` / `NIGHTGATE_PASSWORD` | unset | Basic auth (CAP dev/mocked auth) |
120
- | `NIGHTGATE_TOKEN` | unset | `ngat_...` agent-grant token (sent as `x-agent-token`, combinable with basic auth) or a plain bearer token |
167
+ | `ODATANO_ACCESS_URL` | `https://api.odatano.dev` | The ODATANO ACCESS gateway, or a direct NIGHTGATE host app (`http://localhost:4004` for `cds watch`) |
168
+ | `ODATANO_ACCESS_USER` / `ODATANO_ACCESS_PASSWORD` | unset | Basic auth against a direct instance (CAP dev/mocked auth); not for agents |
169
+ | `ODATANO_ACCESS_KEY` | unset | **The credential: an ODATANO ACCESS key `oda_…`** (sent as `Authorization: Bearer`; buy one at `POST https://api.odatano.dev/keys`, redeem a code, or sign in at the console). The same variable configures `@odatano/core-mcp`. Against a direct NIGHTGATE instance a raw `ngat_...` agent grant (sent as `x-agent-token`, combinable with basic auth) or any other bearer goes here too |
121
170
  | `NIGHTGATE_SERVICE_PATH` | `/api/v1/nightgate` | OData service path |
122
171
  | `NIGHTGATE_TIMEOUT_MS` | `30000` | Per-request timeout |
123
172
  | `NIGHTGATE_SEED_HEX` | unset | Caller seed (64 or 128 hex) for `build_sponsorable_transaction`; never a tool argument. Needs `@odatano/nightgate-tx` installed |
@@ -126,54 +175,26 @@ Configuration is environment-driven:
126
175
  | `NIGHTGATE_ZK_CONFIG_BASE_URL` | `<base url>/zk-config/attestation-vault` | Where the builder fetches prover keys (cached on disk, `NIGHTGATE_ZK_CACHE_DIR`) |
127
176
  | `NIGHTGATE_PROOF_SERVER_URL` | unset | Prove contract circuits on a proof server instead of in-process wasm |
128
177
 
129
- ## Use with Claude Code
130
-
131
- ```bash
132
- claude mcp add nightgate \
133
- --env NIGHTGATE_BASE_URL=http://localhost:4004 \
134
- --env NIGHTGATE_USERNAME=alice \
135
- -- node /path/to/NIGHTGATE-MCP/dist/index.js
136
- ```
137
-
138
- Or in a project `.mcp.json`:
139
-
140
- ```json
141
- {
142
- "mcpServers": {
143
- "nightgate": {
144
- "command": "node",
145
- "args": ["/path/to/NIGHTGATE-MCP/dist/index.js"],
146
- "env": {
147
- "NIGHTGATE_BASE_URL": "http://localhost:4004",
148
- "NIGHTGATE_USERNAME": "alice"
149
- }
150
- }
151
- }
152
- }
153
- ```
154
-
155
178
  ## Tools
156
179
 
157
180
  | Tool | What it does |
158
181
  |---|---|
159
- | `verify_attestation` | Live-state check that a payload hash is attested in an AttestationVault (crawler-free, optional content-root check, optional cross-network read) |
160
- | `verify_predicate` | Live-state check that a ZK claim was recorded true on-chain, id-free: numeric predicates, `bytesEquality` (+ `expectedDigest`), `setMembership` (+ `setRoot`) and the cross-root kinds `documentIntegrity` / `documentDiff` (+ `payloadHashB`) |
182
+ | `verify_attestation` | Live-state check that an attester's record of a payload hash stands in an AttestationVault: named by `attesterId` + `payloadHash` or by a bound `documentId` (crawler-free, optional content-root / schema check, optional cross-network read) |
183
+ | `verify_predicate` | Live-state check that a ZK claim was recorded true on-chain, id-free: `attesterId` + `payloadHash` name the record; numeric predicates, `bytesEquality` (+ `expectedDigest`), `setMembership` (+ `setRoot`) and the cross-root kinds `documentIntegrity` / `documentDiff` (+ `payloadHashB`, optional `attesterIdB`) |
161
184
  | `verify_predicate_attestation` | Verify a server-issued predicate attestation by its row id |
162
185
  | `verify_document` | Verify an anchored document by document id + sha256 |
163
186
  | `prepare_document_proof` | Canonicalize a document into payloadHash + salted Merkle contentRoot + schemaId + per-field proof inputs (incl. each slot salt) + the full `opening` the cross-root proofs need (synchronous) |
164
187
  | `prepare_membership_set` | Build the canonical allow-list set tree: setRoot for verifiers, inclusion path for provers (synchronous) |
165
188
  | `attest_agent_output` | Anchor agent-output provenance (canonical envelope, third-party verifiable; async job, NIGHTGATE >= 0.14.0) |
166
- | `anchor_document` | Anchor a document content hash on-chain; with a `nonce` it is the guarded reveal that reclaims a front-run hash (async job) |
189
+ | `anchor_document` | Anchor a document content hash on-chain as the session's own record, keyed by attester and hash; returns `attesterId` for verifiers (async job) |
167
190
  | `prove_field_predicate` | ZK proof that a hidden document field satisfies a threshold, without revealing it (async job) |
168
191
  | `prove_field_equality` | ZK proof that a string field carries exactly the value behind a public digest (async job) |
169
192
  | `prove_field_membership` | ZK proof that a hidden string field is one of a public allow-list, without revealing which (async job) |
170
193
  | `prove_field_predicates_batch` | Up to 8 claims on one document in ONE transaction, any mix of numeric / equality / membership / cross-root kinds (async job) |
171
194
  | `prove_document_integrity` | ZK proof that a second document differs from the anchored one ONLY in a public slot mask, values hidden (async job) |
172
195
  | `prove_document_diff` | ZK proof that two anchored documents differ at >= k of the vault's slots, without revealing which (async job) |
173
- | `prepare_anchor_commitment` | Compute the commitment + secret nonce for guarded anchoring (synchronous) |
174
- | `commit_document_anchor` | Record that commitment on-chain, so a mempool observer cannot front-run the later reveal (async job) |
175
196
  | `grant_disclosure` / `revoke_disclosure` | Attester-only on-chain disclosure ACL (async jobs) |
176
- | `build_sponsorable_transaction` | Build, prove and sign an AttestationVault call LOCALLY with the seed from the server environment (attest, anchorContentRoot, grant/revokeDisclosure, register/bindPassport, attestCommit/Reveal); returns the fee-unpaid bytes for the sponsor tools, unbound by default (synchronous, 20-60 s, needs `@odatano/nightgate-tx`) |
197
+ | `build_sponsorable_transaction` | Build, prove and sign an AttestationVault call LOCALLY with the seed from the server environment (attest, anchorContentRoot, grant/revokeDisclosure, register/bindPassport, the proveField* claims against any attester's record); returns the fee-unpaid bytes for the sponsor tools, unbound by default (synchronous, 20-60 s, needs `@odatano/nightgate-tx`) |
177
198
  | `get_attester_identity` | The attester id this server builds under, derived from the seed (synchronous) |
178
199
  | `sponsor_finalized_transaction` | Submit a transaction that was built, proven and signed ELSEWHERE (e.g. with the `@odatano/nightgate-tx` txbuilder, the builder's key never leaves its machine); the sponsor session pays the dust, the effect carries the builder's identity; serial per sponsor wallet (async job) |
179
200
  | `sponsor_unbound_transaction` | Same trust shape for an UNBOUND (`bind: false`) caller transaction: the sponsor merges a dust spend from a locked backing, binds and submits, several per sponsor wallet in parallel; `sponsorSessionId` may be the platform pool id (async job) |
@@ -195,7 +216,7 @@ Runs an in-memory MCP client against the server: asserts the tool set,
195
216
  schemas, and argument validation. Optional live round-trip:
196
217
 
197
218
  ```bash
198
- NIGHTGATE_LIVE=1 NIGHTGATE_BASE_URL=... NIGHTGATE_USERNAME=... \
219
+ NIGHTGATE_LIVE=1 ODATANO_ACCESS_URL=... ODATANO_ACCESS_USER=... \
199
220
  NIGHTGATE_TEST_CONTRACT=<vault address> NIGHTGATE_TEST_PAYLOAD_HASH=<64 hex> \
200
221
  npm run integration
201
222
  ```
@@ -206,7 +227,7 @@ tools with a grant token only: `get_attester_identity`,
206
227
  `get_job_status`, `verify_attestation` (the attester id must be ours):
207
228
 
208
229
  ```bash
209
- NIGHTGATE_BASE_URL=https://api.nightgate.dev NIGHTGATE_TOKEN=ngat_... \
230
+ ODATANO_ACCESS_KEY=oda_... \
210
231
  NIGHTGATE_SEED_HEX=<64 or 128 hex, a throwaway is fine> \
211
232
  NIGHTGATE_VAULT=<vault address> NIGHTGATE_SPONSOR_SESSION_ID=<sponsor or pool id> \
212
233
  npm run live:sponsor-unbound
package/dist/builder.d.ts CHANGED
@@ -10,7 +10,7 @@ import type { NightgateMcpConfig } from './config.js';
10
10
  * the wrong shape for anyone but the operator: it would put someone else's
11
11
  * key in our custody and stamp every claim with the same attester id.
12
12
  */
13
- export declare const BUILDABLE_CALLS: readonly ["attest", "anchorContentRoot", "grantDisclosure", "revokeDisclosure", "registerPassport", "bindPassport", "attestCommit", "attestReveal", "proveFieldPredicate", "proveFieldEquality", "proveFieldMembership", "proveFieldsUnchangedExcept", "proveFieldsDiffer"];
13
+ export declare const BUILDABLE_CALLS: readonly ["attest", "anchorContentRoot", "grantDisclosure", "revokeDisclosure", "registerPassport", "bindPassport", "proveFieldPredicate", "proveFieldEquality", "proveFieldMembership", "proveFieldsUnchangedExcept", "proveFieldsDiffer"];
14
14
  export type BuildableCall = (typeof BUILDABLE_CALLS)[number];
15
15
  /**
16
16
  * Vault lineages the local builder can load. Each needs its OWN compiled
package/dist/builder.js CHANGED
@@ -29,8 +29,6 @@ export const BUILDABLE_CALLS = [
29
29
  'revokeDisclosure',
30
30
  'registerPassport',
31
31
  'bindPassport',
32
- 'attestCommit',
33
- 'attestReveal',
34
32
  'proveFieldPredicate',
35
33
  'proveFieldEquality',
36
34
  'proveFieldMembership',
@@ -60,11 +58,16 @@ async function loadModules(ref = DEFAULT_ARTIFACT) {
60
58
  ? import('@odatano/nightgate-tx/attestation-vault-32')
61
59
  : import('@odatano/nightgate-tx/attestation-vault'),
62
60
  ]);
63
- return { createTxBuilder: tx.createTxBuilder, calls: calls, Contract: vault.Contract };
61
+ return {
62
+ createTxBuilder: tx.createTxBuilder,
63
+ computeRecordKey: tx.computeRecordKey,
64
+ calls: calls,
65
+ Contract: vault.Contract,
66
+ };
64
67
  }
65
68
  catch (err) {
66
69
  modules.delete(ref);
67
- throw new Error(`local building of '${ref}' needs @odatano/nightgate-tx >= 0.3.0 next to the MCP server ` +
70
+ throw new Error(`local building of '${ref}' needs @odatano/nightgate-tx >= 0.6.0 next to the MCP server ` +
68
71
  '(npm install @odatano/nightgate-tx): ' + (err instanceof Error ? err.message : String(err)));
69
72
  }
70
73
  })();
@@ -133,10 +136,30 @@ function hexParam(params, key) {
133
136
  throw new Error(`params.${key} must be 64 hex characters`);
134
137
  return v.toLowerCase();
135
138
  }
136
- /** Map the tool's flat params onto the typed prepare* helper of the call kind. */
137
- function prepareCall(calls, input, attestationSecret) {
139
+ /**
140
+ * Map the tool's flat params onto the typed prepare* helper of the call kind.
141
+ * The proof helpers take the RECORD KEY of the document they prove against:
142
+ * `recordKey` as given, else recordKey(attesterId ?? this builder, payloadHash).
143
+ */
144
+ function prepareCall(mods, input, attestationSecret, ownAttesterId) {
145
+ const { calls } = mods;
138
146
  const p = input.params;
139
147
  const slotWidth = input.compiledArtifactRef === 'attestation-vault-32' ? 32 : 16;
148
+ const recordKeyOf = (keyName, payloadName, attesterName) => {
149
+ if (typeof p[keyName] === 'string')
150
+ return hexParam(p, keyName);
151
+ const attester = typeof p[attesterName] === 'string' ? hexParam(p, attesterName) : ownAttesterId;
152
+ return mods.computeRecordKey(attester, hexParam(p, payloadName));
153
+ };
154
+ const recordKey = () => recordKeyOf('recordKey', 'payloadHash', 'attesterId');
155
+ const recordKeyA = () => recordKeyOf('recordKeyA', 'payloadHashA', 'attesterIdA');
156
+ const recordKeyB = () => {
157
+ if (typeof p.recordKeyB === 'string')
158
+ return hexParam(p, 'recordKeyB');
159
+ const attester = typeof p.attesterIdB === 'string' ? hexParam(p, 'attesterIdB')
160
+ : typeof p.attesterIdA === 'string' ? hexParam(p, 'attesterIdA') : ownAttesterId;
161
+ return mods.computeRecordKey(attester, hexParam(p, 'payloadHashB'));
162
+ };
140
163
  const witness = (what) => {
141
164
  if (!input.merkleProof)
142
165
  throw new Error(`call '${input.call}' needs merkleProof (${what}); take it from prepare_document_proof`);
@@ -153,31 +176,31 @@ function prepareCall(calls, input, attestationSecret) {
153
176
  if (![0, 1].includes(op))
154
177
  throw new Error('params.op must be 0 (lessOrEqual) or 1 (greaterOrEqual)');
155
178
  return calls.prepareProveFieldPredicate({
156
- payloadHash: hexParam(p, 'payloadHash'), fieldKey: hexParam(p, 'fieldKey'),
179
+ recordKey: recordKey(), fieldKey: hexParam(p, 'fieldKey'),
157
180
  threshold: BigInt(p.threshold), op: BigInt(op),
158
181
  merkleProof: witness('fieldValue, fieldSalt, siblings, dirs'), attestationSecret, slotWidth,
159
182
  });
160
183
  }
161
184
  case 'proveFieldEquality':
162
185
  return calls.prepareProveFieldEquality({
163
- payloadHash: hexParam(p, 'payloadHash'), fieldKey: hexParam(p, 'fieldKey'),
186
+ recordKey: recordKey(), fieldKey: hexParam(p, 'fieldKey'),
164
187
  expectedDigest: hexParam(p, 'expectedDigest'),
165
188
  merkleProof: witness('fieldSalt, siblings, dirs'), attestationSecret, slotWidth,
166
189
  });
167
190
  case 'proveFieldMembership':
168
191
  return calls.prepareProveFieldMembership({
169
- payloadHash: hexParam(p, 'payloadHash'), fieldKey: hexParam(p, 'fieldKey'),
192
+ recordKey: recordKey(), fieldKey: hexParam(p, 'fieldKey'),
170
193
  setRoot: hexParam(p, 'setRoot'),
171
194
  merkleProof: witness('fieldDigest, fieldSalt, siblings, dirs, setProof'), attestationSecret, slotWidth,
172
195
  });
173
196
  case 'proveFieldsUnchangedExcept':
174
197
  return calls.prepareProveFieldsUnchangedExcept({
175
- payloadHashA: hexParam(p, 'payloadHashA'), payloadHashB: hexParam(p, 'payloadHashB'),
198
+ recordKeyA: recordKeyA(), recordKeyB: recordKeyB(),
176
199
  allowedMask: Number(p.allowedMask), docPair: pair(), attestationSecret, slotWidth,
177
200
  });
178
201
  case 'proveFieldsDiffer':
179
202
  return calls.prepareProveFieldsDiffer({
180
- payloadHashA: hexParam(p, 'payloadHashA'), payloadHashB: hexParam(p, 'payloadHashB'),
203
+ recordKeyA: recordKeyA(), recordKeyB: recordKeyB(),
181
204
  k: Number(p.k), docPair: pair(), attestationSecret, slotWidth,
182
205
  });
183
206
  case 'attest':
@@ -196,10 +219,6 @@ function prepareCall(calls, input, attestationSecret) {
196
219
  return calls.prepareRegisterPassport({ passportId: hexParam(p, 'passportId'), ownerId: hexParam(p, 'ownerId'), attestationSecret });
197
220
  case 'bindPassport':
198
221
  return calls.prepareBindPassport({ passportId: hexParam(p, 'passportId'), payloadHash: hexParam(p, 'payloadHash'), attestationSecret });
199
- case 'attestCommit':
200
- return calls.prepareAttestCommit({ commitment: hexParam(p, 'commitment'), attestationSecret });
201
- case 'attestReveal':
202
- return calls.prepareAttestReveal({ payloadHash: hexParam(p, 'payloadHash'), metadataHash: hexParam(p, 'metadataHash'), nonce: hexParam(p, 'nonce'), attestationSecret });
203
222
  }
204
223
  }
205
224
  /** Build + prove + sign locally; unbound (parallel channel) by default. */
@@ -207,8 +226,8 @@ export async function buildSponsorable(config, input) {
207
226
  const t0 = Date.now();
208
227
  const ref = input.compiledArtifactRef ?? DEFAULT_ARTIFACT;
209
228
  const b = await getBuilder(config, ref);
210
- const { calls } = await loadModules(ref);
211
- const call = prepareCall(calls, input, b.attestationSecret);
229
+ const mods = await loadModules(ref);
230
+ const call = prepareCall(mods, input, b.attestationSecret, String(b.attesterId));
212
231
  const built = await b.buildSponsorable({ contractAddress: input.contractAddress, call, bind: input.bind ? true : false });
213
232
  const out = {
214
233
  channel: input.bind ? 'bound' : 'unbound',
@@ -1 +1 @@
1
- {"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAGjC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ;IACR,mBAAmB;IACnB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,cAAc;IACd,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,sBAAs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 -3,8 +3,19 @@ import type { NightgateMcpConfig } from './config.js';
3
3
  export declare class NightgateApiError extends Error {
4
4
  readonly status: number;
5
5
  readonly code: string | undefined;
6
- constructor(status: number, code: string | undefined, message: string);
6
+ /** Extra fields of a gateway error body (unitsLeft, price, topup, products, validUntil, retryAfterSeconds). */
7
+ readonly detail?: Record<string, unknown> | undefined;
8
+ constructor(status: number, code: string | undefined, message: string,
9
+ /** Extra fields of a gateway error body (unitsLeft, price, topup, products, validUntil, retryAfterSeconds). */
10
+ detail?: Record<string, unknown> | undefined);
7
11
  }
12
+ /**
13
+ * Two error shapes reach the client: CAP's `{ error: { code, message } }`
14
+ * from NIGHTGATE itself, and the ODATANO ACCESS gateway's `{ error: "<text>",
15
+ * ...detail }` (401 key problems, 402 units exhausted with a top-up hint,
16
+ * 403 closed action or product not on the key, 429 with Retry-After).
17
+ */
18
+ export declare function apiError(status: number, payload: unknown, headers: Headers, fallback: string): NightgateApiError;
8
19
  /**
9
20
  * Marker for an OData Int64 URL literal: rendered unquoted so precision
10
21
  * is preserved beyond Number.MAX_SAFE_INTEGER.