@adcp/sdk 8.1.0-beta.13 → 8.1.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/adcp-registry.js +2 -2
- package/dist/lib/canonical-references/index.d.ts +107 -0
- package/dist/lib/canonical-references/index.d.ts.map +1 -0
- package/dist/lib/canonical-references/index.js +551 -0
- package/dist/lib/canonical-references/index.js.map +1 -0
- package/dist/lib/core/ConversationTypes.d.ts +7 -0
- package/dist/lib/core/ConversationTypes.d.ts.map +1 -1
- package/dist/lib/core/ProtocolResponseParser.d.ts +10 -0
- package/dist/lib/core/ProtocolResponseParser.d.ts.map +1 -1
- package/dist/lib/core/ProtocolResponseParser.js +110 -0
- package/dist/lib/core/ProtocolResponseParser.js.map +1 -1
- package/dist/lib/core/ResponseValidator.d.ts +2 -0
- package/dist/lib/core/ResponseValidator.d.ts.map +1 -1
- package/dist/lib/core/ResponseValidator.js +3 -3
- package/dist/lib/core/ResponseValidator.js.map +1 -1
- package/dist/lib/core/TaskExecutor.d.ts +2 -0
- package/dist/lib/core/TaskExecutor.d.ts.map +1 -1
- package/dist/lib/core/TaskExecutor.js +32 -8
- package/dist/lib/core/TaskExecutor.js.map +1 -1
- package/dist/lib/index.d.ts +5 -4
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +27 -11
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/mock-server/creative-ad-server/server.d.ts +2 -0
- package/dist/lib/mock-server/creative-ad-server/server.d.ts.map +1 -1
- package/dist/lib/mock-server/creative-ad-server/server.js +37 -1
- package/dist/lib/mock-server/creative-ad-server/server.js.map +1 -1
- package/dist/lib/mock-server/creative-template/server.d.ts +2 -0
- package/dist/lib/mock-server/creative-template/server.d.ts.map +1 -1
- package/dist/lib/mock-server/creative-template/server.js +29 -2
- package/dist/lib/mock-server/creative-template/server.js.map +1 -1
- package/dist/lib/mock-server/index.d.ts +10 -1
- package/dist/lib/mock-server/index.d.ts.map +1 -1
- package/dist/lib/mock-server/index.js +38 -8
- package/dist/lib/mock-server/index.js.map +1 -1
- package/dist/lib/mock-server/sales-guaranteed/server.d.ts +2 -0
- package/dist/lib/mock-server/sales-guaranteed/server.d.ts.map +1 -1
- package/dist/lib/mock-server/sales-guaranteed/server.js +64 -7
- package/dist/lib/mock-server/sales-guaranteed/server.js.map +1 -1
- package/dist/lib/mock-server/sales-non-guaranteed/server.d.ts +2 -0
- package/dist/lib/mock-server/sales-non-guaranteed/server.d.ts.map +1 -1
- package/dist/lib/mock-server/sales-non-guaranteed/server.js +44 -1
- package/dist/lib/mock-server/sales-non-guaranteed/server.js.map +1 -1
- package/dist/lib/mock-server/sales-social/server.d.ts +2 -0
- package/dist/lib/mock-server/sales-social/server.d.ts.map +1 -1
- package/dist/lib/mock-server/sales-social/server.js +64 -4
- package/dist/lib/mock-server/sales-social/server.js.map +1 -1
- package/dist/lib/mock-server/scenario.d.ts +97 -0
- package/dist/lib/mock-server/scenario.d.ts.map +1 -0
- package/dist/lib/mock-server/scenario.js +464 -0
- package/dist/lib/mock-server/scenario.js.map +1 -0
- package/dist/lib/mock-server/signal-marketplace/server.d.ts +2 -0
- package/dist/lib/mock-server/signal-marketplace/server.d.ts.map +1 -1
- package/dist/lib/mock-server/signal-marketplace/server.js +29 -1
- package/dist/lib/mock-server/signal-marketplace/server.js.map +1 -1
- package/dist/lib/mock-server/sponsored-intelligence/server.d.ts +2 -0
- package/dist/lib/mock-server/sponsored-intelligence/server.d.ts.map +1 -1
- package/dist/lib/mock-server/sponsored-intelligence/server.js +47 -9
- package/dist/lib/mock-server/sponsored-intelligence/server.js.map +1 -1
- package/dist/lib/protocols/index.d.ts +4 -2
- package/dist/lib/protocols/index.d.ts.map +1 -1
- package/dist/lib/protocols/index.js +10 -3
- package/dist/lib/protocols/index.js.map +1 -1
- package/dist/lib/registry/index.d.ts +42 -16
- package/dist/lib/registry/index.d.ts.map +1 -1
- package/dist/lib/registry/index.js +191 -24
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/types.d.ts +39 -8
- package/dist/lib/registry/types.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.d.ts +2873 -699
- package/dist/lib/registry/types.generated.d.ts.map +1 -1
- package/dist/lib/registry/types.generated.js +2 -2
- package/dist/lib/registry/types.generated.js.map +1 -1
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/a2a-adapter.d.ts +3 -1
- package/dist/lib/server/a2a-adapter.d.ts.map +1 -1
- package/dist/lib/server/a2a-adapter.js +11 -2
- package/dist/lib/server/a2a-adapter.js.map +1 -1
- package/dist/lib/server/adcp-server.js +32 -0
- package/dist/lib/server/adcp-server.js.map +1 -1
- package/dist/lib/server/create-adcp-server.d.ts +12 -6
- package/dist/lib/server/create-adcp-server.d.ts.map +1 -1
- package/dist/lib/server/create-adcp-server.js +72 -11
- package/dist/lib/server/create-adcp-server.js.map +1 -1
- package/dist/lib/server/decisioning/account.d.ts +17 -17
- package/dist/lib/server/decisioning/account.d.ts.map +1 -1
- package/dist/lib/server/decisioning/account.js.map +1 -1
- package/dist/lib/server/decisioning/buyer-agent.d.ts +27 -10
- package/dist/lib/server/decisioning/buyer-agent.d.ts.map +1 -1
- package/dist/lib/server/decisioning/buyer-agent.js +25 -7
- package/dist/lib/server/decisioning/buyer-agent.js.map +1 -1
- package/dist/lib/server/decisioning/capabilities.d.ts +35 -7
- package/dist/lib/server/decisioning/capabilities.d.ts.map +1 -1
- package/dist/lib/server/decisioning/errors-typed.d.ts +18 -16
- package/dist/lib/server/decisioning/errors-typed.d.ts.map +1 -1
- package/dist/lib/server/decisioning/errors-typed.js +26 -24
- package/dist/lib/server/decisioning/errors-typed.js.map +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/index.d.ts.map +1 -1
- package/dist/lib/server/decisioning/index.js +4 -2
- package/dist/lib/server/decisioning/index.js.map +1 -1
- package/dist/lib/server/decisioning/platform-helpers.d.ts +3 -2
- package/dist/lib/server/decisioning/platform-helpers.d.ts.map +1 -1
- package/dist/lib/server/decisioning/platform-helpers.js +3 -2
- package/dist/lib/server/decisioning/platform-helpers.js.map +1 -1
- package/dist/lib/server/decisioning/platform.d.ts +27 -10
- package/dist/lib/server/decisioning/platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/platform.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +14 -10
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.js +374 -59
- package/dist/lib/server/decisioning/runtime/from-platform.js.map +1 -1
- package/dist/lib/server/decisioning/runtime/validate-platform.d.ts.map +1 -1
- package/dist/lib/server/decisioning/runtime/validate-platform.js +3 -8
- package/dist/lib/server/decisioning/runtime/validate-platform.js.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sponsored-intelligence.d.ts +9 -11
- package/dist/lib/server/decisioning/specialisms/sponsored-intelligence.d.ts.map +1 -1
- package/dist/lib/server/decisioning/specialisms/sponsored-intelligence.js +9 -11
- package/dist/lib/server/decisioning/specialisms/sponsored-intelligence.js.map +1 -1
- package/dist/lib/server/operational-platform.d.ts +6 -8
- package/dist/lib/server/operational-platform.d.ts.map +1 -1
- package/dist/lib/server/operational-platform.js +4 -6
- package/dist/lib/server/operational-platform.js.map +1 -1
- package/dist/lib/server/test-controller-bridge.d.ts +14 -14
- package/dist/lib/server/test-controller-bridge.d.ts.map +1 -1
- package/dist/lib/server/test-controller-bridge.js +16 -16
- package/dist/lib/server/test-controller-bridge.js.map +1 -1
- package/dist/lib/server/test-controller.d.ts +31 -9
- package/dist/lib/server/test-controller.d.ts.map +1 -1
- package/dist/lib/server/test-controller.js +106 -54
- package/dist/lib/server/test-controller.js.map +1 -1
- package/dist/lib/signing/canonicalize.d.ts +0 -53
- package/dist/lib/signing/canonicalize.d.ts.map +1 -1
- package/dist/lib/signing/canonicalize.js +1 -33
- package/dist/lib/signing/canonicalize.js.map +1 -1
- package/dist/lib/signing/client.d.ts +5 -5
- package/dist/lib/signing/client.d.ts.map +1 -1
- package/dist/lib/signing/client.js +1 -10
- package/dist/lib/signing/client.js.map +1 -1
- package/dist/lib/signing/errors.d.ts +0 -11
- package/dist/lib/signing/errors.d.ts.map +1 -1
- package/dist/lib/signing/errors.js +1 -11
- package/dist/lib/signing/errors.js.map +1 -1
- package/dist/lib/signing/jwks-helpers.d.ts +2 -4
- package/dist/lib/signing/jwks-helpers.d.ts.map +1 -1
- package/dist/lib/signing/jwks-helpers.js +9 -0
- package/dist/lib/signing/jwks-helpers.js.map +1 -1
- package/dist/lib/signing/provider.d.ts +11 -10
- package/dist/lib/signing/provider.d.ts.map +1 -1
- package/dist/lib/signing/request-context.d.ts +8 -11
- package/dist/lib/signing/request-context.d.ts.map +1 -1
- package/dist/lib/signing/request-context.js +7 -10
- package/dist/lib/signing/request-context.js.map +1 -1
- package/dist/lib/signing/server.d.ts +3 -4
- package/dist/lib/signing/server.d.ts.map +1 -1
- package/dist/lib/signing/server.js +1 -9
- package/dist/lib/signing/server.js.map +1 -1
- package/dist/lib/signing/signer-async.d.ts +2 -8
- package/dist/lib/signing/signer-async.d.ts.map +1 -1
- package/dist/lib/signing/signer-async.js +0 -12
- package/dist/lib/signing/signer-async.js.map +1 -1
- package/dist/lib/signing/signer.d.ts +4 -111
- package/dist/lib/signing/signer.d.ts.map +1 -1
- package/dist/lib/signing/signer.js +2 -98
- package/dist/lib/signing/signer.js.map +1 -1
- package/dist/lib/signing/testing.d.ts +10 -10
- package/dist/lib/signing/testing.d.ts.map +1 -1
- package/dist/lib/signing/testing.js +6 -13
- package/dist/lib/signing/testing.js.map +1 -1
- package/dist/lib/signing/types.d.ts +0 -36
- package/dist/lib/signing/types.d.ts.map +1 -1
- package/dist/lib/signing/types.js +1 -37
- package/dist/lib/signing/types.js.map +1 -1
- package/dist/lib/testing/agent-tester.d.ts +1 -0
- package/dist/lib/testing/agent-tester.d.ts.map +1 -1
- package/dist/lib/testing/agent-tester.js.map +1 -1
- package/dist/lib/testing/client.d.ts +1 -1
- package/dist/lib/testing/client.d.ts.map +1 -1
- package/dist/lib/testing/client.js +4 -2
- package/dist/lib/testing/client.js.map +1 -1
- package/dist/lib/testing/compliance/comply.d.ts +8 -0
- package/dist/lib/testing/compliance/comply.d.ts.map +1 -1
- package/dist/lib/testing/compliance/comply.js +98 -7
- package/dist/lib/testing/compliance/comply.js.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.d.ts +6 -6
- package/dist/lib/testing/compliance/spec-conformance.d.ts.map +1 -1
- package/dist/lib/testing/compliance/spec-conformance.js +6 -6
- package/dist/lib/testing/compliance/spec-conformance.js.map +1 -1
- package/dist/lib/testing/compliance/summary.d.ts +5 -0
- package/dist/lib/testing/compliance/summary.d.ts.map +1 -1
- package/dist/lib/testing/compliance/summary.js +17 -0
- package/dist/lib/testing/compliance/summary.js.map +1 -1
- package/dist/lib/testing/comply-controller.d.ts +19 -0
- package/dist/lib/testing/comply-controller.d.ts.map +1 -1
- package/dist/lib/testing/comply-controller.js +11 -8
- package/dist/lib/testing/comply-controller.js.map +1 -1
- package/dist/lib/testing/index.d.ts +4 -3
- package/dist/lib/testing/index.d.ts.map +1 -1
- package/dist/lib/testing/index.js +13 -1
- package/dist/lib/testing/index.js.map +1 -1
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.d.ts +4 -0
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js +881 -0
- package/dist/lib/testing/storyboard/canonical-format-satisfaction.js.map +1 -0
- package/dist/lib/testing/storyboard/compliance.d.ts +6 -0
- package/dist/lib/testing/storyboard/compliance.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/compliance.js +8 -4
- package/dist/lib/testing/storyboard/compliance.js.map +1 -1
- package/dist/lib/testing/storyboard/index.d.ts +2 -1
- package/dist/lib/testing/storyboard/index.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/index.js +9 -1
- package/dist/lib/testing/storyboard/index.js.map +1 -1
- package/dist/lib/testing/storyboard/loader.d.ts +3 -2
- package/dist/lib/testing/storyboard/loader.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/loader.js +73 -2
- package/dist/lib/testing/storyboard/loader.js.map +1 -1
- package/dist/lib/testing/storyboard/path.d.ts +21 -0
- package/dist/lib/testing/storyboard/path.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/path.js +86 -0
- package/dist/lib/testing/storyboard/path.js.map +1 -1
- package/dist/lib/testing/storyboard/rate-limit-trip.d.ts +92 -0
- package/dist/lib/testing/storyboard/rate-limit-trip.d.ts.map +1 -0
- package/dist/lib/testing/storyboard/rate-limit-trip.js +276 -0
- package/dist/lib/testing/storyboard/rate-limit-trip.js.map +1 -0
- package/dist/lib/testing/storyboard/runner.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/runner.js +361 -28
- package/dist/lib/testing/storyboard/runner.js.map +1 -1
- package/dist/lib/testing/storyboard/seeding.d.ts +5 -4
- package/dist/lib/testing/storyboard/seeding.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/seeding.js +23 -3
- package/dist/lib/testing/storyboard/seeding.js.map +1 -1
- package/dist/lib/testing/storyboard/types.d.ts +108 -20
- package/dist/lib/testing/storyboard/types.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/types.js +1 -0
- package/dist/lib/testing/storyboard/types.js.map +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +18 -0
- package/dist/lib/testing/storyboard/validations.d.ts.map +1 -1
- package/dist/lib/testing/storyboard/validations.js +238 -33
- package/dist/lib/testing/storyboard/validations.js.map +1 -1
- package/dist/lib/testing/test-controller.d.ts +17 -25
- package/dist/lib/testing/test-controller.d.ts.map +1 -1
- package/dist/lib/testing/test-controller.js.map +1 -1
- package/dist/lib/testing/types.d.ts +13 -1
- package/dist/lib/testing/types.d.ts.map +1 -1
- package/dist/lib/types/check-governance.d.ts +1 -1
- package/dist/lib/types/comply-test-controller.d.ts +243 -3
- package/dist/lib/types/core.generated.d.ts +261 -21
- package/dist/lib/types/core.generated.d.ts.map +1 -1
- package/dist/lib/types/core.generated.js +1 -1
- package/dist/lib/types/create-media-buy.d.ts +107 -3
- package/dist/lib/types/error-codes.d.ts +2 -2
- package/dist/lib/types/get-adcp-capabilities.d.ts +1 -1
- package/dist/lib/types/get-media-buys.d.ts +107 -3
- package/dist/lib/types/get-plan-audit-logs.d.ts +1 -1
- package/dist/lib/types/get-products.d.ts +104 -3
- package/dist/lib/types/inline-enums.generated.d.ts +27 -17
- package/dist/lib/types/inline-enums.generated.d.ts.map +1 -1
- package/dist/lib/types/inline-enums.generated.js +39 -28
- package/dist/lib/types/inline-enums.generated.js.map +1 -1
- package/dist/lib/types/manifest.generated.d.ts +7 -4
- package/dist/lib/types/manifest.generated.d.ts.map +1 -1
- package/dist/lib/types/manifest.generated.js +2 -2
- package/dist/lib/types/manifest.generated.js.map +1 -1
- package/dist/lib/types/report-plan-outcome.d.ts +1 -1
- package/dist/lib/types/schemas.generated.d.ts +714 -193
- package/dist/lib/types/schemas.generated.d.ts.map +1 -1
- package/dist/lib/types/schemas.generated.js +194 -79
- package/dist/lib/types/schemas.generated.js.map +1 -1
- package/dist/lib/types/sync-plans.d.ts +1 -1
- package/dist/lib/types/tools.generated.d.ts +331 -28
- package/dist/lib/types/tools.generated.d.ts.map +1 -1
- package/dist/lib/types/update-media-buy.d.ts +107 -3
- package/dist/lib/types/v3-1-beta/tools.generated.d.ts +20 -0
- package/dist/lib/types/v3-1-beta/tools.generated.d.ts.map +1 -1
- package/dist/lib/upstream-recorder/constants.d.ts +2 -0
- package/dist/lib/upstream-recorder/constants.d.ts.map +1 -0
- package/dist/lib/upstream-recorder/constants.js +5 -0
- package/dist/lib/upstream-recorder/constants.js.map +1 -0
- package/dist/lib/upstream-recorder/index.d.ts +20 -10
- package/dist/lib/upstream-recorder/index.d.ts.map +1 -1
- package/dist/lib/upstream-recorder/index.js +21 -10
- package/dist/lib/upstream-recorder/index.js.map +1 -1
- package/dist/lib/upstream-recorder/recorder.d.ts +65 -0
- package/dist/lib/upstream-recorder/recorder.d.ts.map +1 -1
- package/dist/lib/upstream-recorder/recorder.js +500 -47
- package/dist/lib/upstream-recorder/recorder.js.map +1 -1
- package/dist/lib/upstream-recorder/types.d.ts +109 -13
- package/dist/lib/upstream-recorder/types.d.ts.map +1 -1
- package/dist/lib/upstream-recorder/types.js.map +1 -1
- package/dist/lib/utils/adcp-version-config.d.ts +1 -0
- package/dist/lib/utils/adcp-version-config.d.ts.map +1 -1
- package/dist/lib/utils/adcp-version-config.js +21 -0
- package/dist/lib/utils/adcp-version-config.js.map +1 -1
- package/dist/lib/utils/capability-rollups.d.ts +5 -5
- package/dist/lib/utils/capability-rollups.d.ts.map +1 -1
- package/dist/lib/utils/capability-rollups.js +1 -1
- package/dist/lib/utils/capability-rollups.js.map +1 -1
- package/dist/lib/utils/json-depth.d.ts +2 -0
- package/dist/lib/utils/json-depth.d.ts.map +1 -0
- package/dist/lib/utils/json-depth.js +5 -0
- package/dist/lib/utils/json-depth.js.map +1 -0
- package/dist/lib/utils/media-buy-delivery-notification-builders.d.ts +1 -1
- package/dist/lib/utils/media-buy-delivery-notification-builders.d.ts.map +1 -1
- package/dist/lib/utils/preview-creative-builders.d.ts +1 -1
- package/dist/lib/utils/preview-creative-builders.d.ts.map +1 -1
- package/dist/lib/utils/redact-secrets.d.ts +13 -2
- package/dist/lib/utils/redact-secrets.d.ts.map +1 -1
- package/dist/lib/utils/redact-secrets.js +40 -13
- package/dist/lib/utils/redact-secrets.js.map +1 -1
- package/dist/lib/utils/response-schemas.d.ts +1 -0
- package/dist/lib/utils/response-schemas.d.ts.map +1 -1
- package/dist/lib/utils/response-schemas.js +15 -0
- package/dist/lib/utils/response-schemas.js.map +1 -1
- package/dist/lib/utils/response-unwrapper.d.ts +2 -1
- package/dist/lib/utils/response-unwrapper.d.ts.map +1 -1
- package/dist/lib/utils/response-unwrapper.js +11 -3
- package/dist/lib/utils/response-unwrapper.js.map +1 -1
- package/dist/lib/utils/tool-request-schemas.d.ts +31 -1
- package/dist/lib/utils/tool-request-schemas.d.ts.map +1 -1
- package/dist/lib/v2/format-schema/fetch.d.ts +13 -5
- package/dist/lib/v2/format-schema/fetch.d.ts.map +1 -1
- package/dist/lib/v2/format-schema/fetch.js +27 -16
- package/dist/lib/v2/format-schema/fetch.js.map +1 -1
- package/dist/lib/v2/format-schema/index.d.ts +13 -11
- package/dist/lib/v2/format-schema/index.d.ts.map +1 -1
- package/dist/lib/v2/format-schema/index.js +19 -12
- package/dist/lib/v2/format-schema/index.js.map +1 -1
- package/dist/lib/v2/format-schema/resolver.d.ts +71 -0
- package/dist/lib/v2/format-schema/resolver.d.ts.map +1 -0
- package/dist/lib/v2/format-schema/resolver.js +284 -0
- package/dist/lib/v2/format-schema/resolver.js.map +1 -0
- package/dist/lib/v2/format-schema/sandbox-refs.d.ts +6 -0
- package/dist/lib/v2/format-schema/sandbox-refs.d.ts.map +1 -1
- package/dist/lib/v2/format-schema/sandbox-refs.js +36 -15
- package/dist/lib/v2/format-schema/sandbox-refs.js.map +1 -1
- package/dist/lib/validation/schema-loader.d.ts.map +1 -1
- package/dist/lib/validation/schema-loader.js +48 -3
- package/dist/lib/validation/schema-loader.js.map +1 -1
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/docs/guides/BUILD-AN-AGENT.md +7 -7
- package/docs/guides/CANONICAL-REFERENCE-RESOLVER.md +75 -0
- package/docs/llms.txt +37 -8
- package/examples/README.md +29 -16
- package/examples/hello_creative_adapter_ad_server.ts +8 -2
- package/examples/hello_seller_adapter_guaranteed.ts +26 -18
- package/examples/hello_seller_adapter_multi_tenant.ts +6 -6
- package/examples/hello_seller_adapter_social.ts +80 -4
- package/examples/hello_si_adapter_brand.ts +10 -21
- package/examples/hello_signals_adapter_marketplace.ts +184 -9
- package/examples/proxy-seller-snap/README.md +47 -0
- package/examples/proxy-seller-snap/index.ts +321 -0
- package/package.json +19 -4
- package/skills/build-creative-agent/SKILL.md +1 -15
- package/skills/build-decisioning-platform/SKILL.md +6 -1
- package/skills/build-seller-agent/SKILL.md +5 -2
- package/skills/build-si-agent/SKILL.md +2 -2
- package/skills/call-adcp-agent/SKILL.md +4 -1
- package/dist/lib/signing/response-verifier.d.ts +0 -105
- package/dist/lib/signing/response-verifier.d.ts.map +0 -1
- package/dist/lib/signing/response-verifier.js +0 -271
- package/dist/lib/signing/response-verifier.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adcp/sdk",
|
|
3
|
-
"version": "8.1.0-beta.
|
|
3
|
+
"version": "8.1.0-beta.14",
|
|
4
4
|
"description": "AdCP SDK — client, server, and compliance harnesses for the AdContext Protocol (MCP + A2A)",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
".",
|
|
@@ -93,6 +93,11 @@
|
|
|
93
93
|
"require": "./dist/lib/net/index.js",
|
|
94
94
|
"types": "./dist/lib/net/index.d.ts"
|
|
95
95
|
},
|
|
96
|
+
"./canonical-references": {
|
|
97
|
+
"import": "./dist/lib/canonical-references/index.js",
|
|
98
|
+
"require": "./dist/lib/canonical-references/index.js",
|
|
99
|
+
"types": "./dist/lib/canonical-references/index.d.ts"
|
|
100
|
+
},
|
|
96
101
|
"./server": {
|
|
97
102
|
"import": "./dist/lib/server/index.js",
|
|
98
103
|
"require": "./dist/lib/server/index.js",
|
|
@@ -204,6 +209,9 @@
|
|
|
204
209
|
"net": [
|
|
205
210
|
"dist/lib/net/index.d.ts"
|
|
206
211
|
],
|
|
212
|
+
"canonical-references": [
|
|
213
|
+
"dist/lib/canonical-references/index.d.ts"
|
|
214
|
+
],
|
|
207
215
|
"server": [
|
|
208
216
|
"dist/lib/server/index.d.ts"
|
|
209
217
|
],
|
|
@@ -257,6 +265,7 @@
|
|
|
257
265
|
"ADCP_VERSION",
|
|
258
266
|
"docs/llms.txt",
|
|
259
267
|
"docs/guides/BUILD-AN-AGENT.md",
|
|
268
|
+
"docs/guides/CANONICAL-REFERENCE-RESOLVER.md",
|
|
260
269
|
"examples/**/*",
|
|
261
270
|
"AGENTS.md",
|
|
262
271
|
"README.md",
|
|
@@ -270,9 +279,14 @@
|
|
|
270
279
|
"build:lib": "npm run sync-version && npm run schemas:ensure && tsx scripts/generate-wire-spec-fields.ts && tsc --project tsconfig.lib.json && tsx scripts/copy-schemas-to-dist.ts && tsx scripts/copy-v2-projection-catalog.ts && tsx scripts/generate-per-tool-types.ts",
|
|
271
280
|
"build:test-agents": "npm run build:lib && tsc -p test-agents/tsconfig.json --rootDir test-agents",
|
|
272
281
|
"pretest": "npm run schemas:ensure",
|
|
273
|
-
"test": "
|
|
282
|
+
"test": "npm run test:node && npm test --workspace=packages/eslint-plugin --if-present",
|
|
283
|
+
"test:node": "npm run test:node:fast && npm run test:node:slow",
|
|
284
|
+
"test:node:fast": "NODE_ENV=test node --test-timeout=60000 --test-force-exit --test $(find test -maxdepth 1 -name '*.test.js' ! -name 'generate-zod-object-intersections.test.js' -print) $(find test/lib -maxdepth 1 -name '*.test.js' ! -name 'cli-auth-scheme.test.js' ! -name 'cli-webhook-receiver-flag.test.js' ! -name 'conformance-cli.test.js' -print)",
|
|
285
|
+
"test:node:slow": "NODE_ENV=test node --test-timeout=180000 --test-force-exit --test test/generate-zod-object-intersections.test.js test/lib/cli-auth-scheme.test.js test/lib/cli-webhook-receiver-flag.test.js test/lib/conformance-cli.test.js",
|
|
274
286
|
"pretest:lib": "npm run schemas:ensure",
|
|
275
|
-
"test:lib": "
|
|
287
|
+
"test:lib": "npm run test:lib:fast && npm run test:lib:slow",
|
|
288
|
+
"test:lib:fast": "NODE_ENV=test node --test-timeout=60000 --test-force-exit --test $(find test/lib -maxdepth 1 -name '*.test.js' ! -name 'cli-auth-scheme.test.js' ! -name 'cli-webhook-receiver-flag.test.js' ! -name 'conformance-cli.test.js' -print)",
|
|
289
|
+
"test:lib:slow": "NODE_ENV=test node --test-timeout=180000 --test-force-exit --test test/lib/cli-auth-scheme.test.js test/lib/cli-webhook-receiver-flag.test.js test/lib/conformance-cli.test.js",
|
|
276
290
|
"pretest:examples": "npm run build",
|
|
277
291
|
"test:examples": "NODE_ENV=test node --test-timeout=180000 --test-force-exit --test-concurrency=1 --test test/examples/*.test.js",
|
|
278
292
|
"test:e2e": "node test/e2e/adcp-e2e.test.js",
|
|
@@ -290,6 +304,7 @@
|
|
|
290
304
|
"sync-schemas:v2.5": "tsx scripts/sync-v2-5-schemas.ts",
|
|
291
305
|
"sync-schemas:3.1-beta": "tsx scripts/sync-3-1-beta-schemas.ts",
|
|
292
306
|
"sync-schemas:all": "npm run sync-schemas && npm run sync-schemas:v2.5 && npm run sync-schemas:3.1-beta",
|
|
307
|
+
"sync-registry-schemas": "tsx scripts/generate-registry-types.ts --sync",
|
|
293
308
|
"schemas:ensure": "tsx scripts/schemas-ensure.ts",
|
|
294
309
|
"schema-diff": "tsx scripts/schema-diff.ts",
|
|
295
310
|
"generate-types": "tsx scripts/generate-types.ts && tsx scripts/generate-enum-arrays.ts && tsx scripts/generate-manifest-derived.ts && tsx scripts/generate-entity-hydration.ts",
|
|
@@ -304,7 +319,7 @@
|
|
|
304
319
|
"generate-zod-schemas": "tsx scripts/generate-zod-from-ts.ts && tsx scripts/generate-inline-enum-arrays.ts",
|
|
305
320
|
"generate-wellknown-schemas": "tsx scripts/generate-wellknown-schemas.ts",
|
|
306
321
|
"generate-agent-docs": "tsx scripts/generate-agent-docs.ts",
|
|
307
|
-
"compliance:fork-matrix": "node --test --test-timeout=300000 'test/examples/hello-*.test.js'",
|
|
322
|
+
"compliance:fork-matrix": "node --test --test-timeout=300000 'test/examples/hello-*.test.js' test/examples/proxy-seller-snap.test.js",
|
|
308
323
|
"typecheck:skill-examples": "tsx scripts/typecheck-skill-examples.ts",
|
|
309
324
|
"check:skill-sync": "tsx scripts/check-skill-sync.ts",
|
|
310
325
|
"check:adopter-types": "tsx scripts/check-adopter-types.ts",
|
|
@@ -76,21 +76,7 @@ Audio templates (TTS / mix / master, e.g. AudioStack / ElevenLabs / Resemble) fo
|
|
|
76
76
|
The `audioAsset` builder injects the `asset_type: 'audio'` discriminator the creative-manifest oneOf requires.
|
|
77
77
|
4. Seed an audio template in your upstream platform — see `tpl_audiostack_spot_30s_v1` in `src/lib/mock-server/creative-template/seed-data.ts` for the worked reference.
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npx adcp mock-server creative-template --port 4250
|
|
83
|
-
# In another shell:
|
|
84
|
-
curl -X POST http://127.0.0.1:4250/v3/workspaces/ws_acme_studio/renders \
|
|
85
|
-
-H 'Authorization: Bearer mock_creative_template_key_do_not_use_in_prod' \
|
|
86
|
-
-H 'Content-Type: application/json' \
|
|
87
|
-
-d '{"template_id":"tpl_audiostack_spot_30s_v1","mode":"build","inputs":[{"slot_id":"script","value":"Built for the trail."}],"client_request_id":"smoke-1"}'
|
|
88
|
-
# → { "render_id": "rnd_…", "status": "queued" }
|
|
89
|
-
# Poll twice (queued → running → complete):
|
|
90
|
-
curl -H 'Authorization: Bearer mock_creative_template_key_do_not_use_in_prod' \
|
|
91
|
-
http://127.0.0.1:4250/v3/workspaces/ws_acme_studio/renders/rnd_…
|
|
92
|
-
# Final: { ..., "status": "complete", "output": { "audio_url": "….mp3", "preview_url": "...", "assets": [{ "kind": "audio_url", "mime_type": "audio/mpeg" }] } }
|
|
93
|
-
```
|
|
79
|
+
The `creative_template` storyboard includes an optional `audio_build` phase. Enable it with a test kit that sets `supports_audio_formats: true` once your `list_creative_formats` response declares an audio format; the hello adapter CI gate asserts both the discovered audio format and the seeded AudioStack-style build output.
|
|
94
80
|
|
|
95
81
|
### `creative-generative`
|
|
96
82
|
|
|
@@ -243,7 +243,8 @@ import {
|
|
|
243
243
|
InvalidRequestError, // generic field-level bad input
|
|
244
244
|
InvalidStateError, // illegal transition (paused → archived violations)
|
|
245
245
|
BackwardsTimeRangeError, // start_time >= end_time
|
|
246
|
-
|
|
246
|
+
AuthMissingError, // no Authorization header was presented
|
|
247
|
+
AuthInvalidError, // credentials were presented but rejected
|
|
247
248
|
PermissionDeniedError, // auth present, lacks scope
|
|
248
249
|
RateLimitedError, // throttled (clamps retry_after to [1, 3600])
|
|
249
250
|
UnsupportedFeatureError, // tool unimplemented
|
|
@@ -253,6 +254,10 @@ import {
|
|
|
253
254
|
} from '@adcp/sdk/server';
|
|
254
255
|
```
|
|
255
256
|
|
|
257
|
+
`AuthRequiredError` still exists for older code and emits legacy `AUTH_REQUIRED`;
|
|
258
|
+
new seller code should use `AuthMissingError` / `AuthInvalidError` so buyers can
|
|
259
|
+
distinguish missing credentials from rejected credentials.
|
|
260
|
+
|
|
256
261
|
Each class encodes the right `code` / `recovery` / `field` shape. **Don't throw generic `Error`** — the framework catches that and maps to `SERVICE_UNAVAILABLE`, which the buyer can't pattern-match.
|
|
257
262
|
|
|
258
263
|
## Persisting platform state — `ctx.ctxMetadata`
|
|
@@ -5,17 +5,18 @@ description: Use when building an AdCP seller agent — a publisher, SSP, or ret
|
|
|
5
5
|
|
|
6
6
|
# Build a Seller Agent
|
|
7
7
|
|
|
8
|
-
A seller agent receives briefs from buyers, returns products, accepts media buys, manages creatives, and reports delivery. The fastest path to a passing agent is to **fork a worked adapter** and replace its `// SWAP:` markers with calls to your backend. Each `// SWAP:` comment marks one line you change to your platform's backend call — change only those lines, run the gate, ship. ([`examples/CONTRIBUTING.md`](../../examples/CONTRIBUTING.md) covers the SWAP-marker convention in detail.) This skill tells you which adapter to fork and what cross-cutting rules apply across all of them.
|
|
8
|
+
A seller agent receives briefs from buyers, returns products, accepts media buys, manages creatives, and reports delivery. The fastest path to a passing agent is to **fork a worked adapter** and replace its `// SWAP:` markers with calls to your backend. Each `// SWAP:` comment marks one line you change to your platform's backend call — change only those lines, run the gate, ship. ([`examples/CONTRIBUTING.md`](../../examples/CONTRIBUTING.md) covers the SWAP-marker convention in detail.) Proxy-shaped sellers use the lighter `proxy-seller-snap/` bridge-pattern fork target plus a live-OAuth sandbox runner. This skill tells you which adapter to fork and what cross-cutting rules apply across all of them.
|
|
9
9
|
|
|
10
10
|
## Pick your fork target
|
|
11
11
|
|
|
12
|
-
Each
|
|
12
|
+
Each `hello_*_adapter_*` entry is a worked, currently-running, three-gate-tested reference adapter. `proxy-seller-snap/` is a bridge-pattern fork target for the seed-read problem; pair it with your own live-OAuth sandbox gate before production.
|
|
13
13
|
|
|
14
14
|
| Specialism | Fork this | Mock upstream | Storyboard |
|
|
15
15
|
| ----------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------- | ---------------------- |
|
|
16
16
|
| `sales-guaranteed` | [`hello_seller_adapter_guaranteed.ts`](../../examples/hello_seller_adapter_guaranteed.ts) | `npx adcp mock-server sales-guaranteed` | `sales_guaranteed` |
|
|
17
17
|
| `sales-non-guaranteed` | [`hello_seller_adapter_non_guaranteed.ts`](../../examples/hello_seller_adapter_non_guaranteed.ts) | `npx adcp mock-server sales-non-guaranteed` | `sales_non_guaranteed` |
|
|
18
18
|
| `sales-social` | [`hello_seller_adapter_social.ts`](../../examples/hello_seller_adapter_social.ts) | `npx adcp mock-server sales-social` | `sales_social` |
|
|
19
|
+
| Proxy-shaped seller | [`proxy-seller-snap/`](../../examples/proxy-seller-snap/) | upstream sandbox / OAuth | bridge + live run |
|
|
19
20
|
| Multi-tenant holdco hub | [`hello_seller_adapter_multi_tenant.ts`](../../examples/hello_seller_adapter_multi_tenant.ts) | composed | per specialism |
|
|
20
21
|
|
|
21
22
|
The other sales-\* specialisms reuse one of the primary fork targets and apply specialism deltas:
|
|
@@ -93,6 +94,8 @@ To pass storyboards, you need the runner's `comply_test_controller.seed_product`
|
|
|
93
94
|
|
|
94
95
|
- **Handler reads from a system you don't control** (DSPs proxying to Meta/Snap/TikTok, retail-media networks reading retailer catalog APIs, signals agents brokering third-party data marketplaces, walled-garden brokers). A seeded write to your local store is dead — your handler never sees it; if `comply_test_controller` seeds never appear in your responses, that's the symptom. **Wire the `TestControllerBridge`** ([`docs/guides/VALIDATE-YOUR-AGENT.md` § "Platform-proxy sellers"](../../docs/guides/VALIDATE-YOUR-AGENT.md#platform-proxy-sellers-state-of-record-lives-upstream)). The real handler still runs first (so a broken upstream call still fails the conformance gate), and the SDK merges seeded fixtures into the response after.
|
|
95
96
|
|
|
97
|
+
Start from [`examples/proxy-seller-snap/`](../../examples/proxy-seller-snap/) for the concrete fork shape: `TestControllerBridge<TAccount>`, `bridgeFromSessionStore`, resolved-account session keying, `getSeededProducts`, `getSeededCreatives`, and governance list selectors. Keep `resolveAccount` as the production trust boundary and pair bridge-green storyboards with a live-OAuth sandbox run; bridge passes prove wire conformance, not upstream adapter health.
|
|
98
|
+
|
|
96
99
|
Either path earns the **wire-conformance** half of compliance — your storyboards pass, you speak AdCP correctly. The **live-integration** half requires marker-free passes against a real test surface (sandbox credentials with real upstream traffic), independent of whether the bridge is wired. The `_bridge` marker the SDK stamps on bridge-merged responses tracks which steps in a storyboard run used fixtures vs real upstream.
|
|
97
100
|
|
|
98
101
|
> Certification names in #1782 are under review; the mechanism here is stable.
|
|
@@ -20,7 +20,7 @@ The agent owns the brand voice, transcript state, and product knowledge. The hos
|
|
|
20
20
|
| --- | --- | --- |
|
|
21
21
|
| `sponsored-intelligence` | [`hello_si_adapter_brand.ts`](../../examples/hello_si_adapter_brand.ts) | `si_baseline` |
|
|
22
22
|
|
|
23
|
-
SI is a **protocol** in AdCP 3.
|
|
23
|
+
SI is a **protocol and specialism** in AdCP 3.1. Declare it with `specialisms: ['sponsored-intelligence']` and implement the `sponsoredIntelligence` field on the v6 `DecisioningPlatform`; the framework auto-derives the wire-side `supported_protocols: ['sponsored_intelligence']` entry from the four registered SI tools. Older 3.0-era agents that omit the specialism still dispatch through `platform.sponsoredIntelligence`, but new agents should claim the specialism for compile-time and runtime validation.
|
|
24
24
|
|
|
25
25
|
The storyboard at `compliance/cache/latest/protocols/sponsored-intelligence/index.yaml` has three phases (capability_discovery, offering_discovery, session_lifecycle) covering all four tools. The reference adapter passes 3/3.
|
|
26
26
|
|
|
@@ -53,7 +53,7 @@ One SI-specific note on idempotency:
|
|
|
53
53
|
|
|
54
54
|
## Specialism deltas at a glance
|
|
55
55
|
|
|
56
|
-
**`sponsored-intelligence`
|
|
56
|
+
**`sponsored-intelligence` specialism** —
|
|
57
57
|
|
|
58
58
|
- **Single brand per deployment is typical** — one Agentforce instance per advertiser, one OpenAI Assistant per brand. Multi-brand variants route via per-API-key tenant binding inside `accounts.resolve`, not by carrying `account` on the wire (SI tool schemas don't have it).
|
|
59
59
|
- **Session state**: the framework auto-hydrates a small `req.session` record (intent, offering scoping, identity consent, negotiated capabilities) onto `si_send_message` / `si_terminate_session`. Production brand engines almost always own full transcript state in their own backend (Postgres, Redis, vector store) — full transcripts, RAG embeddings, tool-call logs are too rich for `ctx_metadata` and easily exceed the 16KB blob cap. Treat `req.session` as a convenience, not authoritative state.
|
|
@@ -241,7 +241,10 @@ Quick lookup before reading the full envelope. Match what you see in `adcp_error
|
|
|
241
241
|
| `recovery: 'correctable'` | Buyer-side fix | Read `issues[]`, patch the pointers, resend. Most cases close in one attempt. |
|
|
242
242
|
| `recovery: 'terminal'` (account suspended, payment required, …) | Requires human action | Don't retry. Surface to the user. |
|
|
243
243
|
| `[adcp] Warning: agent … does not expose get_adcp_capabilities` (one-shot per client, `@adcp/client` only) | Seller didn't ship v3 discovery — routed through the v2 adapter with idempotency-TTL guarantee unknown | Branch on `client.isSyntheticV2()` before dispatch. Tighten retry policy (lower attempt cap, longer backoff) or fall back to natural-key recovery for these sellers. Same predicate also flags synthetic v3 caveat — see `isSyntheticV2()` JSDoc. |
|
|
244
|
-
|
|
|
244
|
+
| `adcp_error.code: 'AUTH_MISSING'` | No credential was presented | Escalate by default. Retry only if you own a credential supply or refresh path; otherwise surface re-auth to a human. |
|
|
245
|
+
| `adcp_error.code: 'AUTH_INVALID'` | Credential was presented but rejected or revoked | Do not retry blindly. Refresh once only if you own a valid refresh grant and the rejection is token-expiry-shaped; otherwise surface to a human to rotate credentials. |
|
|
246
|
+
| `adcp_error.code: 'AUTH_REQUIRED'` | Legacy compatibility code; older sellers and some SDK helper paths still use it for missing or rejected credentials | Treat as auth escalation by default. Retry only if your agent owns a credential-refresh path; otherwise surface to a human. |
|
|
247
|
+
| HTTP 401 with `WWW-Authenticate` header | Transport auth challenge; may be missing credentials, wrong scheme, rejected credentials, or required request signing | Follow the challenge scheme. `Bearer` means send/refresh an OAuth-style `Authorization: Bearer ...` token. `Basic` means configure basic auth (`auth: { type: 'basic', username, password }` or `--auth user:pass --auth-scheme basic`) — `Bearer` will never succeed against that gateway. `Signature` means enable RFC 9421 request signing with an AdCP signing key, not an `Authorization` retry. **Saved aliases**: if registered with `--auth-scheme basic`, the scheme persists in `~/.adcp/config.json` and auto-applies on every later invocation — don't redundantly repeat the flag on each call. |
|
|
245
248
|
|
|
246
249
|
If your symptom isn't here, fall through to the next section.
|
|
247
250
|
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RFC 9421 response-signing verifier (§2.2.9).
|
|
3
|
-
*
|
|
4
|
-
* Companion to `verifier.ts` (request signatures) and `webhook-verifier.ts`
|
|
5
|
-
* (webhook callbacks). This verifier runs on the buyer / receiver side of
|
|
6
|
-
* a signed response: a client receives a response from a seller agent and
|
|
7
|
-
* hands it here, with the originating request URL the client sent, for
|
|
8
|
-
* signature validation before parsing the body.
|
|
9
|
-
*
|
|
10
|
-
* Distinct from request / webhook signing:
|
|
11
|
-
* - Tag: `adcp/response-signing/v1`.
|
|
12
|
-
* - Key purpose: `adcp_use: "response-signing"`.
|
|
13
|
-
* - Default covered components: `@status`, `@authority`, `@target-uri`,
|
|
14
|
-
* plus `content-type` + `content-digest` when the body is non-empty.
|
|
15
|
-
* - The originating request URL is carried explicitly on `ResponseLike.request`
|
|
16
|
-
* because RFC 9421 §2.2 binds response signatures to their request
|
|
17
|
-
* context via `@authority` and `@target-uri`. The client supplies the URL
|
|
18
|
-
* it actually sent — a malformed reconstruction (e.g. `req.protocol`
|
|
19
|
-
* lying behind a proxy) will trip step 6a or fail the crypto check.
|
|
20
|
-
*
|
|
21
|
-
* Checklist steps below mirror the 13-step shape in `webhook-verifier.ts`
|
|
22
|
-
* so failures point at the same step numbers the request and webhook
|
|
23
|
-
* verifiers use. Numbers are 1-based.
|
|
24
|
-
*/
|
|
25
|
-
import { type ResponseLike } from './canonicalize';
|
|
26
|
-
import type { JwksResolver } from './jwks';
|
|
27
|
-
import { type ReplayStore } from './replay';
|
|
28
|
-
import { type RevocationStore } from './revocation';
|
|
29
|
-
export interface VerifyResponseOptions {
|
|
30
|
-
jwks: JwksResolver;
|
|
31
|
-
replayStore: ReplayStore;
|
|
32
|
-
revocationStore: RevocationStore;
|
|
33
|
-
/** Now in seconds since epoch. Defaults to `Date.now() / 1000`. */
|
|
34
|
-
now?: () => number;
|
|
35
|
-
/**
|
|
36
|
-
* Optional tag override — spec currently defines exactly
|
|
37
|
-
* `adcp/response-signing/v1`; the override lets test vectors pin a
|
|
38
|
-
* version.
|
|
39
|
-
*/
|
|
40
|
-
requiredTag?: string;
|
|
41
|
-
/** Optional reverse-lookup (kid → publisher URL) for result attribution. */
|
|
42
|
-
agentUrlForKeyid?: (keyid: string) => string | undefined;
|
|
43
|
-
}
|
|
44
|
-
export interface VerifyResponseResult {
|
|
45
|
-
status: 'verified';
|
|
46
|
-
keyid: string;
|
|
47
|
-
agent_url?: string;
|
|
48
|
-
verified_at: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Verify an inbound response's RFC 9421 signature.
|
|
52
|
-
*
|
|
53
|
-
* Ordering invariant matches the webhook verifier: cheap invariant checks
|
|
54
|
-
* (tag, alg, window, components) run before JWKS resolution; revocation and
|
|
55
|
-
* rate-abuse run before cryptographic verify so an attacker can't amplify
|
|
56
|
-
* Ed25519/ECDSA work. Replay insert commits only after every earlier check
|
|
57
|
-
* passes — any signature failing crypto verify never consumes a cap entry.
|
|
58
|
-
*
|
|
59
|
-
* The replay scope is `(keyid, @target-uri-of-originating-request)`. Two
|
|
60
|
-
* responses to two different request URLs under the same keyid use
|
|
61
|
-
* independent replay budgets — same shape as webhook verification.
|
|
62
|
-
*
|
|
63
|
-
* Throws {@link ResponseSignatureError} on the first failed step.
|
|
64
|
-
*/
|
|
65
|
-
export declare function verifyResponseSignature(response: ResponseLike, options: VerifyResponseOptions): Promise<VerifyResponseResult>;
|
|
66
|
-
/**
|
|
67
|
-
* Options for {@link createResponseVerifier}. Identical to
|
|
68
|
-
* {@link VerifyResponseOptions} except `replayStore` and `revocationStore`
|
|
69
|
-
* are optional — the factory defaults them once at creation time so replay
|
|
70
|
-
* state is shared across every response the returned verifier handles.
|
|
71
|
-
*/
|
|
72
|
-
export interface CreateResponseVerifierOptions extends Omit<VerifyResponseOptions, 'replayStore' | 'revocationStore'> {
|
|
73
|
-
/**
|
|
74
|
-
* Stores `(keyid, scope, nonce)` tuples for replay detection. Defaults to
|
|
75
|
-
* a fresh {@link InMemoryReplayStore} — suitable for single-process
|
|
76
|
-
* deployments only. **Multi-replica deployments MUST pass an explicit
|
|
77
|
-
* shared store** (Redis, Postgres, etc.); the default in-memory store
|
|
78
|
-
* does not survive process boundaries, so a signature accepted on
|
|
79
|
-
* replica A is invisible to replica B and can be replayed there within
|
|
80
|
-
* the signature window.
|
|
81
|
-
*/
|
|
82
|
-
replayStore?: ReplayStore;
|
|
83
|
-
/**
|
|
84
|
-
* Consulted for revoked `kid` before accepting a signature. Defaults to a
|
|
85
|
-
* fresh {@link InMemoryRevocationStore}, which starts empty and does not
|
|
86
|
-
* poll for updates. Pass a store backed by your secrets manager or admin
|
|
87
|
-
* tooling when you revoke keys at runtime.
|
|
88
|
-
*/
|
|
89
|
-
revocationStore?: RevocationStore;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Create a bound response-signature verifier with shared replay and
|
|
93
|
-
* revocation stores. Mirrors {@link createWebhookVerifier} for the response
|
|
94
|
-
* profile.
|
|
95
|
-
*
|
|
96
|
-
* **Why a factory?** Replay detection requires the same store instance to
|
|
97
|
-
* be consulted across every response. Constructing stores inside a
|
|
98
|
-
* per-response call would silently defeat replay dedup. The factory pattern
|
|
99
|
-
* captures stores in closure scope at wire-up time.
|
|
100
|
-
*
|
|
101
|
-
* **Multi-replica deployments MUST pass an explicit `replayStore`** backed
|
|
102
|
-
* by a shared persistence layer.
|
|
103
|
-
*/
|
|
104
|
-
export declare function createResponseVerifier(options: CreateResponseVerifierOptions): (response: ResponseLike) => Promise<VerifyResponseResult>;
|
|
105
|
-
//# sourceMappingURL=response-verifier.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-verifier.d.ts","sourceRoot":"","sources":["../../../src/lib/signing/response-verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAkE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAKnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EAA2B,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAS7E,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,eAAe,CAAC;IACjC,mEAAmE;IACnE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC1D;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAuM/B;AAkHD;;;;;GAKG;AACH,MAAM,WAAW,6BAA8B,SAAQ,IAAI,CAAC,qBAAqB,EAAE,aAAa,GAAG,iBAAiB,CAAC;IACnH;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,6BAA6B,GACrC,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAI3D"}
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* RFC 9421 response-signing verifier (§2.2.9).
|
|
4
|
-
*
|
|
5
|
-
* Companion to `verifier.ts` (request signatures) and `webhook-verifier.ts`
|
|
6
|
-
* (webhook callbacks). This verifier runs on the buyer / receiver side of
|
|
7
|
-
* a signed response: a client receives a response from a seller agent and
|
|
8
|
-
* hands it here, with the originating request URL the client sent, for
|
|
9
|
-
* signature validation before parsing the body.
|
|
10
|
-
*
|
|
11
|
-
* Distinct from request / webhook signing:
|
|
12
|
-
* - Tag: `adcp/response-signing/v1`.
|
|
13
|
-
* - Key purpose: `adcp_use: "response-signing"`.
|
|
14
|
-
* - Default covered components: `@status`, `@authority`, `@target-uri`,
|
|
15
|
-
* plus `content-type` + `content-digest` when the body is non-empty.
|
|
16
|
-
* - The originating request URL is carried explicitly on `ResponseLike.request`
|
|
17
|
-
* because RFC 9421 §2.2 binds response signatures to their request
|
|
18
|
-
* context via `@authority` and `@target-uri`. The client supplies the URL
|
|
19
|
-
* it actually sent — a malformed reconstruction (e.g. `req.protocol`
|
|
20
|
-
* lying behind a proxy) will trip step 6a or fail the crypto check.
|
|
21
|
-
*
|
|
22
|
-
* Checklist steps below mirror the 13-step shape in `webhook-verifier.ts`
|
|
23
|
-
* so failures point at the same step numbers the request and webhook
|
|
24
|
-
* verifiers use. Numbers are 1-based.
|
|
25
|
-
*/
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.verifyResponseSignature = verifyResponseSignature;
|
|
28
|
-
exports.createResponseVerifier = createResponseVerifier;
|
|
29
|
-
const canonicalize_1 = require("./canonicalize");
|
|
30
|
-
const content_digest_1 = require("./content-digest");
|
|
31
|
-
const errors_1 = require("./errors");
|
|
32
|
-
const parser_1 = require("./parser");
|
|
33
|
-
const crypto_1 = require("./crypto");
|
|
34
|
-
const replay_1 = require("./replay");
|
|
35
|
-
const revocation_1 = require("./revocation");
|
|
36
|
-
const types_1 = require("./types");
|
|
37
|
-
/**
|
|
38
|
-
* Verify an inbound response's RFC 9421 signature.
|
|
39
|
-
*
|
|
40
|
-
* Ordering invariant matches the webhook verifier: cheap invariant checks
|
|
41
|
-
* (tag, alg, window, components) run before JWKS resolution; revocation and
|
|
42
|
-
* rate-abuse run before cryptographic verify so an attacker can't amplify
|
|
43
|
-
* Ed25519/ECDSA work. Replay insert commits only after every earlier check
|
|
44
|
-
* passes — any signature failing crypto verify never consumes a cap entry.
|
|
45
|
-
*
|
|
46
|
-
* The replay scope is `(keyid, @target-uri-of-originating-request)`. Two
|
|
47
|
-
* responses to two different request URLs under the same keyid use
|
|
48
|
-
* independent replay budgets — same shape as webhook verification.
|
|
49
|
-
*
|
|
50
|
-
* Throws {@link ResponseSignatureError} on the first failed step.
|
|
51
|
-
*/
|
|
52
|
-
async function verifyResponseSignature(response, options) {
|
|
53
|
-
const now = options.now ? options.now() : Math.floor(Date.now() / 1000);
|
|
54
|
-
const requiredTag = options.requiredTag ?? types_1.RESPONSE_SIGNING_TAG;
|
|
55
|
-
// Step 1: both signature headers present AND parseable. Bound-pair rule.
|
|
56
|
-
const sigInputHeader = (0, canonicalize_1.getHeaderValue)(response.headers, 'Signature-Input');
|
|
57
|
-
const sigHeader = (0, canonicalize_1.getHeaderValue)(response.headers, 'Signature');
|
|
58
|
-
if (!sigInputHeader || !sigHeader) {
|
|
59
|
-
throw new errors_1.ResponseSignatureError('response_signature_header_malformed', 1, 'Response is missing Signature or Signature-Input headers.');
|
|
60
|
-
}
|
|
61
|
-
let parsedInput;
|
|
62
|
-
let parsedSig;
|
|
63
|
-
try {
|
|
64
|
-
parsedInput = (0, parser_1.parseSignatureInput)(sigInputHeader);
|
|
65
|
-
parsedSig = (0, parser_1.parseSignature)(sigHeader, parsedInput.label);
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
throw new errors_1.ResponseSignatureError('response_signature_header_malformed', 1, err instanceof Error ? err.message : String(err));
|
|
69
|
-
}
|
|
70
|
-
// Step 2: required params present.
|
|
71
|
-
requireParams(parsedInput);
|
|
72
|
-
// Step 3: tag match.
|
|
73
|
-
if (parsedInput.params.tag !== requiredTag) {
|
|
74
|
-
throw new errors_1.ResponseSignatureError('response_signature_tag_invalid', 3, `Signature tag must be "${requiredTag}"; got "${parsedInput.params.tag}".`);
|
|
75
|
-
}
|
|
76
|
-
// Step 4: alg allowlist.
|
|
77
|
-
if (!types_1.ALLOWED_ALGS.has(parsedInput.params.alg)) {
|
|
78
|
-
throw new errors_1.ResponseSignatureError('response_signature_alg_not_allowed', 4, `Signature alg "${parsedInput.params.alg}" is not in the AdCP allowlist.`);
|
|
79
|
-
}
|
|
80
|
-
// Step 5: window valid.
|
|
81
|
-
validateWindow(parsedInput.params.created, parsedInput.params.expires, now);
|
|
82
|
-
// Step 6: covered components must include the response-signing mandatory set.
|
|
83
|
-
validateCoveredComponents(parsedInput.components, response.body);
|
|
84
|
-
// Step 6a: `@target-uri` syntactic validation against the originating-
|
|
85
|
-
// request URL the caller passed in. Same rationale as the webhook
|
|
86
|
-
// verifier — flag dangerous URI shapes (non-https, userinfo, fragment)
|
|
87
|
-
// before cryptographic work. Distinct from `header_malformed`, which
|
|
88
|
-
// flags the Signature / Signature-Input headers.
|
|
89
|
-
//
|
|
90
|
-
// Note: response-side `@target-uri` comes from `response.request.url`,
|
|
91
|
-
// which is the *client's* reconstruction of what they sent. This check
|
|
92
|
-
// most often fires on caller-side bugs (Express `req.protocol` lying
|
|
93
|
-
// behind a non-trust-proxy reverse proxy → http://...) rather than on
|
|
94
|
-
// wire-level attacker payloads. See ResponseLike.request JSDoc.
|
|
95
|
-
validateTargetUri(response.request.url);
|
|
96
|
-
// Step 7: resolve keyid.
|
|
97
|
-
const jwk = await options.jwks.resolve(parsedInput.params.keyid);
|
|
98
|
-
if (!jwk) {
|
|
99
|
-
throw new errors_1.ResponseSignatureError('response_signature_key_unknown', 7, `No JWK found for keyid "${parsedInput.params.keyid}".`);
|
|
100
|
-
}
|
|
101
|
-
if (jwk.kid !== parsedInput.params.keyid) {
|
|
102
|
-
throw new errors_1.ResponseSignatureError('response_signature_key_unknown', 7, `JWKS resolver returned a JWK whose kid "${jwk.kid}" does not match requested keyid "${parsedInput.params.keyid}".`);
|
|
103
|
-
}
|
|
104
|
-
// Step 8: key purpose — MUST be scoped for response signing.
|
|
105
|
-
//
|
|
106
|
-
// Same split as webhook: "no purpose declared" vs "declared but wrong".
|
|
107
|
-
// The former needs the publisher to add a purpose; the latter needs a
|
|
108
|
-
// new keypair (purpose binding is the whole point of `adcp_use`).
|
|
109
|
-
if (jwk.adcp_use === undefined || !jwk.key_ops?.includes('verify')) {
|
|
110
|
-
throw new errors_1.ResponseSignatureError('response_signature_key_purpose_invalid', 8, `JWK "${jwk.kid}" is not scoped for response-signing verification.`);
|
|
111
|
-
}
|
|
112
|
-
if (jwk.adcp_use !== 'response-signing') {
|
|
113
|
-
throw new errors_1.ResponseSignatureError('response_mode_mismatch', 8, `JWK "${jwk.kid}" declares adcp_use="${jwk.adcp_use}" but this endpoint requires "response-signing".`);
|
|
114
|
-
}
|
|
115
|
-
// Step 9: revocation. The shared revocation store throws
|
|
116
|
-
// `request_signature_revocation_stale` when its cached snapshot is past
|
|
117
|
-
// grace — re-map to the response taxonomy so callers see consistent codes.
|
|
118
|
-
try {
|
|
119
|
-
if (await options.revocationStore.isRevoked(jwk.kid)) {
|
|
120
|
-
throw new errors_1.ResponseSignatureError('response_signature_key_revoked', 9, `JWK "${jwk.kid}" is revoked.`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch (err) {
|
|
124
|
-
if (err instanceof errors_1.RequestSignatureError && err.code === 'request_signature_revocation_stale') {
|
|
125
|
-
throw new errors_1.ResponseSignatureError('response_signature_revocation_stale', 9, err.message);
|
|
126
|
-
}
|
|
127
|
-
throw err;
|
|
128
|
-
}
|
|
129
|
-
// Replay scope is `(keyid, @target-uri-of-originating-request)` — same
|
|
130
|
-
// rationale as webhook signing. A response to /adcp/get_products MUST NOT
|
|
131
|
-
// count against the replay budget for a response to /adcp/create_media_buy
|
|
132
|
-
// under the same keyid.
|
|
133
|
-
const replayScope = (0, canonicalize_1.canonicalTargetUri)(response.request.url);
|
|
134
|
-
// Step 9a: per-keyid rate abuse. Distinct code from step 12 replay — cap
|
|
135
|
-
// exhaustion is a compromised-key / misconfig signal, not "same nonce
|
|
136
|
-
// twice."
|
|
137
|
-
if (await options.replayStore.isCapHit(jwk.kid, replayScope, now)) {
|
|
138
|
-
throw new errors_1.ResponseSignatureError('response_signature_rate_abuse', 9, `Per-keyid replay cache cap exceeded for keyid=${jwk.kid}.`);
|
|
139
|
-
}
|
|
140
|
-
// Pre-check replay before crypto so a replayed nonce short-circuits an
|
|
141
|
-
// expensive Ed25519 / ECDSA verify.
|
|
142
|
-
if (await options.replayStore.has(jwk.kid, replayScope, parsedInput.params.nonce, now)) {
|
|
143
|
-
throw new errors_1.ResponseSignatureError('response_signature_replayed', 12, `Replay of (keyid=${jwk.kid}, nonce=${parsedInput.params.nonce}) within signature window.`);
|
|
144
|
-
}
|
|
145
|
-
// Step 10: cryptographic verify. Use the verbatim signatureParamsValue
|
|
146
|
-
// from the parsed input so byte-identity with what the signer sent is
|
|
147
|
-
// preserved regardless of param-order differences across SDKs.
|
|
148
|
-
const base = (0, canonicalize_1.buildResponseSignatureBase)(parsedInput.components, response, parsedInput.params, parsedInput.signatureParamsValue);
|
|
149
|
-
const publicKey = (0, crypto_1.jwkToPublicKey)(jwk);
|
|
150
|
-
const valid = (0, crypto_1.verifySignature)(parsedInput.params.alg, publicKey, Buffer.from(base, 'utf8'), parsedSig.bytes);
|
|
151
|
-
if (!valid) {
|
|
152
|
-
throw new errors_1.ResponseSignatureError('response_signature_invalid', 10, 'Cryptographic verification of response signature base failed.');
|
|
153
|
-
}
|
|
154
|
-
// Step 11: content-digest match (only when the signature covered it).
|
|
155
|
-
if (parsedInput.components.includes('content-digest')) {
|
|
156
|
-
const digestHeader = (0, canonicalize_1.getHeaderValue)(response.headers, 'Content-Digest');
|
|
157
|
-
if (!digestHeader || !(0, content_digest_1.contentDigestMatches)(digestHeader, response.body ?? '')) {
|
|
158
|
-
throw new errors_1.ResponseSignatureError('response_signature_digest_mismatch', 11, 'Content-Digest header does not match recomputed body hash.');
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
// Step 13: commit nonce. Insert AFTER every prior check passes — external
|
|
162
|
-
// traffic can't grow the cap because any signature failing at step 10
|
|
163
|
-
// never reaches this point.
|
|
164
|
-
const remaining = parsedInput.params.expires - now + types_1.CLOCK_SKEW_TOLERANCE_SECONDS;
|
|
165
|
-
const ttl = Math.max(remaining, types_1.MAX_SIGNATURE_WINDOW_SECONDS + types_1.CLOCK_SKEW_TOLERANCE_SECONDS);
|
|
166
|
-
const insertResult = await options.replayStore.insert(jwk.kid, replayScope, parsedInput.params.nonce, ttl, now);
|
|
167
|
-
if (insertResult === 'replayed') {
|
|
168
|
-
throw new errors_1.ResponseSignatureError('response_signature_replayed', 13, `Replay of (keyid=${jwk.kid}, nonce=${parsedInput.params.nonce}) within signature window.`);
|
|
169
|
-
}
|
|
170
|
-
if (insertResult === 'rate_abuse') {
|
|
171
|
-
throw new errors_1.ResponseSignatureError('response_signature_rate_abuse', 13, `Per-keyid replay cache cap exceeded on commit for keyid=${jwk.kid}.`);
|
|
172
|
-
}
|
|
173
|
-
const agent_url = options.agentUrlForKeyid?.(jwk.kid);
|
|
174
|
-
return { status: 'verified', keyid: jwk.kid, ...(agent_url !== undefined && { agent_url }), verified_at: now };
|
|
175
|
-
}
|
|
176
|
-
function requireParams(parsed) {
|
|
177
|
-
const required = ['created', 'expires', 'nonce', 'keyid', 'alg', 'tag'];
|
|
178
|
-
const missing = required.filter(k => parsed.params[k] === undefined);
|
|
179
|
-
if (missing.length) {
|
|
180
|
-
throw new errors_1.ResponseSignatureError('response_signature_params_incomplete', 2, `Signature-Input missing required parameter(s): ${missing.join(', ')}.`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function validateWindow(created, expires, now) {
|
|
184
|
-
// Same shape as webhook: every window failure (expired, negative window,
|
|
185
|
-
// over-long window, created-in-future) folds to a single code. Specific
|
|
186
|
-
// subtype lives in the error message for diagnostics.
|
|
187
|
-
if (expires <= created) {
|
|
188
|
-
throw new errors_1.ResponseSignatureError('response_signature_window_invalid', 5, 'Signature expires must be strictly greater than created.');
|
|
189
|
-
}
|
|
190
|
-
if (expires - created > types_1.MAX_SIGNATURE_WINDOW_SECONDS) {
|
|
191
|
-
throw new errors_1.ResponseSignatureError('response_signature_window_invalid', 5, `Signature window exceeds ${types_1.MAX_SIGNATURE_WINDOW_SECONDS}s maximum.`);
|
|
192
|
-
}
|
|
193
|
-
if (now < created - types_1.CLOCK_SKEW_TOLERANCE_SECONDS) {
|
|
194
|
-
throw new errors_1.ResponseSignatureError('response_signature_window_invalid', 5, 'Signature created is in the future beyond skew tolerance.');
|
|
195
|
-
}
|
|
196
|
-
if (now > expires + types_1.CLOCK_SKEW_TOLERANCE_SECONDS) {
|
|
197
|
-
throw new errors_1.ResponseSignatureError('response_signature_window_invalid', 5, 'Signature is expired.');
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
function validateCoveredComponents(components, body) {
|
|
201
|
-
for (const mandatory of types_1.RESPONSE_MANDATORY_COMPONENTS) {
|
|
202
|
-
if (!components.includes(mandatory)) {
|
|
203
|
-
throw new errors_1.ResponseSignatureError('response_signature_components_incomplete', 6, `Covered components must include "${mandatory}".`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
// When the response carries a body, `content-digest` coverage is required
|
|
207
|
-
// — an unbound body is the cross-purpose footgun the signer's default
|
|
208
|
-
// opt-out behavior is designed to prevent. The signer omits
|
|
209
|
-
// content-digest only when the body is empty (e.g. 204 No Content); the
|
|
210
|
-
// verifier mirrors that envelope.
|
|
211
|
-
const hasBody = (body ?? '').length > 0;
|
|
212
|
-
if (hasBody && !components.includes('content-digest')) {
|
|
213
|
-
throw new errors_1.ResponseSignatureError('response_signature_components_incomplete', 6, 'Response carries a body but "content-digest" is not in covered components.');
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Syntactic validation of the originating-request `@target-uri` value. Four
|
|
218
|
-
* failure modes mirror the webhook verifier:
|
|
219
|
-
* - URL doesn't parse at all.
|
|
220
|
-
* - Scheme is not https (response signatures bound to http will fail
|
|
221
|
-
* strict-HTTPS verifier profiles; loopback hosts are exempt for local
|
|
222
|
-
* test mock servers).
|
|
223
|
-
* - Authority contains userinfo — credentials don't belong in a signed URI.
|
|
224
|
-
* - URL carries a fragment — fragments are client-side and never transmitted.
|
|
225
|
-
*
|
|
226
|
-
* Each throws `response_target_uri_malformed`. The error message names the
|
|
227
|
-
* failure reason.
|
|
228
|
-
*/
|
|
229
|
-
function validateTargetUri(rawUrl) {
|
|
230
|
-
let url;
|
|
231
|
-
try {
|
|
232
|
-
url = new URL(rawUrl);
|
|
233
|
-
}
|
|
234
|
-
catch {
|
|
235
|
-
throw new errors_1.ResponseSignatureError('response_target_uri_malformed', 6, `@target-uri "${rawUrl}" is not a parseable URL.`);
|
|
236
|
-
}
|
|
237
|
-
if (url.protocol !== 'https:' && !isLoopbackHost(url.hostname)) {
|
|
238
|
-
throw new errors_1.ResponseSignatureError('response_target_uri_malformed', 6, `@target-uri must use https; got "${url.protocol}" in "${rawUrl}".`);
|
|
239
|
-
}
|
|
240
|
-
if (url.username || url.password) {
|
|
241
|
-
throw new errors_1.ResponseSignatureError('response_target_uri_malformed', 6, '@target-uri must not embed userinfo.');
|
|
242
|
-
}
|
|
243
|
-
if (url.hash) {
|
|
244
|
-
throw new errors_1.ResponseSignatureError('response_target_uri_malformed', 6, '@target-uri must not carry a fragment.');
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
function isLoopbackHost(hostname) {
|
|
248
|
-
if (!hostname)
|
|
249
|
-
return false;
|
|
250
|
-
const normalized = hostname.toLowerCase();
|
|
251
|
-
return normalized === 'localhost' || normalized === '::1' || normalized.startsWith('127.');
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Create a bound response-signature verifier with shared replay and
|
|
255
|
-
* revocation stores. Mirrors {@link createWebhookVerifier} for the response
|
|
256
|
-
* profile.
|
|
257
|
-
*
|
|
258
|
-
* **Why a factory?** Replay detection requires the same store instance to
|
|
259
|
-
* be consulted across every response. Constructing stores inside a
|
|
260
|
-
* per-response call would silently defeat replay dedup. The factory pattern
|
|
261
|
-
* captures stores in closure scope at wire-up time.
|
|
262
|
-
*
|
|
263
|
-
* **Multi-replica deployments MUST pass an explicit `replayStore`** backed
|
|
264
|
-
* by a shared persistence layer.
|
|
265
|
-
*/
|
|
266
|
-
function createResponseVerifier(options) {
|
|
267
|
-
const replayStore = options.replayStore ?? new replay_1.InMemoryReplayStore();
|
|
268
|
-
const revocationStore = options.revocationStore ?? new revocation_1.InMemoryRevocationStore();
|
|
269
|
-
return (response) => verifyResponseSignature(response, { ...options, replayStore, revocationStore });
|
|
270
|
-
}
|
|
271
|
-
//# sourceMappingURL=response-verifier.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-verifier.js","sourceRoot":"","sources":["../../../src/lib/signing/response-verifier.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;AAwDH,0DA0MC;AAyJD,wDAMC;AA/ZD,iDAAmH;AACnH,qDAAwD;AACxD,qCAAyE;AACzE,qCAA0F;AAC1F,qCAA2D;AAE3D,qCAAiE;AACjE,6CAA6E;AAC7E,mCAMiB;AAyBjB;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,uBAAuB,CAC3C,QAAsB,EACtB,OAA8B;IAE9B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,4BAAoB,CAAC;IAEhE,yEAAyE;IACzE,MAAM,cAAc,GAAG,IAAA,6BAAc,EAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAC3E,MAAM,SAAS,GAAG,IAAA,6BAAc,EAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAChE,IAAI,CAAC,cAAc,IAAI,CAAC,SAAS,EAAE,CAAC;QAClC,MAAM,IAAI,+BAAsB,CAC9B,qCAAqC,EACrC,CAAC,EACD,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IACD,IAAI,WAAiC,CAAC;IACtC,IAAI,SAA4C,CAAC;IACjD,IAAI,CAAC;QACH,WAAW,GAAG,IAAA,4BAAmB,EAAC,cAAc,CAAC,CAAC;QAClD,SAAS,GAAG,IAAA,uBAAc,EAAC,SAAS,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC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