@emilia-protocol/gate 0.11.0 → 0.14.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 +80 -0
- package/README.md +310 -0
- package/action-control-manifest.js +3 -268
- package/action-escrow-custodian.js +3 -394
- package/action-escrow-evidence.js +3 -858
- package/action-escrow-package.js +3 -1668
- package/action-escrow-postgres.js +3 -337
- package/action-escrow-state.js +3 -396
- package/action-escrow-verifiers.js +3 -331
- package/action-escrow.js +3 -2447
- package/action-packs.js +3 -140
- package/adapters/_kit.js +3 -104
- package/adapters/aws.js +3 -108
- package/adapters/cloudflare.js +3 -54
- package/adapters/gcp.js +3 -70
- package/adapters/github.js +3 -109
- package/adapters/jira.js +3 -55
- package/adapters/k8s.js +3 -70
- package/adapters/linear.js +3 -55
- package/adapters/salesforce.js +3 -55
- package/adapters/stripe.js +3 -81
- package/adapters/supabase.js +3 -121
- package/adapters/terraform.js +3 -59
- package/adapters/vercel.js +3 -84
- package/aec-execution.js +3 -312
- package/breakglass.js +3 -582
- package/capability-receipt.js +4 -0
- package/cf1-conformance.js +3 -106
- package/challenge-store.js +3 -69
- package/control-plane.js +3 -340
- package/coverage.js +3 -721
- package/demo.mjs +1 -1
- package/deployment-attestation.js +3 -247
- package/dist/action-control-manifest.d.ts +82 -0
- package/dist/action-control-manifest.d.ts.map +1 -0
- package/dist/action-control-manifest.js +422 -0
- package/dist/action-control-manifest.js.map +1 -0
- package/dist/action-escrow-custodian.d.ts +74 -0
- package/dist/action-escrow-custodian.d.ts.map +1 -0
- package/dist/action-escrow-custodian.js +363 -0
- package/dist/action-escrow-custodian.js.map +1 -0
- package/dist/action-escrow-evidence.d.ts +130 -0
- package/dist/action-escrow-evidence.d.ts.map +1 -0
- package/dist/action-escrow-evidence.js +1012 -0
- package/dist/action-escrow-evidence.js.map +1 -0
- package/dist/action-escrow-package.d.ts +10 -0
- package/dist/action-escrow-package.d.ts.map +1 -0
- package/dist/action-escrow-package.js +1583 -0
- package/dist/action-escrow-package.js.map +1 -0
- package/dist/action-escrow-postgres.d.ts +62 -0
- package/dist/action-escrow-postgres.d.ts.map +1 -0
- package/dist/action-escrow-postgres.js +339 -0
- package/dist/action-escrow-postgres.js.map +1 -0
- package/dist/action-escrow-state.d.ts +141 -0
- package/dist/action-escrow-state.d.ts.map +1 -0
- package/dist/action-escrow-state.js +413 -0
- package/dist/action-escrow-state.js.map +1 -0
- package/dist/action-escrow-verifiers.d.ts +65 -0
- package/dist/action-escrow-verifiers.d.ts.map +1 -0
- package/dist/action-escrow-verifiers.js +421 -0
- package/dist/action-escrow-verifiers.js.map +1 -0
- package/dist/action-escrow.d.ts +112 -0
- package/dist/action-escrow.d.ts.map +1 -0
- package/dist/action-escrow.js +2661 -0
- package/dist/action-escrow.js.map +1 -0
- package/dist/action-packs.d.ts +54 -0
- package/dist/action-packs.d.ts.map +1 -0
- package/dist/action-packs.js +143 -0
- package/dist/action-packs.js.map +1 -0
- package/dist/adapters/_kit.d.ts +50 -0
- package/dist/adapters/_kit.d.ts.map +1 -0
- package/dist/adapters/_kit.js +98 -0
- package/dist/adapters/_kit.js.map +1 -0
- package/dist/adapters/aws.d.ts +158 -0
- package/dist/adapters/aws.d.ts.map +1 -0
- package/dist/adapters/aws.js +136 -0
- package/dist/adapters/aws.js.map +1 -0
- package/dist/adapters/cloudflare.d.ts +116 -0
- package/dist/adapters/cloudflare.d.ts.map +1 -0
- package/dist/adapters/cloudflare.js +75 -0
- package/dist/adapters/cloudflare.js.map +1 -0
- package/dist/adapters/gcp.d.ts +139 -0
- package/dist/adapters/gcp.d.ts.map +1 -0
- package/dist/adapters/gcp.js +69 -0
- package/dist/adapters/gcp.js.map +1 -0
- package/dist/adapters/github.d.ts +123 -0
- package/dist/adapters/github.d.ts.map +1 -0
- package/dist/adapters/github.js +105 -0
- package/dist/adapters/github.js.map +1 -0
- package/dist/adapters/jira.d.ts +109 -0
- package/dist/adapters/jira.d.ts.map +1 -0
- package/dist/adapters/jira.js +54 -0
- package/dist/adapters/jira.js.map +1 -0
- package/dist/adapters/k8s.d.ts +139 -0
- package/dist/adapters/k8s.d.ts.map +1 -0
- package/dist/adapters/k8s.js +69 -0
- package/dist/adapters/k8s.js.map +1 -0
- package/dist/adapters/linear.d.ts +109 -0
- package/dist/adapters/linear.d.ts.map +1 -0
- package/dist/adapters/linear.js +54 -0
- package/dist/adapters/linear.js.map +1 -0
- package/dist/adapters/salesforce.d.ts +109 -0
- package/dist/adapters/salesforce.d.ts.map +1 -0
- package/dist/adapters/salesforce.js +54 -0
- package/dist/adapters/salesforce.js.map +1 -0
- package/dist/adapters/stripe.d.ts +116 -0
- package/dist/adapters/stripe.d.ts.map +1 -0
- package/dist/adapters/stripe.js +77 -0
- package/dist/adapters/stripe.js.map +1 -0
- package/dist/adapters/supabase.d.ts +127 -0
- package/dist/adapters/supabase.d.ts.map +1 -0
- package/dist/adapters/supabase.js +112 -0
- package/dist/adapters/supabase.js.map +1 -0
- package/dist/adapters/terraform.d.ts +109 -0
- package/dist/adapters/terraform.d.ts.map +1 -0
- package/dist/adapters/terraform.js +58 -0
- package/dist/adapters/terraform.js.map +1 -0
- package/dist/adapters/vercel.d.ts +114 -0
- package/dist/adapters/vercel.d.ts.map +1 -0
- package/dist/adapters/vercel.js +81 -0
- package/dist/adapters/vercel.js.map +1 -0
- package/dist/aec-execution.d.ts +107 -0
- package/dist/aec-execution.d.ts.map +1 -0
- package/dist/aec-execution.js +334 -0
- package/dist/aec-execution.js.map +1 -0
- package/dist/breakglass.d.ts +205 -0
- package/dist/breakglass.d.ts.map +1 -0
- package/dist/breakglass.js +627 -0
- package/dist/breakglass.js.map +1 -0
- package/dist/capability-receipt.d.ts +601 -0
- package/dist/capability-receipt.d.ts.map +1 -0
- package/dist/capability-receipt.js +1177 -0
- package/dist/capability-receipt.js.map +1 -0
- package/dist/cf1-conformance.d.ts +83 -0
- package/dist/cf1-conformance.d.ts.map +1 -0
- package/dist/cf1-conformance.js +94 -0
- package/dist/cf1-conformance.js.map +1 -0
- package/dist/challenge-store.d.ts +20 -0
- package/dist/challenge-store.d.ts.map +1 -0
- package/dist/challenge-store.js +62 -0
- package/dist/challenge-store.js.map +1 -0
- package/dist/control-plane.d.ts +136 -0
- package/dist/control-plane.d.ts.map +1 -0
- package/dist/control-plane.js +349 -0
- package/dist/control-plane.js.map +1 -0
- package/dist/coverage.d.ts +156 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +768 -0
- package/dist/coverage.js.map +1 -0
- package/dist/deployment-attestation.d.ts +93 -0
- package/dist/deployment-attestation.d.ts.map +1 -0
- package/dist/deployment-attestation.js +262 -0
- package/dist/deployment-attestation.js.map +1 -0
- package/dist/eg1-conformance.d.ts +286 -0
- package/dist/eg1-conformance.d.ts.map +1 -0
- package/dist/eg1-conformance.js +379 -0
- package/dist/eg1-conformance.js.map +1 -0
- package/dist/enterprise.d.ts +88 -0
- package/dist/enterprise.d.ts.map +1 -0
- package/dist/enterprise.js +194 -0
- package/dist/enterprise.js.map +1 -0
- package/dist/evidence-postgres.d.ts +123 -0
- package/dist/evidence-postgres.d.ts.map +1 -0
- package/dist/evidence-postgres.js +343 -0
- package/dist/evidence-postgres.js.map +1 -0
- package/dist/evidence.d.ts +113 -0
- package/dist/evidence.d.ts.map +1 -0
- package/dist/evidence.js +369 -0
- package/dist/evidence.js.map +1 -0
- package/dist/execution-binding.d.ts +49 -0
- package/dist/execution-binding.d.ts.map +1 -0
- package/dist/execution-binding.js +243 -0
- package/dist/execution-binding.js.map +1 -0
- package/dist/formal-runtime-map.d.ts +42 -0
- package/dist/formal-runtime-map.d.ts.map +1 -0
- package/dist/formal-runtime-map.js +23 -0
- package/dist/formal-runtime-map.js.map +1 -0
- package/dist/index.d.ts +1003 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1737 -0
- package/dist/index.js.map +1 -0
- package/dist/key-registry.d.ts +60 -0
- package/dist/key-registry.d.ts.map +1 -0
- package/dist/key-registry.js +144 -0
- package/dist/key-registry.js.map +1 -0
- package/dist/mcp.d.ts +53 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +112 -0
- package/dist/mcp.js.map +1 -0
- package/dist/metering.d.ts +80 -0
- package/dist/metering.d.ts.map +1 -0
- package/dist/metering.js +227 -0
- package/dist/metering.js.map +1 -0
- package/dist/metrics.d.ts +68 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +242 -0
- package/dist/metrics.js.map +1 -0
- package/dist/network-witness.d.ts +167 -0
- package/dist/network-witness.d.ts.map +1 -0
- package/dist/network-witness.js +520 -0
- package/dist/network-witness.js.map +1 -0
- package/dist/proposal-to-effect.d.ts +146 -0
- package/dist/proposal-to-effect.d.ts.map +1 -0
- package/dist/proposal-to-effect.js +427 -0
- package/dist/proposal-to-effect.js.map +1 -0
- package/dist/protocol-state.d.ts +141 -0
- package/dist/protocol-state.d.ts.map +1 -0
- package/dist/protocol-state.js +106 -0
- package/dist/protocol-state.js.map +1 -0
- package/dist/receipt-program.d.ts +59 -0
- package/dist/receipt-program.d.ts.map +1 -0
- package/dist/receipt-program.js +1053 -0
- package/dist/receipt-program.js.map +1 -0
- package/dist/reliance-kernel.d.ts +66 -0
- package/dist/reliance-kernel.d.ts.map +1 -0
- package/dist/reliance-kernel.js +103 -0
- package/dist/reliance-kernel.js.map +1 -0
- package/dist/reliance-packet.d.ts +67 -0
- package/dist/reliance-packet.d.ts.map +1 -0
- package/dist/reliance-packet.js +176 -0
- package/dist/reliance-packet.js.map +1 -0
- package/dist/remedy-program-postgres.d.ts +37 -0
- package/dist/remedy-program-postgres.d.ts.map +1 -0
- package/dist/remedy-program-postgres.js +291 -0
- package/dist/remedy-program-postgres.js.map +1 -0
- package/dist/remedy-program-receipt.d.ts +97 -0
- package/dist/remedy-program-receipt.d.ts.map +1 -0
- package/dist/remedy-program-receipt.js +817 -0
- package/dist/remedy-program-receipt.js.map +1 -0
- package/dist/remedy-program.d.ts +76 -0
- package/dist/remedy-program.d.ts.map +1 -0
- package/dist/remedy-program.js +1346 -0
- package/dist/remedy-program.js.map +1 -0
- package/dist/reports/art14.d.ts +101 -0
- package/dist/reports/art14.d.ts.map +1 -0
- package/dist/reports/art14.js +340 -0
- package/dist/reports/art14.js.map +1 -0
- package/dist/reports/assurance-package.d.ts +197 -0
- package/dist/reports/assurance-package.d.ts.map +1 -0
- package/dist/reports/assurance-package.js +313 -0
- package/dist/reports/assurance-package.js.map +1 -0
- package/dist/reports/auditor-workpaper.d.ts +194 -0
- package/dist/reports/auditor-workpaper.d.ts.map +1 -0
- package/dist/reports/auditor-workpaper.js +545 -0
- package/dist/reports/auditor-workpaper.js.map +1 -0
- package/dist/reports/external-verification.d.ts +76 -0
- package/dist/reports/external-verification.d.ts.map +1 -0
- package/dist/reports/external-verification.js +209 -0
- package/dist/reports/external-verification.js.map +1 -0
- package/dist/reports/reperform.d.ts +122 -0
- package/dist/reports/reperform.d.ts.map +1 -0
- package/dist/reports/reperform.js +432 -0
- package/dist/reports/reperform.js.map +1 -0
- package/dist/reports/underwriter.d.ts +127 -0
- package/dist/reports/underwriter.d.ts.map +1 -0
- package/dist/reports/underwriter.js +348 -0
- package/dist/reports/underwriter.js.map +1 -0
- package/dist/retention.d.ts +88 -0
- package/dist/retention.d.ts.map +1 -0
- package/dist/retention.js +90 -0
- package/dist/retention.js.map +1 -0
- package/dist/roster.d.ts +113 -0
- package/dist/roster.d.ts.map +1 -0
- package/dist/roster.js +261 -0
- package/dist/roster.js.map +1 -0
- package/dist/runtime-monitor.d.ts +132 -0
- package/dist/runtime-monitor.d.ts.map +1 -0
- package/dist/runtime-monitor.js +197 -0
- package/dist/runtime-monitor.js.map +1 -0
- package/dist/settlement.d.ts +68 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +306 -0
- package/dist/settlement.js.map +1 -0
- package/dist/siem.d.ts +261 -0
- package/dist/siem.d.ts.map +1 -0
- package/dist/siem.js +247 -0
- package/dist/siem.js.map +1 -0
- package/dist/store-postgres.d.ts +107 -0
- package/dist/store-postgres.d.ts.map +1 -0
- package/dist/store-postgres.js +152 -0
- package/dist/store-postgres.js.map +1 -0
- package/dist/store.d.ts +95 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +202 -0
- package/dist/store.js.map +1 -0
- package/dist/strict-json.d.ts +14 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +132 -0
- package/dist/strict-json.js.map +1 -0
- package/dist/trust-program-adapters.d.ts +122 -0
- package/dist/trust-program-adapters.d.ts.map +1 -0
- package/dist/trust-program-adapters.js +802 -0
- package/dist/trust-program-adapters.js.map +1 -0
- package/dist/trust-program-postgres.d.ts +41 -0
- package/dist/trust-program-postgres.d.ts.map +1 -0
- package/dist/trust-program-postgres.js +346 -0
- package/dist/trust-program-postgres.js.map +1 -0
- package/dist/trust-program-revocation.d.ts +206 -0
- package/dist/trust-program-revocation.d.ts.map +1 -0
- package/dist/trust-program-revocation.js +600 -0
- package/dist/trust-program-revocation.js.map +1 -0
- package/dist/trust-program.d.ts +197 -0
- package/dist/trust-program.d.ts.map +1 -0
- package/dist/trust-program.js +1351 -0
- package/dist/trust-program.js.map +1 -0
- package/dist/witness-postgres.d.ts +43 -0
- package/dist/witness-postgres.d.ts.map +1 -0
- package/dist/witness-postgres.js +92 -0
- package/dist/witness-postgres.js.map +1 -0
- package/dist/zk-range-proof.d.ts +78 -0
- package/dist/zk-range-proof.d.ts.map +1 -0
- package/dist/zk-range-proof.js +228 -0
- package/dist/zk-range-proof.js.map +1 -0
- package/eg1-conformance.js +3 -404
- package/enterprise.js +3 -180
- package/ep-assure.mjs +1 -0
- package/evidence-postgres.js +3 -356
- package/evidence.js +4 -360
- package/execution-binding.js +3 -212
- package/formal-runtime-map.js +4 -0
- package/index.js +4 -1249
- package/key-registry.js +3 -134
- package/mcp.js +3 -109
- package/metering.js +3 -226
- package/metrics.js +3 -231
- package/network-witness.js +3 -499
- package/package.json +35 -4
- package/proposal-to-effect.js +4 -0
- package/receipt-program.js +4 -0
- package/reliance-kernel.js +3 -112
- package/reliance-packet.js +3 -175
- package/remedy-program-postgres.js +4 -0
- package/remedy-program-receipt.js +4 -0
- package/remedy-program.js +4 -0
- package/reports/art14.js +0 -0
- package/reports/assurance-package.js +2 -312
- package/reports/auditor-workpaper.js +3 -537
- package/reports/external-verification.js +3 -222
- package/reports/reperform.js +3 -424
- package/reports/underwriter.js +3 -339
- package/retention.js +3 -84
- package/roster.js +3 -264
- package/runtime-monitor.js +4 -0
- package/settlement.js +3 -299
- package/siem.js +3 -235
- package/src/action-control-manifest.ts +424 -0
- package/src/action-escrow-custodian.ts +427 -0
- package/src/action-escrow-evidence.ts +1178 -0
- package/src/action-escrow-package.ts +1821 -0
- package/src/action-escrow-postgres.ts +366 -0
- package/src/action-escrow-state.ts +498 -0
- package/src/action-escrow-verifiers.ts +484 -0
- package/src/action-escrow.ts +3039 -0
- package/src/action-packs.ts +170 -0
- package/src/adapters/_kit.ts +117 -0
- package/src/adapters/aws.ts +142 -0
- package/src/adapters/cloudflare.ts +78 -0
- package/src/adapters/gcp.ts +71 -0
- package/src/adapters/github.ts +110 -0
- package/src/adapters/jira.ts +56 -0
- package/src/adapters/k8s.ts +71 -0
- package/src/adapters/linear.ts +56 -0
- package/src/adapters/salesforce.ts +56 -0
- package/src/adapters/stripe.ts +82 -0
- package/src/adapters/supabase.ts +122 -0
- package/src/adapters/terraform.ts +60 -0
- package/src/adapters/vercel.ts +85 -0
- package/src/aec-execution.ts +354 -0
- package/src/breakglass.ts +647 -0
- package/src/capability-receipt.ts +1258 -0
- package/src/cf1-conformance.ts +120 -0
- package/src/challenge-store.ts +70 -0
- package/src/control-plane.ts +374 -0
- package/src/coverage.ts +832 -0
- package/src/deployment-attestation.ts +259 -0
- package/src/eg1-conformance.ts +471 -0
- package/src/enterprise.ts +195 -0
- package/src/evidence-postgres.ts +374 -0
- package/src/evidence.ts +367 -0
- package/src/execution-binding.ts +236 -0
- package/src/formal-runtime-map.ts +24 -0
- package/src/index.ts +2127 -0
- package/src/key-registry.ts +150 -0
- package/src/mcp.ts +120 -0
- package/src/metering.ts +237 -0
- package/src/metrics.ts +232 -0
- package/src/network-witness.ts +585 -0
- package/src/proposal-to-effect.ts +571 -0
- package/src/protocol-state.ts +143 -0
- package/src/protocol-state.typecheck.ts +94 -0
- package/src/receipt-program.ts +1105 -0
- package/src/reliance-kernel.ts +119 -0
- package/src/reliance-packet.ts +206 -0
- package/src/remedy-program-postgres.ts +367 -0
- package/src/remedy-program-receipt.ts +891 -0
- package/src/remedy-program.ts +1388 -0
- package/src/reports/art14.ts +361 -0
- package/src/reports/assurance-package.ts +330 -0
- package/src/reports/auditor-workpaper.ts +558 -0
- package/src/reports/external-verification.ts +232 -0
- package/src/reports/reperform.ts +441 -0
- package/src/reports/underwriter.ts +356 -0
- package/src/retention.ts +100 -0
- package/src/roster.ts +273 -0
- package/src/runtime-monitor.ts +217 -0
- package/src/settlement.ts +313 -0
- package/src/siem.ts +247 -0
- package/src/store-postgres.ts +167 -0
- package/src/store.ts +214 -0
- package/src/strict-json.ts +115 -0
- package/src/trust-program-adapters.ts +847 -0
- package/src/trust-program-postgres.ts +429 -0
- package/src/trust-program-revocation.ts +751 -0
- package/src/trust-program.ts +1460 -0
- package/src/witness-postgres.ts +106 -0
- package/src/zk-range-proof.ts +250 -0
- package/store-postgres.js +3 -161
- package/store.js +4 -198
- package/strict-json.js +3 -102
- package/trust-program-adapters.js +4 -0
- package/trust-program-postgres.js +4 -0
- package/trust-program-revocation.js +4 -0
- package/trust-program.js +4 -0
- package/witness-postgres.js +3 -96
- package/zk-range-proof.js +4 -0
package/demo.mjs
CHANGED
|
@@ -54,7 +54,7 @@ line(` 2. release_payment, no receipt -> ${r(await gate.check({ select
|
|
|
54
54
|
line(` 3. release_payment, software receipt -> ${r(await gate.check({ selector: PAY, receipt: receipt('allow'), observedAction: action }))} (needs class_a)`);
|
|
55
55
|
const good = receipt('allow_with_signoff');
|
|
56
56
|
line(` 4. release_payment, observed drift -> ${r(await gate.check({ selector: PAY, receipt: good, observedAction: { ...action, amount_usd: 999999 } }))}`);
|
|
57
|
-
const run = await gate.run({ selector: PAY, receipt: good, observedAction: action }, async () => ({ released: true, id: 'wire_123' }));
|
|
57
|
+
const run = await gate.run({ selector: PAY, receipt: /** @type {any} */ (good), observedAction: /** @type {any} */ (action) }, async () => ({ released: true, id: 'wire_123' }));
|
|
58
58
|
const a4 = run.authorization;
|
|
59
59
|
line(` 5. release_payment, class_a + bound -> ${r(a4)}`);
|
|
60
60
|
const exec = run.execution;
|
|
@@ -1,248 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
* profile pins a verifier selected by the relying party, and that verifier may
|
|
6
|
-
* consume EAT/RATS, App Attest, Play Integrity, TPM, confidential-compute, or
|
|
7
|
-
* workload-identity evidence.
|
|
8
|
-
*/
|
|
9
|
-
import { canonicalize, hashCanonical } from './execution-binding.js';
|
|
10
|
-
|
|
11
|
-
export const DEPLOYMENT_PROFILE_VERSION = 'EP-GATE-DEPLOYMENT-PROFILE-v1';
|
|
12
|
-
export const DEPLOYMENT_ATTESTATION_VERDICTS = Object.freeze([
|
|
13
|
-
'attested',
|
|
14
|
-
'refuse_profile_invalid',
|
|
15
|
-
'refuse_verifier_unpinned',
|
|
16
|
-
'refuse_evidence_invalid',
|
|
17
|
-
'refuse_verifier_error',
|
|
18
|
-
'refuse_context_mismatch',
|
|
19
|
-
'refuse_measurement_mismatch',
|
|
20
|
-
'refuse_stale',
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
const DIGEST_RE = /^sha256:[0-9a-f]{64}$/;
|
|
24
|
-
const RFC3339 = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?Z$/;
|
|
25
|
-
|
|
26
|
-
function isPlainObject(value) {
|
|
27
|
-
if (value === null || typeof value !== 'object' || Array.isArray(value)) return false;
|
|
28
|
-
const prototype = Object.getPrototypeOf(value);
|
|
29
|
-
return prototype === Object.prototype || prototype === null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function strictInstantMs(value) {
|
|
33
|
-
if (typeof value !== 'string') return NaN;
|
|
34
|
-
const match = value.match(RFC3339);
|
|
35
|
-
if (!match) return NaN;
|
|
36
|
-
const [, y, m, d, h, min, s] = match;
|
|
37
|
-
const calendar = new Date(0);
|
|
38
|
-
calendar.setUTCFullYear(Number(y), Number(m) - 1, Number(d));
|
|
39
|
-
calendar.setUTCHours(Number(h), Number(min), Number(s), 0);
|
|
40
|
-
if (calendar.toISOString().slice(0, 19) !== `${y}-${m}-${d}T${h}:${min}:${s}`) return NaN;
|
|
41
|
-
const parsed = Date.parse(value);
|
|
42
|
-
return Number.isFinite(parsed) ? parsed : NaN;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function string(value, max = 512) {
|
|
46
|
-
return typeof value === 'string' && value.length > 0 && value.length <= max && !/[\u0000-\u001f\u007f]/.test(value);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function digest(value) {
|
|
50
|
-
return typeof value === 'string' && DIGEST_RE.test(value);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function exactKeys(value, allowed) {
|
|
54
|
-
return isPlainObject(value) && Object.keys(value).every((key) => allowed.has(key));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function validateProfile(profile) {
|
|
58
|
-
if (!exactKeys(profile, new Set([
|
|
59
|
-
'@version', 'profile_id', 'verifier_id', 'evidence_type', 'gate_id', 'environment_id',
|
|
60
|
-
'audience', 'nonce', 'max_age_sec', 'max_future_skew_sec', 'required_measurements',
|
|
61
|
-
]))) return 'profile_shape_invalid';
|
|
62
|
-
if (profile['@version'] !== DEPLOYMENT_PROFILE_VERSION) return 'profile_version_invalid';
|
|
63
|
-
for (const field of ['profile_id', 'verifier_id', 'evidence_type', 'gate_id', 'environment_id', 'audience']) {
|
|
64
|
-
if (!string(profile[field])) return `profile_${field}_invalid`;
|
|
65
|
-
}
|
|
66
|
-
if (!string(profile.nonce, 1024)) return 'profile_nonce_invalid';
|
|
67
|
-
if (!Number.isSafeInteger(profile.max_age_sec) || profile.max_age_sec < 1 || profile.max_age_sec > 86_400) {
|
|
68
|
-
return 'profile_max_age_invalid';
|
|
69
|
-
}
|
|
70
|
-
if (!Number.isSafeInteger(profile.max_future_skew_sec)
|
|
71
|
-
|| profile.max_future_skew_sec < 0 || profile.max_future_skew_sec > 300) {
|
|
72
|
-
return 'profile_future_skew_invalid';
|
|
73
|
-
}
|
|
74
|
-
if (!isPlainObject(profile.required_measurements)
|
|
75
|
-
|| Object.keys(profile.required_measurements).length === 0
|
|
76
|
-
|| Object.keys(profile.required_measurements).length > 32) return 'profile_measurements_invalid';
|
|
77
|
-
for (const [name, value] of Object.entries(profile.required_measurements)) {
|
|
78
|
-
if (!string(name, 128) || !digest(value)) return 'profile_measurements_invalid';
|
|
79
|
-
}
|
|
80
|
-
try { canonicalize(profile); } catch { return 'profile_canonicalization_invalid'; }
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function deploymentProfileDigest(profile) {
|
|
85
|
-
const invalid = validateProfile(profile);
|
|
86
|
-
if (invalid) throw new TypeError(invalid);
|
|
87
|
-
return `sha256:${hashCanonical(profile)}`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function fail(verdict, profileHash = null, extra = {}) {
|
|
91
|
-
return {
|
|
92
|
-
accepted: false,
|
|
93
|
-
verified: false,
|
|
94
|
-
verdict,
|
|
95
|
-
profile_hash: profileHash,
|
|
96
|
-
checks: {
|
|
97
|
-
profile: verdict !== 'refuse_profile_invalid',
|
|
98
|
-
verifier: false,
|
|
99
|
-
evidence: false,
|
|
100
|
-
context: false,
|
|
101
|
-
freshness: false,
|
|
102
|
-
measurements: false,
|
|
103
|
-
...extra,
|
|
104
|
-
},
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function verifierFor(verifiers, verifierId) {
|
|
109
|
-
let verifier;
|
|
110
|
-
if (verifiers instanceof Map) verifier = verifiers.get(verifierId);
|
|
111
|
-
else if (isPlainObject(verifiers)) {
|
|
112
|
-
verifier = Object.getOwnPropertyDescriptor(verifiers, verifierId)?.value;
|
|
113
|
-
}
|
|
114
|
-
return typeof verifier === 'function' ? verifier : null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Verify deployment evidence under a relying-party-pinned profile.
|
|
119
|
-
*
|
|
120
|
-
* The selected verifier is taken from `profile.verifier_id`, which is a trusted
|
|
121
|
-
* input. A presenter cannot select its own verifier by labeling the evidence.
|
|
122
|
-
* The verifier returns normalized claims; this kernel independently compares
|
|
123
|
-
* every context and measurement claim with the profile.
|
|
124
|
-
*/
|
|
125
|
-
export async function verifyDeploymentAttestation(evidence, options = {}) {
|
|
126
|
-
let profile;
|
|
127
|
-
let invalid;
|
|
128
|
-
try {
|
|
129
|
-
invalid = validateProfile(options.profile);
|
|
130
|
-
profile = invalid ? options.profile : JSON.parse(canonicalize(options.profile));
|
|
131
|
-
} catch {
|
|
132
|
-
invalid = 'profile_hostile_input';
|
|
133
|
-
profile = null;
|
|
134
|
-
}
|
|
135
|
-
if (invalid) return { ...fail('refuse_profile_invalid'), reason: invalid };
|
|
136
|
-
const profileHash = deploymentProfileDigest(profile);
|
|
137
|
-
const verifier = verifierFor(options.verifiers, profile.verifier_id);
|
|
138
|
-
if (typeof verifier !== 'function') {
|
|
139
|
-
return { ...fail('refuse_verifier_unpinned', profileHash, { profile: true }), reason: 'pinned_verifier_missing' };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
let claims;
|
|
143
|
-
try {
|
|
144
|
-
claims = await verifier(evidence, Object.freeze({
|
|
145
|
-
evidence_type: profile.evidence_type,
|
|
146
|
-
audience: profile.audience,
|
|
147
|
-
nonce: profile.nonce,
|
|
148
|
-
gate_id: profile.gate_id,
|
|
149
|
-
environment_id: profile.environment_id,
|
|
150
|
-
}));
|
|
151
|
-
} catch {
|
|
152
|
-
return {
|
|
153
|
-
...fail('refuse_verifier_error', profileHash, { profile: true, verifier: true }),
|
|
154
|
-
reason: 'pinned_verifier_threw',
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
if (!isPlainObject(claims) || claims.verified !== true || !isPlainObject(claims.measurements)) {
|
|
158
|
-
return {
|
|
159
|
-
...fail('refuse_evidence_invalid', profileHash, { profile: true, verifier: true }),
|
|
160
|
-
reason: 'attestation_not_verified',
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
try { claims = JSON.parse(canonicalize(claims)); } catch {
|
|
164
|
-
return {
|
|
165
|
-
...fail('refuse_evidence_invalid', profileHash, { profile: true, verifier: true }),
|
|
166
|
-
reason: 'attestation_claims_not_canonical_json',
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const contextMatches = claims.verifier_id === profile.verifier_id
|
|
171
|
-
&& claims.evidence_type === profile.evidence_type
|
|
172
|
-
&& claims.gate_id === profile.gate_id
|
|
173
|
-
&& claims.environment_id === profile.environment_id
|
|
174
|
-
&& claims.audience === profile.audience
|
|
175
|
-
&& claims.nonce === profile.nonce;
|
|
176
|
-
if (!contextMatches) {
|
|
177
|
-
return {
|
|
178
|
-
...fail('refuse_context_mismatch', profileHash, {
|
|
179
|
-
profile: true, verifier: true, evidence: true,
|
|
180
|
-
}),
|
|
181
|
-
reason: 'attestation_context_mismatch',
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const now = options.now === undefined ? Date.now() : Number(options.now);
|
|
186
|
-
const issuedAt = strictInstantMs(claims.issued_at);
|
|
187
|
-
const expiresAt = strictInstantMs(claims.expires_at);
|
|
188
|
-
if (!Number.isFinite(now) || !Number.isFinite(issuedAt) || !Number.isFinite(expiresAt)
|
|
189
|
-
|| expiresAt < issuedAt
|
|
190
|
-
|| issuedAt > now + (profile.max_future_skew_sec * 1000)
|
|
191
|
-
|| now - issuedAt > profile.max_age_sec * 1000
|
|
192
|
-
|| now >= expiresAt) {
|
|
193
|
-
return {
|
|
194
|
-
...fail('refuse_stale', profileHash, {
|
|
195
|
-
profile: true, verifier: true, evidence: true, context: true,
|
|
196
|
-
}),
|
|
197
|
-
reason: 'attestation_outside_freshness_window',
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const mismatched = [];
|
|
202
|
-
const missing = [];
|
|
203
|
-
for (const [name, expected] of Object.entries(profile.required_measurements)) {
|
|
204
|
-
if (!Object.hasOwn(claims.measurements, name)) missing.push(name);
|
|
205
|
-
else if (claims.measurements[name] !== expected) mismatched.push(name);
|
|
206
|
-
}
|
|
207
|
-
if (missing.length || mismatched.length) {
|
|
208
|
-
return {
|
|
209
|
-
...fail('refuse_measurement_mismatch', profileHash, {
|
|
210
|
-
profile: true, verifier: true, evidence: true, context: true, freshness: true,
|
|
211
|
-
}),
|
|
212
|
-
reason: 'attestation_measurement_mismatch',
|
|
213
|
-
missing_measurements: missing,
|
|
214
|
-
mismatched_measurements: mismatched,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
return {
|
|
219
|
-
accepted: true,
|
|
220
|
-
verified: true,
|
|
221
|
-
verdict: 'attested',
|
|
222
|
-
reason: null,
|
|
223
|
-
profile_hash: profileHash,
|
|
224
|
-
verifier_id: profile.verifier_id,
|
|
225
|
-
evidence_type: profile.evidence_type,
|
|
226
|
-
gate_id: profile.gate_id,
|
|
227
|
-
environment_id: profile.environment_id,
|
|
228
|
-
issued_at: claims.issued_at,
|
|
229
|
-
expires_at: claims.expires_at,
|
|
230
|
-
measurements: Object.freeze({ ...profile.required_measurements }),
|
|
231
|
-
checks: {
|
|
232
|
-
profile: true,
|
|
233
|
-
verifier: true,
|
|
234
|
-
evidence: true,
|
|
235
|
-
context: true,
|
|
236
|
-
freshness: true,
|
|
237
|
-
measurements: true,
|
|
238
|
-
},
|
|
239
|
-
limitation: 'Attestation proves the expected workload measurements, not that every consequential route is forced through that workload.',
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
export default {
|
|
244
|
-
DEPLOYMENT_PROFILE_VERSION,
|
|
245
|
-
DEPLOYMENT_ATTESTATION_VERDICTS,
|
|
246
|
-
deploymentProfileDigest,
|
|
247
|
-
verifyDeploymentAttestation,
|
|
248
|
-
};
|
|
2
|
+
// Compatibility entry point for the TypeScript deployment-attestation module.
|
|
3
|
+
export * from './dist/deployment-attestation.js';
|
|
4
|
+
export { default } from './dist/deployment-attestation.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
type Obj = Record<string, any>;
|
|
2
|
+
export declare const ACTION_CONTROL_MANIFEST_VERSION = "EP-ACTION-CONTROL-MANIFEST-v0.2";
|
|
3
|
+
export declare const ACTION_CONTROL_SCHEMA_URL = "https://www.emiliaprotocol.ai/docs/schemas/agent-action-control-manifest-v0.2.schema.json";
|
|
4
|
+
export declare const ACTION_CONTROL_CONFORMANCE_LEVEL = "EG-1";
|
|
5
|
+
export declare const ACTION_CONTROL_AUTHORIZATION: Readonly<{
|
|
6
|
+
authorization_endpoint: "https://www.emiliaprotocol.ai/api/v1/approvals";
|
|
7
|
+
flow: "EP-APPROVAL-v1";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const ACTION_CONTROL_ACQUISITION_ACTION_TYPES: readonly string[];
|
|
10
|
+
export declare const ACTION_CONTROL_DEFAULTS: Readonly<{
|
|
11
|
+
decision_point: "pre_effect_commit";
|
|
12
|
+
missing_receipt: "refuse";
|
|
13
|
+
invalid_receipt: "refuse";
|
|
14
|
+
stale_receipt: "refuse";
|
|
15
|
+
replay: "one_time_consumption";
|
|
16
|
+
evidence_log: "strict";
|
|
17
|
+
}>;
|
|
18
|
+
export declare const ACTION_CONTROL_EVIDENCE_PROFILES: Readonly<{
|
|
19
|
+
authorization_receipt: "EP-RECEIPT-v1";
|
|
20
|
+
execution_attestation: "EP-EXECUTION-ATTESTATION-v1";
|
|
21
|
+
reliance_packet: "EP-RELIANCE-PACKET-v1";
|
|
22
|
+
transparency: "SCITT-compatible Signed Statement";
|
|
23
|
+
}>;
|
|
24
|
+
export declare const ACTION_CONTROL_CONFORMANCE_CHECKS: readonly string[];
|
|
25
|
+
export declare function toActionControl(action: Obj): Obj;
|
|
26
|
+
/**
|
|
27
|
+
* @param {object} [o]
|
|
28
|
+
* @param {{ name?: string, issuer?: string, manifest_url?: string }} [o.service]
|
|
29
|
+
* @param {boolean} [o.includePassThrough]
|
|
30
|
+
* @param {Array<object>} [o.extraActions]
|
|
31
|
+
*/
|
|
32
|
+
export declare function createDefaultActionControlManifest({ service, includePassThrough, extraActions, }?: {
|
|
33
|
+
service?: Obj;
|
|
34
|
+
includePassThrough?: boolean;
|
|
35
|
+
extraActions?: Obj[];
|
|
36
|
+
}): Obj;
|
|
37
|
+
export declare function findActionControl(manifest: Obj, selector?: Obj): Obj | null;
|
|
38
|
+
export declare function resolveActionControl(manifest: Obj, selector?: Obj): {
|
|
39
|
+
status: 'none';
|
|
40
|
+
action: null;
|
|
41
|
+
} | {
|
|
42
|
+
status: 'one';
|
|
43
|
+
action: Obj;
|
|
44
|
+
} | {
|
|
45
|
+
status: 'ambiguous';
|
|
46
|
+
action: null;
|
|
47
|
+
action_ids: string[];
|
|
48
|
+
};
|
|
49
|
+
export declare function validateActionControlManifest(manifest: Obj, { requireAcquisition }?: {
|
|
50
|
+
requireAcquisition?: boolean;
|
|
51
|
+
}): Obj;
|
|
52
|
+
declare const _default: {
|
|
53
|
+
ACTION_CONTROL_MANIFEST_VERSION: string;
|
|
54
|
+
ACTION_CONTROL_SCHEMA_URL: string;
|
|
55
|
+
ACTION_CONTROL_CONFORMANCE_LEVEL: string;
|
|
56
|
+
ACTION_CONTROL_AUTHORIZATION: Readonly<{
|
|
57
|
+
authorization_endpoint: "https://www.emiliaprotocol.ai/api/v1/approvals";
|
|
58
|
+
flow: "EP-APPROVAL-v1";
|
|
59
|
+
}>;
|
|
60
|
+
ACTION_CONTROL_DEFAULTS: Readonly<{
|
|
61
|
+
decision_point: "pre_effect_commit";
|
|
62
|
+
missing_receipt: "refuse";
|
|
63
|
+
invalid_receipt: "refuse";
|
|
64
|
+
stale_receipt: "refuse";
|
|
65
|
+
replay: "one_time_consumption";
|
|
66
|
+
evidence_log: "strict";
|
|
67
|
+
}>;
|
|
68
|
+
ACTION_CONTROL_EVIDENCE_PROFILES: Readonly<{
|
|
69
|
+
authorization_receipt: "EP-RECEIPT-v1";
|
|
70
|
+
execution_attestation: "EP-EXECUTION-ATTESTATION-v1";
|
|
71
|
+
reliance_packet: "EP-RELIANCE-PACKET-v1";
|
|
72
|
+
transparency: "SCITT-compatible Signed Statement";
|
|
73
|
+
}>;
|
|
74
|
+
ACTION_CONTROL_CONFORMANCE_CHECKS: readonly string[];
|
|
75
|
+
toActionControl: typeof toActionControl;
|
|
76
|
+
createDefaultActionControlManifest: typeof createDefaultActionControlManifest;
|
|
77
|
+
findActionControl: typeof findActionControl;
|
|
78
|
+
resolveActionControl: typeof resolveActionControl;
|
|
79
|
+
validateActionControlManifest: typeof validateActionControlManifest;
|
|
80
|
+
};
|
|
81
|
+
export default _default;
|
|
82
|
+
//# sourceMappingURL=action-control-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-control-manifest.d.ts","sourceRoot":"","sources":["../src/action-control-manifest.ts"],"names":[],"mappings":"AAYA,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE/B,eAAO,MAAM,+BAA+B,oCAAoC,CAAC;AACjF,eAAO,MAAM,yBAAyB,8FAA8F,CAAC;AACrI,eAAO,MAAM,gCAAgC,SAAS,CAAC;AACvD,eAAO,MAAM,4BAA4B;;;EAGvC,CAAC;AAIH,eAAO,MAAM,uCAAuC,mBAElD,CAAC;AAMH,eAAO,MAAM,uBAAuB;;;;;;;EAOlC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;EAK3C,CAAC;AAEH,eAAO,MAAM,iCAAiC,mBAS5C,CAAC;AAoEH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAuBhD;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,EACjD,OAAY,EACZ,kBAAyB,EACzB,YAAiB,GAClB,GAAG;IAAE,OAAO,CAAC,EAAE,GAAG,CAAC;IAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAA;CAAO,GAAG,GAAG,CA8BnF;AAmBD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAE,GAAQ,GAAG,GAAG,GAAG,IAAI,CAG/E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAE,GAAQ,GAClE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,GAAG,CAAA;CAAE,GAC9B;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAU9D;AA2DD,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,GAAG,EACb,EAAE,kBAA0B,EAAE,GAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAAO,GACpE,GAAG,CAuHL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAED,wBAaE"}
|