@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.
Files changed (321) 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 +25 -2
  12. package/dist/lib/core/SingleAgentClient.d.ts +25 -2
  13. package/dist/lib/core/SingleAgentClient.js +280 -62
  14. package/dist/lib/core/SingleAgentClient.mjs +282 -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/generated-compat.d.mts +34 -0
  28. package/dist/lib/identity-3.3/generated-compat.d.ts +34 -0
  29. package/dist/lib/identity-3.3/generated-compat.js +16 -0
  30. package/dist/lib/identity-3.3/generated-compat.mjs +0 -0
  31. package/dist/lib/identity-3.3/index.d.mts +10 -0
  32. package/dist/lib/identity-3.3/index.d.ts +10 -0
  33. package/dist/lib/identity-3.3/index.js +79 -0
  34. package/dist/lib/identity-3.3/index.mjs +50 -0
  35. package/dist/lib/identity-3.3/lifecycle.d.mts +125 -0
  36. package/dist/lib/identity-3.3/lifecycle.d.ts +125 -0
  37. package/dist/lib/identity-3.3/lifecycle.js +294 -0
  38. package/dist/lib/identity-3.3/lifecycle.mjs +272 -0
  39. package/dist/lib/identity-3.3/revocation.d.mts +86 -0
  40. package/dist/lib/identity-3.3/revocation.d.ts +86 -0
  41. package/dist/lib/identity-3.3/revocation.js +308 -0
  42. package/dist/lib/identity-3.3/revocation.mjs +286 -0
  43. package/dist/lib/identity-3.3/schemas.draft.d.mts +2472 -0
  44. package/dist/lib/identity-3.3/schemas.draft.d.ts +2472 -0
  45. package/dist/lib/identity-3.3/schemas.draft.js +1448 -0
  46. package/dist/lib/identity-3.3/schemas.draft.mjs +1428 -0
  47. package/dist/lib/identity-3.3/server.d.mts +46 -0
  48. package/dist/lib/identity-3.3/server.d.ts +46 -0
  49. package/dist/lib/identity-3.3/server.js +279 -0
  50. package/dist/lib/identity-3.3/server.mjs +260 -0
  51. package/dist/lib/identity-3.3/store.d.mts +24 -0
  52. package/dist/lib/identity-3.3/store.d.ts +24 -0
  53. package/dist/lib/identity-3.3/store.js +191 -0
  54. package/dist/lib/identity-3.3/store.mjs +169 -0
  55. package/dist/lib/identity-3.3/trust.d.mts +155 -0
  56. package/dist/lib/identity-3.3/trust.d.ts +155 -0
  57. package/dist/lib/identity-3.3/trust.js +383 -0
  58. package/dist/lib/identity-3.3/trust.mjs +342 -0
  59. package/dist/lib/identity-3.3/types.d.mts +155 -0
  60. package/dist/lib/identity-3.3/types.d.ts +155 -0
  61. package/dist/lib/identity-3.3/types.js +16 -0
  62. package/dist/lib/identity-3.3/types.mjs +0 -0
  63. package/dist/lib/identity-3.3/validation.d.mts +2 -0
  64. package/dist/lib/identity-3.3/validation.d.ts +2 -0
  65. package/dist/lib/identity-3.3/validation.js +125 -0
  66. package/dist/lib/identity-3.3/validation.mjs +91 -0
  67. package/dist/lib/index.d.mts +1 -1
  68. package/dist/lib/index.d.ts +1 -1
  69. package/dist/lib/index.js +2 -0
  70. package/dist/lib/index.mjs +2 -0
  71. package/dist/lib/protocols/index.d.mts +1 -1
  72. package/dist/lib/protocols/index.d.ts +1 -1
  73. package/dist/lib/protocols/index.js +2 -2
  74. package/dist/lib/protocols/index.mjs +2 -2
  75. package/dist/lib/reporting/azure/index.d.mts +5 -0
  76. package/dist/lib/reporting/azure/index.d.ts +5 -0
  77. package/dist/lib/reporting/azure/index.js +26 -7
  78. package/dist/lib/reporting/azure/index.mjs +26 -7
  79. package/dist/lib/reporting/bigquery/index.d.mts +39 -5
  80. package/dist/lib/reporting/bigquery/index.d.ts +39 -5
  81. package/dist/lib/reporting/bigquery/index.js +26 -20
  82. package/dist/lib/reporting/bigquery/index.mjs +26 -20
  83. package/dist/lib/reporting/gcs/adapter.d.mts +8 -1
  84. package/dist/lib/reporting/gcs/adapter.d.ts +8 -1
  85. package/dist/lib/reporting/gcs/errors.d.mts +6 -0
  86. package/dist/lib/reporting/gcs/errors.d.ts +6 -0
  87. package/dist/lib/reporting/gcs/fence.d.mts +5 -0
  88. package/dist/lib/reporting/gcs/fence.d.ts +5 -0
  89. package/dist/lib/reporting/gcs/index.d.mts +9 -0
  90. package/dist/lib/reporting/gcs/index.d.ts +9 -0
  91. package/dist/lib/reporting/gcs/reader.d.mts +27 -3
  92. package/dist/lib/reporting/gcs/reader.d.ts +27 -3
  93. package/dist/lib/reporting/gcs/row-provider.d.mts +7 -0
  94. package/dist/lib/reporting/gcs/row-provider.d.ts +7 -0
  95. package/dist/lib/reporting/gcs/row-provider.js +34 -14
  96. package/dist/lib/reporting/gcs/row-provider.mjs +34 -14
  97. package/dist/lib/reporting/ledger/change-feed.d.mts +22 -1
  98. package/dist/lib/reporting/ledger/change-feed.d.ts +22 -1
  99. package/dist/lib/reporting/ledger/index.d.mts +11 -0
  100. package/dist/lib/reporting/ledger/index.d.ts +11 -0
  101. package/dist/lib/reporting/ledger/managed-postgres.d.mts +8 -0
  102. package/dist/lib/reporting/ledger/managed-postgres.d.ts +8 -0
  103. package/dist/lib/reporting/ledger/managed-router.d.mts +27 -2
  104. package/dist/lib/reporting/ledger/managed-router.d.ts +27 -2
  105. package/dist/lib/reporting/ledger/managed.d.mts +86 -6
  106. package/dist/lib/reporting/ledger/managed.d.ts +86 -6
  107. package/dist/lib/reporting/ledger/notification-activity.d.mts +65 -3
  108. package/dist/lib/reporting/ledger/notification-activity.d.ts +65 -3
  109. package/dist/lib/reporting/ledger/object-writes.d.mts +64 -5
  110. package/dist/lib/reporting/ledger/object-writes.d.ts +64 -5
  111. package/dist/lib/reporting/ledger/postgres.d.mts +43 -9
  112. package/dist/lib/reporting/ledger/postgres.d.ts +43 -9
  113. package/dist/lib/reporting/ledger/postgres.js +43 -27
  114. package/dist/lib/reporting/ledger/postgres.mjs +43 -27
  115. package/dist/lib/reporting/ledger/row-encoding.d.mts +92 -6
  116. package/dist/lib/reporting/ledger/row-encoding.d.ts +92 -6
  117. package/dist/lib/reporting/ledger/row-encoding.js +8 -4
  118. package/dist/lib/reporting/ledger/row-encoding.mjs +6 -3
  119. package/dist/lib/reporting/ledger/row-storage-errors.d.mts +11 -1
  120. package/dist/lib/reporting/ledger/row-storage-errors.d.ts +11 -1
  121. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +19 -1
  122. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +19 -1
  123. package/dist/lib/reporting/ledger/row-storage-migration.js +133 -18
  124. package/dist/lib/reporting/ledger/row-storage-migration.mjs +133 -18
  125. package/dist/lib/reporting/ledger/row-storage-object.d.mts +103 -12
  126. package/dist/lib/reporting/ledger/row-storage-object.d.ts +103 -12
  127. package/dist/lib/reporting/ledger/row-storage-object.js +106 -31
  128. package/dist/lib/reporting/ledger/row-storage-object.mjs +104 -31
  129. package/dist/lib/reporting/ledger/row-storage.d.mts +87 -20
  130. package/dist/lib/reporting/ledger/row-storage.d.ts +87 -20
  131. package/dist/lib/reporting/ledger/row-storage.js +126 -66
  132. package/dist/lib/reporting/ledger/row-storage.mjs +129 -67
  133. package/dist/lib/reporting/ledger/schedule.d.mts +13 -0
  134. package/dist/lib/reporting/ledger/schedule.d.ts +13 -0
  135. package/dist/lib/reporting/ledger/schedule.js +24 -0
  136. package/dist/lib/reporting/ledger/schedule.mjs +23 -0
  137. package/dist/lib/reporting/ledger/types.d.mts +23 -1
  138. package/dist/lib/reporting/ledger/types.d.ts +23 -1
  139. package/dist/lib/reporting/s3/index.d.mts +5 -0
  140. package/dist/lib/reporting/s3/index.d.ts +5 -0
  141. package/dist/lib/reporting/s3/index.js +37 -14
  142. package/dist/lib/reporting/s3/index.mjs +37 -14
  143. package/dist/lib/reporting/service/index.d.mts +10 -0
  144. package/dist/lib/reporting/service/index.d.ts +10 -0
  145. package/dist/lib/reporting/service/maintenance.d.mts +28 -2
  146. package/dist/lib/reporting/service/maintenance.d.ts +28 -2
  147. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  148. package/dist/lib/server/account-sync-contract.d.mts +14 -0
  149. package/dist/lib/server/account-sync-contract.d.ts +14 -0
  150. package/dist/lib/server/account-sync-contract.js +225 -0
  151. package/dist/lib/server/account-sync-contract.mjs +197 -0
  152. package/dist/lib/server/adcp-server.js +5 -0
  153. package/dist/lib/server/adcp-server.mjs +10 -0
  154. package/dist/lib/server/auth-signature.d.mts +15 -0
  155. package/dist/lib/server/auth-signature.d.ts +15 -0
  156. package/dist/lib/server/auth-signature.js +72 -2
  157. package/dist/lib/server/auth-signature.mjs +81 -2
  158. package/dist/lib/server/auth.d.mts +6 -0
  159. package/dist/lib/server/auth.d.ts +6 -0
  160. package/dist/lib/server/auth.js +6 -0
  161. package/dist/lib/server/auth.mjs +6 -0
  162. package/dist/lib/server/create-adcp-server.d.mts +19 -5
  163. package/dist/lib/server/create-adcp-server.d.ts +19 -5
  164. package/dist/lib/server/create-adcp-server.js +259 -19
  165. package/dist/lib/server/create-adcp-server.mjs +266 -10
  166. package/dist/lib/server/decisioning/account.d.mts +24 -1
  167. package/dist/lib/server/decisioning/account.d.ts +24 -1
  168. package/dist/lib/server/decisioning/index.d.mts +1 -1
  169. package/dist/lib/server/decisioning/index.d.ts +1 -1
  170. package/dist/lib/server/decisioning/runtime/from-platform.d.mts +0 -50
  171. package/dist/lib/server/decisioning/runtime/from-platform.d.ts +0 -50
  172. package/dist/lib/server/decisioning/runtime/from-platform.js +61 -11
  173. package/dist/lib/server/decisioning/runtime/from-platform.mjs +65 -12
  174. package/dist/lib/server/index.d.mts +2 -0
  175. package/dist/lib/server/index.d.ts +2 -0
  176. package/dist/lib/server/index.js +12 -0
  177. package/dist/lib/server/index.mjs +12 -0
  178. package/dist/lib/server/notification-subscriptions/runtime.js +9 -1
  179. package/dist/lib/server/notification-subscriptions/runtime.mjs +9 -1
  180. package/dist/lib/server/notification-subscriptions/types.d.mts +5 -0
  181. package/dist/lib/server/notification-subscriptions/types.d.ts +5 -0
  182. package/dist/lib/server/principal/types.d.mts +1 -1
  183. package/dist/lib/server/principal/types.d.ts +1 -1
  184. package/dist/lib/server/serve.js +5 -0
  185. package/dist/lib/server/serve.mjs +5 -0
  186. package/dist/lib/server/webhook-delivery/recovery.d.mts +1 -0
  187. package/dist/lib/server/webhook-delivery/recovery.d.ts +1 -0
  188. package/dist/lib/server/webhook-delivery/recovery.js +4 -0
  189. package/dist/lib/server/webhook-delivery/recovery.mjs +4 -0
  190. package/dist/lib/server/webhook-emitter.d.mts +10 -0
  191. package/dist/lib/server/webhook-emitter.d.ts +10 -0
  192. package/dist/lib/server/webhook-emitter.js +22 -0
  193. package/dist/lib/server/webhook-emitter.mjs +22 -0
  194. package/dist/lib/signing/agent-context.d.mts +0 -5
  195. package/dist/lib/signing/agent-context.d.ts +0 -5
  196. package/dist/lib/signing/agent-context.js +9 -1
  197. package/dist/lib/signing/agent-context.mjs +9 -1
  198. package/dist/lib/signing/agent-fetch.js +27 -2
  199. package/dist/lib/signing/agent-fetch.mjs +32 -2
  200. package/dist/lib/signing/agent-resolver/canonicalize.d.mts +10 -15
  201. package/dist/lib/signing/agent-resolver/canonicalize.d.ts +10 -15
  202. package/dist/lib/signing/agent-resolver/canonicalize.js +17 -5
  203. package/dist/lib/signing/agent-resolver/canonicalize.mjs +16 -5
  204. package/dist/lib/signing/agent-resolver/index.d.mts +1 -0
  205. package/dist/lib/signing/agent-resolver/index.d.ts +1 -0
  206. package/dist/lib/signing/agent-resolver/index.js +5 -0
  207. package/dist/lib/signing/agent-resolver/index.mjs +3 -0
  208. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.mts +3 -2
  209. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.d.ts +3 -2
  210. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.js +30 -3
  211. package/dist/lib/signing/agent-resolver/resolved-agent-jwks.mjs +30 -3
  212. package/dist/lib/signing/agent-resolver/strict-json.d.mts +2 -2
  213. package/dist/lib/signing/agent-resolver/strict-json.d.ts +2 -2
  214. package/dist/lib/signing/agent-resolver/strict-json.js +5 -3
  215. package/dist/lib/signing/agent-resolver/strict-json.mjs +5 -3
  216. package/dist/lib/signing/brand-jwks.d.mts +2 -2
  217. package/dist/lib/signing/brand-jwks.d.ts +2 -2
  218. package/dist/lib/signing/brand-jwks.js +4 -4
  219. package/dist/lib/signing/brand-jwks.mjs +4 -4
  220. package/dist/lib/signing/client.d.mts +1 -0
  221. package/dist/lib/signing/client.d.ts +1 -0
  222. package/dist/lib/signing/client.js +5 -0
  223. package/dist/lib/signing/client.mjs +3 -0
  224. package/dist/lib/signing/crypto.js +8 -0
  225. package/dist/lib/signing/crypto.mjs +9 -1
  226. package/dist/lib/signing/fetch-async.js +1 -1
  227. package/dist/lib/signing/fetch-async.mjs +1 -1
  228. package/dist/lib/signing/fetch.js +1 -1
  229. package/dist/lib/signing/fetch.mjs +1 -1
  230. package/dist/lib/signing/jwks-https.d.mts +1 -1
  231. package/dist/lib/signing/jwks-https.d.ts +1 -1
  232. package/dist/lib/signing/jwks-https.js +1 -1
  233. package/dist/lib/signing/jwks-https.mjs +1 -1
  234. package/dist/lib/signing/jwks.d.mts +11 -3
  235. package/dist/lib/signing/jwks.d.ts +11 -3
  236. package/dist/lib/signing/jwks.js +1 -1
  237. package/dist/lib/signing/jwks.mjs +1 -1
  238. package/dist/lib/signing/middleware.js +9 -0
  239. package/dist/lib/signing/middleware.mjs +14 -0
  240. package/dist/lib/signing/parser.d.mts +9 -6
  241. package/dist/lib/signing/parser.d.ts +9 -6
  242. package/dist/lib/signing/parser.js +82 -64
  243. package/dist/lib/signing/parser.mjs +83 -65
  244. package/dist/lib/signing/revocation.d.mts +4 -1
  245. package/dist/lib/signing/revocation.d.ts +4 -1
  246. package/dist/lib/signing/revocation.js +36 -3
  247. package/dist/lib/signing/revocation.mjs +34 -2
  248. package/dist/lib/signing/server.d.mts +1 -1
  249. package/dist/lib/signing/server.d.ts +1 -1
  250. package/dist/lib/signing/server.js +4 -0
  251. package/dist/lib/signing/server.mjs +4 -0
  252. package/dist/lib/signing/types.d.mts +3 -0
  253. package/dist/lib/signing/types.d.ts +3 -0
  254. package/dist/lib/signing/verifier.js +1 -1
  255. package/dist/lib/signing/verifier.mjs +1 -1
  256. package/dist/lib/signing/web-bot-auth.d.mts +191 -0
  257. package/dist/lib/signing/web-bot-auth.d.ts +191 -0
  258. package/dist/lib/signing/web-bot-auth.js +837 -0
  259. package/dist/lib/signing/web-bot-auth.mjs +796 -0
  260. package/dist/lib/signing/webhook-verifier.js +1 -1
  261. package/dist/lib/signing/webhook-verifier.mjs +1 -1
  262. package/dist/lib/testing/client.d.mts +1 -4
  263. package/dist/lib/testing/client.d.ts +1 -4
  264. package/dist/lib/testing/client.js +141 -20
  265. package/dist/lib/testing/client.mjs +137 -19
  266. package/dist/lib/testing/compliance/comply.js +29 -10
  267. package/dist/lib/testing/compliance/comply.mjs +37 -11
  268. package/dist/lib/testing/storyboard/account-sync-contract.d.mts +3 -0
  269. package/dist/lib/testing/storyboard/account-sync-contract.d.ts +3 -0
  270. package/dist/lib/testing/storyboard/account-sync-contract.js +79 -0
  271. package/dist/lib/testing/storyboard/account-sync-contract.mjs +55 -0
  272. package/dist/lib/testing/storyboard/default-invariants.js +2 -0
  273. package/dist/lib/testing/storyboard/default-invariants.mjs +2 -0
  274. package/dist/lib/testing/storyboard/runner.js +23 -8
  275. package/dist/lib/testing/storyboard/runner.mjs +24 -8
  276. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  277. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  278. package/dist/lib/types/adcp.d.mts +4 -0
  279. package/dist/lib/types/adcp.d.ts +4 -0
  280. package/dist/lib/types/schemas.generated.d.ts +6 -6
  281. package/dist/lib/utils/capabilities.d.mts +1 -0
  282. package/dist/lib/utils/capabilities.d.ts +1 -0
  283. package/dist/lib/utils/capabilities.js +5 -0
  284. package/dist/lib/utils/capabilities.mjs +5 -0
  285. package/dist/lib/v2/projection/catalog-snapshot.js +3 -1
  286. package/dist/lib/v2/projection/catalog-snapshot.mjs +3 -1
  287. package/dist/lib/v2/projection/creative-delivery.d.mts +34 -10
  288. package/dist/lib/v2/projection/creative-delivery.d.ts +34 -10
  289. package/dist/lib/v2/projection/creative-delivery.js +26 -10
  290. package/dist/lib/v2/projection/creative-delivery.mjs +26 -10
  291. package/dist/lib/v2/projection/index.d.mts +1 -1
  292. package/dist/lib/v2/projection/index.d.ts +1 -1
  293. package/dist/lib/v2/projection/index.js +2 -0
  294. package/dist/lib/v2/projection/index.mjs +2 -0
  295. package/dist/lib/v2/projection/legacy-routes.d.mts +34 -2
  296. package/dist/lib/v2/projection/legacy-routes.d.ts +34 -2
  297. package/dist/lib/v2/projection/legacy-routes.js +35 -2
  298. package/dist/lib/v2/projection/legacy-routes.mjs +32 -2
  299. package/dist/lib/validation/schema-loader.d.mts +2 -0
  300. package/dist/lib/validation/schema-loader.d.ts +2 -0
  301. package/dist/lib/validation/schema-loader.js +43 -4
  302. package/dist/lib/validation/schema-loader.mjs +39 -3
  303. package/dist/lib/version.d.mts +3 -3
  304. package/dist/lib/version.d.ts +3 -3
  305. package/dist/lib/version.js +3 -3
  306. package/dist/lib/version.mjs +3 -3
  307. package/docs/TYPE-SUMMARY.md +2 -2
  308. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +4 -0
  309. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +1 -1
  310. package/docs/guides/REPORTING-LEDGER.md +99 -29
  311. package/docs/guides/REPORTING-OPERATIONS.md +29 -13
  312. package/docs/guides/REPORTING-STABILITY.md +76 -0
  313. package/docs/guides/account-resolution.md +101 -0
  314. package/docs/llms.txt +3 -2
  315. package/docs/migration-12-to-13.md +15 -0
  316. package/docs/migration-14.x-rc-worksheet.md +4 -4
  317. package/docs/migration-agent-identity-3.3.md +494 -0
  318. package/docs/migration-agent-resolution-3.3.md +5 -0
  319. package/docs/migration-reporting-row-storage-alignment.md +137 -0
  320. package/examples/storyboards/account-sync-contract.yaml +57 -0
  321. package/package.json +17 -1
