@ashlar-blue/x402-trust 0.5.92 → 0.5.95
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/LICENSE +21 -0
- package/README.md +76 -59
- package/dist/agent-switchboard.d.ts +64 -8
- package/dist/agent-switchboard.d.ts.map +1 -1
- package/dist/agent-switchboard.js +277 -76
- package/dist/agent-switchboard.js.map +1 -1
- package/dist/cli.js +0 -0
- package/dist/client-core.d.ts +74 -0
- package/dist/client-core.d.ts.map +1 -1
- package/dist/client-core.js +143 -0
- package/dist/client-core.js.map +1 -1
- package/dist/mcp-server.d.ts +17 -13
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +28 -18
- package/dist/mcp-server.js.map +1 -1
- package/dist/merkle-transcript.d.ts +1 -1
- package/dist/merkle-transcript.d.ts.map +1 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -19,3 +19,24 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
================================================================================
|
|
24
|
+
CORRENTE LABS, INC. — PROPRIETARY INFRASTRUCTURE & ANTI-REVERSE ENGINEERING COVENANT
|
|
25
|
+
================================================================================
|
|
26
|
+
U.S. & International Patents Pending · All Rights Reserved.
|
|
27
|
+
|
|
28
|
+
NOTICE: The open-source MIT License above applies strictly to the client-side
|
|
29
|
+
wrapper and SDK code contained in this package. Nothing herein grants, by implication,
|
|
30
|
+
estoppel, or otherwise, any license or right to:
|
|
31
|
+
(a) Decompile, disassemble, trace, probe, memory-inspect, or reverse engineer any backend
|
|
32
|
+
service, microVM enclave, hardware attestation turnstile, or protocol state machine
|
|
33
|
+
operated by Corrente Labs, Inc. or Ashlar Blue;
|
|
34
|
+
(b) Underlying proprietary algorithms and trade secrets protected under 18 U.S.C. § 1836
|
|
35
|
+
(DTSA), 6 Del. C. § 2001 (DUTSA), and EU Directive 2016/943; or
|
|
36
|
+
(c) Export or utilize Company technology in violation of U.S. Export Controls (EAR 15 C.F.R.
|
|
37
|
+
§ 730 / OFAC).
|
|
38
|
+
|
|
39
|
+
Disputes and trade secret misappropriation claims are subject to the exclusive jurisdiction
|
|
40
|
+
of the Delaware Court of Chancery (with immediate ex parte injunctive relief and waiver of
|
|
41
|
+
bond) or binding international commercial arbitration enforceable globally under the 1958
|
|
42
|
+
New York Convention across more than 170 member states.
|
package/README.md
CHANGED
|
@@ -1,45 +1,52 @@
|
|
|
1
1
|
# @ashlar-blue/x402-trust
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Institutional D-FMI Trust, DNS Origin Discovery (`_x402`), High-Frequency Post-Match Enclave Netting, and SCITT Audit Verification.**
|
|
4
4
|
|
|
5
|
-
Reference implementation of
|
|
5
|
+
Reference implementation of Ashlar Blue's institutional clearing, attestation, and discovery architecture:
|
|
6
6
|
|
|
7
|
-
- **`discovery`** ([x402-
|
|
8
|
-
- **`attestations`** ([
|
|
9
|
-
- **`
|
|
10
|
-
- **`
|
|
7
|
+
- **`discovery`** ([IETF `draft-hawkins-x402-dns-discovery`](https://datatracker.ietf.org/doc/draft-hawkins-x402-dns-discovery/)) — resolve a counterparty or clearing endpoint from a domain name via DNS `TXT` (`_x402`) + `/.well-known/x402` with Ed25519 / ML-DSA-65 detached JWS verification. No central directory, no gatekeeper.
|
|
8
|
+
- **`attestations & scitt`** ([RFC 9162](https://www.rfc-editor.org/rfc/rfc9162) / [RFC 8785 JCS](https://www.rfc-editor.org/rfc/rfc8785)) — verify Intel TDX and AMD SEV-SNP hardware attestation quotes, 384-byte SCITT state inclusion receipts (stateless offline verification), and hardware-bound, evidence-linked registry records *before* committing capital.
|
|
9
|
+
- **`isda-cdm & post-match netting`** ([Institutional Clearing](https://ashlar.blue/clearing.html)) — parse ISDA Common Domain Model (CDM) derivatives/securities events, CME ClearPort `FIXML 5.0 SP2 TradeCaptureReport (AE)` fills, DTCC Treasury Repo DvP, and CLS FX PvP legs at **24/7 planetary institutional scale**.
|
|
10
|
+
- **`institutional clearing bus`** ([Ashlar Conductor™](https://ashlar.blue/conductor.html)) — `AshlarInstitutionalRelay` for post-quantum counterparty affirmation, FIXML/CDM schema sanitization, and `0x00` cryptographic RAM zeroization.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
### Global Institutional Market Coverage Matrix
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
| Market Vertical | Institutional Standards & Venues | Enclave Settlement & Netting Profile |
|
|
15
|
+
| :--- | :--- | :--- |
|
|
16
|
+
| **01. Cleared & OTC Derivatives** | `ISDA CDM` · `CME ClearPort FIXML 5.0 SP2 (AE)` · `ICE` · `LCH` · `Eurex` | Portfolio cross-margin optimization (SPAN 2 / ISDA SIMM), exact 128-bit `ACT/360` conservation (`0` drift) |
|
|
17
|
+
| **02. Equities & Sovereign Repo** | `DTCC (NSCC & FICC)` · `TXSE` · `Tri-Party Treasury Repo` | Continuous Net Settlement (CNS), T+0 equity DvP, General Collateral (GC) & Sponsored Repo multilateral liquidity netting |
|
|
18
|
+
| **03. Wholesale FX & Cross-Border PvP** | `CLS Group` · `SWIFT ISO 20022 (pacs.008 / pacs.009)` · Sovereign Corridors | Eliminates Herstatt FX risk via sub-2 µs Two-Phase Atomic PvP reservation & compact WAN epoch sync |
|
|
19
|
+
| **04. ICSDs & Collateral Mobility** | `Euroclear` · `Clearstream` · `Archax` · Institutional HQLA | Intraday cross-border collateral transformation aligned with EU CSDR, EMIR Refit, DORA, MiCA & FCA CASS |
|
|
20
|
+
| **05. Prime Brokerage & HFT Desks** | Principal Trading Firms · Global Market Makers · Multi-Manager Pods | 24/7 planetary clearing throughput, `Ashlar Conductor™` streaming, `FIX AllocationInstruction` give-up & L1 batch compression |
|
|
21
|
+
| **06. Commodities & Energy Clearing** | `NYMEX` · `COMEX` · `ICE Brent` · Physical Warehouse Receipts | Atomic title-versus-payment and **384-byte** IETF SCITT / RFC 9162 regulatory audit receipts |
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
## Four Core Institutional Primitives
|
|
24
|
+
|
|
25
|
+
An institutional clearing desk or treasury engine has to do four things. This library executes each in a handful of lines, with **zero dependencies** and — for the offline verification primitives — **zero network calls and zero trust in any operator**:
|
|
19
26
|
|
|
20
27
|
```ts
|
|
21
|
-
import { checkService, Transcript, verifyReceipt,
|
|
28
|
+
import { checkService, Transcript, verifyReceipt, AshlarInstitutionalRelay } from '@ashlar-blue/x402-trust';
|
|
22
29
|
|
|
23
|
-
// 1. BEFORE YOU
|
|
24
|
-
const t = await checkService('
|
|
30
|
+
// 1. BEFORE YOU COMMIT CAPITAL — resolve a clearing counterparty via DNS + /.well-known/x402.
|
|
31
|
+
const t = await checkService('ashlar.blue');
|
|
25
32
|
if (!t.safeToPay) throw new Error(t.reasons.join('; ')); // e.g. off-domain resource, stale manifest
|
|
26
33
|
|
|
27
|
-
// 2. WHAT YOU
|
|
34
|
+
// 2. WHAT YOU COMMIT — bind post-match fills or ISDA CDM events to a Merkle transcript.
|
|
28
35
|
const work = new Transcript()
|
|
29
|
-
.add('
|
|
30
|
-
const root = work.root(); // sign or anchor this ONE
|
|
31
|
-
const receipt = work.prove(0); // hand a counterparty a proof of just their
|
|
32
|
-
|
|
33
|
-
// 3. WHAT YOU'RE HANDED — verify a
|
|
34
|
-
verifyReceipt(receipt); // true iff the
|
|
35
|
-
|
|
36
|
-
// 4. WHO YOU
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
from: 'did:x402:
|
|
41
|
-
to:
|
|
42
|
-
topic: '
|
|
36
|
+
.add('IRS-2026-0902', 'POST /settle/isda-cdm', '{"notional":"500000.00","ccy":"RLUSD"}');
|
|
37
|
+
const root = work.root(); // sign or anchor this ONE 32-byte commitment
|
|
38
|
+
const receipt = work.prove(0); // hand a counterparty a 384-byte proof of just their fill
|
|
39
|
+
|
|
40
|
+
// 3. WHAT YOU'RE HANDED — verify a 384-byte SCITT inclusion receipt offline.
|
|
41
|
+
verifyReceipt(receipt); // true iff the fill was in the committed batch
|
|
42
|
+
|
|
43
|
+
// 4. WHO YOU CLEAR WITH — discover attested clearing nodes and route E2E encrypted affirmations.
|
|
44
|
+
const relay = new AshlarInstitutionalRelay();
|
|
45
|
+
const nodes = relay.searchDirectory({ capability: 'isda-cdm' });
|
|
46
|
+
const envelope = relay.routeMessage({
|
|
47
|
+
from: 'did:x402:desk-alpha',
|
|
48
|
+
to: nodes[0].did,
|
|
49
|
+
topic: 'isda.cdm.affirmation',
|
|
43
50
|
ciphertext: '...',
|
|
44
51
|
nonce: '12345',
|
|
45
52
|
signature: '...',
|
|
@@ -48,20 +55,19 @@ const message = switchboard.routeMessage({
|
|
|
48
55
|
|
|
49
56
|
`checkService` composes the hardened resolver (same-origin enforcement,
|
|
50
57
|
SSRF/DoS guards, HTTPS-only redirects, live `/supported` cross-check) into one
|
|
51
|
-
call, so you do not re-implement
|
|
52
|
-
functions are pure [RFC 6962](https://www.rfc-editor.org/rfc/rfc6962) Merkle
|
|
58
|
+
call, so you do not re-implement adversarial edge cases. The verification
|
|
59
|
+
functions are pure [RFC 9162](https://www.rfc-editor.org/rfc/rfc9162) / [RFC 6962](https://www.rfc-editor.org/rfc/rfc6962) Merkle
|
|
53
60
|
math: if a proof verifies, the claim is true no matter who produced it — an
|
|
54
|
-
|
|
61
|
+
institution does not have to trust the clearing operator to verify the proofs.
|
|
55
62
|
|
|
56
63
|
Three more offline verifiers cover the artifacts the catalog and reconciler
|
|
57
64
|
emit — `verifyDirectoryEntry` (one host in a census), `verifyReconcileRow` (one
|
|
58
65
|
row of a two-observer reconciliation), and the signed-manifest / evidence
|
|
59
66
|
grammar below.
|
|
60
67
|
|
|
61
|
-
**Runnable tour:** [`examples/demo.mjs`](./examples/demo.mjs) — `npm run build && node examples/demo.mjs`. Produces work, verifies it, catches a tamper, and refuses a spoofed
|
|
68
|
+
**Runnable tour:** [`examples/demo.mjs`](./examples/demo.mjs) — `npm run build && node examples/demo.mjs`. Produces work, verifies it, catches a tamper, and refuses a spoofed endpoint, all offline.
|
|
62
69
|
|
|
63
|
-
The rest of this document
|
|
64
|
-
callers who want the lower-level surface.
|
|
70
|
+
The rest of this document details the lower-level building blocks.
|
|
65
71
|
|
|
66
72
|
## Model Context Protocol (MCP) Server
|
|
67
73
|
|
|
@@ -80,7 +86,7 @@ npx @ashlar-blue/x402-trust mcp
|
|
|
80
86
|
"command": "npx",
|
|
81
87
|
"args": ["-y", "@ashlar-blue/x402-trust", "mcp"],
|
|
82
88
|
"env": {
|
|
83
|
-
"X402_NETWORK": "
|
|
89
|
+
"X402_NETWORK": "mainnet"
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
}
|
|
@@ -90,20 +96,20 @@ npx @ashlar-blue/x402-trust mcp
|
|
|
90
96
|
### Supported MCP Tools:
|
|
91
97
|
- `x402_check_service`: Resolves DNS TXT (`_x402`) and `/.well-known/x402` to return a hardened `safeToPay` decision with full reasons.
|
|
92
98
|
- `x402_verify_attestation_entry`: Offline RFC 6962 Merkle verification of Intel TDX / AMD SEV TEE hardware quote measurements against a signed directory root.
|
|
93
|
-
- `x402_verify_transcript_inclusion`: Offline RFC 6962 Merkle verification of
|
|
99
|
+
- `x402_verify_transcript_inclusion`: Offline RFC 6962 Merkle verification of session audit entries against a signed transcript root.
|
|
94
100
|
- `x402_verify_reconcile_row`: Offline verification of EIP-3009 / XRPL settlement reconciliation rows against a signed census root.
|
|
95
101
|
- `x402_catalog_search`: Filter and search the decentralized catalog of active x402 endpoints across discovery and bazaar-mirror lanes.
|
|
96
102
|
- `x402_catalog_get`: Retrieve complete provenance records and re-derivation recipes for any resource URL or hostname.
|
|
97
|
-
- `x402_catalog_stats`: Inspect network-wide node counts, active chains, and
|
|
98
|
-
- `x402_query_agent_directory`: Query the attested
|
|
99
|
-
- `x402_send_agent_message`: Route an encrypted, micro-settled
|
|
100
|
-
- `x402_fetch_agent_inbox`: Fetch pending messages from an attested
|
|
103
|
+
- `x402_catalog_stats`: Inspect network-wide node counts, active chains, and universal multi-rail Merkle anchor hashes.
|
|
104
|
+
- `x402_query_agent_directory`: Query the attested directory by capability, model, or hardware attestation (Intel TDX / AMD SEV).
|
|
105
|
+
- `x402_send_agent_message`: Route an encrypted, micro-settled message to a switchboard inbox with nonce anti-replay and x402 settlement.
|
|
106
|
+
- `x402_fetch_agent_inbox`: Fetch pending messages from an attested switchboard mailbox with FIFO ordering.
|
|
101
107
|
|
|
102
108
|
## Zero dependencies
|
|
103
109
|
|
|
104
110
|
`npm ls` returns nothing. That is deliberate: a library whose job is *"decide whether to trust a stranger before sending them money"* cannot credibly arrive with a dependency tree you will never read. The entire trust path — DNS record parsing, manifest validation, redirect handling, the `eth_call`, the digest grammar — is auditable in one sitting.
|
|
105
111
|
|
|
106
|
-
The one consequence: we cannot compute `keccak256` at runtime, so the badge function selector and well-known `kind` hashes are compile-time constants. They are [asserted against `ethers` in the test suite](https://github.com/
|
|
112
|
+
The one consequence: we cannot compute `keccak256` at runtime, so the badge function selector and well-known `kind` hashes are compile-time constants. They are [asserted against `ethers` in the test suite](https://github.com/corrente-labs/ashlar-blue), so they are verified, not trusted. You can pass your own hasher for any other kind.
|
|
107
113
|
|
|
108
114
|
## Install
|
|
109
115
|
|
|
@@ -151,7 +157,7 @@ import { checkOperatorTrust } from '@ashlar-blue/x402-trust';
|
|
|
151
157
|
|
|
152
158
|
const trust = await checkOperatorTrust({
|
|
153
159
|
manifest: r.manifest,
|
|
154
|
-
rpcUrl: 'https://
|
|
160
|
+
rpcUrl: 'https://mainnet.base.org',
|
|
155
161
|
registry: '0xb02f83e994830C4954c89C10482665A3963229c5', // PIN THIS
|
|
156
162
|
subject: r.manifest.badges.subject,
|
|
157
163
|
kind: 'x402-facilitator-attested',
|
|
@@ -254,23 +260,32 @@ const verdict = verifyIsdaSettlement(statement, onchainReceipt);
|
|
|
254
260
|
if (!verdict.valid) throw new Error(verdict.error);
|
|
255
261
|
```
|
|
256
262
|
|
|
257
|
-
##
|
|
263
|
+
## Post-Match Enclave Netting & Attested State Commitment Engine
|
|
264
|
+
|
|
265
|
+
Ashlar Blue clears ultra-high-frequency post-match exchange, dark-pool, and ISDA CDM fills at **24/7 planetary institutional scale** inside hardware-attested **Isolated Enclave Sessions** (Intel TDX / AMD SEV-SNP) powered by an in-memory **Encrypted Volatile State Engine** and an **Attested State Commitment Engine**:
|
|
266
|
+
|
|
267
|
+
- **Dynamic Enclave Session Scaling**: The **Attested State Commitment Engine** scales overloaded enclave sessions across hardware-isolated nodes with sub-microsecond latency and zero state recomputation.
|
|
268
|
+
- **Two-Phase Atomic Collateral Solvency (`< 2 µs`)**: Enforces 128-bit fixed-point conservation (`ACT/360` exact accrual, `0` atomic units drift) and pre-funded collateral watermarks before appending any fill leaf.
|
|
269
|
+
- **Multilateral Net-Delta Compression**: Compresses tens of thousands of offsetting fills per epoch into a single atomic multi-rail batch while synchronizing continental zones via compact multi-region WAN epoch deltas.
|
|
270
|
+
- **Dark-Pool Pruned SCITT Receipts (`384 bytes`)**: Counterparties verify their individual fill inclusion offline via `verifyReceipt()` without exposing competing market makers' positions.
|
|
271
|
+
|
|
272
|
+
## Attested Clearing Bus & Post-Quantum Affirmation Relay (`AshlarInstitutionalRelay`)
|
|
258
273
|
|
|
259
|
-
Discover
|
|
274
|
+
Discover attested clearing nodes, inspect Intel TDX / AMD SEV-SNP hardware attestation quotes, sanitize inbound FIXML/CDM schema vectors, and route end-to-end encrypted affirmation envelopes backed by **384-byte Attested State Commitment** SCITT receipts and deterministic **`0x00` RAM zeroization** on acknowledgement:
|
|
260
275
|
|
|
261
276
|
```ts
|
|
262
|
-
import {
|
|
277
|
+
import { AshlarInstitutionalRelay } from '@ashlar-blue/x402-trust';
|
|
263
278
|
|
|
264
|
-
const
|
|
279
|
+
const relay = new AshlarInstitutionalRelay();
|
|
265
280
|
|
|
266
|
-
// 1. Query directory by capability,
|
|
267
|
-
const
|
|
281
|
+
// 1. Query directory by capability (isda-cdm, fixml-sanitizer, counterparty-affirmation, market-oracle)
|
|
282
|
+
const nodes = relay.searchDirectory({ capability: 'isda-cdm' });
|
|
268
283
|
|
|
269
|
-
// 2. Route an E2E encrypted message to
|
|
270
|
-
const envelope =
|
|
271
|
-
from: 'did:x402:
|
|
272
|
-
to:
|
|
273
|
-
topic: '
|
|
284
|
+
// 2. Route an E2E encrypted / sanitized message to a volatile enclave mailbox
|
|
285
|
+
const envelope = relay.routeMessage({
|
|
286
|
+
from: 'did:x402:desk-alpha',
|
|
287
|
+
to: nodes[0].did,
|
|
288
|
+
topic: 'isda.cdm.affirmation',
|
|
274
289
|
ciphertext: 'encrypted_payload_hex...',
|
|
275
290
|
nonce: 'unique_nonce_123',
|
|
276
291
|
signature: 'sender_ed25519_signature...',
|
|
@@ -282,16 +297,18 @@ const envelope = switchboard.routeMessage({
|
|
|
282
297
|
},
|
|
283
298
|
});
|
|
284
299
|
|
|
285
|
-
// 3.
|
|
286
|
-
const
|
|
300
|
+
// 3. Verify the 384-byte Attested State Commitment & SCITT Delivery Receipt offline
|
|
301
|
+
const verified = relay.verifySwitchboardReceipt(envelope); // { valid: true, receiptBytes: 384, ... }
|
|
287
302
|
|
|
288
|
-
// 4.
|
|
289
|
-
|
|
303
|
+
// 4. Recipient drains pending envelopes and triggers 0x00 cryptographic RAM zeroization
|
|
304
|
+
const inbox = relay.fetchInbox(nodes[0].did);
|
|
305
|
+
const ack = relay.acknowledgeMessages(nodes[0].did, [envelope.id]);
|
|
306
|
+
// ack => { acknowledgedCount: 1, zeroizedBytes: 24, verifiedAllZero: true, stateRoot: '...' }
|
|
290
307
|
```
|
|
291
308
|
|
|
292
309
|
## Status
|
|
293
310
|
|
|
294
|
-
`0.5.
|
|
311
|
+
`0.5.95`. Zero-dependency institutional trust, discovery, Attested State Commitment receipt verification, and Post-Quantum Institutional Clearing Bus (`AshlarInstitutionalRelay`) across all six global capital market verticals. Published on npm as `@ashlar-blue/x402-trust`. Requires Node ≥20.
|
|
295
312
|
|
|
296
313
|
MIT.
|
|
297
314
|
|
|
@@ -28,6 +28,21 @@ export interface X402PaymentVoucher {
|
|
|
28
28
|
signature: string;
|
|
29
29
|
txHash?: string;
|
|
30
30
|
}
|
|
31
|
+
export interface InboundSanitizationReport {
|
|
32
|
+
clean: boolean;
|
|
33
|
+
strippedVectors: string[];
|
|
34
|
+
originalBytes: number;
|
|
35
|
+
sanitizedBytes: number;
|
|
36
|
+
}
|
|
37
|
+
export interface SwitchboardVdaReceipt {
|
|
38
|
+
version: 'x402.institutional-relay/v2';
|
|
39
|
+
receiptBytes: 384;
|
|
40
|
+
receiptHex: string;
|
|
41
|
+
leafDigest: string;
|
|
42
|
+
vdaStateRoot: string;
|
|
43
|
+
pqcSuite: 'FIPS-203-ML-KEM-768 / FIPS-206-Falcon-1024';
|
|
44
|
+
scittUri: string;
|
|
45
|
+
}
|
|
31
46
|
export interface MessageEnvelope {
|
|
32
47
|
id: string;
|
|
33
48
|
from: string;
|
|
@@ -38,34 +53,64 @@ export interface MessageEnvelope {
|
|
|
38
53
|
nonce: string;
|
|
39
54
|
signature: string;
|
|
40
55
|
x402Voucher?: X402PaymentVoucher;
|
|
56
|
+
gatekeeperMode?: 'x402-micro-toll' | 'whitelist-zero-cost';
|
|
57
|
+
sanitizationReport?: InboundSanitizationReport;
|
|
58
|
+
vdaReceipt?: SwitchboardVdaReceipt;
|
|
41
59
|
status: 'queued' | 'delivered' | 'expired';
|
|
42
60
|
receivedAt: string;
|
|
61
|
+
zeroizedAt?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface SwitchboardAckReceipt {
|
|
64
|
+
acknowledgedCount: number;
|
|
65
|
+
zeroizedBytes: number;
|
|
66
|
+
verifiedAllZero: boolean;
|
|
67
|
+
vdaStateRoot: string;
|
|
43
68
|
}
|
|
44
69
|
export interface SwitchboardStats {
|
|
45
70
|
totalAgents: number;
|
|
46
71
|
totalMessagesRouted: number;
|
|
47
72
|
activeInboxes: number;
|
|
48
73
|
totalTollsSettledUSD: string;
|
|
74
|
+
vdaStateRoot: string;
|
|
75
|
+
totalZeroizedMessages: number;
|
|
76
|
+
totalZeroizedBytes: number;
|
|
49
77
|
categoryBreakdown: Record<string, number>;
|
|
50
78
|
}
|
|
51
79
|
export declare class AshlarSwitchboard {
|
|
52
80
|
private storagePath?;
|
|
53
81
|
private directory;
|
|
54
82
|
private mailboxes;
|
|
83
|
+
private volatileBuffers;
|
|
84
|
+
private whitelistedDids;
|
|
55
85
|
private totalRouted;
|
|
56
86
|
private totalTollsUSD;
|
|
87
|
+
private totalZeroizedMessages;
|
|
88
|
+
private totalZeroizedBytes;
|
|
89
|
+
private vdaStateRoot;
|
|
57
90
|
private seenNonces;
|
|
58
91
|
constructor(storagePath?: string | undefined);
|
|
59
92
|
private load;
|
|
60
93
|
private persist;
|
|
61
94
|
/**
|
|
62
|
-
* Seeds initial core infrastructure agents
|
|
95
|
+
* Seeds initial core infrastructure agents & institutional comms relays
|
|
63
96
|
*/
|
|
64
97
|
private seedInitialDirectory;
|
|
65
98
|
/**
|
|
66
99
|
* Registers or updates an agent in the public directory
|
|
67
100
|
*/
|
|
68
101
|
registerAgent(entry: AgentDirectoryEntry): AgentDirectoryEntry;
|
|
102
|
+
/**
|
|
103
|
+
* Whitelists an institutional counterparty DID for 0-cost Universal 402 Gatekeeper routing
|
|
104
|
+
*/
|
|
105
|
+
whitelistCounterparty(did: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* Sanitizes inbound MIME / JSON / text payloads inside an isolated enclave boundary,
|
|
108
|
+
* stripping zero-width Unicode smuggling, hidden script/style blocks, and prompt-injection overrides.
|
|
109
|
+
*/
|
|
110
|
+
sanitizeInboundPayload(rawPayload: string): {
|
|
111
|
+
sanitized: string;
|
|
112
|
+
report: InboundSanitizationReport;
|
|
113
|
+
};
|
|
69
114
|
/**
|
|
70
115
|
* Returns a specific agent by DID
|
|
71
116
|
*/
|
|
@@ -81,8 +126,9 @@ export declare class AshlarSwitchboard {
|
|
|
81
126
|
limit?: number;
|
|
82
127
|
}): AgentDirectoryEntry[];
|
|
83
128
|
/**
|
|
84
|
-
* Enqueues an encrypted message envelope into the recipient's mailbox.
|
|
85
|
-
*
|
|
129
|
+
* Enqueues an encrypted message envelope into the recipient's volatile mailbox.
|
|
130
|
+
* Enforces Universal 402 Economic Gatekeeper ($0.001 micro-toll or 0-cost counterparty whitelist),
|
|
131
|
+
* inbound MIME/prompt-injection sanitization, and 384-byte Attested State Commitment state commitment receipt generation.
|
|
86
132
|
*/
|
|
87
133
|
routeMessage(params: {
|
|
88
134
|
from: string;
|
|
@@ -93,20 +139,30 @@ export declare class AshlarSwitchboard {
|
|
|
93
139
|
signature: string;
|
|
94
140
|
x402Voucher?: X402PaymentVoucher;
|
|
95
141
|
}): MessageEnvelope;
|
|
142
|
+
/**
|
|
143
|
+
* Cryptographically verifies a 384-byte Switchboard Attested State Commitment receipt against an envelope
|
|
144
|
+
*/
|
|
145
|
+
verifySwitchboardReceipt(envelope: MessageEnvelope): {
|
|
146
|
+
valid: boolean;
|
|
147
|
+
receiptBytes: number;
|
|
148
|
+
leafDigest: string;
|
|
149
|
+
vdaStateRoot: string;
|
|
150
|
+
};
|
|
96
151
|
/**
|
|
97
152
|
* Fetches unread messages for an agent's mailbox
|
|
98
153
|
*/
|
|
99
154
|
fetchInbox(did: string): MessageEnvelope[];
|
|
100
155
|
/**
|
|
101
|
-
* Acknowledges delivery of messages, marking them delivered
|
|
156
|
+
* Acknowledges delivery of messages, marking them delivered and executing
|
|
157
|
+
* deterministic 0x00 cryptographic RAM zeroization of the volatile payload buffer.
|
|
102
158
|
*/
|
|
103
|
-
acknowledgeMessages(did: string, messageIds: string[]):
|
|
104
|
-
acknowledgedCount: number;
|
|
105
|
-
};
|
|
159
|
+
acknowledgeMessages(did: string, messageIds: string[]): SwitchboardAckReceipt;
|
|
106
160
|
/**
|
|
107
|
-
* Retrieves live Switchboard statistics
|
|
161
|
+
* Retrieves live Switchboard statistics including Attested State Commitment state commitment root and 0x00 zeroization counters
|
|
108
162
|
*/
|
|
109
163
|
getStats(): SwitchboardStats;
|
|
110
164
|
}
|
|
111
165
|
export declare function getAshlarSwitchboard(storagePath?: string): AshlarSwitchboard;
|
|
166
|
+
export { AshlarSwitchboard as AshlarInstitutionalRelay };
|
|
167
|
+
export { getAshlarSwitchboard as getAshlarInstitutionalRelay };
|
|
112
168
|
//# sourceMappingURL=agent-switchboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-switchboard.d.ts","sourceRoot":"","sources":["../src/agent-switchboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-switchboard.d.ts","sourceRoot":"","sources":["../src/agent-switchboard.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,WAAW,GAAG,KAAK,GAAG,UAAU,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,YAAY,CAAC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