@intentrax/sdk 1.1.1 → 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 +11 -4
- package/cli/intentrax.mjs +62 -13
- package/package.json +1 -1
- package/trust/production-key-set.json +2 -1
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
|
|
134
|
-
|
|
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
|
|
|
@@ -143,13 +144,19 @@ pass the production key set Intentrax publishes with `--trusted-keys <file>`.
|
|
|
143
144
|
4. checks each signer against published key sets: the bundled production set
|
|
144
145
|
(`trust/production-key-set.json`, trust-bearing), the bundled sandbox set
|
|
145
146
|
(`trust/sandbox-key-set.json`, not trust-bearing), and any `--trusted-keys` files.
|
|
146
|
-
A revocation in any loaded set wins
|
|
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.
|
|
147
153
|
|
|
148
154
|
| Status | Exit | Meaning |
|
|
149
155
|
|---|---|---|
|
|
150
|
-
| `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 |
|
|
151
157
|
| `SANDBOX_NON_TRUST_BEARING` | 0 | Every signer is a published sandbox key: the mechanics check out, but this is not production assurance |
|
|
152
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) |
|
|
153
160
|
| `REVOKED_SIGNER`, `MIXED_TRUST` | 3 | Not a trusted result |
|
|
154
161
|
| (none) | 2 | An integrity, signature, or binding check failed (failed closed) |
|
|
155
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.
|
|
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,7 +22,11 @@ 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
|
-
|
|
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
31
|
// Published production signer keys (trust-bearing), exported from the production
|
|
28
32
|
// keyring with engine/cmd/sovereign-public-key-set.
|
|
@@ -1195,9 +1199,10 @@ function buildLocalProofVerificationReport(proofExport, proofExportPath, reportP
|
|
|
1195
1199
|
const withoutHash = {
|
|
1196
1200
|
schema_version: LOCAL_PROOF_VERIFICATION_SCHEMA_VERSION,
|
|
1197
1201
|
verifier_version: LOCAL_PROOF_VERIFIER_VERSION,
|
|
1198
|
-
// PASS only when every signer is a published, trust-bearing key
|
|
1199
|
-
//
|
|
1200
|
-
// signed, so they
|
|
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.
|
|
1201
1206
|
status: trust.signer_trust === "TRUSTED" ? "PASS" : trust.signer_trust,
|
|
1202
1207
|
signer_trust: trust.signer_trust,
|
|
1203
1208
|
trust_bearing: trust.signer_trust === "TRUSTED",
|
|
@@ -1206,6 +1211,10 @@ function buildLocalProofVerificationReport(proofExport, proofExportPath, reportP
|
|
|
1206
1211
|
signed_bytes: "verification_bundle.payload.canonical_payload_json",
|
|
1207
1212
|
required_signatures: signatures.required,
|
|
1208
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,
|
|
1209
1218
|
signers: trust.signers,
|
|
1210
1219
|
},
|
|
1211
1220
|
key_sets: keySets.map((set) => ({ key_set_id: set.key_set_id, environment: set.environment, source: set.source })),
|
|
@@ -1231,7 +1240,8 @@ function buildLocalProofVerificationReport(proofExport, proofExportPath, reportP
|
|
|
1231
1240
|
ed25519_signatures_verified: true,
|
|
1232
1241
|
signature_quorum_satisfied: true,
|
|
1233
1242
|
signed_payload_binds_record_aep: true,
|
|
1234
|
-
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",
|
|
1235
1245
|
canonical_json_authoritative: true,
|
|
1236
1246
|
pdf_receipt_non_authoritative: true,
|
|
1237
1247
|
},
|
|
@@ -1415,9 +1425,20 @@ function parsePublishedKeySet(source, origin) {
|
|
|
1415
1425
|
}
|
|
1416
1426
|
const set = parseSingleJSON(source, "trusted key set");
|
|
1417
1427
|
const invalid = [];
|
|
1418
|
-
if (!isRecord(set) || set.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");
|
|
1419
1429
|
if (isRecord(set) && !stableNonEmpty(set.key_set_id)) invalid.push("key_set_id");
|
|
1420
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
|
+
}
|
|
1421
1442
|
if (isRecord(set) && Array.isArray(set.keys)) {
|
|
1422
1443
|
for (const [index, key] of set.keys.entries()) {
|
|
1423
1444
|
if (!isRecord(key)
|
|
@@ -1432,13 +1453,17 @@ function parsePublishedKeySet(source, origin) {
|
|
|
1432
1453
|
}
|
|
1433
1454
|
}
|
|
1434
1455
|
if (invalid.length > 0) {
|
|
1435
|
-
|
|
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}`);
|
|
1436
1460
|
}
|
|
1437
1461
|
const environments = [...new Set(set.keys.map((key) => key.environment).filter(stableNonEmpty))];
|
|
1438
1462
|
return {
|
|
1439
1463
|
key_set_id: set.key_set_id,
|
|
1440
1464
|
environment: environments.length === 1 ? environments[0] : "mixed",
|
|
1441
1465
|
source: origin,
|
|
1466
|
+
min_trusted_signers: set.schema_version === PUBLISHED_KEY_SET_SCHEMA_VERSION ? set.min_trusted_signers : 1,
|
|
1442
1467
|
keys: set.keys,
|
|
1443
1468
|
};
|
|
1444
1469
|
}
|
|
@@ -1461,13 +1486,26 @@ function classifySignerTrust(signers, keySets) {
|
|
|
1461
1486
|
?? null;
|
|
1462
1487
|
return { key_id: signer.key_id, key_version: signer.key_version, public_key_hash: signer.public_key_hash, anchor };
|
|
1463
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;
|
|
1464
1500
|
let signerTrust;
|
|
1465
1501
|
if (resolved.some((signer) => signer.anchor?.status === "REVOKED")) signerTrust = "REVOKED_SIGNER";
|
|
1466
1502
|
else if (resolved.length === 0 || resolved.some((signer) => signer.anchor === null)) signerTrust = "UNPINNED_SIGNER";
|
|
1467
|
-
else if (resolved.every((signer) => signer.anchor.trust_bearing === true))
|
|
1503
|
+
else if (resolved.every((signer) => signer.anchor.trust_bearing === true)) {
|
|
1504
|
+
signerTrust = distinctTrustedSigners >= minTrustedSigners ? "TRUSTED" : "INSUFFICIENT_TRUSTED_SIGNERS";
|
|
1505
|
+
}
|
|
1468
1506
|
else if (resolved.every((signer) => signer.anchor.trust_bearing === false)) signerTrust = "SANDBOX_NON_TRUST_BEARING";
|
|
1469
1507
|
else signerTrust = "MIXED_TRUST";
|
|
1470
|
-
return { signer_trust: signerTrust, signers: resolved };
|
|
1508
|
+
return { signer_trust: signerTrust, signers: resolved, min_trusted_signers: minTrustedSigners, distinct_trusted_signers: distinctTrustedSigners };
|
|
1471
1509
|
}
|
|
1472
1510
|
|
|
1473
1511
|
function signerTrustMessage(report) {
|
|
@@ -1477,6 +1515,10 @@ function signerTrustMessage(report) {
|
|
|
1477
1515
|
if (report.signer_trust === "REVOKED_SIGNER") {
|
|
1478
1516
|
return "intentrax: a signing key is REVOKED in the trusted key set; this proof must not be relied on.";
|
|
1479
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
|
+
}
|
|
1480
1522
|
if (report.signer_trust === "MIXED_TRUST") {
|
|
1481
1523
|
return "intentrax: the proof mixes trust-bearing and sandbox signers; it is not a production-trusted proof.";
|
|
1482
1524
|
}
|
|
@@ -2687,17 +2729,24 @@ Proof export verification:
|
|
|
2687
2729
|
not required. The JSON export is authoritative; PDF receipts are companions.
|
|
2688
2730
|
|
|
2689
2731
|
Result (status / exit code):
|
|
2690
|
-
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
|
|
2691
2735
|
SANDBOX_NON_TRUST_BEARING 0 every signer is a published sandbox key: the
|
|
2692
2736
|
mechanics check out, but it is not production
|
|
2693
2737
|
assurance
|
|
2694
2738
|
UNPINNED_SIGNER 3 signatures are valid but a signer is not in
|
|
2695
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)
|
|
2696
2743
|
REVOKED_SIGNER / MIXED_TRUST 3
|
|
2697
2744
|
any integrity or signature failure exits 2 (failed closed)
|
|
2698
2745
|
|
|
2699
|
-
The SDK ships the
|
|
2700
|
-
|
|
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).
|
|
2701
2750
|
|
|
2702
2751
|
PDF receipt verification:
|
|
2703
2752
|
verify-pdf-receipt reads downloaded PDF receipt bytes, checks the PDF header,
|
package/package.json
CHANGED