@@ -88,11 +88,11 @@ class BrandJsonJwksResolver {
88
88
  });
89
89
  return this.onboarding;
90
90
  }
91
- async resolve(keyid) {
92
- return (await this.confirmedResolver()).resolve(keyid);
91
+ async resolve(keyid, signerOrigin) {
92
+ return (await this.confirmedResolver()).resolve(keyid, signerOrigin);
93
93
  }
94
- async resolveWithMetadata(keyid) {
95
- return (await this.confirmedResolver()).resolveWithMetadata(keyid);
94
+ async resolveWithMetadata(keyid, signerOrigin) {
95
+ return (await this.confirmedResolver()).resolveWithMetadata(keyid, signerOrigin);
96
96
  }
97
97
  get agentUrl() {
98
98
  return this.resolver?.resolvedAgentUrl;
@@ -23,3 +23,4 @@ export { buildAgentSigningFetch, createAgentSignedFetch, extractAdcpOperation, i
23
23
  export { buildAgentSigningContext, signingContextStorage, type AgentSigningContext, type AgentSigningIdentitySnapshot, } from './agent-context.mjs';
24
24
  export { ensureCapabilityLoaded, CAPABILITY_OP } from './capability-priming.mjs';
25
25
  export { pemToAdcpJwk, type AdcpUse, type PemToAdcpJwkOptions } from './jwks-helpers.mjs';
26
+ export { canonicalAgentOrigin, CanonicalizeError } from './agent-resolver/canonicalize.mjs';
@@ -23,3 +23,4 @@ export { buildAgentSigningFetch, createAgentSignedFetch, extractAdcpOperation, i
23
23
  export { buildAgentSigningContext, signingContextStorage, type AgentSigningContext, type AgentSigningIdentitySnapshot, } from './agent-context';
24
24
  export { ensureCapabilityLoaded, CAPABILITY_OP } from './capability-priming';
25
25
  export { pemToAdcpJwk, type AdcpUse, type PemToAdcpJwkOptions } from './jwks-helpers';
26
+ export { canonicalAgentOrigin, CanonicalizeError } from './agent-resolver/canonicalize';
@@ -21,6 +21,7 @@ __export(client_exports, {
21
21
  ALLOWED_ALGS: () => import_types.ALLOWED_ALGS,
22
22
  CAPABILITY_OP: () => import_capability_priming.CAPABILITY_OP,
23
23
  CLOCK_SKEW_TOLERANCE_SECONDS: () => import_types.CLOCK_SKEW_TOLERANCE_SECONDS,
24
+ CanonicalizeError: () => import_canonicalize2.CanonicalizeError,
24
25
  CapabilityCache: () => import_capability_cache.CapabilityCache,
25
26
  MANDATORY_COMPONENTS: () => import_types.MANDATORY_COMPONENTS,
26
27
  MAX_SIGNATURE_WINDOW_SECONDS: () => import_types.MAX_SIGNATURE_WINDOW_SECONDS,
@@ -39,6 +40,7 @@ __export(client_exports, {
39
40
  buildCapabilityCacheKey: () => import_capability_cache.buildCapabilityCacheKey,
40
41
  buildResponseSignatureBase: () => import_canonicalize.buildResponseSignatureBase,
41
42
  buildSignatureBase: () => import_canonicalize.buildSignatureBase,
43
+ canonicalAgentOrigin: () => import_canonicalize2.canonicalAgentOrigin,
42
44
  canonicalAuthority: () => import_canonicalize.canonicalAuthority,
43
45
  canonicalMethod: () => import_canonicalize.canonicalMethod,
44
46
  canonicalTargetUri: () => import_canonicalize.canonicalTargetUri,
@@ -95,11 +97,13 @@ var import_agent_fetch = require('./agent-fetch.js');
95
97
  var import_agent_context = require('./agent-context.js');
96
98
  var import_capability_priming = require('./capability-priming.js');
97
99
  var import_jwks_helpers = require('./jwks-helpers.js');
100
+ var import_canonicalize2 = require('./agent-resolver/canonicalize.js');
98
101
  // Annotate the CommonJS export names for ESM import in node:
99
102
  0 && (module.exports = {
100
103
  ALLOWED_ALGS,
101
104
  CAPABILITY_OP,
102
105
  CLOCK_SKEW_TOLERANCE_SECONDS,
106
+ CanonicalizeError,
103
107
  CapabilityCache,
104
108
  MANDATORY_COMPONENTS,
105
109
  MAX_SIGNATURE_WINDOW_SECONDS,
@@ -118,6 +122,7 @@ var import_jwks_helpers = require('./jwks-helpers.js');
118
122
  buildCapabilityCacheKey,
119
123
  buildResponseSignatureBase,
120
124
  buildSignatureBase,
125
+ canonicalAgentOrigin,
121
126
  canonicalAuthority,
122
127
  canonicalMethod,
123
128
  canonicalTargetUri,
@@ -71,10 +71,12 @@ import {
71
71
  } from "./agent-context.mjs";
72
72
  import { ensureCapabilityLoaded, CAPABILITY_OP } from "./capability-priming.mjs";
73
73
  import { pemToAdcpJwk } from "./jwks-helpers.mjs";
74
+ import { canonicalAgentOrigin, CanonicalizeError } from "./agent-resolver/canonicalize.mjs";
74
75
  export {
75
76
  ALLOWED_ALGS,
76
77
  CAPABILITY_OP,
77
78
  CLOCK_SKEW_TOLERANCE_SECONDS,
79
+ CanonicalizeError,
78
80
  CapabilityCache,
79
81
  MANDATORY_COMPONENTS,
80
82
  MAX_SIGNATURE_WINDOW_SECONDS,
@@ -93,6 +95,7 @@ export {
93
95
  buildCapabilityCacheKey,
94
96
  buildResponseSignatureBase,
95
97
  buildSignatureBase,
98
+ canonicalAgentOrigin,
96
99
  canonicalAuthority,
97
100
  canonicalMethod,
98
101
  canonicalTargetUri,
@@ -47,6 +47,14 @@ function verifySignature(alg, publicKey, data, signature) {
47
47
  if (alg === "ecdsa-p256-sha256") {
48
48
  return (0, import_crypto.verify)("sha256", data, { key: publicKey, dsaEncoding: "ieee-p1363" }, signature);
49
49
  }
50
+ if (alg === "rsa-pss-sha512") {
51
+ return (0, import_crypto.verify)(
52
+ "sha512",
53
+ data,
54
+ { key: publicKey, padding: import_crypto.constants.RSA_PKCS1_PSS_PADDING, saltLength: 64 },
55
+ signature
56
+ );
57
+ }
50
58
  return false;
51
59
  } catch {
52
60
  return false;
@@ -1,4 +1,4 @@
1
- import { createPublicKey, verify as nodeVerify } from "crypto";
1
+ import { constants, createPublicKey, verify as nodeVerify } from "crypto";
2
2
  import { RequestSignatureError } from "./errors.mjs";
3
3
  function jwkToPublicKey(jwk) {
4
4
  const publicJwk = { ...jwk };
@@ -23,6 +23,14 @@ function verifySignature(alg, publicKey, data, signature) {
23
23
  if (alg === "ecdsa-p256-sha256") {
24
24
  return nodeVerify("sha256", data, { key: publicKey, dsaEncoding: "ieee-p1363" }, signature);
25
25
  }
26
+ if (alg === "rsa-pss-sha512") {
27
+ return nodeVerify(
28
+ "sha512",
29
+ data,
30
+ { key: publicKey, padding: constants.RSA_PKCS1_PSS_PADDING, saltLength: 64 },
31
+ signature
32
+ );
33
+ }
26
34
  return false;
27
35
  } catch {
28
36
  return false;
@@ -82,7 +82,7 @@ function bodyToString(body) {
82
82
  }
83
83
  function decodeUtf8Strict(bytes) {
84
84
  try {
85
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
85
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
86
86
  } catch {
87
87
  throw new TypeError(
88
88
  "createSigningFetchAsync received a Uint8Array/ArrayBuffer body that is not valid UTF-8. Pass a string body, ensure the bytes are UTF-8, or sign the request manually with `signRequestAsync` against the exact wire bytes you intend to send."
@@ -61,7 +61,7 @@ function bodyToString(body) {
61
61
  }
62
62
  function decodeUtf8Strict(bytes) {
63
63
  try {
64
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
64
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
65
65
  } catch {
66
66
  throw new TypeError(
67
67
  "createSigningFetchAsync received a Uint8Array/ArrayBuffer body that is not valid UTF-8. Pass a string body, ensure the bytes are UTF-8, or sign the request manually with `signRequestAsync` against the exact wire bytes you intend to send."
@@ -91,7 +91,7 @@ function bodyToString(body) {
91
91
  }
92
92
  function decodeUtf8Strict(bytes) {
93
93
  try {
94
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
94
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
95
95
  } catch {
96
96
  throw new TypeError(
97
97
  "createSigningFetch received a Uint8Array/ArrayBuffer body that is not valid UTF-8. Pass a string body, ensure the bytes are UTF-8, or sign the request manually with `signRequest` against the exact wire bytes you intend to send."
@@ -67,7 +67,7 @@ function bodyToString(body) {
67
67
  }
68
68
  function decodeUtf8Strict(bytes) {
69
69
  try {
70
- return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
70
+ return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
71
71
  } catch {
72
72
  throw new TypeError(
73
73
  "createSigningFetch received a Uint8Array/ArrayBuffer body that is not valid UTF-8. Pass a string body, ensure the bytes are UTF-8, or sign the request manually with `signRequest` against the exact wire bytes you intend to send."
@@ -58,7 +58,7 @@ export declare class HttpsJwksResolver implements JwksResolver {
58
58
  private inFlight;
59
59
  private lastAttemptAt;
60
60
  constructor(url: string, options?: HttpsJwksResolverOptions);
61
- resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
61
+ resolve(keyid: string, _signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
62
62
  /**
63
63
  * Force a refetch, bypassing the cooldown. Primarily for tests and for
64
64
  * operator-triggered rotation flushes; normal callers should rely on the
@@ -58,7 +58,7 @@ export declare class HttpsJwksResolver implements JwksResolver {
58
58
  private inFlight;
59
59
  private lastAttemptAt;
60
60
  constructor(url: string, options?: HttpsJwksResolverOptions);
61
- resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
61
+ resolve(keyid: string, _signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
62
62
  /**
63
63
  * Force a refetch, bypassing the cooldown. Primarily for tests and for
64
64
  * operator-triggered rotation flushes; normal callers should rely on the
@@ -56,7 +56,7 @@ class HttpsJwksResolver {
56
56
  this.lookup = options.lookup;
57
57
  this.now = options.now ?? (() => Math.floor(Date.now() / 1e3));
58
58
  }
59
- async resolve(keyid) {
59
+ async resolve(keyid, _signerOrigin) {
60
60
  if (!this.cache) {
61
61
  if (!this.inFlight && this.now() - this.lastAttemptAt < this.minCooldown) {
62
62
  throw new Error("JWKS lookup is in its retry cooldown");
@@ -33,7 +33,7 @@ class HttpsJwksResolver {
33
33
  this.lookup = options.lookup;
34
34
  this.now = options.now ?? (() => Math.floor(Date.now() / 1e3));
35
35
  }
36
- async resolve(keyid) {
36
+ async resolve(keyid, _signerOrigin) {
37
37
  if (!this.cache) {
38
38
  if (!this.inFlight && this.now() - this.lastAttemptAt < this.minCooldown) {
39
39
  throw new Error("JWKS lookup is in its retry cooldown");
@@ -13,12 +13,20 @@ export interface JwksResolution {
13
13
  operatorAuthorizationValidUntil?: number;
14
14
  }
15
15
  export interface JwksResolver {
16
- resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
16
+ /**
17
+ * Optional signer-origin locator for resolvers serving multiple signers.
18
+ * It is unverified request context, never proof of identity or authority.
19
+ * Origin-aware caches must scope entries by (canonical origin, keyid).
20
+ * Wrappers must forward it on both lookup methods. Existing one-argument
21
+ * implementations remain valid; static and HTTPS resolvers stay pinned to
22
+ * their configured key source and do not attribute identity from this value.
23
+ */
24
+ resolve(keyid: string, signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
17
25
  /** Optional metadata-aware lookup used by verifiers that must enforce delegation expiry at acceptance time. */
18
- resolveWithMetadata?(keyid: string): Promise<JwksResolution>;
26
+ resolveWithMetadata?(keyid: string, signerOrigin?: string): Promise<JwksResolution>;
19
27
  }
20
28
  export declare class StaticJwksResolver implements JwksResolver {
21
29
  private readonly byKid;
22
30
  constructor(keys: AdcpJsonWebKey[]);
23
- resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
31
+ resolve(keyid: string, _signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
24
32
  }
@@ -13,12 +13,20 @@ export interface JwksResolution {
13
13
  operatorAuthorizationValidUntil?: number;
14
14
  }
15
15
  export interface JwksResolver {
16
- resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
16
+ /**
17
+ * Optional signer-origin locator for resolvers serving multiple signers.
18
+ * It is unverified request context, never proof of identity or authority.
19
+ * Origin-aware caches must scope entries by (canonical origin, keyid).
20
+ * Wrappers must forward it on both lookup methods. Existing one-argument
21
+ * implementations remain valid; static and HTTPS resolvers stay pinned to
22
+ * their configured key source and do not attribute identity from this value.
23
+ */
24
+ resolve(keyid: string, signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
17
25
  /** Optional metadata-aware lookup used by verifiers that must enforce delegation expiry at acceptance time. */
18
- resolveWithMetadata?(keyid: string): Promise<JwksResolution>;
26
+ resolveWithMetadata?(keyid: string, signerOrigin?: string): Promise<JwksResolution>;
19
27
  }
20
28
  export declare class StaticJwksResolver implements JwksResolver {
21
29
  private readonly byKid;
22
30
  constructor(keys: AdcpJsonWebKey[]);
23
- resolve(keyid: string): Promise<AdcpJsonWebKey | null>;
31
+ resolve(keyid: string, _signerOrigin?: string): Promise<AdcpJsonWebKey | null>;
24
32
  }
@@ -26,7 +26,7 @@ class StaticJwksResolver {
26
26
  constructor(keys) {
27
27
  for (const k of keys) this.byKid.set(k.kid, k);
28
28
  }
29
- async resolve(keyid) {
29
+ async resolve(keyid, _signerOrigin) {
30
30
  return this.byKid.get(keyid) ?? null;
31
31
  }
32
32
  }
@@ -3,7 +3,7 @@ class StaticJwksResolver {
3
3
  constructor(keys) {
4
4
  for (const k of keys) this.byKid.set(k.kid, k);
5
5
  }
6
- async resolve(keyid) {
6
+ async resolve(keyid, _signerOrigin) {
7
7
  return this.byKid.get(keyid) ?? null;
8
8
  }
9
9
  }
@@ -30,6 +30,15 @@ function createExpressVerifier(options) {
30
30
  const replayStore = options.replayStore ?? new import_replay.InMemoryReplayStore();
31
31
  const revocationStore = options.revocationStore ?? new import_revocation.InMemoryRevocationStore();
32
32
  return async function requestSignatureMiddleware(req, res, next) {
33
+ const { selectSignatureProfile, WebBotAuthError } = require('./web-bot-auth.js');
34
+ if (selectSignatureProfile({ headers: req.headers }) === "web-bot-auth") {
35
+ const refused = new WebBotAuthError(403, "profile_disabled");
36
+ res.status(refused.status).set("Cache-Control", "no-store").json({
37
+ ...refused.body,
38
+ message: "Web Bot Auth is not configured on this endpoint; use createAdcpServer signedRequests.webBotAuth or verifySignatureAsAuthenticator({ webBotAuth })"
39
+ });
40
+ return;
41
+ }
33
42
  try {
34
43
  const url = options.getUrl ? options.getUrl(req) : defaultUrl(req);
35
44
  const body = resolveRawBody(req);
@@ -1,3 +1,8 @@
1
+ import { fileURLToPath as __adcpFileURLToPath } from "node:url";
2
+ import { dirname as __adcpDirname } from "node:path";
3
+ import { createRequire as __adcpCreateRequire } from "node:module";
4
+ const __dirname = __adcpDirname(__adcpFileURLToPath(import.meta.url));
5
+ const require2 = __adcpCreateRequire(import.meta.url);
1
6
  import { getHeaderValue } from "./canonicalize.mjs";
2
7
  import { RequestSignatureError } from "./errors.mjs";
3
8
  import { InMemoryReplayStore } from "./replay.mjs";
@@ -7,6 +12,15 @@ function createExpressVerifier(options) {
7
12
  const replayStore = options.replayStore ?? new InMemoryReplayStore();
8
13
  const revocationStore = options.revocationStore ?? new InMemoryRevocationStore();
9
14
  return async function requestSignatureMiddleware(req, res, next) {
15
+ const { selectSignatureProfile, WebBotAuthError } = require2("./web-bot-auth");
16
+ if (selectSignatureProfile({ headers: req.headers }) === "web-bot-auth") {
17
+ const refused = new WebBotAuthError(403, "profile_disabled");
18
+ res.status(refused.status).set("Cache-Control", "no-store").json({
19
+ ...refused.body,
20
+ message: "Web Bot Auth is not configured on this endpoint; use createAdcpServer signedRequests.webBotAuth or verifySignatureAsAuthenticator({ webBotAuth })"
21
+ });
22
+ return;
23
+ }
10
24
  try {
11
25
  const url = options.getUrl ? options.getUrl(req) : defaultUrl(req);
12
26
  const body = resolveRawBody(req);
@@ -23,13 +23,16 @@ export interface ParsedSignature {
23
23
  label: string;
24
24
  bytes: Uint8Array;
25
25
  }
26
- export declare function parseSignatureInput(headerValue: string): ParsedSignatureInput;
26
+ export declare function parseSignatureInput(headerValue: string, expectedLabel?: string): ParsedSignatureInput;
27
27
  export declare function parseSignature(headerValue: string, expectedLabel: string, encoding?: SfBinaryEncoding): ParsedSignature;
28
28
  /**
29
- * RFC 8941 §3.2 parsers deduplicate by keeping the last value. The AdCP
30
- * profile (step 1) overrides that: duplicate keys are a downgrade vector —
31
- * a proxy could smuggle a weaker component set past a verifier that reads
32
- * the first. Detect duplicates at the raw-header level before the library
33
- * silently drops them.
29
+ * RFC 8941 / RFC 9651 parsers deduplicate dictionary keys and parameter keys
30
+ * by keeping the last value. The AdCP profile (step 1) overrides that:
31
+ * duplicates are a cross-implementation differential and a downgrade vector
32
+ * (a proxy could smuggle a weaker component set or a different `created`,
33
+ * `keyid` or `tag` past a verifier that reads the first). Detect them at the
34
+ * raw-header level before the library silently drops them: top-level
35
+ * dictionary keys, parameters on members and inner lists, and parameters on
36
+ * each inner-list item.
34
37
  */
35
38
  export declare function rejectDuplicateDictionaryKeys(headerValue: string, headerName: string): void;
@@ -23,13 +23,16 @@ export interface ParsedSignature {
23
23
  label: string;
24
24
  bytes: Uint8Array;
25
25
  }
26
- export declare function parseSignatureInput(headerValue: string): ParsedSignatureInput;
26
+ export declare function parseSignatureInput(headerValue: string, expectedLabel?: string): ParsedSignatureInput;
27
27
  export declare function parseSignature(headerValue: string, expectedLabel: string, encoding?: SfBinaryEncoding): ParsedSignature;
28
28
  /**
29
- * RFC 8941 §3.2 parsers deduplicate by keeping the last value. The AdCP
30
- * profile (step 1) overrides that: duplicate keys are a downgrade vector —
31
- * a proxy could smuggle a weaker component set past a verifier that reads
32
- * the first. Detect duplicates at the raw-header level before the library
33
- * silently drops them.
29
+ * RFC 8941 / RFC 9651 parsers deduplicate dictionary keys and parameter keys
30
+ * by keeping the last value. The AdCP profile (step 1) overrides that:
31
+ * duplicates are a cross-implementation differential and a downgrade vector
32
+ * (a proxy could smuggle a weaker component set or a different `created`,
33
+ * `keyid` or `tag` past a verifier that reads the first). Detect them at the
34
+ * raw-header level before the library silently drops them: top-level
35
+ * dictionary keys, parameters on members and inner lists, and parameters on
36
+ * each inner-list item.
34
37
  */
35
38
  export declare function rejectDuplicateDictionaryKeys(headerValue: string, headerName: string): void;
@@ -31,7 +31,7 @@ const INTEGER_PARAMS = /* @__PURE__ */ new Set(["created", "expires"]);
31
31
  function malformed(message) {
32
32
  throw new import_errors.RequestSignatureError("request_signature_header_malformed", 1, message);
33
33
  }
34
- function parseSignatureInput(headerValue) {
34
+ function parseSignatureInput(headerValue, expectedLabel) {
35
35
  rejectDuplicateDictionaryKeys(headerValue, "Signature-Input");
36
36
  let dict;
37
37
  try {
@@ -41,7 +41,8 @@ function parseSignatureInput(headerValue) {
41
41
  throw e;
42
42
  }
43
43
  if (dict.size === 0) malformed("Signature-Input header is empty");
44
- const label = dict.has("sig1") ? "sig1" : dict.keys().next().value;
44
+ const label = expectedLabel ?? (dict.has("sig1") ? "sig1" : dict.keys().next().value);
45
+ if (!dict.has(label)) malformed("Signature-Input label is missing");
45
46
  const entry = dict.get(label);
46
47
  if (!isInnerList(entry)) {
47
48
  malformed("Signature-Input value must be a parenthesized component list");
@@ -49,7 +50,8 @@ function parseSignatureInput(headerValue) {
49
50
  const components = [];
50
51
  for (const [bare, itemParams] of entry[0]) {
51
52
  if (typeof bare !== "string") malformed("Signature-Input components must all be strings");
52
- components.push(itemParams instanceof Map && itemParams.get("req") === true ? `${bare};req` : bare);
53
+ const serialized = (0, import_structured_headers.serializeItem)([bare, itemParams]);
54
+ components.push(`${bare}${serialized.slice(serialized.indexOf('"', 1) + 1)}`);
53
55
  }
54
56
  const params = {};
55
57
  for (const [key, value] of entry[1]) {
@@ -109,85 +111,101 @@ function isInnerList(entry) {
109
111
  return Array.isArray(entry) && Array.isArray(entry[0]);
110
112
  }
111
113
  function rejectDuplicateDictionaryKeys(headerValue, headerName) {
112
- const keys = extractTopLevelDictKeys(headerValue);
113
- const seen = /* @__PURE__ */ new Set();
114
- for (const key of keys) {
115
- if (seen.has(key)) {
116
- malformed(`${headerName} header declares key "${key}" more than once`);
117
- }
118
- seen.add(key);
119
- }
114
+ const duplicate = findDuplicateStructuredKey(headerValue);
115
+ if (duplicate?.kind === "member") malformed(`${headerName} header declares key "${duplicate.key}" more than once`);
116
+ if (duplicate) malformed(`${headerName} header declares parameter "${duplicate.key}" more than once`);
120
117
  }
121
- function extractTopLevelDictKeys(input) {
122
- const keys = [];
118
+ function findDuplicateStructuredKey(input) {
123
119
  let i = 0;
124
- const len = input.length;
125
- let atEntryStart = true;
126
- while (i < len) {
127
- if (atEntryStart) {
128
- while (i < len && (input[i] === " " || input[i] === " ")) i++;
129
- const keyStart = i;
130
- while (i < len && /[A-Za-z0-9_*-]/.test(input[i])) i++;
131
- if (i > keyStart) keys.push(input.slice(keyStart, i).toLowerCase());
132
- atEntryStart = false;
133
- continue;
120
+ const n = input.length;
121
+ const ows = () => {
122
+ while (i < n && (input[i] === " " || input[i] === " ")) i++;
123
+ };
124
+ const key = () => {
125
+ const start = i;
126
+ while (i < n && /[A-Za-z0-9_.*-]/.test(input[i])) i++;
127
+ return input.slice(start, i).toLowerCase();
128
+ };
129
+ const bareItem = () => {
130
+ if (input[i] === "%" && input[i + 1] === '"') {
131
+ i += 2;
132
+ while (i < n && input[i] !== '"') i++;
133
+ i++;
134
+ return;
134
135
  }
135
- const ch = input[i];
136
- if (ch === '"') {
136
+ if (input[i] === '"') {
137
137
  i++;
138
- while (i < len) {
139
- if (input[i] === "\\" && i + 1 < len) {
138
+ while (i < n) {
139
+ if (input[i] === "\\") {
140
140
  i += 2;
141
141
  continue;
142
142
  }
143
- if (input[i] === '"') {
144
- i++;
145
- break;
146
- }
147
- i++;
143
+ if (input[i++] === '"') return;
148
144
  }
149
- continue;
145
+ return;
150
146
  }
151
- if (ch === ":") {
147
+ if (input[i] === ":") {
152
148
  i++;
153
- while (i < len && input[i] !== ":") i++;
154
- if (i < len) i++;
155
- continue;
149
+ while (i < n && input[i] !== ":") i++;
150
+ i++;
151
+ return;
156
152
  }
157
- if (ch === "(") {
153
+ while (i < n && !/[;,()\s"]/.test(input[i])) i++;
154
+ };
155
+ const parameters = () => {
156
+ const seen = /* @__PURE__ */ new Set();
157
+ while (i < n && input[i] === ";") {
158
158
  i++;
159
- let depth = 1;
160
- while (i < len && depth > 0) {
161
- const c = input[i];
162
- if (c === '"') {
163
- i++;
164
- while (i < len) {
165
- if (input[i] === "\\" && i + 1 < len) {
166
- i += 2;
167
- continue;
168
- }
169
- if (input[i] === '"') {
170
- i++;
171
- break;
172
- }
173
- i++;
174
- }
175
- continue;
176
- }
177
- if (c === "(") depth++;
178
- else if (c === ")") depth--;
159
+ ows();
160
+ const k = key();
161
+ if (!k) return void 0;
162
+ if (seen.has(k)) return k;
163
+ seen.add(k);
164
+ if (input[i] === "=") {
179
165
  i++;
166
+ bareItem();
180
167
  }
181
- continue;
182
168
  }
183
- if (ch === ",") {
184
- atEntryStart = true;
169
+ return void 0;
170
+ };
171
+ const members = /* @__PURE__ */ new Set();
172
+ while (i < n) {
173
+ ows();
174
+ const k = key();
175
+ if (!k) return void 0;
176
+ if (members.has(k)) return { kind: "member", key: k };
177
+ members.add(k);
178
+ let duplicate;
179
+ if (input[i] === "=") {
185
180
  i++;
186
- continue;
187
- }
181
+ if (input[i] === "(") {
182
+ i++;
183
+ for (; ; ) {
184
+ while (i < n && input[i] === " ") i++;
185
+ if (i >= n) return void 0;
186
+ if (input[i] === ")") {
187
+ i++;
188
+ break;
189
+ }
190
+ const before = i;
191
+ bareItem();
192
+ duplicate = parameters();
193
+ if (duplicate) return { kind: "parameter", key: `${k}: ${duplicate}` };
194
+ if (i === before) return void 0;
195
+ }
196
+ duplicate = parameters();
197
+ } else {
198
+ bareItem();
199
+ duplicate = parameters();
200
+ }
201
+ } else duplicate = parameters();
202
+ if (duplicate) return { kind: "parameter", key: `${k}: ${duplicate}` };
203
+ ows();
204
+ if (i >= n) return void 0;
205
+ if (input[i] !== ",") return void 0;
188
206
  i++;
189
207
  }
190
- return keys;
208
+ return void 0;
191
209
  }
192
210
  function normalizeByteSequenceBase64(input) {
193
211
  let out = "";