@adcp/sdk 15.9.1 → 16.0.0-beta.2
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/bin/adcp-identity.js +74 -0
- package/bin/adcp.js +2 -0
- package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
- package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
- package/dist/lib/adapters/keyed-account-backend.js +121 -0
- package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
- package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
- package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
- package/dist/lib/adapters/keyed-account-store.js +227 -0
- package/dist/lib/adapters/keyed-account-store.mjs +203 -0
- package/dist/lib/core/SingleAgentClient.d.mts +25 -2
- package/dist/lib/core/SingleAgentClient.d.ts +25 -2
- package/dist/lib/core/SingleAgentClient.js +280 -62
- package/dist/lib/core/SingleAgentClient.mjs +282 -57
- package/dist/lib/core/TaskExecutor.d.mts +6 -0
- package/dist/lib/core/TaskExecutor.d.ts +6 -0
- package/dist/lib/core/TaskExecutor.js +66 -5
- package/dist/lib/core/TaskExecutor.mjs +71 -5
- package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
- package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
- package/dist/lib/core/redis-webhook-registration-store.js +23 -1
- package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
- package/dist/lib/core/webhook-registration.d.mts +7 -1
- package/dist/lib/core/webhook-registration.d.ts +7 -1
- package/dist/lib/core/webhook-registration.js +24 -2
- package/dist/lib/core/webhook-registration.mjs +23 -2
- package/dist/lib/identity-3.3/generated-compat.d.mts +34 -0
- package/dist/lib/identity-3.3/generated-compat.d.ts +34 -0
- package/dist/lib/identity-3.3/generated-compat.js +16 -0
- package/dist/lib/identity-3.3/generated-compat.mjs +0 -0
- package/dist/lib/identity-3.3/index.d.mts +10 -0
- package/dist/lib/identity-3.3/index.d.ts +10 -0
- package/dist/lib/identity-3.3/index.js +79 -0
- package/dist/lib/identity-3.3/index.mjs +50 -0
- package/dist/lib/identity-3.3/lifecycle.d.mts +125 -0
- package/dist/lib/identity-3.3/lifecycle.d.ts +125 -0
- package/dist/lib/identity-3.3/lifecycle.js +294 -0
- package/dist/lib/identity-3.3/lifecycle.mjs +272 -0
- package/dist/lib/identity-3.3/revocation.d.mts +86 -0
- package/dist/lib/identity-3.3/revocation.d.ts +86 -0
- package/dist/lib/identity-3.3/revocation.js +308 -0
- package/dist/lib/identity-3.3/revocation.mjs +286 -0
- package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
- package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
- package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
- package/dist/lib/identity-3.3/server.d.mts +46 -0
- package/dist/lib/identity-3.3/server.d.ts +46 -0
- package/dist/lib/identity-3.3/server.js +279 -0
- package/dist/lib/identity-3.3/server.mjs +260 -0
- package/dist/lib/identity-3.3/store.d.mts +24 -0
- package/dist/lib/identity-3.3/store.d.ts +24 -0
- package/dist/lib/identity-3.3/store.js +191 -0
- package/dist/lib/identity-3.3/store.mjs +169 -0
- package/dist/lib/identity-3.3/trust.d.mts +155 -0
- package/dist/lib/identity-3.3/trust.d.ts +155 -0
- package/dist/lib/identity-3.3/trust.js +383 -0
- package/dist/lib/identity-3.3/trust.mjs +342 -0
- package/dist/lib/identity-3.3/types.d.mts +155 -0
- package/dist/lib/identity-3.3/types.d.ts +155 -0
- package/dist/lib/identity-3.3/types.js +16 -0
- package/dist/lib/identity-3.3/types.mjs +0 -0
- package/dist/lib/identity-3.3/validation.d.mts +2 -0
- package/dist/lib/identity-3.3/validation.d.ts +2 -0
- package/dist/lib/identity-3.3/validation.js +125 -0
- package/dist/lib/identity-3.3/validation.mjs +91 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.mjs +2 -0
- package/dist/lib/protocols/index.d.mts +1 -1
- package/dist/lib/protocols/index.d.ts +1 -1
- package/dist/lib/protocols/index.js +2 -2
- package/dist/lib/protocols/index.mjs +2 -2
- package/dist/lib/reporting/azure/index.d.mts +5 -0
- package/dist/lib/reporting/azure/index.d.ts +5 -0
- package/dist/lib/reporting/azure/index.js +26 -7
- package/dist/lib/reporting/azure/index.mjs +26 -7
- package/dist/lib/reporting/bigquery/index.d.mts +39 -5
- package/dist/lib/reporting/bigquery/index.d.ts +39 -5
- package/dist/lib/reporting/bigquery/index.js +26 -20
- package/dist/lib/reporting/bigquery/index.mjs +26 -20
- package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
- package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
- package/dist/lib/reporting/gcs/errors.d.mts +6 -0
- package/dist/lib/reporting/gcs/errors.d.ts +6 -0
- package/dist/lib/reporting/gcs/fence.d.mts +5 -0
- package/dist/lib/reporting/gcs/fence.d.ts +5 -0
- package/dist/lib/reporting/gcs/index.d.mts +9 -0
- package/dist/lib/reporting/gcs/index.d.ts +9 -0
- package/dist/lib/reporting/gcs/reader.d.mts +27 -3
- package/dist/lib/reporting/gcs/reader.d.ts +27 -3
- package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
- package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
- package/dist/lib/reporting/gcs/row-provider.js +34 -14
- package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
- package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
- package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
- package/dist/lib/reporting/ledger/index.d.mts +11 -0
- package/dist/lib/reporting/ledger/index.d.ts +11 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
- package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
- package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
- package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
- package/dist/lib/reporting/ledger/managed.d.mts +86 -6
- package/dist/lib/reporting/ledger/managed.d.ts +86 -6
- package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
- package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
- package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
- package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
- package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
- package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
- package/dist/lib/reporting/ledger/postgres.js +43 -27
- package/dist/lib/reporting/ledger/postgres.mjs +43 -27
- package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
- package/dist/lib/reporting/ledger/row-encoding.js +8 -4
- package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
- package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
- package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
- package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
- package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
- package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
- package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
- package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
- package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
- package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
- package/dist/lib/reporting/ledger/row-storage.js +126 -66
- package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
- package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
- package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
- package/dist/lib/reporting/ledger/schedule.js +24 -0
- package/dist/lib/reporting/ledger/schedule.mjs +23 -0
- package/dist/lib/reporting/ledger/types.d.mts +23 -1
- package/dist/lib/reporting/ledger/types.d.ts +23 -1
- package/dist/lib/reporting/s3/index.d.mts +5 -0
- package/dist/lib/reporting/s3/index.d.ts +5 -0
- package/dist/lib/reporting/s3/index.js +37 -14
- package/dist/lib/reporting/s3/index.mjs +37 -14
- package/dist/lib/reporting/service/index.d.mts +10 -0
- package/dist/lib/reporting/service/index.d.ts +10 -0
- package/dist/lib/reporting/service/maintenance.d.mts +28 -2
- package/dist/lib/reporting/service/maintenance.d.ts +28 -2
- package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
- package/dist/lib/server/account-sync-contract.d.mts +14 -0
- package/dist/lib/server/account-sync-contract.d.ts +14 -0
- package/dist/lib/server/account-sync-contract.js +225 -0
- package/dist/lib/server/account-sync-contract.mjs +197 -0
- package/dist/lib/server/adcp-server.js +5 -0
- package/dist/lib/server/adcp-server.mjs +10 -0
- package/dist/lib/server/auth-signature.d.mts +15 -0
- package/dist/lib/server/auth-signature.d.ts +15 -0
- package/dist/lib/server/auth-signature.js +72 -2
- package/dist/lib/server/auth-signature.mjs +81 -2
- package/dist/lib/server/auth.d.mts +6 -0
- package/dist/lib/server/auth.d.ts +6 -0
- package/dist/lib/server/auth.js +6 -0
- package/dist/lib/server/auth.mjs +6 -0
- package/dist/lib/server/create-adcp-server.d.mts +19 -5
- package/dist/lib/server/create-adcp-server.d.ts +19 -5
- package/dist/lib/server/create-adcp-server.js +259 -19
- package/dist/lib/server/create-adcp-server.mjs +266 -10
- package/dist/lib/server/decisioning/account.d.mts +24 -1
- package/dist/lib/server/decisioning/account.d.ts +24 -1
- package/dist/lib/server/decisioning/index.d.mts +1 -1
- package/dist/lib/server/decisioning/index.d.ts +1 -1
- package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
- package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
- package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
- package/dist/lib/server/index.d.mts +2 -0
- package/dist/lib/server/index.d.ts +2 -0
- package/dist/lib/server/index.js +12 -0
- package/dist/lib/server/index.mjs +12 -0
- package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
- package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
- package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
- package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
- package/dist/lib/server/principal/types.d.mts +1 -1
- package/dist/lib/server/principal/types.d.ts +1 -1
- package/dist/lib/server/serve.js +5 -0
- package/dist/lib/server/serve.mjs +5 -0
- package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
- package/dist/lib/server/webhook-delivery/recovery.js +4 -0
- package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
- package/dist/lib/server/webhook-emitter.d.mts +10 -0
- package/dist/lib/server/webhook-emitter.d.ts +10 -0
- package/dist/lib/server/webhook-emitter.js +22 -0
- package/dist/lib/server/webhook-emitter.mjs +22 -0
- package/dist/lib/signing/agent-context.d.mts +0 -5
- package/dist/lib/signing/agent-context.d.ts +0 -5
- package/dist/lib/signing/agent-context.js +9 -1
- package/dist/lib/signing/agent-context.mjs +9 -1
- package/dist/lib/signing/agent-fetch.js +27 -2
- package/dist/lib/signing/agent-fetch.mjs +32 -2
- package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
- package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
- package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
- package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
- package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
- package/dist/lib/signing/agent-resolver/index.js +5 -0
- package/dist/lib/signing/agent-resolver/index.mjs +3 -0
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
- package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
- package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
- package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
- package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
- package/dist/lib/signing/brand-jwks.d.mts +2 -2
- package/dist/lib/signing/brand-jwks.d.ts +2 -2
- package/dist/lib/signing/brand-jwks.js +4 -4
- package/dist/lib/signing/brand-jwks.mjs +4 -4
- package/dist/lib/signing/client.d.mts +1 -0
- package/dist/lib/signing/client.d.ts +1 -0
- package/dist/lib/signing/client.js +5 -0
- package/dist/lib/signing/client.mjs +3 -0
- package/dist/lib/signing/crypto.js +8 -0
- package/dist/lib/signing/crypto.mjs +9 -1
- package/dist/lib/signing/fetch-async.js +1 -1
- package/dist/lib/signing/fetch-async.mjs +1 -1
- package/dist/lib/signing/fetch.js +1 -1
- package/dist/lib/signing/fetch.mjs +1 -1
- package/dist/lib/signing/jwks-https.d.mts +1 -1
- package/dist/lib/signing/jwks-https.d.ts +1 -1
- package/dist/lib/signing/jwks-https.js +1 -1
- package/dist/lib/signing/jwks-https.mjs +1 -1
- package/dist/lib/signing/jwks.d.mts +11 -3
- package/dist/lib/signing/jwks.d.ts +11 -3
- package/dist/lib/signing/jwks.js +1 -1
- package/dist/lib/signing/jwks.mjs +1 -1
- package/dist/lib/signing/middleware.js +9 -0
- package/dist/lib/signing/middleware.mjs +14 -0
- package/dist/lib/signing/parser.d.mts +9 -6
- package/dist/lib/signing/parser.d.ts +9 -6
- package/dist/lib/signing/parser.js +82 -64
- package/dist/lib/signing/parser.mjs +83 -65
- package/dist/lib/signing/revocation.d.mts +4 -1
- package/dist/lib/signing/revocation.d.ts +4 -1
- package/dist/lib/signing/revocation.js +36 -3
- package/dist/lib/signing/revocation.mjs +34 -2
- package/dist/lib/signing/server.d.mts +1 -1
- package/dist/lib/signing/server.d.ts +1 -1
- package/dist/lib/signing/server.js +4 -0
- package/dist/lib/signing/server.mjs +4 -0
- package/dist/lib/signing/types.d.mts +3 -0
- package/dist/lib/signing/types.d.ts +3 -0
- package/dist/lib/signing/verifier.js +1 -1
- package/dist/lib/signing/verifier.mjs +1 -1
- package/dist/lib/signing/web-bot-auth.d.mts +191 -0
- package/dist/lib/signing/web-bot-auth.d.ts +191 -0
- package/dist/lib/signing/web-bot-auth.js +837 -0
- package/dist/lib/signing/web-bot-auth.mjs +796 -0
- package/dist/lib/signing/webhook-verifier.js +1 -1
- package/dist/lib/signing/webhook-verifier.mjs +1 -1
- package/dist/lib/testing/client.d.mts +1 -4
- package/dist/lib/testing/client.d.ts +1 -4
- package/dist/lib/testing/client.js +141 -20
- package/dist/lib/testing/client.mjs +137 -19
- package/dist/lib/testing/compliance/comply.js +29 -10
- package/dist/lib/testing/compliance/comply.mjs +37 -11
- package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
- package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
- package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
- package/dist/lib/testing/storyboard/default-invariants.js +2 -0
- package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
- package/dist/lib/testing/storyboard/runner.js +23 -8
- package/dist/lib/testing/storyboard/runner.mjs +24 -8
- package/dist/lib/testing/storyboard/validations.d.mts +1 -1
- package/dist/lib/testing/storyboard/validations.d.ts +1 -1
- package/dist/lib/types/adcp.d.mts +4 -0
- package/dist/lib/types/adcp.d.ts +4 -0
- package/dist/lib/types/schemas.generated.d.ts +6 -6
- package/dist/lib/utils/capabilities.d.mts +1 -0
- package/dist/lib/utils/capabilities.d.ts +1 -0
- package/dist/lib/utils/capabilities.js +5 -0
- package/dist/lib/utils/capabilities.mjs +5 -0
- package/dist/lib/v2/projection/catalog-snapshot.js +3 -1
- package/dist/lib/v2/projection/catalog-snapshot.mjs +3 -1
- package/dist/lib/v2/projection/creative-delivery.d.mts +34 -10
- package/dist/lib/v2/projection/creative-delivery.d.ts +34 -10
- package/dist/lib/v2/projection/creative-delivery.js +26 -10
- package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
- package/dist/lib/v2/projection/index.d.mts +1 -1
- package/dist/lib/v2/projection/index.d.ts +1 -1
- package/dist/lib/v2/projection/index.js +2 -0
- package/dist/lib/v2/projection/index.mjs +2 -0
- package/dist/lib/v2/projection/legacy-routes.d.mts +34 -2
- package/dist/lib/v2/projection/legacy-routes.d.ts +34 -2
- package/dist/lib/v2/projection/legacy-routes.js +35 -2
- package/dist/lib/v2/projection/legacy-routes.mjs +32 -2
- package/dist/lib/validation/schema-loader.d.mts +2 -0
- package/dist/lib/validation/schema-loader.d.ts +2 -0
- package/dist/lib/validation/schema-loader.js +43 -4
- package/dist/lib/validation/schema-loader.mjs +39 -3
- package/dist/lib/version.d.mts +3 -3
- package/dist/lib/version.d.ts +3 -3
- package/dist/lib/version.js +3 -3
- package/dist/lib/version.mjs +3 -3
- package/docs/TYPE-SUMMARY.md +2 -2
- package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
- package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
- package/docs/guides/REPORTING-LEDGER.md +99 -29
- package/docs/guides/REPORTING-OPERATIONS.md +29 -13
- package/docs/guides/REPORTING-STABILITY.md +76 -0
- package/docs/guides/account-resolution.md +101 -0
- package/docs/llms.txt +3 -2
- package/docs/migration-12-to-13.md +15 -0
- package/docs/migration-14.x-rc-worksheet.md +4 -4
- package/docs/migration-agent-identity-3.3.md +494 -0
- package/docs/migration-agent-resolution-3.3.md +5 -0
- package/docs/migration-reporting-row-storage-alignment.md +137 -0
- package/examples/storyboards/account-sync-contract.yaml +57 -0
- package/package.json +17 -1
|
@@ -185,6 +185,7 @@ function createPersistentNotificationRuntime(options) {
|
|
|
185
185
|
return {
|
|
186
186
|
decision: "allow",
|
|
187
187
|
authentication: null,
|
|
188
|
+
...subscription.signingProfile && { signingProfile: subscription.signingProfile },
|
|
188
189
|
...checkpoint.attemptOrdinal === void 0 ? {} : { attemptOrdinal: checkpoint.attemptOrdinal }
|
|
189
190
|
};
|
|
190
191
|
}
|
|
@@ -269,6 +270,7 @@ function createPersistentNotificationRuntime(options) {
|
|
|
269
270
|
accountEventTypes,
|
|
270
271
|
callerEventTypes,
|
|
271
272
|
callerOnlyEventTypes,
|
|
273
|
+
supportedSigningProfiles: options.supportedSigningProfiles,
|
|
272
274
|
credentialAdapter: options.credentialAdapter,
|
|
273
275
|
credentialStages,
|
|
274
276
|
adopterCallbackTimeoutMs,
|
|
@@ -522,10 +524,13 @@ async function normalizeConfig(input) {
|
|
|
522
524
|
if (config.product_payload_view !== void 0 && !eventTypes.some((eventType) => eventType.startsWith("product."))) {
|
|
523
525
|
throw validation("product_payload_view requires a product.* event type", input.index, "product_payload_view");
|
|
524
526
|
}
|
|
527
|
+
if (config.signing_profile !== void 0 && (!(input.supportedSigningProfiles ?? ["adcp/webhook-signing/v1"]).includes(config.signing_profile) || config.authentication !== void 0))
|
|
528
|
+
throw validation("Unsupported or ambiguous signing_profile", input.index, "signing_profile");
|
|
525
529
|
const authentication = await normalizeAuthentication(input);
|
|
526
530
|
const destinationGeneration = `dest_${(0, import_jcs.canonicalJsonSha256)({
|
|
527
531
|
scope,
|
|
528
532
|
subscriberId: config.subscriber_id,
|
|
533
|
+
...config.signing_profile !== void 0 && { signingProfile: config.signing_profile },
|
|
529
534
|
url,
|
|
530
535
|
authentication,
|
|
531
536
|
eventTypes,
|
|
@@ -535,6 +540,7 @@ async function normalizeConfig(input) {
|
|
|
535
540
|
})}`;
|
|
536
541
|
return {
|
|
537
542
|
subscriberId: config.subscriber_id,
|
|
543
|
+
...config.signing_profile !== void 0 && { signingProfile: config.signing_profile },
|
|
538
544
|
url,
|
|
539
545
|
eventTypes,
|
|
540
546
|
active: config.active !== false,
|
|
@@ -668,6 +674,7 @@ async function normalizeAuthentication(input) {
|
|
|
668
674
|
function projectSubscription(subscription, includeGenerations) {
|
|
669
675
|
return {
|
|
670
676
|
subscriber_id: subscription.subscriberId,
|
|
677
|
+
...subscription.signingProfile !== void 0 && { signing_profile: subscription.signingProfile },
|
|
671
678
|
url: subscription.url,
|
|
672
679
|
event_types: [...subscription.eventTypes],
|
|
673
680
|
active: subscription.active && subscription.deactivationNotificationId === void 0,
|
|
@@ -688,7 +695,8 @@ function projectNotificationSubscriptionReadback(views) {
|
|
|
688
695
|
...view.all_authorized_accounts === void 0 ? {} : { all_authorized_accounts: view.all_authorized_accounts },
|
|
689
696
|
...view.include_future_event_types === void 0 ? {} : { include_future_event_types: view.include_future_event_types },
|
|
690
697
|
...view.product_payload_view === void 0 ? {} : { product_payload_view: view.product_payload_view },
|
|
691
|
-
...view.authentication === void 0 ? {} : { authentication: view.authentication }
|
|
698
|
+
...view.authentication === void 0 ? {} : { authentication: view.authentication },
|
|
699
|
+
...view.signing_profile !== void 0 && { signing_profile: view.signing_profile }
|
|
692
700
|
}));
|
|
693
701
|
}
|
|
694
702
|
function projectStoredNotificationSubscriptionReadback(subscriptions) {
|
|
@@ -156,6 +156,7 @@ function createPersistentNotificationRuntime(options) {
|
|
|
156
156
|
return {
|
|
157
157
|
decision: "allow",
|
|
158
158
|
authentication: null,
|
|
159
|
+
...subscription.signingProfile && { signingProfile: subscription.signingProfile },
|
|
159
160
|
...checkpoint.attemptOrdinal === void 0 ? {} : { attemptOrdinal: checkpoint.attemptOrdinal }
|
|
160
161
|
};
|
|
161
162
|
}
|
|
@@ -240,6 +241,7 @@ function createPersistentNotificationRuntime(options) {
|
|
|
240
241
|
accountEventTypes,
|
|
241
242
|
callerEventTypes,
|
|
242
243
|
callerOnlyEventTypes,
|
|
244
|
+
supportedSigningProfiles: options.supportedSigningProfiles,
|
|
243
245
|
credentialAdapter: options.credentialAdapter,
|
|
244
246
|
credentialStages,
|
|
245
247
|
adopterCallbackTimeoutMs,
|
|
@@ -493,10 +495,13 @@ async function normalizeConfig(input) {
|
|
|
493
495
|
if (config.product_payload_view !== void 0 && !eventTypes.some((eventType) => eventType.startsWith("product."))) {
|
|
494
496
|
throw validation("product_payload_view requires a product.* event type", input.index, "product_payload_view");
|
|
495
497
|
}
|
|
498
|
+
if (config.signing_profile !== void 0 && (!(input.supportedSigningProfiles ?? ["adcp/webhook-signing/v1"]).includes(config.signing_profile) || config.authentication !== void 0))
|
|
499
|
+
throw validation("Unsupported or ambiguous signing_profile", input.index, "signing_profile");
|
|
496
500
|
const authentication = await normalizeAuthentication(input);
|
|
497
501
|
const destinationGeneration = `dest_${canonicalJsonSha256({
|
|
498
502
|
scope,
|
|
499
503
|
subscriberId: config.subscriber_id,
|
|
504
|
+
...config.signing_profile !== void 0 && { signingProfile: config.signing_profile },
|
|
500
505
|
url,
|
|
501
506
|
authentication,
|
|
502
507
|
eventTypes,
|
|
@@ -506,6 +511,7 @@ async function normalizeConfig(input) {
|
|
|
506
511
|
})}`;
|
|
507
512
|
return {
|
|
508
513
|
subscriberId: config.subscriber_id,
|
|
514
|
+
...config.signing_profile !== void 0 && { signingProfile: config.signing_profile },
|
|
509
515
|
url,
|
|
510
516
|
eventTypes,
|
|
511
517
|
active: config.active !== false,
|
|
@@ -639,6 +645,7 @@ async function normalizeAuthentication(input) {
|
|
|
639
645
|
function projectSubscription(subscription, includeGenerations) {
|
|
640
646
|
return {
|
|
641
647
|
subscriber_id: subscription.subscriberId,
|
|
648
|
+
...subscription.signingProfile !== void 0 && { signing_profile: subscription.signingProfile },
|
|
642
649
|
url: subscription.url,
|
|
643
650
|
event_types: [...subscription.eventTypes],
|
|
644
651
|
active: subscription.active && subscription.deactivationNotificationId === void 0,
|
|
@@ -659,7 +666,8 @@ function projectNotificationSubscriptionReadback(views) {
|
|
|
659
666
|
...view.all_authorized_accounts === void 0 ? {} : { all_authorized_accounts: view.all_authorized_accounts },
|
|
660
667
|
...view.include_future_event_types === void 0 ? {} : { include_future_event_types: view.include_future_event_types },
|
|
661
668
|
...view.product_payload_view === void 0 ? {} : { product_payload_view: view.product_payload_view },
|
|
662
|
-
...view.authentication === void 0 ? {} : { authentication: view.authentication }
|
|
669
|
+
...view.authentication === void 0 ? {} : { authentication: view.authentication },
|
|
670
|
+
...view.signing_profile !== void 0 && { signing_profile: view.signing_profile }
|
|
663
671
|
}));
|
|
664
672
|
}
|
|
665
673
|
function projectStoredNotificationSubscriptionReadback(subscriptions) {
|
|
@@ -14,6 +14,7 @@ export type NotificationEventAnchor = 'caller' | 'account';
|
|
|
14
14
|
/** Structural input accepted from either generated notification-config shape. */
|
|
15
15
|
export interface NotificationSubscriptionConfigInput {
|
|
16
16
|
subscriber_id: string;
|
|
17
|
+
signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
17
18
|
url: string;
|
|
18
19
|
event_types: readonly string[];
|
|
19
20
|
all_authorized_accounts?: boolean;
|
|
@@ -33,6 +34,7 @@ export interface StoredNotificationAuthentication {
|
|
|
33
34
|
}
|
|
34
35
|
export interface StoredNotificationSubscription {
|
|
35
36
|
subscriberId: string;
|
|
37
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
36
38
|
url: string;
|
|
37
39
|
eventTypes: string[];
|
|
38
40
|
active: boolean;
|
|
@@ -190,6 +192,7 @@ export interface NotificationProofAdapter {
|
|
|
190
192
|
export type NotificationDestinationValidator = (input: {
|
|
191
193
|
scope: Readonly<NotificationSubscriptionScope>;
|
|
192
194
|
subscriberId: string;
|
|
195
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
193
196
|
url: string;
|
|
194
197
|
signal: AbortSignal;
|
|
195
198
|
}) => MaybePromise<{
|
|
@@ -303,6 +306,7 @@ export type NotificationDeliveryAttemptCheckpoint = (input: Readonly<Notificatio
|
|
|
303
306
|
export type NotificationSuppressionDisposition = 'terminal' | 'retryable';
|
|
304
307
|
export interface NotificationSubscriptionView {
|
|
305
308
|
subscriber_id: string;
|
|
309
|
+
signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
306
310
|
url: string;
|
|
307
311
|
event_types: string[];
|
|
308
312
|
active: boolean;
|
|
@@ -404,6 +408,7 @@ export interface PersistentNotificationRuntimeOptions {
|
|
|
404
408
|
/** Build the emitter with the supplied mandatory per-attempt authorizer. */
|
|
405
409
|
createEmitter(authorizeAttempt: WebhookAttemptAuthorizer): RecoverableWebhookEmitter;
|
|
406
410
|
supportedCallerEventTypes?: readonly string[];
|
|
411
|
+
supportedSigningProfiles?: readonly ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
|
|
407
412
|
supportedAccountEventTypes?: readonly string[];
|
|
408
413
|
/**
|
|
409
414
|
* Later-version caller-only events safe for `include_future_event_types`.
|
|
@@ -14,6 +14,7 @@ export type NotificationEventAnchor = 'caller' | 'account';
|
|
|
14
14
|
/** Structural input accepted from either generated notification-config shape. */
|
|
15
15
|
export interface NotificationSubscriptionConfigInput {
|
|
16
16
|
subscriber_id: string;
|
|
17
|
+
signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
17
18
|
url: string;
|
|
18
19
|
event_types: readonly string[];
|
|
19
20
|
all_authorized_accounts?: boolean;
|
|
@@ -33,6 +34,7 @@ export interface StoredNotificationAuthentication {
|
|
|
33
34
|
}
|
|
34
35
|
export interface StoredNotificationSubscription {
|
|
35
36
|
subscriberId: string;
|
|
37
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
36
38
|
url: string;
|
|
37
39
|
eventTypes: string[];
|
|
38
40
|
active: boolean;
|
|
@@ -190,6 +192,7 @@ export interface NotificationProofAdapter {
|
|
|
190
192
|
export type NotificationDestinationValidator = (input: {
|
|
191
193
|
scope: Readonly<NotificationSubscriptionScope>;
|
|
192
194
|
subscriberId: string;
|
|
195
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
193
196
|
url: string;
|
|
194
197
|
signal: AbortSignal;
|
|
195
198
|
}) => MaybePromise<{
|
|
@@ -303,6 +306,7 @@ export type NotificationDeliveryAttemptCheckpoint = (input: Readonly<Notificatio
|
|
|
303
306
|
export type NotificationSuppressionDisposition = 'terminal' | 'retryable';
|
|
304
307
|
export interface NotificationSubscriptionView {
|
|
305
308
|
subscriber_id: string;
|
|
309
|
+
signing_profile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
306
310
|
url: string;
|
|
307
311
|
event_types: string[];
|
|
308
312
|
active: boolean;
|
|
@@ -404,6 +408,7 @@ export interface PersistentNotificationRuntimeOptions {
|
|
|
404
408
|
/** Build the emitter with the supplied mandatory per-attempt authorizer. */
|
|
405
409
|
createEmitter(authorizeAttempt: WebhookAttemptAuthorizer): RecoverableWebhookEmitter;
|
|
406
410
|
supportedCallerEventTypes?: readonly string[];
|
|
411
|
+
supportedSigningProfiles?: readonly ('adcp/webhook-signing/v1' | 'web-bot-auth')[];
|
|
407
412
|
supportedAccountEventTypes?: readonly string[];
|
|
408
413
|
/**
|
|
409
414
|
* Later-version caller-only events safe for `include_future_event_types`.
|
|
@@ -38,7 +38,7 @@ export interface PendingPrincipalNotification {
|
|
|
38
38
|
emissionId: string;
|
|
39
39
|
changedAt: string;
|
|
40
40
|
firedAt: string;
|
|
41
|
-
reason: 'destination_state_changed' | 'setup_expiring' | 'setup_expired' | 'proof_invalidated' | 'declarations_intersection_changed' | 'other';
|
|
41
|
+
reason: 'relationship_changed' | 'relationship_expiring' | 'destination_state_changed' | 'setup_expiring' | 'setup_expired' | 'proof_invalidated' | 'declarations_intersection_changed' | 'other';
|
|
42
42
|
destinationId?: string;
|
|
43
43
|
recipients: NotificationRecipientRef[];
|
|
44
44
|
}
|
|
@@ -38,7 +38,7 @@ export interface PendingPrincipalNotification {
|
|
|
38
38
|
emissionId: string;
|
|
39
39
|
changedAt: string;
|
|
40
40
|
firedAt: string;
|
|
41
|
-
reason: 'destination_state_changed' | 'setup_expiring' | 'setup_expired' | 'proof_invalidated' | 'declarations_intersection_changed' | 'other';
|
|
41
|
+
reason: 'relationship_changed' | 'relationship_expiring' | 'destination_state_changed' | 'setup_expiring' | 'setup_expired' | 'proof_invalidated' | 'declarations_intersection_changed' | 'other';
|
|
42
42
|
destinationId?: string;
|
|
43
43
|
recipients: NotificationRecipientRef[];
|
|
44
44
|
}
|
package/dist/lib/server/serve.js
CHANGED
|
@@ -310,6 +310,11 @@ function serve(createAgent, options) {
|
|
|
310
310
|
try {
|
|
311
311
|
principal = await options.authenticate(req);
|
|
312
312
|
} catch (err) {
|
|
313
|
+
if (err instanceof import_auth.AuthError && err.status) {
|
|
314
|
+
res.writeHead(err.status, { ...err.headers, "Content-Type": "application/json" });
|
|
315
|
+
res.end(JSON.stringify(err.body ?? { error: err.publicMessage }));
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
313
318
|
const publicMessage = err instanceof import_auth.AuthError ? err.publicMessage : "Credentials rejected.";
|
|
314
319
|
console.error("[adcp/auth] rejected:", err);
|
|
315
320
|
const signatureCode = (0, import_auth.signatureErrorCodeFromCause)(err);
|
|
@@ -293,6 +293,11 @@ function serve(createAgent, options) {
|
|
|
293
293
|
try {
|
|
294
294
|
principal = await options.authenticate(req);
|
|
295
295
|
} catch (err) {
|
|
296
|
+
if (err instanceof AuthError && err.status) {
|
|
297
|
+
res.writeHead(err.status, { ...err.headers, "Content-Type": "application/json" });
|
|
298
|
+
res.end(JSON.stringify(err.body ?? { error: err.publicMessage }));
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
296
301
|
const publicMessage = err instanceof AuthError ? err.publicMessage : "Credentials rejected.";
|
|
297
302
|
console.error("[adcp/auth] rejected:", err);
|
|
298
303
|
const signatureCode = signatureErrorCodeFromCause(err);
|
|
@@ -30,6 +30,7 @@ export interface WebhookAuthenticationContext {
|
|
|
30
30
|
snapshotContextFingerprint: string;
|
|
31
31
|
}
|
|
32
32
|
export interface StoredWebhookDeliverySnapshot {
|
|
33
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
33
34
|
url: string;
|
|
34
35
|
payload: Record<string, unknown>;
|
|
35
36
|
/** Non-secret live-authorization context; never serialized into the webhook body. */
|
|
@@ -30,6 +30,7 @@ export interface WebhookAuthenticationContext {
|
|
|
30
30
|
snapshotContextFingerprint: string;
|
|
31
31
|
}
|
|
32
32
|
export interface StoredWebhookDeliverySnapshot {
|
|
33
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
33
34
|
url: string;
|
|
34
35
|
payload: Record<string, unknown>;
|
|
35
36
|
/** Non-secret live-authorization context; never serialized into the webhook body. */
|
|
@@ -344,6 +344,7 @@ async function protectSnapshot(snapshot, key, adapter, protectPayloadToken) {
|
|
|
344
344
|
if (cleartextPayloadToken !== void 0) delete payload.token;
|
|
345
345
|
const base = {
|
|
346
346
|
url: snapshot.url,
|
|
347
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
347
348
|
payload,
|
|
348
349
|
retries: { ...snapshot.retries },
|
|
349
350
|
...snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: structuredClone(snapshot.attemptAuthorizationContext) }
|
|
@@ -402,6 +403,7 @@ async function resolveSnapshot(snapshot, key, adapter) {
|
|
|
402
403
|
}
|
|
403
404
|
return {
|
|
404
405
|
url: snapshot.url,
|
|
406
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
405
407
|
payload,
|
|
406
408
|
authentication,
|
|
407
409
|
retries: { ...snapshot.retries },
|
|
@@ -438,6 +440,7 @@ function authenticationContext(key, snapshot, purpose) {
|
|
|
438
440
|
purpose,
|
|
439
441
|
key,
|
|
440
442
|
url: snapshot.url,
|
|
443
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
441
444
|
payload: snapshot.payload,
|
|
442
445
|
retries: snapshot.retries,
|
|
443
446
|
...snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: snapshot.attemptAuthorizationContext }
|
|
@@ -494,6 +497,7 @@ function snapshotFingerprint(snapshot) {
|
|
|
494
497
|
return (0, import_jcs.canonicalJsonSha256)({
|
|
495
498
|
url: snapshot.url,
|
|
496
499
|
payload: snapshot.payload,
|
|
500
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
497
501
|
retries: snapshot.retries,
|
|
498
502
|
...snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: snapshot.attemptAuthorizationContext },
|
|
499
503
|
authentication: snapshot.authentication.kind === "none" ? { kind: "none" } : { kind: "protected", fingerprint: snapshot.authentication.fingerprint },
|
|
@@ -323,6 +323,7 @@ async function protectSnapshot(snapshot, key, adapter, protectPayloadToken) {
|
|
|
323
323
|
if (cleartextPayloadToken !== void 0) delete payload.token;
|
|
324
324
|
const base = {
|
|
325
325
|
url: snapshot.url,
|
|
326
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
326
327
|
payload,
|
|
327
328
|
retries: { ...snapshot.retries },
|
|
328
329
|
...snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: structuredClone(snapshot.attemptAuthorizationContext) }
|
|
@@ -381,6 +382,7 @@ async function resolveSnapshot(snapshot, key, adapter) {
|
|
|
381
382
|
}
|
|
382
383
|
return {
|
|
383
384
|
url: snapshot.url,
|
|
385
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
384
386
|
payload,
|
|
385
387
|
authentication,
|
|
386
388
|
retries: { ...snapshot.retries },
|
|
@@ -417,6 +419,7 @@ function authenticationContext(key, snapshot, purpose) {
|
|
|
417
419
|
purpose,
|
|
418
420
|
key,
|
|
419
421
|
url: snapshot.url,
|
|
422
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
420
423
|
payload: snapshot.payload,
|
|
421
424
|
retries: snapshot.retries,
|
|
422
425
|
...snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: snapshot.attemptAuthorizationContext }
|
|
@@ -473,6 +476,7 @@ function snapshotFingerprint(snapshot) {
|
|
|
473
476
|
return canonicalJsonSha256({
|
|
474
477
|
url: snapshot.url,
|
|
475
478
|
payload: snapshot.payload,
|
|
479
|
+
...snapshot.signingProfile !== void 0 && { signingProfile: snapshot.signingProfile },
|
|
476
480
|
retries: snapshot.retries,
|
|
477
481
|
...snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: snapshot.attemptAuthorizationContext },
|
|
478
482
|
authentication: snapshot.authentication.kind === "none" ? { kind: "none" } : { kind: "protected", fingerprint: snapshot.authentication.fingerprint },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WebBotSigningKey } from '../signing/web-bot-auth.mjs';
|
|
1
2
|
/**
|
|
2
3
|
* Publisher-side webhook emitter — the symmetric counterpart to PR #629's
|
|
3
4
|
* receiver-side dedup. A seller / governance agent / rights agent building
|
|
@@ -65,6 +66,7 @@ export interface WebhookDeliveryProposal {
|
|
|
65
66
|
}
|
|
66
67
|
/** Exact caller-owned state required to reconstruct a delivery after restart. */
|
|
67
68
|
export interface WebhookDeliverySnapshot {
|
|
69
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
68
70
|
url: string;
|
|
69
71
|
payload: Record<string, unknown>;
|
|
70
72
|
authentication: WebhookAuthentication;
|
|
@@ -173,6 +175,12 @@ export interface WebhookRetryOptions {
|
|
|
173
175
|
jitter?: number;
|
|
174
176
|
}
|
|
175
177
|
export interface WebhookEmitterOptions {
|
|
178
|
+
/** Experimental profile must be selected by trusted subscription configuration. */
|
|
179
|
+
webBotAuth?: {
|
|
180
|
+
origin: string;
|
|
181
|
+
key: WebBotSigningKey;
|
|
182
|
+
};
|
|
183
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
176
184
|
/**
|
|
177
185
|
* In-process JWK signing key. Its JWKS entry SHOULD carry
|
|
178
186
|
* `adcp_use: "request-signing"` — webhooks are signed with the agent's
|
|
@@ -320,6 +328,7 @@ export interface WebhookEmitParams {
|
|
|
320
328
|
* 9421 default.
|
|
321
329
|
*/
|
|
322
330
|
authentication?: WebhookAuthentication;
|
|
331
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
323
332
|
/** Per-emit retries override. */
|
|
324
333
|
retries?: WebhookRetryOptions;
|
|
325
334
|
/**
|
|
@@ -352,6 +361,7 @@ export type WebhookAttemptAuthorizationDecision = {
|
|
|
352
361
|
decision: 'allow';
|
|
353
362
|
/** Optional just-in-time override; `null` explicitly selects RFC 9421. */
|
|
354
363
|
authentication?: WebhookAuthentication;
|
|
364
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
355
365
|
/** Durable transport ordinal allocated by the pre-POST checkpoint. */
|
|
356
366
|
attemptOrdinal?: number;
|
|
357
367
|
} | {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type WebBotSigningKey } from '../signing/web-bot-auth';
|
|
1
2
|
/**
|
|
2
3
|
* Publisher-side webhook emitter — the symmetric counterpart to PR #629's
|
|
3
4
|
* receiver-side dedup. A seller / governance agent / rights agent building
|
|
@@ -65,6 +66,7 @@ export interface WebhookDeliveryProposal {
|
|
|
65
66
|
}
|
|
66
67
|
/** Exact caller-owned state required to reconstruct a delivery after restart. */
|
|
67
68
|
export interface WebhookDeliverySnapshot {
|
|
69
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
68
70
|
url: string;
|
|
69
71
|
payload: Record<string, unknown>;
|
|
70
72
|
authentication: WebhookAuthentication;
|
|
@@ -173,6 +175,12 @@ export interface WebhookRetryOptions {
|
|
|
173
175
|
jitter?: number;
|
|
174
176
|
}
|
|
175
177
|
export interface WebhookEmitterOptions {
|
|
178
|
+
/** Experimental profile must be selected by trusted subscription configuration. */
|
|
179
|
+
webBotAuth?: {
|
|
180
|
+
origin: string;
|
|
181
|
+
key: WebBotSigningKey;
|
|
182
|
+
};
|
|
183
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
176
184
|
/**
|
|
177
185
|
* In-process JWK signing key. Its JWKS entry SHOULD carry
|
|
178
186
|
* `adcp_use: "request-signing"` — webhooks are signed with the agent's
|
|
@@ -320,6 +328,7 @@ export interface WebhookEmitParams {
|
|
|
320
328
|
* 9421 default.
|
|
321
329
|
*/
|
|
322
330
|
authentication?: WebhookAuthentication;
|
|
331
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
323
332
|
/** Per-emit retries override. */
|
|
324
333
|
retries?: WebhookRetryOptions;
|
|
325
334
|
/**
|
|
@@ -352,6 +361,7 @@ export type WebhookAttemptAuthorizationDecision = {
|
|
|
352
361
|
decision: 'allow';
|
|
353
362
|
/** Optional just-in-time override; `null` explicitly selects RFC 9421. */
|
|
354
363
|
authentication?: WebhookAuthentication;
|
|
364
|
+
signingProfile?: 'adcp/webhook-signing/v1' | 'web-bot-auth';
|
|
355
365
|
/** Durable transport ordinal allocated by the pre-POST checkpoint. */
|
|
356
366
|
attemptOrdinal?: number;
|
|
357
367
|
} | {
|
|
@@ -23,6 +23,7 @@ __export(webhook_emitter_exports, {
|
|
|
23
23
|
memoryWebhookKeyStore: () => memoryWebhookKeyStore
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(webhook_emitter_exports);
|
|
26
|
+
var import_web_bot_auth = require('../signing/web-bot-auth.js');
|
|
26
27
|
var import_signer = require('../signing/signer.js');
|
|
27
28
|
var import_signer_async = require('../signing/signer-async.js');
|
|
28
29
|
var import_jcs = require('../utils/jcs.js');
|
|
@@ -122,6 +123,7 @@ function createWebhookEmitter(options) {
|
|
|
122
123
|
payload: delivery.snapshot.payload,
|
|
123
124
|
authentication: delivery.snapshot.authentication,
|
|
124
125
|
retries: delivery.snapshot.retries,
|
|
126
|
+
signingProfile: delivery.snapshot.signingProfile ?? "adcp/webhook-signing/v1",
|
|
125
127
|
...delivery.snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: delivery.snapshot.attemptAuthorizationContext },
|
|
126
128
|
delivery_id: delivery.key.deliveryId,
|
|
127
129
|
__recoveryClaim: delivery
|
|
@@ -138,7 +140,12 @@ function createWebhookEmitter(options) {
|
|
|
138
140
|
throw new TypeError("delivery_id must be a non-empty string");
|
|
139
141
|
}
|
|
140
142
|
const url = params.url;
|
|
143
|
+
const signingProfile = params.signingProfile ?? options.signingProfile ?? "adcp/webhook-signing/v1";
|
|
144
|
+
if (!["adcp/webhook-signing/v1", "web-bot-auth"].includes(signingProfile) || signingProfile === "web-bot-auth" && !options.webBotAuth)
|
|
145
|
+
throw new TypeError("Unsupported or unconfigured webhook signing profile");
|
|
141
146
|
const payloadSnapshot = structuredClone(params.payload);
|
|
147
|
+
if (signingProfile === "web-bot-auth" && params.authentication != null)
|
|
148
|
+
throw new TypeError("Web Bot Auth cannot be combined with legacy webhook authentication");
|
|
142
149
|
const authentication = params.authentication == null ? null : structuredClone(params.authentication);
|
|
143
150
|
const attemptAuthorizationContext = params.attemptAuthorizationContext === void 0 ? void 0 : structuredClone(params.attemptAuthorizationContext);
|
|
144
151
|
const retries = resolveRetries(params.retries === void 0 ? options.retries : structuredClone(params.retries));
|
|
@@ -151,6 +158,7 @@ function createWebhookEmitter(options) {
|
|
|
151
158
|
payload: structuredClone(payloadSnapshot),
|
|
152
159
|
authentication: authentication === null ? null : structuredClone(authentication),
|
|
153
160
|
retries: { ...retries },
|
|
161
|
+
...(signingProfile === "web-bot-auth" || options.signingProfile === "web-bot-auth") && { signingProfile },
|
|
154
162
|
...attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: structuredClone(attemptAuthorizationContext) }
|
|
155
163
|
});
|
|
156
164
|
const recoveryHeartbeat = recoveryClaim ? startRecoveryClaimHeartbeat(recoveryClaim) : void 0;
|
|
@@ -206,6 +214,7 @@ function createWebhookEmitter(options) {
|
|
|
206
214
|
assertPositiveInteger(resolvedAttempt, "resolved webhook attempt ordinal", 1e6);
|
|
207
215
|
let attemptInfo = { ...candidate, attempt: resolvedAttempt };
|
|
208
216
|
let attemptAuthentication = authentication;
|
|
217
|
+
let attemptSigningProfile = signingProfile;
|
|
209
218
|
if (options.authorizeAttempt) {
|
|
210
219
|
let authorization;
|
|
211
220
|
try {
|
|
@@ -243,10 +252,17 @@ function createWebhookEmitter(options) {
|
|
|
243
252
|
assertPositiveInteger(authorization.attemptOrdinal, "authorized webhook attempt ordinal", 1e6);
|
|
244
253
|
attemptInfo = { ...attemptInfo, attempt: authorization.attemptOrdinal };
|
|
245
254
|
}
|
|
255
|
+
if (authorization.signingProfile !== void 0) {
|
|
256
|
+
if (!["adcp/webhook-signing/v1", "web-bot-auth"].includes(authorization.signingProfile) || authorization.signingProfile === "web-bot-auth" && !options.webBotAuth)
|
|
257
|
+
throw new TypeError("Attempt selected an unsupported webhook signing profile");
|
|
258
|
+
attemptSigningProfile = authorization.signingProfile;
|
|
259
|
+
}
|
|
246
260
|
if ("authentication" in authorization) {
|
|
247
261
|
attemptAuthentication = authorization.authentication == null ? null : structuredClone(authorization.authentication);
|
|
248
262
|
}
|
|
249
263
|
}
|
|
264
|
+
if (attemptSigningProfile === "web-bot-auth" && attemptAuthentication !== null)
|
|
265
|
+
throw new TypeError("Web Bot Auth cannot be combined with legacy webhook authentication");
|
|
250
266
|
attempts = attempt;
|
|
251
267
|
await observeAttempt(options, "attempt", attemptInfo);
|
|
252
268
|
await recoveryHeartbeat?.renewNow();
|
|
@@ -262,6 +278,8 @@ function createWebhookEmitter(options) {
|
|
|
262
278
|
bodyBytes,
|
|
263
279
|
signerKey: options.signerKey,
|
|
264
280
|
signerProvider: options.signerProvider,
|
|
281
|
+
webBotAuth: options.webBotAuth,
|
|
282
|
+
signingProfile: attemptSigningProfile,
|
|
265
283
|
authentication: attemptAuthentication,
|
|
266
284
|
tag: options.tag,
|
|
267
285
|
userAgent: options.userAgent,
|
|
@@ -519,6 +537,10 @@ async function buildHeaders(args) {
|
|
|
519
537
|
headers: baseHeaders,
|
|
520
538
|
body: args.bodyBytes
|
|
521
539
|
};
|
|
540
|
+
if (args.signingProfile === "web-bot-auth") {
|
|
541
|
+
if (!args.webBotAuth) throw new TypeError("Selected Web Bot Auth profile has no configured signing identity");
|
|
542
|
+
return (0, import_web_bot_auth.signWebBotAuth)(request, args.webBotAuth.key, { origin: args.webBotAuth.origin });
|
|
543
|
+
}
|
|
522
544
|
const signOpts = args.tag !== void 0 ? { tag: args.tag } : {};
|
|
523
545
|
const signed = args.signerProvider ? await (0, import_signer_async.signWebhookAsync)(request, args.signerProvider, signOpts) : (0, import_signer.signWebhook)(request, args.signerKey, signOpts);
|
|
524
546
|
return { ...baseHeaders, ...signed.headers };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { signWebBotAuth } from "../signing/web-bot-auth.mjs";
|
|
1
2
|
import { signWebhook } from "../signing/signer.mjs";
|
|
2
3
|
import { signWebhookAsync } from "../signing/signer-async.mjs";
|
|
3
4
|
import { canonicalJsonSha256 } from "../utils/jcs.mjs";
|
|
@@ -103,6 +104,7 @@ function createWebhookEmitter(options) {
|
|
|
103
104
|
payload: delivery.snapshot.payload,
|
|
104
105
|
authentication: delivery.snapshot.authentication,
|
|
105
106
|
retries: delivery.snapshot.retries,
|
|
107
|
+
signingProfile: delivery.snapshot.signingProfile ?? "adcp/webhook-signing/v1",
|
|
106
108
|
...delivery.snapshot.attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: delivery.snapshot.attemptAuthorizationContext },
|
|
107
109
|
delivery_id: delivery.key.deliveryId,
|
|
108
110
|
__recoveryClaim: delivery
|
|
@@ -119,7 +121,12 @@ function createWebhookEmitter(options) {
|
|
|
119
121
|
throw new TypeError("delivery_id must be a non-empty string");
|
|
120
122
|
}
|
|
121
123
|
const url = params.url;
|
|
124
|
+
const signingProfile = params.signingProfile ?? options.signingProfile ?? "adcp/webhook-signing/v1";
|
|
125
|
+
if (!["adcp/webhook-signing/v1", "web-bot-auth"].includes(signingProfile) || signingProfile === "web-bot-auth" && !options.webBotAuth)
|
|
126
|
+
throw new TypeError("Unsupported or unconfigured webhook signing profile");
|
|
122
127
|
const payloadSnapshot = structuredClone(params.payload);
|
|
128
|
+
if (signingProfile === "web-bot-auth" && params.authentication != null)
|
|
129
|
+
throw new TypeError("Web Bot Auth cannot be combined with legacy webhook authentication");
|
|
123
130
|
const authentication = params.authentication == null ? null : structuredClone(params.authentication);
|
|
124
131
|
const attemptAuthorizationContext = params.attemptAuthorizationContext === void 0 ? void 0 : structuredClone(params.attemptAuthorizationContext);
|
|
125
132
|
const retries = resolveRetries(params.retries === void 0 ? options.retries : structuredClone(params.retries));
|
|
@@ -132,6 +139,7 @@ function createWebhookEmitter(options) {
|
|
|
132
139
|
payload: structuredClone(payloadSnapshot),
|
|
133
140
|
authentication: authentication === null ? null : structuredClone(authentication),
|
|
134
141
|
retries: { ...retries },
|
|
142
|
+
...(signingProfile === "web-bot-auth" || options.signingProfile === "web-bot-auth") && { signingProfile },
|
|
135
143
|
...attemptAuthorizationContext === void 0 ? {} : { attemptAuthorizationContext: structuredClone(attemptAuthorizationContext) }
|
|
136
144
|
});
|
|
137
145
|
const recoveryHeartbeat = recoveryClaim ? startRecoveryClaimHeartbeat(recoveryClaim) : void 0;
|
|
@@ -187,6 +195,7 @@ function createWebhookEmitter(options) {
|
|
|
187
195
|
assertPositiveInteger(resolvedAttempt, "resolved webhook attempt ordinal", 1e6);
|
|
188
196
|
let attemptInfo = { ...candidate, attempt: resolvedAttempt };
|
|
189
197
|
let attemptAuthentication = authentication;
|
|
198
|
+
let attemptSigningProfile = signingProfile;
|
|
190
199
|
if (options.authorizeAttempt) {
|
|
191
200
|
let authorization;
|
|
192
201
|
try {
|
|
@@ -224,10 +233,17 @@ function createWebhookEmitter(options) {
|
|
|
224
233
|
assertPositiveInteger(authorization.attemptOrdinal, "authorized webhook attempt ordinal", 1e6);
|
|
225
234
|
attemptInfo = { ...attemptInfo, attempt: authorization.attemptOrdinal };
|
|
226
235
|
}
|
|
236
|
+
if (authorization.signingProfile !== void 0) {
|
|
237
|
+
if (!["adcp/webhook-signing/v1", "web-bot-auth"].includes(authorization.signingProfile) || authorization.signingProfile === "web-bot-auth" && !options.webBotAuth)
|
|
238
|
+
throw new TypeError("Attempt selected an unsupported webhook signing profile");
|
|
239
|
+
attemptSigningProfile = authorization.signingProfile;
|
|
240
|
+
}
|
|
227
241
|
if ("authentication" in authorization) {
|
|
228
242
|
attemptAuthentication = authorization.authentication == null ? null : structuredClone(authorization.authentication);
|
|
229
243
|
}
|
|
230
244
|
}
|
|
245
|
+
if (attemptSigningProfile === "web-bot-auth" && attemptAuthentication !== null)
|
|
246
|
+
throw new TypeError("Web Bot Auth cannot be combined with legacy webhook authentication");
|
|
231
247
|
attempts = attempt;
|
|
232
248
|
await observeAttempt(options, "attempt", attemptInfo);
|
|
233
249
|
await recoveryHeartbeat?.renewNow();
|
|
@@ -243,6 +259,8 @@ function createWebhookEmitter(options) {
|
|
|
243
259
|
bodyBytes,
|
|
244
260
|
signerKey: options.signerKey,
|
|
245
261
|
signerProvider: options.signerProvider,
|
|
262
|
+
webBotAuth: options.webBotAuth,
|
|
263
|
+
signingProfile: attemptSigningProfile,
|
|
246
264
|
authentication: attemptAuthentication,
|
|
247
265
|
tag: options.tag,
|
|
248
266
|
userAgent: options.userAgent,
|
|
@@ -500,6 +518,10 @@ async function buildHeaders(args) {
|
|
|
500
518
|
headers: baseHeaders,
|
|
501
519
|
body: args.bodyBytes
|
|
502
520
|
};
|
|
521
|
+
if (args.signingProfile === "web-bot-auth") {
|
|
522
|
+
if (!args.webBotAuth) throw new TypeError("Selected Web Bot Auth profile has no configured signing identity");
|
|
523
|
+
return signWebBotAuth(request, args.webBotAuth.key, { origin: args.webBotAuth.origin });
|
|
524
|
+
}
|
|
503
525
|
const signOpts = args.tag !== void 0 ? { tag: args.tag } : {};
|
|
504
526
|
const signed = args.signerProvider ? await signWebhookAsync(request, args.signerProvider, signOpts) : signWebhook(request, args.signerKey, signOpts);
|
|
505
527
|
return { ...baseHeaders, ...signed.headers };
|
|
@@ -64,11 +64,6 @@ export interface AgentSigningContext {
|
|
|
64
64
|
* scope.
|
|
65
65
|
*/
|
|
66
66
|
export declare const signingContextStorage: import("async_hooks").AsyncLocalStorage<AgentSigningContext | undefined>;
|
|
67
|
-
/**
|
|
68
|
-
* Build an `AgentSigningContext` from an `AgentConfig` when signing is
|
|
69
|
-
* configured. Returns `undefined` when the agent has no `request_signing`
|
|
70
|
-
* block — callers use this to branch into the no-op fast path.
|
|
71
|
-
*/
|
|
72
67
|
export declare function buildAgentSigningContext(agent: AgentConfig, options?: {
|
|
73
68
|
cache?: CapabilityCache;
|
|
74
69
|
adcpVersion?: string;
|
|
@@ -64,11 +64,6 @@ export interface AgentSigningContext {
|
|
|
64
64
|
* scope.
|
|
65
65
|
*/
|
|
66
66
|
export declare const signingContextStorage: import("async_hooks").AsyncLocalStorage<AgentSigningContext | undefined>;
|
|
67
|
-
/**
|
|
68
|
-
* Build an `AgentSigningContext` from an `AgentConfig` when signing is
|
|
69
|
-
* configured. Returns `undefined` when the agent has no `request_signing`
|
|
70
|
-
* block — callers use this to branch into the no-op fast path.
|
|
71
|
-
*/
|
|
72
67
|
export declare function buildAgentSigningContext(agent: AgentConfig, options?: {
|
|
73
68
|
cache?: CapabilityCache;
|
|
74
69
|
adcpVersion?: string;
|
|
@@ -28,12 +28,20 @@ var import_capability_cache = require('./capability-cache.js');
|
|
|
28
28
|
var import_version = require('../version.js');
|
|
29
29
|
const CAPABILITY_SCOPE_SALT = (0, import_node_crypto.randomBytes)(32);
|
|
30
30
|
const signingContextStorage = (0, import_global_async_local_storage.globalAsyncLocalStorage)("signingContext");
|
|
31
|
+
let rfcIdentityWarningEmitted = false;
|
|
31
32
|
function buildAgentSigningContext(agent, options = {}) {
|
|
32
33
|
const signing = agent.request_signing;
|
|
33
34
|
if (!signing) return void 0;
|
|
35
|
+
if (signing.profile !== "web-bot-auth" && !rfcIdentityWarningEmitted) {
|
|
36
|
+
rfcIdentityWarningEmitted = true;
|
|
37
|
+
process.emitWarning(
|
|
38
|
+
"RFC 9421 agent identity discovery is deprecated in AdCP 3.3; opt into Web Bot Auth after counterparties advertise support. RFC configuration remains supported through 3.x.",
|
|
39
|
+
{ code: "ADCP_RFC9421_IDENTITY_DEPRECATED", type: "Warning" }
|
|
40
|
+
);
|
|
41
|
+
}
|
|
34
42
|
const cache = options.cache ?? import_capability_cache.defaultCapabilityCache;
|
|
35
43
|
const identity = snapshotIdentity(signing);
|
|
36
|
-
const cacheFingerprint = deriveCacheFingerprint(identity);
|
|
44
|
+
const cacheFingerprint = signing.profile === "web-bot-auth" ? (0, import_node_crypto.createHash)("sha256").update(deriveCacheFingerprint(identity)).update("\0web-bot-auth\0").update(signing.agent_url).digest("hex").slice(0, 32) : deriveCacheFingerprint(identity);
|
|
37
45
|
const adcpVersion = options.adcpVersion ?? import_version.ADCP_VERSION;
|
|
38
46
|
const capabilityCacheKey = (0, import_capability_cache.buildCapabilityCacheKey)(
|
|
39
47
|
agent.agent_uri,
|
|
@@ -7,12 +7,20 @@ import {
|
|
|
7
7
|
import { ADCP_VERSION } from "../version.mjs";
|
|
8
8
|
const CAPABILITY_SCOPE_SALT = randomBytes(32);
|
|
9
9
|
const signingContextStorage = globalAsyncLocalStorage("signingContext");
|
|
10
|
+
let rfcIdentityWarningEmitted = false;
|
|
10
11
|
function buildAgentSigningContext(agent, options = {}) {
|
|
11
12
|
const signing = agent.request_signing;
|
|
12
13
|
if (!signing) return void 0;
|
|
14
|
+
if (signing.profile !== "web-bot-auth" && !rfcIdentityWarningEmitted) {
|
|
15
|
+
rfcIdentityWarningEmitted = true;
|
|
16
|
+
process.emitWarning(
|
|
17
|
+
"RFC 9421 agent identity discovery is deprecated in AdCP 3.3; opt into Web Bot Auth after counterparties advertise support. RFC configuration remains supported through 3.x.",
|
|
18
|
+
{ code: "ADCP_RFC9421_IDENTITY_DEPRECATED", type: "Warning" }
|
|
19
|
+
);
|
|
20
|
+
}
|
|
13
21
|
const cache = options.cache ?? defaultCapabilityCache;
|
|
14
22
|
const identity = snapshotIdentity(signing);
|
|
15
|
-
const cacheFingerprint = deriveCacheFingerprint(identity);
|
|
23
|
+
const cacheFingerprint = signing.profile === "web-bot-auth" ? createHash("sha256").update(deriveCacheFingerprint(identity)).update("\0web-bot-auth\0").update(signing.agent_url).digest("hex").slice(0, 32) : deriveCacheFingerprint(identity);
|
|
16
24
|
const adcpVersion = options.adcpVersion ?? ADCP_VERSION;
|
|
17
25
|
const capabilityCacheKey = buildCapabilityCacheKey(
|
|
18
26
|
agent.agent_uri,
|