@intentrax/sdk 1.1.0 → 1.2.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/README.md CHANGED
@@ -130,8 +130,9 @@ npx @intentrax/sdk verify-proof node_modules/@intentrax/sdk/examples/sandbox/tam
130
130
  ```
131
131
 
132
132
  To verify your own artifact, point the command at any proof lookup JSON export
133
- downloaded from your tenant's `/v1/proofs/{proof_id}/export?format=json`, and
134
- pass the production key set Intentrax publishes with `--trusted-keys <file>`.
133
+ downloaded from your tenant's `/v1/proofs/{proof_id}/export?format=json`. The
134
+ production key set is bundled, so you don't need any flags. Pass extra key sets
135
+ (for example, ones that revoke a key) with `--trusted-keys <file>`.
135
136
 
136
137
  `verify-proof` reads a registry-backed proof lookup JSON export and, offline:
137
138
 
@@ -140,14 +141,22 @@ pass the production key set Intentrax publishes with `--trusted-keys <file>`.
140
141
  (`canonical_payload_json`) and the signature quorum;
141
142
  3. checks that the signed payload carries the record's own AEP, so the AEP cannot
142
143
  be rewritten after signing even if every outer hash is recomputed;
143
- 4. checks each signer against published key sets: the bundled sandbox set
144
- (`trust/sandbox-key-set.json`, not trust-bearing) and any `--trusted-keys` files.
144
+ 4. checks each signer against published key sets: the bundled production set
145
+ (`trust/production-key-set.json`, trust-bearing), the bundled sandbox set
146
+ (`trust/sandbox-key-set.json`, not trust-bearing), and any `--trusted-keys` files.
147
+ A revocation in any loaded set wins;
148
+ 5. checks that at least the key set's `min_trusted_signers` distinct trusted keys
149
+ signed. The production set requires 2. A proof's own quorum isn't enough,
150
+ because a signature can be stripped along with the quorum and roster entries
151
+ that describe it. When several sets vouch for the signers, the strictest
152
+ minimum applies.
145
153
 
146
154
  | Status | Exit | Meaning |
147
155
  |---|---|---|
148
- | `PASS` | 0 | Every signer is a published, trust-bearing key |
156
+ | `PASS` | 0 | Every signer is a published, trust-bearing key, and enough distinct keys signed |
149
157
  | `SANDBOX_NON_TRUST_BEARING` | 0 | Every signer is a published sandbox key: the mechanics check out, but this is not production assurance |
150
158
  | `UNPINNED_SIGNER` | 3 | Signatures are valid, but a signer is not in any trusted key set, so who signed is unproven |
159
+ | `INSUFFICIENT_TRUSTED_SIGNERS` | 3 | Every signer is trusted, but fewer distinct keys signed than the key set requires (signatures may have been stripped) |
151
160
  | `REVOKED_SIGNER`, `MIXED_TRUST` | 3 | Not a trusted result |
152
161
  | (none) | 2 | An integrity, signature, or binding check failed (failed closed) |
153
162
 
package/cli/intentrax.mjs CHANGED
@@ -5,7 +5,7 @@ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import { buildAgentGatewayAdmissionEnvelope } from "../index.js";
7
7
 
8
- const VERSION = "1.1.0";
8
+ const VERSION = "1.2.0";
9
9
  const ADMISSION_SCHEMA_VERSION = "intentrax.runtime.agent_admission_request/1.0";
10
10
  const INIT_SCHEMA_VERSION = "intentrax.onboarding.agent_adapter_init/1.0";
11
11
  const ACTION_RECEIPT_SCHEMA_VERSION = "intentrax.onboarding.agent_adapter_action_receipt/1.0";
@@ -22,9 +22,14 @@ const AEP_HASH_DOMAIN = "INTENTRAX_PROOF_CANONICAL_AEP_V1";
22
22
  const SIGNATURE_PAYLOAD_HASH_DOMAIN = "INTENTRAX_TRUST_SIGNATURE_PAYLOAD_V1";
23
23
  const SIGNATURE_PAYLOAD_VERSION = "intentrax.trust.signature_payload/1.0";
24
24
  const SIGNATURE_PAYLOAD_FIELDS = Object.freeze(["payload_version", "canonical_aep_json", "aep_hash"]);
25
- const PUBLISHED_KEY_SET_SCHEMA_VERSION = "intentrax.trust.published_key_set/1.0";
25
+ // 1.1 adds a required min_trusted_signers: how many distinct trust-bearing keys
26
+ // (by key_id) must have signed a proof for it to PASS. 1.0 is still accepted,
27
+ // but only for sets with no trust-bearing keys (sandbox sets).
28
+ const PUBLISHED_KEY_SET_SCHEMA_VERSION = "intentrax.trust.published_key_set/1.1";
29
+ const PUBLISHED_KEY_SET_SCHEMA_VERSION_V1 = "intentrax.trust.published_key_set/1.0";
26
30
  const BUILT_IN_KEY_SET_URLS = Object.freeze([
27
- // Published production signer keys (trust-bearing), bundled once Intentrax publishes them.
31
+ // Published production signer keys (trust-bearing), exported from the production
32
+ // keyring with engine/cmd/sovereign-public-key-set.
28
33
  new URL("../trust/production-key-set.json", import.meta.url),
29
34
  // Published sandbox keys (not trust-bearing).
30
35
  new URL("../trust/sandbox-key-set.json", import.meta.url),
@@ -1194,9 +1199,10 @@ function buildLocalProofVerificationReport(proofExport, proofExportPath, reportP
1194
1199
  const withoutHash = {
1195
1200
  schema_version: LOCAL_PROOF_VERIFICATION_SCHEMA_VERSION,
1196
1201
  verifier_version: LOCAL_PROOF_VERIFIER_VERSION,
1197
- // PASS only when every signer is a published, trust-bearing key. Valid
1198
- // signatures from keys you have not chosen to trust prove nothing about who
1199
- // signed, so they never yield PASS.
1202
+ // PASS only when every signer is a published, trust-bearing key and at least
1203
+ // min_trusted_signers distinct trusted keys signed. Valid signatures from
1204
+ // keys you have not chosen to trust prove nothing about who signed, so they
1205
+ // never yield PASS.
1200
1206
  status: trust.signer_trust === "TRUSTED" ? "PASS" : trust.signer_trust,
1201
1207
  signer_trust: trust.signer_trust,
1202
1208
  trust_bearing: trust.signer_trust === "TRUSTED",
@@ -1205,6 +1211,10 @@ function buildLocalProofVerificationReport(proofExport, proofExportPath, reportP
1205
1211
  signed_bytes: "verification_bundle.payload.canonical_payload_json",
1206
1212
  required_signatures: signatures.required,
1207
1213
  valid_signatures: signatures.signers.length,
1214
+ // The published policy from the key sets, not the proof's own quorum: a
1215
+ // proof's roster and quorum metadata can be reduced together.
1216
+ min_trusted_signers: trust.min_trusted_signers,
1217
+ distinct_trusted_signers: trust.distinct_trusted_signers,
1208
1218
  signers: trust.signers,
1209
1219
  },
1210
1220
  key_sets: keySets.map((set) => ({ key_set_id: set.key_set_id, environment: set.environment, source: set.source })),
@@ -1230,7 +1240,8 @@ function buildLocalProofVerificationReport(proofExport, proofExportPath, reportP
1230
1240
  ed25519_signatures_verified: true,
1231
1241
  signature_quorum_satisfied: true,
1232
1242
  signed_payload_binds_record_aep: true,
1233
- signers_pinned_to_published_keys: trust.signer_trust === "TRUSTED" || trust.signer_trust === "SANDBOX_NON_TRUST_BEARING",
1243
+ signers_pinned_to_published_keys: trust.signer_trust === "TRUSTED" || trust.signer_trust === "SANDBOX_NON_TRUST_BEARING" || trust.signer_trust === "INSUFFICIENT_TRUSTED_SIGNERS",
1244
+ min_trusted_signers_met: trust.signer_trust === "TRUSTED",
1234
1245
  canonical_json_authoritative: true,
1235
1246
  pdf_receipt_non_authoritative: true,
1236
1247
  },
@@ -1393,8 +1404,8 @@ function validateSignerRoster(bundle, signatureBundle, quorum, payload) {
1393
1404
  }
1394
1405
 
1395
1406
  // A published key set pins who may sign: production keys (trust_bearing) or
1396
- // sandbox keys (not trust-bearing). The SDK ships the sandbox set; production
1397
- // keys are supplied with --trusted-keys from the set Intentrax publishes.
1407
+ // sandbox keys (not trust-bearing). The SDK ships both published sets; extra sets
1408
+ // (or revocations) can be supplied with --trusted-keys.
1398
1409
  function loadPublishedKeySets(trustedKeyPaths) {
1399
1410
  const sets = [];
1400
1411
  for (const url of BUILT_IN_KEY_SET_URLS) {
@@ -1414,9 +1425,20 @@ function parsePublishedKeySet(source, origin) {
1414
1425
  }
1415
1426
  const set = parseSingleJSON(source, "trusted key set");
1416
1427
  const invalid = [];
1417
- if (!isRecord(set) || set.schema_version !== PUBLISHED_KEY_SET_SCHEMA_VERSION) invalid.push("schema_version");
1428
+ if (!isRecord(set) || ![PUBLISHED_KEY_SET_SCHEMA_VERSION, PUBLISHED_KEY_SET_SCHEMA_VERSION_V1].includes(set.schema_version)) invalid.push("schema_version");
1418
1429
  if (isRecord(set) && !stableNonEmpty(set.key_set_id)) invalid.push("key_set_id");
1419
1430
  if (!isRecord(set) || !Array.isArray(set.keys) || set.keys.length === 0) invalid.push("keys");
1431
+ if (isRecord(set) && Array.isArray(set.keys)) {
1432
+ const keyIds = new Set(set.keys.filter(isRecord).map((key) => key.key_id));
1433
+ if (set.schema_version === PUBLISHED_KEY_SET_SCHEMA_VERSION) {
1434
+ // The policy must be satisfiable by this set's own keys.
1435
+ if (!Number.isInteger(set.min_trusted_signers) || set.min_trusted_signers < 1 || set.min_trusted_signers > keyIds.size) invalid.push("min_trusted_signers");
1436
+ } else if (set.schema_version === PUBLISHED_KEY_SET_SCHEMA_VERSION_V1) {
1437
+ if (Object.hasOwn(set, "min_trusted_signers")) invalid.push("min_trusted_signers");
1438
+ // A 1.0 set cannot state a minimum trusted-signer count, so it may not anchor trust.
1439
+ if (set.keys.some((key) => isRecord(key) && key.trust_bearing === true)) invalid.push("schema_version");
1440
+ }
1441
+ }
1420
1442
  if (isRecord(set) && Array.isArray(set.keys)) {
1421
1443
  for (const [index, key] of set.keys.entries()) {
1422
1444
  if (!isRecord(key)
@@ -1431,13 +1453,17 @@ function parsePublishedKeySet(source, origin) {
1431
1453
  }
1432
1454
  }
1433
1455
  if (invalid.length > 0) {
1434
- fail(`trusted key set is invalid (${origin}): ${sortedUnique(invalid).join(",")}`);
1456
+ const hint = invalid.includes("schema_version") || invalid.includes("min_trusted_signers")
1457
+ ? ` (trust-bearing keys need ${PUBLISHED_KEY_SET_SCHEMA_VERSION} with an integer min_trusted_signers between 1 and the number of distinct key_ids)`
1458
+ : "";
1459
+ fail(`trusted key set is invalid (${origin}): ${sortedUnique(invalid).join(",")}${hint}`);
1435
1460
  }
1436
1461
  const environments = [...new Set(set.keys.map((key) => key.environment).filter(stableNonEmpty))];
1437
1462
  return {
1438
1463
  key_set_id: set.key_set_id,
1439
1464
  environment: environments.length === 1 ? environments[0] : "mixed",
1440
1465
  source: origin,
1466
+ min_trusted_signers: set.schema_version === PUBLISHED_KEY_SET_SCHEMA_VERSION ? set.min_trusted_signers : 1,
1441
1467
  keys: set.keys,
1442
1468
  };
1443
1469
  }
@@ -1460,13 +1486,26 @@ function classifySignerTrust(signers, keySets) {
1460
1486
  ?? null;
1461
1487
  return { key_id: signer.key_id, key_version: signer.key_version, public_key_hash: signer.public_key_hash, anchor };
1462
1488
  });
1489
+ // The strictest policy wins: every key set that vouches for any signer as
1490
+ // trust-bearing contributes its min_trusted_signers, and the maximum applies.
1491
+ // Supplying an extra, laxer set cannot lower the bundled production policy.
1492
+ let minTrustedSigners = 1;
1493
+ for (const set of keySets) {
1494
+ const vouches = set.keys.some((key) => key.trust_bearing === true && key.status !== "REVOKED"
1495
+ && signers.some((signer) => key.key_id === signer.key_id && key.key_version === signer.key_version && key.public_key_material === signer.public_key_material));
1496
+ if (vouches) minTrustedSigners = Math.max(minTrustedSigners, set.min_trusted_signers);
1497
+ }
1498
+ // Versions of one key are one signer.
1499
+ const distinctTrustedSigners = new Set(resolved.filter((signer) => signer.anchor?.trust_bearing === true && signer.anchor.status !== "REVOKED").map((signer) => signer.key_id)).size;
1463
1500
  let signerTrust;
1464
1501
  if (resolved.some((signer) => signer.anchor?.status === "REVOKED")) signerTrust = "REVOKED_SIGNER";
1465
1502
  else if (resolved.length === 0 || resolved.some((signer) => signer.anchor === null)) signerTrust = "UNPINNED_SIGNER";
1466
- else if (resolved.every((signer) => signer.anchor.trust_bearing === true)) signerTrust = "TRUSTED";
1503
+ else if (resolved.every((signer) => signer.anchor.trust_bearing === true)) {
1504
+ signerTrust = distinctTrustedSigners >= minTrustedSigners ? "TRUSTED" : "INSUFFICIENT_TRUSTED_SIGNERS";
1505
+ }
1467
1506
  else if (resolved.every((signer) => signer.anchor.trust_bearing === false)) signerTrust = "SANDBOX_NON_TRUST_BEARING";
1468
1507
  else signerTrust = "MIXED_TRUST";
1469
- return { signer_trust: signerTrust, signers: resolved };
1508
+ return { signer_trust: signerTrust, signers: resolved, min_trusted_signers: minTrustedSigners, distinct_trusted_signers: distinctTrustedSigners };
1470
1509
  }
1471
1510
 
1472
1511
  function signerTrustMessage(report) {
@@ -1476,6 +1515,10 @@ function signerTrustMessage(report) {
1476
1515
  if (report.signer_trust === "REVOKED_SIGNER") {
1477
1516
  return "intentrax: a signing key is REVOKED in the trusted key set; this proof must not be relied on.";
1478
1517
  }
1518
+ if (report.signer_trust === "INSUFFICIENT_TRUSTED_SIGNERS") {
1519
+ const verification = report.signature_verification;
1520
+ return `intentrax: every signer is a published trust-bearing key, but only ${verification.distinct_trusted_signers} distinct key(s) signed and the published key set requires ${verification.min_trusted_signers}. Signatures may have been stripped from this proof; it must not be relied on.`;
1521
+ }
1479
1522
  if (report.signer_trust === "MIXED_TRUST") {
1480
1523
  return "intentrax: the proof mixes trust-bearing and sandbox signers; it is not a production-trusted proof.";
1481
1524
  }
@@ -2686,17 +2729,24 @@ Proof export verification:
2686
2729
  not required. The JSON export is authoritative; PDF receipts are companions.
2687
2730
 
2688
2731
  Result (status / exit code):
2689
- PASS 0 every signer is a published, trust-bearing key
2732
+ PASS 0 every signer is a published, trust-bearing key,
2733
+ and at least the key set's min_trusted_signers
2734
+ distinct keys signed
2690
2735
  SANDBOX_NON_TRUST_BEARING 0 every signer is a published sandbox key: the
2691
2736
  mechanics check out, but it is not production
2692
2737
  assurance
2693
2738
  UNPINNED_SIGNER 3 signatures are valid but a signer is not in
2694
2739
  any trusted key set (who signed is unproven)
2740
+ INSUFFICIENT_TRUSTED_SIGNERS 3 every signer is trusted, but fewer distinct
2741
+ keys signed than the published key set
2742
+ requires (signatures may have been stripped)
2695
2743
  REVOKED_SIGNER / MIXED_TRUST 3
2696
2744
  any integrity or signature failure exits 2 (failed closed)
2697
2745
 
2698
- The SDK ships the sandbox key set (trust/sandbox-key-set.json). Supply
2699
- production keys with --trusted-keys <file> (repeatable).
2746
+ The SDK ships the production key set (trust/production-key-set.json,
2747
+ min_trusted_signers 2) and the sandbox key set (trust/sandbox-key-set.json).
2748
+ Add more sets, for example revocations, with --trusted-keys <file>
2749
+ (repeatable).
2700
2750
 
2701
2751
  PDF receipt verification:
2702
2752
  verify-pdf-receipt reads downloaded PDF receipt bytes, checks the PDF header,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentrax/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Intentrax deterministic public SDK for proof verification and API-wrapper execution.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -0,0 +1,27 @@
1
+ {
2
+ "issuer": "Intentrax",
3
+ "key_set_id": "intentrax-production-beta",
4
+ "keys": [
5
+ {
6
+ "algorithm": "ED25519",
7
+ "environment": "production",
8
+ "key_id": "runtime-sovereign-proof-key-a",
9
+ "key_version": "v1",
10
+ "public_key_material": "cca8a59628ffe97d9b27a1946385c3b44493be7145498f6019c65aeaef3ab82c",
11
+ "status": "ACTIVE",
12
+ "trust_bearing": true
13
+ },
14
+ {
15
+ "algorithm": "ED25519",
16
+ "environment": "production",
17
+ "key_id": "runtime-sovereign-proof-key-b",
18
+ "key_version": "v1",
19
+ "public_key_material": "b9c4170f3dbf862af8cff05e96b41ca377660f32c714de837b98bff02c3303b1",
20
+ "status": "ACTIVE",
21
+ "trust_bearing": true
22
+ }
23
+ ],
24
+ "min_trusted_signers": 2,
25
+ "published_at": "2026-11-12T13:55:49Z",
26
+ "schema_version": "intentrax.trust.published_key_set/1.1"
27
+ }