@adcp/sdk 15.9.0 → 16.0.0-beta.1

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.
Files changed (295) hide show
  1. package/bin/adcp-identity.js +74 -0
  2. package/bin/adcp.js +2 -0
  3. package/dist/lib/adapters/keyed-account-backend.d.mts +37 -0
  4. package/dist/lib/adapters/keyed-account-backend.d.ts +37 -0
  5. package/dist/lib/adapters/keyed-account-backend.js +121 -0
  6. package/dist/lib/adapters/keyed-account-backend.mjs +94 -0
  7. package/dist/lib/adapters/keyed-account-store.d.mts +28 -0
  8. package/dist/lib/adapters/keyed-account-store.d.ts +28 -0
  9. package/dist/lib/adapters/keyed-account-store.js +227 -0
  10. package/dist/lib/adapters/keyed-account-store.mjs +203 -0
  11. package/dist/lib/core/SingleAgentClient.d.mts +16 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +16 -2
  13. package/dist/lib/core/SingleAgentClient.js +259 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +261 -57
  15. package/dist/lib/core/TaskExecutor.d.mts +6 -0
  16. package/dist/lib/core/TaskExecutor.d.ts +6 -0
  17. package/dist/lib/core/TaskExecutor.js +66 -5
  18. package/dist/lib/core/TaskExecutor.mjs +71 -5
  19. package/dist/lib/core/postgres-webhook-registration-store.js +32 -5
  20. package/dist/lib/core/postgres-webhook-registration-store.mjs +32 -5
  21. package/dist/lib/core/redis-webhook-registration-store.js +23 -1
  22. package/dist/lib/core/redis-webhook-registration-store.mjs +23 -1
  23. package/dist/lib/core/webhook-registration.d.mts +7 -1
  24. package/dist/lib/core/webhook-registration.d.ts +7 -1
  25. package/dist/lib/core/webhook-registration.js +24 -2
  26. package/dist/lib/core/webhook-registration.mjs +23 -2
  27. package/dist/lib/identity-3.3/index.d.mts +10 -0
  28. package/dist/lib/identity-3.3/index.d.ts +10 -0
  29. package/dist/lib/identity-3.3/index.js +75 -0
  30. package/dist/lib/identity-3.3/index.mjs +46 -0
  31. package/dist/lib/identity-3.3/lifecycle.d.mts +113 -0
  32. package/dist/lib/identity-3.3/lifecycle.d.ts +113 -0
  33. package/dist/lib/identity-3.3/lifecycle.js +267 -0
  34. package/dist/lib/identity-3.3/lifecycle.mjs +240 -0
  35. package/dist/lib/identity-3.3/revocation.d.mts +50 -0
  36. package/dist/lib/identity-3.3/revocation.d.ts +50 -0
  37. package/dist/lib/identity-3.3/revocation.js +238 -0
  38. package/dist/lib/identity-3.3/revocation.mjs +216 -0
  39. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  40. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  41. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  42. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  43. package/dist/lib/identity-3.3/server.d.mts +34 -0
  44. package/dist/lib/identity-3.3/server.d.ts +34 -0
  45. package/dist/lib/identity-3.3/server.js +219 -0
  46. package/dist/lib/identity-3.3/server.mjs +194 -0
  47. package/dist/lib/identity-3.3/store.d.mts +24 -0
  48. package/dist/lib/identity-3.3/store.d.ts +24 -0
  49. package/dist/lib/identity-3.3/store.js +191 -0
  50. package/dist/lib/identity-3.3/store.mjs +169 -0
  51. package/dist/lib/identity-3.3/trust.d.mts +94 -0
  52. package/dist/lib/identity-3.3/trust.d.ts +94 -0
  53. package/dist/lib/identity-3.3/trust.js +278 -0
  54. package/dist/lib/identity-3.3/trust.mjs +239 -0
  55. package/dist/lib/identity-3.3/types.d.mts +127 -0
  56. package/dist/lib/identity-3.3/types.d.ts +127 -0
  57. package/dist/lib/identity-3.3/types.js +16 -0
  58. package/dist/lib/identity-3.3/types.mjs +0 -0
  59. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  60. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  61. package/dist/lib/identity-3.3/validation.js +125 -0
  62. package/dist/lib/identity-3.3/validation.mjs +91 -0
  63. package/dist/lib/index.d.mts +1 -1
  64. package/dist/lib/index.d.ts +1 -1
  65. package/dist/lib/reporting/azure/index.d.mts +5 -0
  66. package/dist/lib/reporting/azure/index.d.ts +5 -0
  67. package/dist/lib/reporting/azure/index.js +26 -7
  68. package/dist/lib/reporting/azure/index.mjs +26 -7
  69. package/dist/lib/reporting/bigquery/index.d.mts +80 -25
  70. package/dist/lib/reporting/bigquery/index.d.ts +80 -25
  71. package/dist/lib/reporting/bigquery/index.js +184 -81
  72. package/dist/lib/reporting/bigquery/index.mjs +182 -80
  73. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  74. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  75. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  76. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  77. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  78. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  79. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  80. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  81. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  82. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  83. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  84. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  85. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  86. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  87. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  88. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  89. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  90. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  91. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  92. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  93. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  94. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  95. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  96. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  97. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  98. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  99. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  100. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  101. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  102. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  103. package/dist/lib/reporting/ledger/postgres.js +43 -27
  104. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  105. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  106. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  107. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  108. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  109. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  110. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  111. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  112. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  113. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  114. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  115. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  116. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  117. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  118. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  119. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  120. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  121. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  122. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  123. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  124. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  125. package/dist/lib/reporting/ledger/schedule.js +24 -0
  126. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  127. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  128. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  129. package/dist/lib/reporting/s3/index.d.mts +5 -0
  130. package/dist/lib/reporting/s3/index.d.ts +5 -0
  131. package/dist/lib/reporting/s3/index.js +37 -14
  132. package/dist/lib/reporting/s3/index.mjs +37 -14
  133. package/dist/lib/reporting/service/index.d.mts +10 -0
  134. package/dist/lib/reporting/service/index.d.ts +10 -0
  135. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  136. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  137. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  138. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  139. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  140. package/dist/lib/server/account-sync-contract.js +225 -0
  141. package/dist/lib/server/account-sync-contract.mjs +197 -0
  142. package/dist/lib/server/adcp-server.js +5 -0
  143. package/dist/lib/server/adcp-server.mjs +10 -0
  144. package/dist/lib/server/auth-signature.d.mts +10 -0
  145. package/dist/lib/server/auth-signature.d.ts +10 -0
  146. package/dist/lib/server/auth-signature.js +61 -2
  147. package/dist/lib/server/auth-signature.mjs +65 -2
  148. package/dist/lib/server/auth.d.mts +6 -0
  149. package/dist/lib/server/auth.d.ts +6 -0
  150. package/dist/lib/server/auth.js +6 -0
  151. package/dist/lib/server/auth.mjs +6 -0
  152. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  153. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  154. package/dist/lib/server/create-adcp-server.js +238 -19
  155. package/dist/lib/server/create-adcp-server.mjs +240 -10
  156. package/dist/lib/server/decisioning/account.d.mts +24 -1
  157. package/dist/lib/server/decisioning/account.d.ts +24 -1
  158. package/dist/lib/server/decisioning/index.d.mts +1 -1
  159. package/dist/lib/server/decisioning/index.d.ts +1 -1
  160. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  161. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  162. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  163. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  164. package/dist/lib/server/index.d.mts +2 -0
  165. package/dist/lib/server/index.d.ts +2 -0
  166. package/dist/lib/server/index.js +12 -0
  167. package/dist/lib/server/index.mjs +12 -0
  168. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  169. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  170. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  171. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  172. package/dist/lib/server/principal/types.d.mts +1 -1
  173. package/dist/lib/server/principal/types.d.ts +1 -1
  174. package/dist/lib/server/serve.js +5 -0
  175. package/dist/lib/server/serve.mjs +5 -0
  176. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  177. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  178. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  179. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  180. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  181. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  182. package/dist/lib/server/webhook-emitter.js +22 -0
  183. package/dist/lib/server/webhook-emitter.mjs +22 -0
  184. package/dist/lib/signing/agent-context.d.mts +0 -5
  185. package/dist/lib/signing/agent-context.d.ts +0 -5
  186. package/dist/lib/signing/agent-context.js +9 -1
  187. package/dist/lib/signing/agent-context.mjs +9 -1
  188. package/dist/lib/signing/agent-fetch.js +27 -2
  189. package/dist/lib/signing/agent-fetch.mjs +32 -2
  190. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  191. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  192. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  193. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  194. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  195. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  196. package/dist/lib/signing/agent-resolver/index.js +5 -0
  197. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  198. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  199. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  200. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  201. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  202. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  203. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  204. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  205. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  206. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  207. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  208. package/dist/lib/signing/brand-jwks.js +4 -4
  209. package/dist/lib/signing/brand-jwks.mjs +4 -4
  210. package/dist/lib/signing/client.d.mts +1 -0
  211. package/dist/lib/signing/client.d.ts +1 -0
  212. package/dist/lib/signing/client.js +5 -0
  213. package/dist/lib/signing/client.mjs +3 -0
  214. package/dist/lib/signing/jwks-https.d.mts +1 -1
  215. package/dist/lib/signing/jwks-https.d.ts +1 -1
  216. package/dist/lib/signing/jwks-https.js +1 -1
  217. package/dist/lib/signing/jwks-https.mjs +1 -1
  218. package/dist/lib/signing/jwks.d.mts +11 -3
  219. package/dist/lib/signing/jwks.d.ts +11 -3
  220. package/dist/lib/signing/jwks.js +1 -1
  221. package/dist/lib/signing/jwks.mjs +1 -1
  222. package/dist/lib/signing/parser.d.mts +1 -1
  223. package/dist/lib/signing/parser.d.ts +1 -1
  224. package/dist/lib/signing/parser.js +5 -3
  225. package/dist/lib/signing/parser.mjs +6 -4
  226. package/dist/lib/signing/revocation.d.mts +4 -1
  227. package/dist/lib/signing/revocation.d.ts +4 -1
  228. package/dist/lib/signing/revocation.js +33 -3
  229. package/dist/lib/signing/revocation.mjs +31 -2
  230. package/dist/lib/signing/server.d.mts +1 -1
  231. package/dist/lib/signing/server.d.ts +1 -1
  232. package/dist/lib/signing/server.js +4 -0
  233. package/dist/lib/signing/server.mjs +4 -0
  234. package/dist/lib/signing/types.d.mts +3 -0
  235. package/dist/lib/signing/types.d.ts +3 -0
  236. package/dist/lib/signing/web-bot-auth.d.mts +117 -0
  237. package/dist/lib/signing/web-bot-auth.d.ts +117 -0
  238. package/dist/lib/signing/web-bot-auth.js +660 -0
  239. package/dist/lib/signing/web-bot-auth.mjs +624 -0
  240. package/dist/lib/testing/client.d.mts +1 -4
  241. package/dist/lib/testing/client.d.ts +1 -4
  242. package/dist/lib/testing/client.js +141 -20
  243. package/dist/lib/testing/client.mjs +137 -19
  244. package/dist/lib/testing/compliance/comply.js +29 -10
  245. package/dist/lib/testing/compliance/comply.mjs +37 -11
  246. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  247. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  248. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  249. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  250. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  251. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  252. package/dist/lib/testing/storyboard/runner.js +23 -8
  253. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  254. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  255. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  256. package/dist/lib/types/adcp.d.mts +4 -0
  257. package/dist/lib/types/adcp.d.ts +4 -0
  258. package/dist/lib/types/schemas.generated.d.ts +6 -6
  259. package/dist/lib/utils/capabilities.d.mts +1 -0
  260. package/dist/lib/utils/capabilities.d.ts +1 -0
  261. package/dist/lib/utils/capabilities.js +5 -0
  262. package/dist/lib/utils/capabilities.mjs +5 -0
  263. package/dist/lib/v2/projection/creative-delivery.d.mts +3 -1
  264. package/dist/lib/v2/projection/creative-delivery.d.ts +3 -1
  265. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  266. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  267. package/dist/lib/v2/projection/index.d.mts +1 -1
  268. package/dist/lib/v2/projection/index.d.ts +1 -1
  269. package/dist/lib/v2/projection/legacy-routes.d.mts +24 -2
  270. package/dist/lib/v2/projection/legacy-routes.d.ts +24 -2
  271. package/dist/lib/v2/projection/legacy-routes.js +28 -2
  272. package/dist/lib/v2/projection/legacy-routes.mjs +26 -2
  273. package/dist/lib/validation/schema-loader.d.mts +2 -0
  274. package/dist/lib/validation/schema-loader.d.ts +2 -0
  275. package/dist/lib/validation/schema-loader.js +43 -4
  276. package/dist/lib/validation/schema-loader.mjs +39 -3
  277. package/dist/lib/version.d.mts +3 -3
  278. package/dist/lib/version.d.ts +3 -3
  279. package/dist/lib/version.js +3 -3
  280. package/dist/lib/version.mjs +3 -3
  281. package/docs/TYPE-SUMMARY.md +2 -2
  282. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  283. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  284. package/docs/guides/REPORTING-LEDGER.md +132 -46
  285. package/docs/guides/REPORTING-OPERATIONS.md +25 -4
  286. package/docs/guides/REPORTING-STABILITY.md +76 -0
  287. package/docs/guides/account-resolution.md +101 -0
  288. package/docs/llms.txt +3 -2
  289. package/docs/migration-12-to-13.md +7 -0
  290. package/docs/migration-14.x-rc-worksheet.md +4 -4
  291. package/docs/migration-agent-identity-3.3.md +355 -0
  292. package/docs/migration-agent-resolution-3.3.md +5 -0
  293. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  294. package/examples/storyboards/account-sync-contract.yaml +57 -0
  295. package/package.json +15 -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
  }
@@ -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,