@kya-os/mcp 1.16.2 → 1.18.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/AUDITABILITY.md +129 -8
- package/CHANGELOG.md +641 -0
- package/CONFORMANCE.md +12 -6
- package/README.md +67 -26
- package/SPEC.md +105 -18
- package/dist/audit/adapters/legacy-audit-log.d.ts +0 -1
- package/dist/audit/adapters/mcp.d.ts +0 -1
- package/dist/audit/adapters/mcp.js +35 -20
- package/dist/audit/adapters/mcp.js.map +1 -1
- package/dist/audit/adapters/references.d.ts +9 -0
- package/dist/audit/adapters/references.js +22 -0
- package/dist/audit/adapters/references.js.map +1 -0
- package/dist/audit/assurance.d.ts +0 -1
- package/dist/audit/checkpoint-coordinator.d.ts +0 -1
- package/dist/audit/checkpoint.d.ts +17 -1
- package/dist/audit/checkpoint.js +76 -21
- package/dist/audit/checkpoint.js.map +1 -1
- package/dist/audit/cli.d.ts +0 -1
- package/dist/audit/crypto.d.ts +0 -1
- package/dist/audit/crypto.js +12 -3
- package/dist/audit/crypto.js.map +1 -1
- package/dist/audit/errors.d.ts +0 -1
- package/dist/audit/evidence.d.ts +0 -1
- package/dist/audit/index.d.ts +0 -1
- package/dist/audit/integrity.d.ts +0 -1
- package/dist/audit/merkle.d.ts +0 -1
- package/dist/audit/mirror-service.d.ts +0 -1
- package/dist/audit/projection.d.ts +1 -1
- package/dist/audit/projection.js +23 -2
- package/dist/audit/projection.js.map +1 -1
- package/dist/audit/providers/anchor.d.ts +0 -1
- package/dist/audit/providers/evidence.d.ts +0 -1
- package/dist/audit/providers/journal.d.ts +0 -1
- package/dist/audit/providers/memory-journal.d.ts +0 -1
- package/dist/audit/providers/observer.d.ts +0 -1
- package/dist/audit/providers/outbox.d.ts +35 -6
- package/dist/audit/providers/outbox.js +46 -8
- package/dist/audit/providers/outbox.js.map +1 -1
- package/dist/audit/providers/recorder-client.d.ts +0 -1
- package/dist/audit/providers/source-state.d.ts +24 -2
- package/dist/audit/providers/source-state.js +65 -44
- package/dist/audit/providers/source-state.js.map +1 -1
- package/dist/audit/read-contract.d.ts +0 -1
- package/dist/audit/read-service.d.ts +2 -3
- package/dist/audit/read-service.js +17 -12
- package/dist/audit/read-service.js.map +1 -1
- package/dist/audit/recorder-service.d.ts +33 -5
- package/dist/audit/recorder-service.js +116 -20
- package/dist/audit/recorder-service.js.map +1 -1
- package/dist/audit/reference-recorder.d.ts +0 -1
- package/dist/audit/replay-bundle.d.ts +0 -1
- package/dist/audit/replay-bundle.js +143 -36
- package/dist/audit/replay-bundle.js.map +1 -1
- package/dist/audit/schemas.d.ts +0 -1
- package/dist/audit/service.d.ts +6 -3
- package/dist/audit/service.js +55 -24
- package/dist/audit/service.js.map +1 -1
- package/dist/audit/testing/index.d.ts +0 -1
- package/dist/audit/testing/provider-contracts.d.ts +1 -2
- package/dist/audit/testing/provider-contracts.js +32 -2
- package/dist/audit/testing/provider-contracts.js.map +1 -1
- package/dist/audit/types.d.ts +0 -1
- package/dist/audit/verifier.d.ts +57 -5
- package/dist/audit/verifier.js +240 -49
- package/dist/audit/verifier.js.map +1 -1
- package/dist/auth/handshake.d.ts +12 -1
- package/dist/auth/handshake.js +44 -11
- package/dist/auth/handshake.js.map +1 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/types.d.ts +0 -1
- package/dist/authz/accountability.d.ts +0 -1
- package/dist/authz/adapter.d.ts +0 -1
- package/dist/authz/examples/inmemory-oidc.d.ts +0 -1
- package/dist/authz/index.d.ts +0 -1
- package/dist/authz/oidc/authorize.d.ts +0 -1
- package/dist/authz/oidc/metadata.d.ts +0 -1
- package/dist/authz/oidc/oidc-adapter.d.ts +0 -1
- package/dist/authz/oidc/oidc-adapter.js +51 -3
- package/dist/authz/oidc/oidc-adapter.js.map +1 -1
- package/dist/authz/oidc/pending-flow-store.d.ts +6 -1
- package/dist/authz/oidc/pending-flow-store.js +22 -2
- package/dist/authz/oidc/pending-flow-store.js.map +1 -1
- package/dist/authz/oidc/pkce.d.ts +0 -1
- package/dist/authz/registry.d.ts +0 -1
- package/dist/authz/requirement.d.ts +0 -1
- package/dist/card/build.d.ts +0 -1
- package/dist/card/builder.d.ts +0 -1
- package/dist/card/cimd.d.ts +19 -5
- package/dist/card/cimd.js +52 -7
- package/dist/card/cimd.js.map +1 -1
- package/dist/card/delegation.d.ts +12 -4
- package/dist/card/delegation.js +38 -22
- package/dist/card/delegation.js.map +1 -1
- package/dist/card/emit.d.ts +0 -1
- package/dist/card/index.d.ts +0 -1
- package/dist/card/middleware.d.ts +0 -1
- package/dist/card/proof/build.d.ts +0 -1
- package/dist/card/proof/canonical.d.ts +0 -1
- package/dist/card/proof/canonical.js +6 -1
- package/dist/card/proof/canonical.js.map +1 -1
- package/dist/card/proof/http-sig.d.ts +0 -1
- package/dist/card/proof/index.d.ts +0 -1
- package/dist/card/proof/nonce-cache.d.ts +15 -14
- package/dist/card/proof/nonce-cache.js +22 -20
- package/dist/card/proof/nonce-cache.js.map +1 -1
- package/dist/card/proof/signer.d.ts +0 -1
- package/dist/card/proof/types.d.ts +10 -4
- package/dist/card/proof/types.js +2 -2
- package/dist/card/proof/verify.d.ts +0 -1
- package/dist/card/proof/verify.js +17 -3
- package/dist/card/proof/verify.js.map +1 -1
- package/dist/card/resolve.d.ts +0 -1
- package/dist/card/resolve.js +13 -8
- package/dist/card/resolve.js.map +1 -1
- package/dist/card/revocation.d.ts +0 -1
- package/dist/card/revocation.js +18 -6
- package/dist/card/revocation.js.map +1 -1
- package/dist/card/schema.d.ts +7 -6
- package/dist/card/schema.js +7 -3
- package/dist/card/schema.js.map +1 -1
- package/dist/card/verify.d.ts +0 -1
- package/dist/delegation/audience-validator.d.ts +0 -1
- package/dist/delegation/bitstring.d.ts +0 -1
- package/dist/delegation/cascading-revocation.d.ts +1 -2
- package/dist/delegation/cascading-revocation.js +34 -36
- package/dist/delegation/cascading-revocation.js.map +1 -1
- package/dist/delegation/chain-enforcement.d.ts +42 -5
- package/dist/delegation/chain-enforcement.js +127 -34
- package/dist/delegation/chain-enforcement.js.map +1 -1
- package/dist/delegation/delegation-graph.d.ts +30 -1
- package/dist/delegation/delegation-graph.js +33 -0
- package/dist/delegation/delegation-graph.js.map +1 -1
- package/dist/delegation/delegation-registration.d.ts +22 -0
- package/dist/delegation/delegation-registration.js +51 -0
- package/dist/delegation/delegation-registration.js.map +1 -0
- package/dist/delegation/delegation-status-entry.d.ts +22 -0
- package/dist/delegation/delegation-status-entry.js +42 -0
- package/dist/delegation/delegation-status-entry.js.map +1 -0
- package/dist/delegation/did-key-resolver.d.ts +0 -1
- package/dist/delegation/did-key-resolver.js +15 -4
- package/dist/delegation/did-key-resolver.js.map +1 -1
- package/dist/delegation/did-linkage.d.ts +0 -1
- package/dist/delegation/did-resolver-registry.d.ts +0 -1
- package/dist/delegation/did-web-resolver.d.ts +0 -1
- package/dist/delegation/did-web-resolver.js +40 -5
- package/dist/delegation/did-web-resolver.js.map +1 -1
- package/dist/delegation/holder-binding.d.ts +11 -11
- package/dist/delegation/holder-binding.js +8 -17
- package/dist/delegation/holder-binding.js.map +1 -1
- package/dist/delegation/index.d.ts +0 -1
- package/dist/delegation/outbound-headers.d.ts +0 -1
- package/dist/delegation/outbound-proof.d.ts +0 -1
- package/dist/delegation/scope-matcher.d.ts +25 -2
- package/dist/delegation/scope-matcher.js +75 -5
- package/dist/delegation/scope-matcher.js.map +1 -1
- package/dist/delegation/status-cache.d.ts +0 -1
- package/dist/delegation/statuslist-manager.d.ts +18 -2
- package/dist/delegation/statuslist-manager.js +40 -14
- package/dist/delegation/statuslist-manager.js.map +1 -1
- package/dist/delegation/storage/memory-graph-storage.d.ts +9 -3
- package/dist/delegation/storage/memory-graph-storage.js +28 -14
- package/dist/delegation/storage/memory-graph-storage.js.map +1 -1
- package/dist/delegation/storage/memory-statuslist-storage.d.ts +0 -1
- package/dist/delegation/utils.d.ts +5 -5
- package/dist/delegation/utils.js +4 -4
- package/dist/delegation/utils.js.map +1 -1
- package/dist/delegation/vc-issuer.d.ts +0 -1
- package/dist/delegation/vc-jwt-verify.d.ts +7 -2
- package/dist/delegation/vc-jwt-verify.js +55 -3
- package/dist/delegation/vc-jwt-verify.js.map +1 -1
- package/dist/delegation/vc-verification-checks.d.ts +0 -1
- package/dist/delegation/vc-verification-checks.js +9 -5
- package/dist/delegation/vc-verification-checks.js.map +1 -1
- package/dist/delegation/vc-verifier.d.ts +0 -1
- package/dist/delegation/vc-verifier.types.d.ts +0 -1
- package/dist/delegation/verification-method-key.d.ts +0 -1
- package/dist/delegation/verification-method-key.js +4 -3
- package/dist/delegation/verification-method-key.js.map +1 -1
- package/dist/errors.d.ts +0 -1
- package/dist/extension/declaration.d.ts +0 -1
- package/dist/extension/gate.d.ts +0 -1
- package/dist/extension/index.d.ts +0 -1
- package/dist/extension/settings.d.ts +0 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/cheqd/dlr.d.ts +0 -1
- package/dist/integrations/cheqd/dlr.js +6 -1
- package/dist/integrations/cheqd/dlr.js.map +1 -1
- package/dist/integrations/cheqd/index.d.ts +0 -1
- package/dist/integrations/cheqd/linkage.d.ts +0 -1
- package/dist/integrations/cheqd/registrar.d.ts +0 -1
- package/dist/integrations/cheqd/resolver.d.ts +0 -1
- package/dist/integrations/cheqd/statuslist-resolver.d.ts +0 -1
- package/dist/logging/index.d.ts +0 -1
- package/dist/logging/logger.d.ts +0 -1
- package/dist/middleware/index.d.ts +0 -1
- package/dist/middleware/kya-os-transport.d.ts +5 -3
- package/dist/middleware/kya-os-transport.js +58 -24
- package/dist/middleware/kya-os-transport.js.map +1 -1
- package/dist/middleware/with-kya-os-server.d.ts +30 -4
- package/dist/middleware/with-kya-os-server.js +19 -0
- package/dist/middleware/with-kya-os-server.js.map +1 -1
- package/dist/middleware/with-kya-os.config-types.d.ts +32 -4
- package/dist/middleware/with-kya-os.d.ts +0 -1
- package/dist/middleware/with-kya-os.delegation-gate.d.ts +2 -1
- package/dist/middleware/with-kya-os.delegation-gate.js +37 -9
- package/dist/middleware/with-kya-os.delegation-gate.js.map +1 -1
- package/dist/middleware/with-kya-os.delegation-verify.d.ts +1 -1
- package/dist/middleware/with-kya-os.delegation-verify.js +52 -9
- package/dist/middleware/with-kya-os.delegation-verify.js.map +1 -1
- package/dist/middleware/with-kya-os.deps.d.ts +0 -1
- package/dist/middleware/with-kya-os.grants.d.ts +13 -6
- package/dist/middleware/with-kya-os.grants.js +56 -18
- package/dist/middleware/with-kya-os.grants.js.map +1 -1
- package/dist/middleware/with-kya-os.helpers.d.ts +0 -1
- package/dist/middleware/with-kya-os.js +14 -4
- package/dist/middleware/with-kya-os.js.map +1 -1
- package/dist/middleware/with-kya-os.policy-gate.d.ts +0 -1
- package/dist/middleware/with-kya-os.policy-gate.js +18 -9
- package/dist/middleware/with-kya-os.policy-gate.js.map +1 -1
- package/dist/middleware/with-kya-os.protocol.d.ts +0 -1
- package/dist/middleware/with-kya-os.session.d.ts +28 -1
- package/dist/middleware/with-kya-os.session.js +146 -7
- package/dist/middleware/with-kya-os.session.js.map +1 -1
- package/dist/middleware/with-kya-os.types.d.ts +28 -5
- package/dist/policy/approval.d.ts +13 -2
- package/dist/policy/approval.js +15 -4
- package/dist/policy/approval.js.map +1 -1
- package/dist/policy/classifier.d.ts +0 -1
- package/dist/policy/default-engine.d.ts +5 -2
- package/dist/policy/default-engine.js +10 -2
- package/dist/policy/default-engine.js.map +1 -1
- package/dist/policy/engine.d.ts +0 -1
- package/dist/policy/index.d.ts +0 -1
- package/dist/policy/projection.d.ts +0 -1
- package/dist/policy/types.d.ts +0 -1
- package/dist/proof/covered-request.d.ts +46 -0
- package/dist/proof/covered-request.js +107 -0
- package/dist/proof/covered-request.js.map +1 -0
- package/dist/proof/errors.d.ts +3 -1
- package/dist/proof/errors.js +5 -0
- package/dist/proof/errors.js.map +1 -1
- package/dist/proof/generator.d.ts +51 -1
- package/dist/proof/generator.js +71 -13
- package/dist/proof/generator.js.map +1 -1
- package/dist/proof/index.d.ts +1 -2
- package/dist/proof/index.js.map +1 -1
- package/dist/proof/verifier.d.ts +50 -12
- package/dist/proof/verifier.js +164 -84
- package/dist/proof/verifier.js.map +1 -1
- package/dist/providers/audit-log.d.ts +0 -1
- package/dist/providers/base.d.ts +19 -1
- package/dist/providers/base.js.map +1 -1
- package/dist/providers/grant-store.d.ts +8 -2
- package/dist/providers/grant-store.js +5 -5
- package/dist/providers/grant-store.js.map +1 -1
- package/dist/providers/index.d.ts +0 -1
- package/dist/providers/memory.d.ts +19 -1
- package/dist/providers/memory.js +53 -7
- package/dist/providers/memory.js.map +1 -1
- package/dist/providers/node-crypto.d.ts +4 -1
- package/dist/providers/node-crypto.js +32 -9
- package/dist/providers/node-crypto.js.map +1 -1
- package/dist/providers/nonce-admission.d.ts +31 -0
- package/dist/providers/nonce-admission.js +47 -0
- package/dist/providers/nonce-admission.js.map +1 -0
- package/dist/providers/nonce-retention.d.ts +8 -0
- package/dist/providers/nonce-retention.js +15 -0
- package/dist/providers/nonce-retention.js.map +1 -0
- package/dist/providers/runtime-fetch.d.ts +0 -1
- package/dist/providers/system-clock.d.ts +0 -1
- package/dist/providers/web-crypto.d.ts +0 -1
- package/dist/providers/web-crypto.js +7 -1
- package/dist/providers/web-crypto.js.map +1 -1
- package/dist/session/index.d.ts +0 -1
- package/dist/session/manager.d.ts +13 -1
- package/dist/session/manager.js +25 -9
- package/dist/session/manager.js.map +1 -1
- package/dist/session/session-store.d.ts +0 -1
- package/dist/types/protocol.d.ts +11 -3
- package/dist/types/protocol.js +21 -14
- package/dist/types/protocol.js.map +1 -1
- package/dist/utils/base58.d.ts +16 -3
- package/dist/utils/base58.js +34 -12
- package/dist/utils/base58.js.map +1 -1
- package/dist/utils/base64.d.ts +0 -1
- package/dist/utils/canonical-json.d.ts +7 -1
- package/dist/utils/canonical-json.js +130 -60
- package/dist/utils/canonical-json.js.map +1 -1
- package/dist/utils/crypto-service.d.ts +0 -1
- package/dist/utils/crypto-service.js +22 -2
- package/dist/utils/crypto-service.js.map +1 -1
- package/dist/utils/did-helpers.d.ts +0 -1
- package/dist/utils/ed25519-constants.d.ts +0 -1
- package/dist/utils/ed25519-public-key.d.ts +27 -0
- package/dist/utils/ed25519-public-key.js +86 -0
- package/dist/utils/ed25519-public-key.js.map +1 -0
- package/dist/utils/guards.d.ts +0 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/ip-classifier.d.ts +0 -1
- package/dist/utils/safe-fetch-transports.d.ts +0 -1
- package/dist/utils/safe-fetch-types.d.ts +0 -1
- package/dist/utils/safe-fetch.d.ts +0 -1
- package/dist/utils/statuslist-bits.d.ts +0 -1
- package/dist/utils/statuslist-purpose.d.ts +0 -1
- package/dist/utils/ttl-cache.d.ts +0 -1
- package/dist/utils/url.d.ts +0 -1
- package/package.json +24 -19
- package/schemas/card-delegation-credential.json +4 -1
- package/dist/audit/adapters/legacy-audit-log.d.ts.map +0 -1
- package/dist/audit/adapters/mcp.d.ts.map +0 -1
- package/dist/audit/assurance.d.ts.map +0 -1
- package/dist/audit/checkpoint-coordinator.d.ts.map +0 -1
- package/dist/audit/checkpoint.d.ts.map +0 -1
- package/dist/audit/cli.d.ts.map +0 -1
- package/dist/audit/crypto.d.ts.map +0 -1
- package/dist/audit/errors.d.ts.map +0 -1
- package/dist/audit/evidence.d.ts.map +0 -1
- package/dist/audit/index.d.ts.map +0 -1
- package/dist/audit/integrity.d.ts.map +0 -1
- package/dist/audit/merkle.d.ts.map +0 -1
- package/dist/audit/mirror-service.d.ts.map +0 -1
- package/dist/audit/projection.d.ts.map +0 -1
- package/dist/audit/providers/anchor.d.ts.map +0 -1
- package/dist/audit/providers/evidence.d.ts.map +0 -1
- package/dist/audit/providers/journal.d.ts.map +0 -1
- package/dist/audit/providers/memory-journal.d.ts.map +0 -1
- package/dist/audit/providers/observer.d.ts.map +0 -1
- package/dist/audit/providers/outbox.d.ts.map +0 -1
- package/dist/audit/providers/recorder-client.d.ts.map +0 -1
- package/dist/audit/providers/source-state.d.ts.map +0 -1
- package/dist/audit/read-contract.d.ts.map +0 -1
- package/dist/audit/read-service.d.ts.map +0 -1
- package/dist/audit/recorder-service.d.ts.map +0 -1
- package/dist/audit/reference-recorder.d.ts.map +0 -1
- package/dist/audit/replay-bundle.d.ts.map +0 -1
- package/dist/audit/schemas.d.ts.map +0 -1
- package/dist/audit/service.d.ts.map +0 -1
- package/dist/audit/testing/index.d.ts.map +0 -1
- package/dist/audit/testing/provider-contracts.d.ts.map +0 -1
- package/dist/audit/types.d.ts.map +0 -1
- package/dist/audit/verifier.d.ts.map +0 -1
- package/dist/auth/handshake.d.ts.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/authz/accountability.d.ts.map +0 -1
- package/dist/authz/adapter.d.ts.map +0 -1
- package/dist/authz/examples/inmemory-oidc.d.ts.map +0 -1
- package/dist/authz/index.d.ts.map +0 -1
- package/dist/authz/oidc/authorize.d.ts.map +0 -1
- package/dist/authz/oidc/metadata.d.ts.map +0 -1
- package/dist/authz/oidc/oidc-adapter.d.ts.map +0 -1
- package/dist/authz/oidc/pending-flow-store.d.ts.map +0 -1
- package/dist/authz/oidc/pkce.d.ts.map +0 -1
- package/dist/authz/registry.d.ts.map +0 -1
- package/dist/authz/requirement.d.ts.map +0 -1
- package/dist/card/build.d.ts.map +0 -1
- package/dist/card/builder.d.ts.map +0 -1
- package/dist/card/cimd.d.ts.map +0 -1
- package/dist/card/delegation.d.ts.map +0 -1
- package/dist/card/emit.d.ts.map +0 -1
- package/dist/card/index.d.ts.map +0 -1
- package/dist/card/middleware.d.ts.map +0 -1
- package/dist/card/proof/build.d.ts.map +0 -1
- package/dist/card/proof/canonical.d.ts.map +0 -1
- package/dist/card/proof/http-sig.d.ts.map +0 -1
- package/dist/card/proof/index.d.ts.map +0 -1
- package/dist/card/proof/nonce-cache.d.ts.map +0 -1
- package/dist/card/proof/signer.d.ts.map +0 -1
- package/dist/card/proof/types.d.ts.map +0 -1
- package/dist/card/proof/verify.d.ts.map +0 -1
- package/dist/card/resolve.d.ts.map +0 -1
- package/dist/card/revocation.d.ts.map +0 -1
- package/dist/card/schema.d.ts.map +0 -1
- package/dist/card/verify.d.ts.map +0 -1
- package/dist/delegation/audience-validator.d.ts.map +0 -1
- package/dist/delegation/bitstring.d.ts.map +0 -1
- package/dist/delegation/cascading-revocation.d.ts.map +0 -1
- package/dist/delegation/chain-enforcement.d.ts.map +0 -1
- package/dist/delegation/delegation-graph.d.ts.map +0 -1
- package/dist/delegation/did-key-resolver.d.ts.map +0 -1
- package/dist/delegation/did-linkage.d.ts.map +0 -1
- package/dist/delegation/did-resolver-registry.d.ts.map +0 -1
- package/dist/delegation/did-web-resolver.d.ts.map +0 -1
- package/dist/delegation/holder-binding.d.ts.map +0 -1
- package/dist/delegation/index.d.ts.map +0 -1
- package/dist/delegation/outbound-headers.d.ts.map +0 -1
- package/dist/delegation/outbound-proof.d.ts.map +0 -1
- package/dist/delegation/scope-matcher.d.ts.map +0 -1
- package/dist/delegation/status-cache.d.ts.map +0 -1
- package/dist/delegation/statuslist-manager.d.ts.map +0 -1
- package/dist/delegation/storage/memory-graph-storage.d.ts.map +0 -1
- package/dist/delegation/storage/memory-statuslist-storage.d.ts.map +0 -1
- package/dist/delegation/utils.d.ts.map +0 -1
- package/dist/delegation/vc-issuer.d.ts.map +0 -1
- package/dist/delegation/vc-jwt-verify.d.ts.map +0 -1
- package/dist/delegation/vc-verification-checks.d.ts.map +0 -1
- package/dist/delegation/vc-verifier.d.ts.map +0 -1
- package/dist/delegation/vc-verifier.types.d.ts.map +0 -1
- package/dist/delegation/verification-method-key.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/extension/declaration.d.ts.map +0 -1
- package/dist/extension/gate.d.ts.map +0 -1
- package/dist/extension/index.d.ts.map +0 -1
- package/dist/extension/settings.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/integrations/cheqd/dlr.d.ts.map +0 -1
- package/dist/integrations/cheqd/index.d.ts.map +0 -1
- package/dist/integrations/cheqd/linkage.d.ts.map +0 -1
- package/dist/integrations/cheqd/registrar.d.ts.map +0 -1
- package/dist/integrations/cheqd/resolver.d.ts.map +0 -1
- package/dist/integrations/cheqd/statuslist-resolver.d.ts.map +0 -1
- package/dist/logging/index.d.ts.map +0 -1
- package/dist/logging/logger.d.ts.map +0 -1
- package/dist/middleware/index.d.ts.map +0 -1
- package/dist/middleware/kya-os-transport.d.ts.map +0 -1
- package/dist/middleware/with-kya-os-server.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.config-types.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.delegation-gate.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.delegation-verify.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.deps.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.grants.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.helpers.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.policy-gate.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.protocol.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.session.d.ts.map +0 -1
- package/dist/middleware/with-kya-os.types.d.ts.map +0 -1
- package/dist/policy/approval.d.ts.map +0 -1
- package/dist/policy/classifier.d.ts.map +0 -1
- package/dist/policy/default-engine.d.ts.map +0 -1
- package/dist/policy/engine.d.ts.map +0 -1
- package/dist/policy/index.d.ts.map +0 -1
- package/dist/policy/projection.d.ts.map +0 -1
- package/dist/policy/types.d.ts.map +0 -1
- package/dist/proof/errors.d.ts.map +0 -1
- package/dist/proof/generator.d.ts.map +0 -1
- package/dist/proof/index.d.ts.map +0 -1
- package/dist/proof/verifier.d.ts.map +0 -1
- package/dist/providers/audit-log.d.ts.map +0 -1
- package/dist/providers/base.d.ts.map +0 -1
- package/dist/providers/grant-store.d.ts.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/memory.d.ts.map +0 -1
- package/dist/providers/node-crypto.d.ts.map +0 -1
- package/dist/providers/runtime-fetch.d.ts.map +0 -1
- package/dist/providers/system-clock.d.ts.map +0 -1
- package/dist/providers/web-crypto.d.ts.map +0 -1
- package/dist/session/index.d.ts.map +0 -1
- package/dist/session/manager.d.ts.map +0 -1
- package/dist/session/session-store.d.ts.map +0 -1
- package/dist/types/protocol.d.ts.map +0 -1
- package/dist/utils/base58.d.ts.map +0 -1
- package/dist/utils/base64.d.ts.map +0 -1
- package/dist/utils/canonical-json.d.ts.map +0 -1
- package/dist/utils/crypto-service.d.ts.map +0 -1
- package/dist/utils/did-helpers.d.ts.map +0 -1
- package/dist/utils/ed25519-constants.d.ts.map +0 -1
- package/dist/utils/guards.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/ip-classifier.d.ts.map +0 -1
- package/dist/utils/safe-fetch-transports.d.ts.map +0 -1
- package/dist/utils/safe-fetch-types.d.ts.map +0 -1
- package/dist/utils/safe-fetch.d.ts.map +0 -1
- package/dist/utils/statuslist-bits.d.ts.map +0 -1
- package/dist/utils/statuslist-purpose.d.ts.map +0 -1
- package/dist/utils/ttl-cache.d.ts.map +0 -1
- package/dist/utils/url.d.ts.map +0 -1
package/CONFORMANCE.md
CHANGED
|
@@ -52,7 +52,7 @@ Implementation MUST:
|
|
|
52
52
|
- Generate cryptographically secure random 32-byte private seed
|
|
53
53
|
- Derive 32-byte public key from seed
|
|
54
54
|
- Derive `did:key` DID from public key using multicodec prefix `0xed01` and base58btc encoding
|
|
55
|
-
- Key ID format: `<did
|
|
55
|
+
- Key ID format: `<did>#<multibase>`, the W3C did:key verification method ID (SPEC.md §4.3)
|
|
56
56
|
|
|
57
57
|
#### L1.2 — SHA-256 Hashing
|
|
58
58
|
|
|
@@ -125,7 +125,7 @@ Implementation MUST validate:
|
|
|
125
125
|
#### L2.5 — Nonce Replay Prevention
|
|
126
126
|
|
|
127
127
|
Implementation MUST:
|
|
128
|
-
- Store (nonce, agentDid) tuples
|
|
128
|
+
- Store (nonce, agentDid) tuples at least until the nonce's timestamp leaves the acceptance window (`ts + skew`, SPEC §5.5)
|
|
129
129
|
- Reject any request with a previously-seen nonce for the same agentDid
|
|
130
130
|
- Support cleanup of expired nonces
|
|
131
131
|
|
|
@@ -139,10 +139,10 @@ Proof metadata MUST include:
|
|
|
139
139
|
- `did`: Signer's DID
|
|
140
140
|
- `kid`: Key ID used for signing
|
|
141
141
|
- `ts`: Unix epoch seconds
|
|
142
|
-
- `nonce`:
|
|
142
|
+
- `nonce`: Fresh random nonce per proof
|
|
143
143
|
- `audience`: Session audience
|
|
144
144
|
- `sessionId`: Session identifier
|
|
145
|
-
- `requestHash`: SHA-256 of canonicalized request (`sha256:<hex>`)
|
|
145
|
+
- `requestHash`: SHA-256 of the canonicalized request (`sha256:<hex>`), over the covered request of SPEC §7.3 or, as 1.x implementations emit it, the legacy `{method: <tool name>, params: <arguments>}` shape; a verifier accepts either for the same call
|
|
146
146
|
|
|
147
147
|
`responseHash` (SHA-256 of the canonicalized response, `sha256:<hex>`) MUST be
|
|
148
148
|
present on proofs that carry a response body — success proofs and
|
|
@@ -161,8 +161,14 @@ intact while swapping the `authorizationUrl`, and only the recompute detects it.
|
|
|
161
161
|
|
|
162
162
|
`_meta` is the MCP per-request metadata channel and is shared with reserved
|
|
163
163
|
reverse-DNS keys. A conformant verifier MUST:
|
|
164
|
-
- Read the
|
|
165
|
-
|
|
164
|
+
- Read the detached response proof from `org.kya-os/response-proof`. Through
|
|
165
|
+
1.x, also accept the prior keys `org.kya-os/proof` and bare `proof` (SPEC
|
|
166
|
+
§7.6), in that order: the first key present wins. Servers write `org.kya-os/response-proof` and, unless configured with
|
|
167
|
+
`emitLegacyProofKey: false`, mirror it under bare `proof`; nothing writes
|
|
168
|
+
`org.kya-os/proof`.
|
|
169
|
+
- Treat the holder-of-key request proof, under `org.kya-os/request-proof`
|
|
170
|
+
(SPEC-ENTITY-CARD §8.1), as a separate profile: never read one in place of
|
|
171
|
+
the other.
|
|
166
172
|
- Process **only** the KYA-OS proof key; ignore every other `_meta` key (never
|
|
167
173
|
hash it, never trust it).
|
|
168
174
|
- **Never reject** a response merely because `_meta` also carries non-KYA-OS
|
package/README.md
CHANGED
|
@@ -217,6 +217,8 @@ This starts all example servers and opens [MCP Inspector](https://github.com/mod
|
|
|
217
217
|
|
|
218
218
|
Also available: [outbound-delegation](./examples/outbound-delegation/) (gateway pattern), [verify-proof](./examples/verify-proof/) (standalone verification), [statuslist](./examples/statuslist/) (revocation lifecycle), [cheqd-dlr](./examples/cheqd-dlr/) (operator DID linkage + DLR publishing).
|
|
219
219
|
|
|
220
|
+
To run one example on its own, use its `npm run example:*` script, for example `npm run example:server`. The scripts and `scripts/demo.sh` run the examples from `src/` through `tsconfig.examples.json`, so they need no build step. The scripts also need nothing beyond the root `npm install`; `demo.sh` additionally installs each example's own dependencies.
|
|
221
|
+
|
|
220
222
|
## Try it against the live server
|
|
221
223
|
|
|
222
224
|
[](https://github.com/decentralized-identity/kya-os-mcp/actions/workflows/live-probe.yml)
|
|
@@ -252,7 +254,7 @@ The server is operated by a maintainer on pinned releases; this repo does not de
|
|
|
252
254
|
| **Revocation** | StatusList2021 bitstring with cascading revocation |
|
|
253
255
|
| **Replay prevention** | Nonce-based handshake with timestamp skew validation |
|
|
254
256
|
| **Verifiable auditability** | Typed producer events, authoritative atomic recorder, signed chain receipts, RFC 9162 checkpoints, independent observation, encrypted evidence references, replay bundles, and offline CLI |
|
|
255
|
-
| **Extensible** | Bring your own KMS, HSM, nonce
|
|
257
|
+
| **Extensible** | Bring your own KMS, HSM, atomic nonce provider, or DID method |
|
|
256
258
|
|
|
257
259
|
### Multi-instance deployments
|
|
258
260
|
|
|
@@ -263,25 +265,77 @@ implementation for **every** runtime-state seam — the nonce cache
|
|
|
263
265
|
`PendingFlowStore`, `SessionStore`) — so replay protection, grants, pending OAuth
|
|
264
266
|
flows, and sessions are shared across instances and survive restarts.
|
|
265
267
|
|
|
268
|
+
Delegation grants must retain their original signed evidence: `credentialJwt` for VC-JWTs, or `delegationCredential` for object VCs.
|
|
269
|
+
`wrapWithDelegation` revalidates that evidence with the same verifier as a directly presented credential on every reuse, including chain resolution, audience, scope, expiry, and configured status/revocation checks.
|
|
270
|
+
Store providers must preserve these fields and return only active grants; cache availability alone does not authorize a request.
|
|
271
|
+
Grant expiry is bounded by the earliest credential or constraint expiry in the verified chain.
|
|
272
|
+
|
|
273
|
+
**Upgrade compatibility:** legacy grants without signed evidence intentionally return `needs_authorization`; re-present a valid delegation or complete the normal consent flow to replace them.
|
|
274
|
+
Do not reconstruct unsigned credentials from cached metadata.
|
|
275
|
+
Under `holderBinding: 'enforce'`, did:key session retries also require a fresh holder proof.
|
|
276
|
+
`off` and `warn` retain their documented session behavior, and non-did:key binding remains deferred; neither provides an enforced proof-of-possession guarantee for those requests.
|
|
277
|
+
Status and chain providers now receive reads on grant reuse as they do on direct calls, and an unavailable required provider prevents reuse.
|
|
278
|
+
This does not strengthen a provider's own status-cache freshness policy.
|
|
279
|
+
|
|
280
|
+
VC-JWT envelope `exp` and `nbf` are checked on every verification, including signature-cache hits and grant reuse.
|
|
281
|
+
Omitted claims remain supported.
|
|
282
|
+
A present claim must be a finite NumericDate.
|
|
283
|
+
An expired envelope denies authorization even when the embedded VC is otherwise current, and verified envelope expiry can shorten the cached grant's lifetime.
|
|
284
|
+
`nbf` allows `JWT_NBF_LEEWAY_SECONDS` (30 seconds) of clock skew; `exp` allows none.
|
|
285
|
+
|
|
286
|
+
**Delegation issuers:** each re-delegation must be signed by its parent's subject.
|
|
287
|
+
The `issuerDid` inside a credential is only a claim, so the chain walk also checks who signed it.
|
|
288
|
+
Set `delegation.trustedRootIssuers` to the DIDs allowed to issue root delegations, the Responsible Party for the whole chain.
|
|
289
|
+
With it set, a chain whose root is signed by any other DID is rejected, including when a stored grant is reused.
|
|
290
|
+
Without it, any issuer is accepted, including an agent signing a delegation for itself, and the middleware logs a warning at startup.
|
|
291
|
+
A root whose claimed `issuerDid` differs from its signer is still accepted, and logged.
|
|
292
|
+
|
|
293
|
+
**Nonce providers:** give your `NonceCacheProvider` an atomic `consume(nonce, ttlSeconds, agentDid?)`.
|
|
294
|
+
It must record an unseen `(agentDid, nonce)`, return literal `true` only to the call that recorded it, and reject on storage failure.
|
|
295
|
+
Implement the claim in the shared backend with a conditional insert and expiry, not with a local mutex around remote reads and writes.
|
|
296
|
+
Eventually consistent KV alone cannot provide it.
|
|
297
|
+
The bundled memory provider implements `consume`, but it protects only one cache instance and loses its state on restart.
|
|
298
|
+
`consume` is optional: a provider without it keeps working by falling back to `has` then `add`, which cannot stop concurrent duplicates of one signed request, and a warning is logged once.
|
|
299
|
+
Set `requireAtomicNonce: true` on the middleware, `ProofVerifier`, `SessionManager` or `consumeFromNonceCacheProvider` to refuse that fallback; each then throws at construction for a provider without `consume`.
|
|
300
|
+
Any result other than literal `true`, or a storage failure, denies admission.
|
|
301
|
+
`withKyaOs` takes the same `nonceCache` and `requireAtomicNonce` options (and `responseProofProfile`) and passes them to the middleware.
|
|
302
|
+
|
|
303
|
+
Providers must honor the requested retention duration.
|
|
304
|
+
The verifiers retain nonces through the final accepted second, including future timestamps and clock skew, while preserving a longer configured TTL.
|
|
305
|
+
The detached verifier also covers later increases up to its supported `setTimestampSkew` maximum.
|
|
306
|
+
Custom card `consumeNonceIfFresh` callbacks must honor the new third `minTtlSec` argument; the bundled card cache and provider adapter do so.
|
|
307
|
+
Instances sharing a replay namespace must agree on the longest proof-acceptance policy and retain state accordingly.
|
|
308
|
+
Retire old non-atomic writers before claiming atomic protection.
|
|
309
|
+
Preserve or extend existing records through the full remaining acceptance window; merely keeping their old, shorter TTLs is insufficient.
|
|
310
|
+
If the backend cannot extend them safely, pause affected admission and wait out that window before cutover.
|
|
311
|
+
Do not clear records while their proofs may still be accepted.
|
|
312
|
+
|
|
266
313
|
---
|
|
267
314
|
|
|
268
315
|
## Integrations
|
|
269
316
|
|
|
270
|
-
KYA-OS
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this interface"
|
|
274
|
-
|
|
275
|
-
### Modules
|
|
317
|
+
KYA-OS integrates through typed **seams** — the adapter pattern is the whole
|
|
318
|
+
model. Every external dependency is a port with an in-memory or reference
|
|
319
|
+
default; bind your own backend, or drop in a shipped adapter. Adding one is
|
|
320
|
+
"implement this interface" (or, for a self-contained system, "drop a folder
|
|
321
|
+
under `src/integrations/`") — contributions welcome.
|
|
276
322
|
|
|
277
|
-
|
|
|
323
|
+
| Seam (port) | Reference / default | Bring your own |
|
|
278
324
|
| --- | --- | --- |
|
|
279
|
-
|
|
|
280
|
-
|
|
|
281
|
-
|
|
|
325
|
+
| DID resolution — `DIDResolver` | `did:key`, `did:web` | `did:cheqd`, custom methods |
|
|
326
|
+
| Revocation — `StatusListResolver` | not configured | cheqd StatusList2021 |
|
|
327
|
+
| Authorization — `AuthorizationServerAdapter` | `GenericOidcAdapter` (OIDC + PKCE) | Auth0, Okta, your IdP ([example](./examples/authz-inspector/)) |
|
|
328
|
+
| State — `GrantStore`, `SessionStore`, `NonceCacheProvider`, `PendingFlowStore` | in-memory | Redis, DynamoDB, Durable Objects, DB; atomic consumption for replay and pending state ([multi-instance](#multi-instance-deployments)) |
|
|
329
|
+
| Audit delivery — `AuditRecorder`, `AuditAnchorProvider` | local recorder | Checkpoint, on-chain anchoring ([AUDITABILITY.md](./AUDITABILITY.md)) |
|
|
330
|
+
| Crypto — `CryptoProvider` | Node, WebCrypto | your KMS / HSM |
|
|
331
|
+
| Policy — `PolicyEngine` | built-in default | custom engine |
|
|
332
|
+
|
|
333
|
+
### cheqd: a fully-worked on-chain integration
|
|
282
334
|
|
|
283
|
-
|
|
284
|
-
|
|
335
|
+
cheqd is the reference for what filling the seams looks like end to end — one
|
|
336
|
+
package binds three at once: DID resolution (`did:cheqd`), revocation (on-chain
|
|
337
|
+
StatusList2021), and audit anchoring (DID-Linked Resources). Enabling the
|
|
338
|
+
resolver is a small config change:
|
|
285
339
|
|
|
286
340
|
```typescript
|
|
287
341
|
import { cheqdResolver } from '@kya-os/mcp/cheqd';
|
|
@@ -299,19 +353,6 @@ DID-Linked Resource helpers, live testnet E2E) lives in
|
|
|
299
353
|
[src/integrations/cheqd/README.md](./src/integrations/cheqd/README.md); see
|
|
300
354
|
[examples/cheqd-dlr](./examples/cheqd-dlr/) for a complete operator flow.
|
|
301
355
|
|
|
302
|
-
### Adapter seams (bring your own)
|
|
303
|
-
|
|
304
|
-
Every external dependency is a typed interface with an in-memory default, so you
|
|
305
|
-
can swap in your own backend without touching the middleware.
|
|
306
|
-
|
|
307
|
-
| Seam | Default | Swap in |
|
|
308
|
-
| --- | --- | --- |
|
|
309
|
-
| DID resolution — `DIDResolver` | `did:key`, `did:web` | `did:cheqd`, custom |
|
|
310
|
-
| Revocation — `StatusListResolver` | none | cheqd StatusList2021 |
|
|
311
|
-
| State — `GrantStore`, `SessionStore`, `NonceCacheProvider`, `PendingFlowStore` | in-memory | Redis, DynamoDB, KV, Durable Objects, DB ([multi-instance](#multi-instance-deployments)) |
|
|
312
|
-
| Crypto — `CryptoProvider` | Node, WebCrypto | your KMS / HSM |
|
|
313
|
-
| Policy — `PolicyEngine` | default | custom |
|
|
314
|
-
|
|
315
356
|
## Links
|
|
316
357
|
|
|
317
358
|
- [Spec](./SPEC.md) | [Card Profile](./SPEC-ENTITY-CARD.md) | [Changelog](./CHANGELOG.md) | [DIF TAAWG](https://identity.foundation/working-groups/trusted-agents.html) | [npm](https://www.npmjs.com/package/@kya-os/mcp)
|
package/SPEC.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Version: 1.0.0
|
|
6
6
|
Status: Stable
|
|
7
|
-
Editors: KYA-OS Working Group
|
|
7
|
+
Editors: Dylan Hobbs ([@H0BB5](https://github.com/H0BB5)), KYA-OS Working Group
|
|
8
8
|
Repository: https://github.com/decentralized-identity/kya-os-mcp
|
|
9
9
|
|
|
10
10
|
---
|
|
@@ -194,7 +194,18 @@ Base58btc: 6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
|
|
|
194
194
|
DID: did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
|
|
195
195
|
```
|
|
196
196
|
|
|
197
|
-
The verification method ID is `<did
|
|
197
|
+
The verification method ID is `<did>#<multibase>`: the fragment repeats the
|
|
198
|
+
`z`-prefixed multibase value, as the W3C did:key method defines it. For the
|
|
199
|
+
example above:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK#z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This fragment identifies the Ed25519 verification method; `#keys-1` does not.
|
|
206
|
+
A `did:key` document may also carry an X25519 `keyAgreement` method derived
|
|
207
|
+
from the same key; its fragment is the X25519 key's own multibase value
|
|
208
|
+
(`#z6LS…`).
|
|
198
209
|
|
|
199
210
|
### 4.4 did:web Resolution
|
|
200
211
|
|
|
@@ -384,8 +395,8 @@ The server MUST validate the handshake request:
|
|
|
384
395
|
|
|
385
396
|
2. **Nonce Uniqueness**: The (nonce, agentDid) pair MUST NOT have been seen before
|
|
386
397
|
- Reject with "Nonce already used (replay attack prevention)"
|
|
387
|
-
- Nonces MUST be
|
|
388
|
-
- When `agentDid` is omitted, the dedupe key is `nonce` alone. Servers
|
|
398
|
+
- Nonces MUST be retained for at least the acceptance window of rule 1, as §5.5 specifies; retention is not tied to the session TTL
|
|
399
|
+
- When `agentDid` is omitted, the dedupe key is `nonce` alone. Servers MAY keep a shorter minimum retention for anonymous nonces than for authenticated ones (for example 60 and 120 seconds), never below what §5.5 requires
|
|
389
400
|
|
|
390
401
|
3. **Audience Match**: `request.audience` MUST match the server's DID or expected domain
|
|
391
402
|
- Prevents credential forwarding attacks
|
|
@@ -421,9 +432,11 @@ The nonce cache implementation MUST:
|
|
|
421
432
|
- Store (nonce, agentDid, expiry) tuples
|
|
422
433
|
- Support TTL-based automatic expiry
|
|
423
434
|
- Be atomic to prevent race conditions in concurrent environments
|
|
424
|
-
- For distributed deployments: use
|
|
435
|
+
- For distributed deployments: use a shared store with an atomic conditional insert and expiry, such as Redis `SET NX PX`, a DynamoDB conditional write or a Durable Object transaction (not in-memory). Eventually consistent stores such as Cloudflare Workers KV cannot provide the atomic check-and-set on their own.
|
|
425
436
|
|
|
426
|
-
|
|
437
|
+
**Retention.** A verifier MUST retain each admitted nonce at least until the timestamp it was admitted with leaves the acceptance window on the verifier's clock: until `ts + skew`, plus a margin of at least one second for second-granularity timestamps. `ts` is the handshake `timestamp` or the proof's `ts`, and `skew` is the largest timestamp skew the verifier may apply while the nonce is retained; a verifier that can widen its skew at runtime (§10.1) retains for the widest. Servers MUST NOT evict a nonce before its retention ends, to prevent replay via early eviction. Verifiers MAY retain longer, and a verifier whose clock can be stepped backwards SHOULD add the largest expected step to the margin.
|
|
438
|
+
|
|
439
|
+
Retention is bounded by the acceptance window, not by the session TTL. A nonce presented after its window is rejected on its timestamp (§5.2 rule 1, §11.3) before the cache is consulted, so keeping it longer adds memory and denial-of-service exposure and no replay protection. The bound holds because every nonce-checked path checks a timestamp window in the same verification: the handshake (§5.2), the detached proof and the holder-binding request proof (`ts` within skew, signed with the nonce, §7.4), and the Entity Card proof (`created`/`expires`, SPEC-ENTITY-CARD §8). The handshake request is unsigned, so a replayed handshake gives its sender nothing that a fresh handshake would not; its nonce check deduplicates and follows the same window. A path that checked a nonce without a timestamp window would have to retain the nonce for as long as the message it protects stays valid.
|
|
427
440
|
|
|
428
441
|
---
|
|
429
442
|
|
|
@@ -493,7 +506,7 @@ Delegations are issued as W3C Verifiable Credentials:
|
|
|
493
506
|
"proof": {
|
|
494
507
|
"type": "Ed25519Signature2020",
|
|
495
508
|
"created": "2024-03-01T12:00:00Z",
|
|
496
|
-
"verificationMethod": "did:key:z6MkIssuer...#
|
|
509
|
+
"verificationMethod": "did:key:z6MkIssuer...#z6MkIssuer...",
|
|
497
510
|
"proofPurpose": "assertionMethod",
|
|
498
511
|
"proofValue": "<base64url-encoded-signature>"
|
|
499
512
|
}
|
|
@@ -591,6 +604,12 @@ Delegations form a directed acyclic graph (DAG):
|
|
|
591
604
|
- Scope constraints MUST be equal to or narrower than parent's constraints
|
|
592
605
|
- Every chain MUST terminate at a Responsible Party. The Responsible Party's DID is the `issuerDid` of the root `DelegationCredential` and is the entity ultimately accountable for actions taken under any descendant delegation. In personal use the Responsible Party equals the Principal; in organizational use the Responsible Party is the parent organization while the Principal is the immediate human delegator (see §2).
|
|
593
606
|
|
|
607
|
+
**Chain length (non-normative).** The §6.2 profile does not limit how many times authority may be
|
|
608
|
+
re-delegated. Separately, a verifier may cap how many credentials it will verify for one request, as
|
|
609
|
+
a local resource limit: each credential costs a signature check and possibly a DID resolution. The
|
|
610
|
+
reference implementation exposes this as `maxChainLength`, unset by default. Such a cap is the
|
|
611
|
+
verifier's policy, not a protocol rule, and a chain it refuses is not thereby invalid elsewhere.
|
|
612
|
+
|
|
594
613
|
### 6.4.1 Designation Invariant
|
|
595
614
|
|
|
596
615
|
A `DelegationCredential` may authorize multiple resources, either via a list
|
|
@@ -779,6 +798,11 @@ profile issues and verifies, this profile is what the Entity Card path issues an
|
|
|
779
798
|
implementation encountering one never needs to accept the other in its place. The JSON Schema is
|
|
780
799
|
published at `schemas/card-delegation-credential.json`.
|
|
781
800
|
|
|
801
|
+
**Telling the profiles apart (non-normative).** Neither profile carries a separate profile
|
|
802
|
+
identifier; the first `@context` entry selects the rule set. `https://www.w3.org/2018/credentials/v1`
|
|
803
|
+
marks a §6.2 credential, and `https://www.w3.org/ns/credentials/v2`, with the ZCAP-LD context,
|
|
804
|
+
marks a credential of this profile.
|
|
805
|
+
|
|
782
806
|
**Credential shape.** One `DelegationCredential` per delegation **hop**; a chain runs `root → … → leaf`. A
|
|
783
807
|
`DelegationCredential` is a VC 2.0 whose `credentialSubject` IS an attenuated ZCAP-LD capability:
|
|
784
808
|
|
|
@@ -819,18 +843,26 @@ chain:
|
|
|
819
843
|
|
|
820
844
|
- **action subset** - child `allowedAction ⊆ parent`;
|
|
821
845
|
- **monotone caveats** - no parent caveat may be silently dropped; for a shared caveat type, child
|
|
822
|
-
`MaxAmount ≤ parent` (same currency; compared as
|
|
846
|
+
`MaxAmount ≤ parent` (same currency; compared as exact decimals, never rounded or truncated) and
|
|
823
847
|
child `ValidUntil ≤ parent`; an unknown caveat type MUST be replicated **verbatim**;
|
|
824
848
|
- **top-level `validUntil` narrowing** - child `validUntil ≤ parent`;
|
|
825
849
|
- **continuity** - the parent's delegate (`invoker`) MUST equal the child's `issuer` (you may only
|
|
826
850
|
re-delegate what was delegated to YOUR key), and child `parentCapability` MUST reference the
|
|
827
851
|
parent capability `id`;
|
|
828
852
|
- **constant `invocationTarget`** along the chain;
|
|
829
|
-
- **depth** MUST NOT exceed **10** hops (`MAX_DELEGATION_DEPTH`);
|
|
830
853
|
- **root** - root `parentCapability` MUST equal its `invocationTarget` (the resource); when a
|
|
831
854
|
resource owner / resource is asserted, root `issuer` MUST equal the resource owner and root
|
|
832
855
|
`invocationTarget` MUST equal the resource.
|
|
833
856
|
|
|
857
|
+
**Chain length (non-normative).** As in §6.4, this profile does not limit how many times a
|
|
858
|
+
capability may be re-delegated. Earlier drafts listed a 10-hop cap among the invariants above,
|
|
859
|
+
but a longer chain broadens nothing, so it was never an attenuation rule. A verifier may cap how
|
|
860
|
+
many credentials it evaluates for one chain as a local resource limit: each hop may cost a
|
|
861
|
+
signature check and a status-list fetch. The reference implementation takes the same
|
|
862
|
+
`maxChainLength` option here, unset by default, and exports `MAX_DELEGATION_DEPTH` (10) as a
|
|
863
|
+
suggested value. Such a cap is the verifier's policy, not a protocol rule, and a chain it refuses
|
|
864
|
+
is not thereby invalid elsewhere.
|
|
865
|
+
|
|
834
866
|
A verifying resource SHOULD assert its own identity as the expected resource when it evaluates a
|
|
835
867
|
chain (the `resource` context of `evaluateDelegationChain`), so that a chain minted for a
|
|
836
868
|
different resource fails at the root check instead of being accepted by an unrelated Verifier.
|
|
@@ -877,10 +909,10 @@ interface ProofMeta {
|
|
|
877
909
|
did: string; // Server's DID (signer)
|
|
878
910
|
kid: string; // Key ID used for signing
|
|
879
911
|
ts: number; // Unix epoch seconds when proof was generated
|
|
880
|
-
nonce: string; //
|
|
912
|
+
nonce: string; // Fresh random nonce per proof (replay protection, §5.5)
|
|
881
913
|
audience: string; // Session audience
|
|
882
914
|
sessionId: string; // Session identifier
|
|
883
|
-
requestHash: string; // SHA-256 of canonicalized request
|
|
915
|
+
requestHash: string; // SHA-256 of the canonicalized request (§7.3)
|
|
884
916
|
responseHash?: string; // SHA-256 of canonicalized response. Present on success
|
|
885
917
|
// AND on needs_authorization challenges (binds the
|
|
886
918
|
// challenge content, incl. authorizationUrl); ABSENT on
|
|
@@ -905,14 +937,36 @@ interface ProofMeta {
|
|
|
905
937
|
2. **Hash**: Compute SHA-256 of the canonical JSON bytes (UTF-8 encoded)
|
|
906
938
|
3. **Format**: `sha256:<64-char-lowercase-hex>`
|
|
907
939
|
|
|
908
|
-
Request canonicalization
|
|
940
|
+
Request canonicalization covers the JSON-RPC request as sent: its `method` and `params`.
|
|
941
|
+
The envelope members `jsonrpc` and `id` are not covered.
|
|
942
|
+
Two kinds of member are removed before canonicalizing:
|
|
943
|
+
|
|
944
|
+
1. `params._meta`, if present.
|
|
945
|
+
`_meta` is intermediary-mutable transport metadata that also carries proofs (§7.6), so it is never signed.
|
|
946
|
+
Only that top-level member is removed; values nested under other `params` members are not touched.
|
|
947
|
+
2. For `method: "tools/call"`, every member of `params.arguments` whose name begins with `_kyaos`: the KYA-OS control arguments (`_kyaos_delegation`, `_kyaos_proof`, `_kyaos_approvals`).
|
|
948
|
+
They carry the credentials that authorize the call, each authenticated on its own, and the holder-of-key request proof and approval grants are themselves bound to this hash, so covering them would make the hash depend on its own output.
|
|
949
|
+
Tool handlers SHOULD NOT receive control arguments, so that the covered request is the call the tool executes.
|
|
950
|
+
An absent `params.arguments` is covered as `{}`, since a server cannot tell it from an empty one.
|
|
951
|
+
|
|
952
|
+
Every other `params` member (`name`, `task`, and any future member) is covered.
|
|
953
|
+
When `params` is absent the covered request is `{ "method": ... }`.
|
|
954
|
+
For a tool call:
|
|
909
955
|
```json
|
|
910
956
|
{
|
|
911
957
|
"method": "tools/call",
|
|
912
|
-
"params": { /*
|
|
958
|
+
"params": { "name": "echo", "arguments": { /* minus _kyaos* members */ } }
|
|
913
959
|
}
|
|
914
960
|
```
|
|
915
961
|
|
|
962
|
+
A client, a PEP or a third-party auditor recomputes `requestHash` this way from the request it sent or received.
|
|
963
|
+
Rule 1 is the rule Entity Card request proofs use (SPEC-ENTITY-CARD §8.3).
|
|
964
|
+
Appendix C.1 gives vectors.
|
|
965
|
+
|
|
966
|
+
**Legacy shape in 1.x.** The 1.x releases of the reference implementation (`@kya-os/mcp`) still emit `requestHash` over the legacy shape `{"method": <tool name>, "params": <arguments>}` for every proof over a tool call: response and outcome proofs (§7.4), the approval `requestHash` of a step-up challenge, and holder-of-key request proofs.
|
|
967
|
+
Their verifiers accept a `requestHash` over either shape of the call they hold, so a producer that follows this section verifies against them; the reference producers switch to the covered request above in 2.0.0.
|
|
968
|
+
The legacy shape is deprecated: it hashes a tool named after a JSON-RPC method like that method's request, and it has no room for `params` members other than the arguments.
|
|
969
|
+
|
|
916
970
|
Response canonicalization is selected by the proof's response-proof profile, named by the signature-covered `prf` claim (§7.2):
|
|
917
971
|
|
|
918
972
|
- **body** (`prf` ABSENT — the original profile): the `data` field only (excludes `_meta`).
|
|
@@ -1243,7 +1297,7 @@ interface NeedsAuthorizationError {
|
|
|
1243
1297
|
message: string;
|
|
1244
1298
|
authorizationUrl: string; // URL where user can grant authorization
|
|
1245
1299
|
resumeToken: string; // Token to resume flow after authorization
|
|
1246
|
-
expiresAt: number; // Unix
|
|
1300
|
+
expiresAt: number; // Unix timestamp in seconds when resumeToken expires
|
|
1247
1301
|
scopes: string[]; // Scopes being requested
|
|
1248
1302
|
display?: {
|
|
1249
1303
|
title?: string;
|
|
@@ -1422,7 +1476,7 @@ and the residual risk an operator carries.
|
|
|
1422
1476
|
|
|
1423
1477
|
- Nonces MUST be cryptographically random (16 bytes minimum entropy)
|
|
1424
1478
|
- Nonce cache MUST persist across server restarts (use external storage)
|
|
1425
|
-
- Nonce cache
|
|
1479
|
+
- Nonce cache retention MUST cover the timestamp acceptance window (§5.5); it need not reach the session TTL
|
|
1426
1480
|
- Distributed deployments MUST use atomic check-and-set operations
|
|
1427
1481
|
|
|
1428
1482
|
### 11.3 Timestamp Skew Attacks
|
|
@@ -1684,7 +1738,11 @@ purpose/scope authorization out of band. Bundle contents cannot authorize their
|
|
|
1684
1738
|
own signer or bootstrap their own trust root. A verifier MUST distinguish
|
|
1685
1739
|
`valid`, `invalid`, and `indeterminate`, MUST keep authorization-as-observed
|
|
1686
1740
|
separate from current authorization/revocation, and MUST NOT consume a live
|
|
1687
|
-
nonce cache when verifying historical proof artifacts.
|
|
1741
|
+
nonce cache when verifying historical proof artifacts. A verifier MUST NOT
|
|
1742
|
+
ignore a verification-policy constraint (checkpoint-bounded key validity,
|
|
1743
|
+
required assurance profile, key revocation mode), and a constraint it cannot
|
|
1744
|
+
evaluate for the artifacts at hand MUST NOT leave the affected dimension
|
|
1745
|
+
`valid`.
|
|
1688
1746
|
|
|
1689
1747
|
Sensitive payloads SHOULD be encrypted in a separate evidence provider and
|
|
1690
1748
|
referenced by opaque randomized identifiers and ciphertext commitments. The
|
|
@@ -1784,6 +1842,35 @@ These test vectors enable interoperability testing across implementations.
|
|
|
1784
1842
|
sha256:5057521f310b536837b619f0ac040ef8064f8c597da8ec22a56801b435744033
|
|
1785
1843
|
```
|
|
1786
1844
|
|
|
1845
|
+
**Covered request (§7.3).**
|
|
1846
|
+
`requestHash` covers a request's `method` and `params` minus `params._meta` and, on a `tools/call`, minus the `_kyaos*` control arguments; an absent `arguments` is covered as `{}`.
|
|
1847
|
+
Each of these requests covers to the input above and hashes to the same value:
|
|
1848
|
+
|
|
1849
|
+
```json
|
|
1850
|
+
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"echo","arguments":{"_kyaos_proof":{"jws":"...","meta":{}}},"_meta":{"traceparent":"00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01"}}}
|
|
1851
|
+
```
|
|
1852
|
+
|
|
1853
|
+
```json
|
|
1854
|
+
{"method":"tools/call","params":{"name":"echo"}}
|
|
1855
|
+
```
|
|
1856
|
+
|
|
1857
|
+
Business arguments stay covered:
|
|
1858
|
+
|
|
1859
|
+
**Input JSON:**
|
|
1860
|
+
```json
|
|
1861
|
+
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"echo","arguments":{"msg":"hi","_kyaos_delegation":{"id":"urn:uuid:1111-aaaa"}},"_meta":{"progressToken":7}}}
|
|
1862
|
+
```
|
|
1863
|
+
|
|
1864
|
+
**Covered request, JCS canonicalized:**
|
|
1865
|
+
```json
|
|
1866
|
+
{"method":"tools/call","params":{"arguments":{"msg":"hi"},"name":"echo"}}
|
|
1867
|
+
```
|
|
1868
|
+
|
|
1869
|
+
**KYA-OS Format:**
|
|
1870
|
+
```
|
|
1871
|
+
sha256:c8f3d59959c9247211de8c76b94ef17f0c279f09362350ced67f69ecdb89d6c7
|
|
1872
|
+
```
|
|
1873
|
+
|
|
1787
1874
|
### C.2 did:key Derivation
|
|
1788
1875
|
|
|
1789
1876
|
**Ed25519 Public Key (32 bytes, hex):**
|
|
@@ -1813,7 +1900,7 @@ did:key:z6Mko6jQvza2BSKRcrbJwgwbL9KYDn1isCUV5Lnq7gSTTKJq
|
|
|
1813
1900
|
|
|
1814
1901
|
**Verification Method ID:**
|
|
1815
1902
|
```
|
|
1816
|
-
did:key:z6Mko6jQvza2BSKRcrbJwgwbL9KYDn1isCUV5Lnq7gSTTKJq#
|
|
1903
|
+
did:key:z6Mko6jQvza2BSKRcrbJwgwbL9KYDn1isCUV5Lnq7gSTTKJq#z6Mko6jQvza2BSKRcrbJwgwbL9KYDn1isCUV5Lnq7gSTTKJq
|
|
1817
1904
|
```
|
|
1818
1905
|
|
|
1819
1906
|
### C.3 JWS Structure
|
|
@@ -1824,7 +1911,7 @@ A valid detached proof JWS has the following structure:
|
|
|
1824
1911
|
```json
|
|
1825
1912
|
{
|
|
1826
1913
|
"alg": "EdDSA",
|
|
1827
|
-
"kid": "did:key:z6Mk...#
|
|
1914
|
+
"kid": "did:key:z6Mk...#z6Mk..."
|
|
1828
1915
|
}
|
|
1829
1916
|
```
|
|
1830
1917
|
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { boundedAuditReference } from './references.js';
|
|
2
|
+
/** Bounds every caller-supplied reference so a hostile one cannot keep the event out of the ledger. */
|
|
3
|
+
async function boundedAuthorization(authorization) {
|
|
4
|
+
const bounded = { ...authorization };
|
|
5
|
+
for (const field of ['scopeId', 'delegationRef', 'grantRef', 'policyId', 'policyVersion']) {
|
|
6
|
+
const value = authorization[field];
|
|
7
|
+
if (value !== undefined)
|
|
8
|
+
bounded[field] = await boundedAuditReference(value);
|
|
9
|
+
}
|
|
10
|
+
if (authorization.verificationCode !== undefined) {
|
|
11
|
+
bounded.verificationCode = await boundedAuditReference(authorization.verificationCode, 128);
|
|
12
|
+
}
|
|
13
|
+
return bounded;
|
|
3
14
|
}
|
|
4
15
|
/** Privacy-minimal translation from MCP lifecycle signals to binding-neutral events. */
|
|
5
16
|
export class McpAuditEventAdapter {
|
|
@@ -12,7 +23,7 @@ export class McpAuditEventAdapter {
|
|
|
12
23
|
async session(phase, input) {
|
|
13
24
|
await this.trail.record({
|
|
14
25
|
eventType: `session.${phase}`,
|
|
15
|
-
...this.context(input.context),
|
|
26
|
+
...(await this.context(input.context)),
|
|
16
27
|
action: { category: 'session' },
|
|
17
28
|
outcome: input.succeeded ? 'succeeded' : 'failed',
|
|
18
29
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
@@ -26,11 +37,11 @@ export class McpAuditEventAdapter {
|
|
|
26
37
|
async tool(phase, input) {
|
|
27
38
|
await this.trail.record({
|
|
28
39
|
eventType: `tool.call.${phase}`,
|
|
29
|
-
...this.context(input.context),
|
|
40
|
+
...(await this.context(input.context)),
|
|
30
41
|
action: {
|
|
31
42
|
category: 'tool.call',
|
|
32
43
|
...(this.options.includeToolNames
|
|
33
|
-
? { name:
|
|
44
|
+
? { name: await boundedAuditReference(input.toolName) }
|
|
34
45
|
: {}),
|
|
35
46
|
},
|
|
36
47
|
outcome: input.outcome,
|
|
@@ -42,7 +53,7 @@ export class McpAuditEventAdapter {
|
|
|
42
53
|
async proof(phase, input) {
|
|
43
54
|
await this.trail.record({
|
|
44
55
|
eventType: `proof.${phase}`,
|
|
45
|
-
...this.context(input.context),
|
|
56
|
+
...(await this.context(input.context)),
|
|
46
57
|
action: { category: 'proof' },
|
|
47
58
|
outcome: input.outcome,
|
|
48
59
|
evidence: [],
|
|
@@ -61,7 +72,7 @@ export class McpAuditEventAdapter {
|
|
|
61
72
|
: `authorization.${phase}`;
|
|
62
73
|
await this.trail.record({
|
|
63
74
|
eventType,
|
|
64
|
-
...this.context(input.context),
|
|
75
|
+
...(await this.context(input.context)),
|
|
65
76
|
action: { category: 'authorization' },
|
|
66
77
|
outcome: input.outcome,
|
|
67
78
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
@@ -71,24 +82,24 @@ export class McpAuditEventAdapter {
|
|
|
71
82
|
...(input.policyDigest === undefined ? {} : { policyDigest: input.policyDigest }),
|
|
72
83
|
...(input.grantRef === undefined
|
|
73
84
|
? {}
|
|
74
|
-
: { grantRef:
|
|
85
|
+
: { grantRef: await boundedAuditReference(input.grantRef) }),
|
|
75
86
|
},
|
|
76
87
|
});
|
|
77
88
|
}
|
|
78
89
|
async delegation(phase, input) {
|
|
79
90
|
await this.trail.record({
|
|
80
91
|
eventType: `delegation.${phase}`,
|
|
81
|
-
...this.context(input.context),
|
|
92
|
+
...(await this.context(input.context)),
|
|
82
93
|
action: { category: 'delegation' },
|
|
83
94
|
outcome: input.outcome,
|
|
84
95
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
85
96
|
evidence: [],
|
|
86
97
|
details: {
|
|
87
98
|
family: 'delegation', phase,
|
|
88
|
-
delegationRef:
|
|
99
|
+
delegationRef: await boundedAuditReference(input.delegationRef),
|
|
89
100
|
...(input.parentRef === undefined
|
|
90
101
|
? {}
|
|
91
|
-
: { parentRef:
|
|
102
|
+
: { parentRef: await boundedAuditReference(input.parentRef) }),
|
|
92
103
|
},
|
|
93
104
|
});
|
|
94
105
|
}
|
|
@@ -98,7 +109,7 @@ export class McpAuditEventAdapter {
|
|
|
98
109
|
: `consent.${phase}`;
|
|
99
110
|
await this.trail.record({
|
|
100
111
|
eventType: eventType,
|
|
101
|
-
...this.context(input.context),
|
|
112
|
+
...(await this.context(input.context)),
|
|
102
113
|
action: { category: 'consent' },
|
|
103
114
|
outcome: input.outcome,
|
|
104
115
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
@@ -107,7 +118,7 @@ export class McpAuditEventAdapter {
|
|
|
107
118
|
family: 'consent', phase,
|
|
108
119
|
...(input.consentRef === undefined
|
|
109
120
|
? {}
|
|
110
|
-
: { consentRef:
|
|
121
|
+
: { consentRef: await boundedAuditReference(input.consentRef) }),
|
|
111
122
|
},
|
|
112
123
|
});
|
|
113
124
|
}
|
|
@@ -120,7 +131,7 @@ export class McpAuditEventAdapter {
|
|
|
120
131
|
};
|
|
121
132
|
await this.trail.record({
|
|
122
133
|
eventType: eventTypes[phase],
|
|
123
|
-
...this.context(input.context),
|
|
134
|
+
...(await this.context(input.context)),
|
|
124
135
|
action: { category: 'configuration' },
|
|
125
136
|
outcome: input.outcome,
|
|
126
137
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
@@ -147,7 +158,7 @@ export class McpAuditEventAdapter {
|
|
|
147
158
|
};
|
|
148
159
|
await this.trail.record({
|
|
149
160
|
eventType: eventTypes[phase],
|
|
150
|
-
...this.context(input.context),
|
|
161
|
+
...(await this.context(input.context)),
|
|
151
162
|
action: { category: 'audit.ledger' },
|
|
152
163
|
outcome: input.outcome,
|
|
153
164
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
@@ -177,7 +188,7 @@ export class McpAuditEventAdapter {
|
|
|
177
188
|
};
|
|
178
189
|
await this.trail.record({
|
|
179
190
|
eventType: eventTypes[phase],
|
|
180
|
-
...this.context(input.context),
|
|
191
|
+
...(await this.context(input.context)),
|
|
181
192
|
action: { category: 'audit.administration' },
|
|
182
193
|
outcome: input.outcome,
|
|
183
194
|
...(input.reasonCode === undefined ? {} : { reason: { code: input.reasonCode } }),
|
|
@@ -194,7 +205,7 @@ export class McpAuditEventAdapter {
|
|
|
194
205
|
},
|
|
195
206
|
});
|
|
196
207
|
}
|
|
197
|
-
context(context) {
|
|
208
|
+
async context(context) {
|
|
198
209
|
if (context === undefined)
|
|
199
210
|
return {};
|
|
200
211
|
return {
|
|
@@ -204,9 +215,13 @@ export class McpAuditEventAdapter {
|
|
|
204
215
|
: { responsibleParty: context.responsibleParty }),
|
|
205
216
|
...(context.authorization === undefined
|
|
206
217
|
? {}
|
|
207
|
-
: { authorization: context.authorization }),
|
|
208
|
-
...(context.correlationId === undefined
|
|
209
|
-
|
|
218
|
+
: { authorization: await boundedAuthorization(context.authorization) }),
|
|
219
|
+
...(context.correlationId === undefined
|
|
220
|
+
? {}
|
|
221
|
+
: { correlationId: await boundedAuditReference(context.correlationId) }),
|
|
222
|
+
...(context.causationId === undefined
|
|
223
|
+
? {}
|
|
224
|
+
: { causationId: await boundedAuditReference(context.causationId) }),
|
|
210
225
|
};
|
|
211
226
|
}
|
|
212
227
|
}
|