@adcp/sdk 16.0.0-beta.2 → 16.0.0-beta.4

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 (248) hide show
  1. package/README.md +54 -0
  2. package/dist/lib/auth/oauth/diagnose.js +3 -11
  3. package/dist/lib/auth/oauth/diagnose.mjs +4 -12
  4. package/dist/lib/auth/oauth/diagnostics.d.mts +2 -1
  5. package/dist/lib/auth/oauth/diagnostics.d.ts +2 -1
  6. package/dist/lib/auth/oauth/diagnostics.js +8 -10
  7. package/dist/lib/auth/oauth/diagnostics.mjs +7 -10
  8. package/dist/lib/core/ConversationTypes.d.mts +8 -3
  9. package/dist/lib/core/ConversationTypes.d.ts +8 -3
  10. package/dist/lib/core/SingleAgentClient.d.mts +5 -3
  11. package/dist/lib/core/SingleAgentClient.d.ts +5 -3
  12. package/dist/lib/core/TaskExecutor.js +5 -1
  13. package/dist/lib/core/TaskExecutor.mjs +5 -1
  14. package/dist/lib/errors/index.d.mts +9 -4
  15. package/dist/lib/errors/index.d.ts +9 -4
  16. package/dist/lib/index.d.mts +3 -3
  17. package/dist/lib/index.d.ts +3 -3
  18. package/dist/lib/index.js +8 -0
  19. package/dist/lib/index.mjs +14 -2
  20. package/dist/lib/negotiation/types.d.mts +20 -39
  21. package/dist/lib/negotiation/types.d.ts +20 -39
  22. package/dist/lib/protocols/index.d.mts +60 -24
  23. package/dist/lib/protocols/index.d.ts +60 -24
  24. package/dist/lib/protocols/index.js +9 -4
  25. package/dist/lib/protocols/index.mjs +3 -0
  26. package/dist/lib/protocols/mcp-modern.js +1 -0
  27. package/dist/lib/protocols/mcp-modern.mjs +2 -1
  28. package/dist/lib/protocols/mcp.js +1 -0
  29. package/dist/lib/protocols/mcp.mjs +2 -1
  30. package/dist/lib/protocols/responseSizeLimit.d.mts +91 -5
  31. package/dist/lib/protocols/responseSizeLimit.d.ts +91 -5
  32. package/dist/lib/protocols/responseSizeLimit.js +195 -31
  33. package/dist/lib/protocols/responseSizeLimit.mjs +192 -31
  34. package/dist/lib/reporting/consumer-runtime.js +2 -1
  35. package/dist/lib/reporting/consumer-runtime.mjs +2 -1
  36. package/dist/lib/reporting/ledger/handler.js +50 -11
  37. package/dist/lib/reporting/ledger/handler.mjs +50 -12
  38. package/dist/lib/reporting/ledger/index.d.mts +17 -14
  39. package/dist/lib/reporting/ledger/index.d.ts +17 -14
  40. package/dist/lib/reporting/ledger/index.js +32 -20
  41. package/dist/lib/reporting/ledger/index.mjs +21 -10
  42. package/dist/lib/reporting/ledger/offering-validation.d.mts +9 -0
  43. package/dist/lib/reporting/ledger/offering-validation.d.ts +9 -0
  44. package/dist/lib/reporting/{gcs/bucket-policy.js → ledger/offering-validation.js} +9 -8
  45. package/dist/lib/reporting/ledger/offering-validation.mjs +8 -0
  46. package/dist/lib/reporting/ledger/receipts.d.mts +48 -0
  47. package/dist/lib/reporting/ledger/receipts.d.ts +48 -0
  48. package/dist/lib/reporting/ledger/receipts.js +186 -0
  49. package/dist/lib/reporting/ledger/receipts.mjs +161 -0
  50. package/dist/lib/reporting/ledger/status-ingest.js +3 -3
  51. package/dist/lib/reporting/ledger/status-ingest.mjs +4 -5
  52. package/dist/lib/reporting/ledger/types.d.mts +43 -0
  53. package/dist/lib/reporting/ledger/types.d.ts +43 -0
  54. package/dist/lib/reporting/ledger/types.js +31 -2
  55. package/dist/lib/reporting/ledger/types.mjs +26 -1
  56. package/dist/lib/reporting/pagination.d.mts +6 -0
  57. package/dist/lib/reporting/pagination.d.ts +6 -0
  58. package/dist/lib/reporting/{gcs/errors.js → pagination.js} +12 -17
  59. package/dist/lib/reporting/pagination.mjs +12 -0
  60. package/dist/lib/reporting/reconciliation.d.mts +1 -0
  61. package/dist/lib/reporting/reconciliation.d.ts +1 -0
  62. package/dist/lib/reporting/reconciliation.js +3 -2
  63. package/dist/lib/reporting/reconciliation.mjs +3 -2
  64. package/dist/lib/reporting/service/index.d.mts +79 -153
  65. package/dist/lib/reporting/service/index.d.ts +79 -153
  66. package/dist/lib/reporting/service/index.js +34 -491
  67. package/dist/lib/reporting/service/index.mjs +36 -510
  68. package/dist/lib/reporting/service/scheduler-support.d.mts +43 -0
  69. package/dist/lib/reporting/service/scheduler-support.d.ts +43 -0
  70. package/dist/lib/reporting/service/scheduler-support.js +125 -0
  71. package/dist/lib/reporting/service/scheduler-support.mjs +96 -0
  72. package/dist/lib/schemas-data/v2.5/_provenance.json +1 -1
  73. package/dist/lib/signing/canonicalize.d.mts +4 -0
  74. package/dist/lib/signing/canonicalize.d.ts +4 -0
  75. package/dist/lib/signing/canonicalize.js +14 -8
  76. package/dist/lib/signing/canonicalize.mjs +14 -8
  77. package/dist/lib/signing/content-digest.d.mts +8 -0
  78. package/dist/lib/signing/content-digest.d.ts +8 -0
  79. package/dist/lib/signing/content-digest.js +11 -5
  80. package/dist/lib/signing/content-digest.mjs +10 -5
  81. package/dist/lib/signing/crypto.d.mts +15 -0
  82. package/dist/lib/signing/crypto.d.ts +15 -0
  83. package/dist/lib/signing/crypto.js +75 -3
  84. package/dist/lib/signing/crypto.mjs +78 -3
  85. package/dist/lib/signing/server.d.mts +1 -1
  86. package/dist/lib/signing/server.d.ts +1 -1
  87. package/dist/lib/signing/server.js +2 -0
  88. package/dist/lib/signing/server.mjs +2 -1
  89. package/dist/lib/signing/signer.js +11 -14
  90. package/dist/lib/signing/signer.mjs +13 -16
  91. package/dist/lib/signing/testing.js +2 -6
  92. package/dist/lib/signing/testing.mjs +3 -7
  93. package/dist/lib/signing/verifier.js +2 -2
  94. package/dist/lib/signing/verifier.mjs +3 -3
  95. package/dist/lib/signing/web-bot-auth.js +122 -43
  96. package/dist/lib/signing/web-bot-auth.mjs +128 -44
  97. package/dist/lib/signing/webhook-verifier.js +2 -2
  98. package/dist/lib/signing/webhook-verifier.mjs +3 -3
  99. package/dist/lib/substitution/compile.js +2 -1
  100. package/dist/lib/substitution/compile.mjs +2 -1
  101. package/dist/lib/substitution/consent-macros.d.mts +4 -0
  102. package/dist/lib/substitution/consent-macros.d.ts +4 -0
  103. package/dist/lib/substitution/consent-macros.js +45 -0
  104. package/dist/lib/substitution/consent-macros.mjs +20 -0
  105. package/dist/lib/substitution/index.d.mts +1 -1
  106. package/dist/lib/substitution/index.d.ts +1 -1
  107. package/dist/lib/substitution/index.js +2 -0
  108. package/dist/lib/substitution/index.mjs +2 -1
  109. package/dist/lib/substitution/translate.d.mts +15 -2
  110. package/dist/lib/substitution/translate.d.ts +15 -2
  111. package/dist/lib/substitution/translate.js +148 -26
  112. package/dist/lib/substitution/translate.mjs +147 -26
  113. package/dist/lib/testing/client.js +2 -1
  114. package/dist/lib/testing/client.mjs +2 -1
  115. package/dist/lib/testing/scenarios/capabilities.js +1 -1
  116. package/dist/lib/testing/scenarios/capabilities.mjs +1 -1
  117. package/dist/lib/testing/storyboard/junit.js +16 -3
  118. package/dist/lib/testing/storyboard/junit.mjs +16 -3
  119. package/dist/lib/testing/storyboard/request-signing/builder.js +12 -14
  120. package/dist/lib/testing/storyboard/request-signing/builder.mjs +13 -15
  121. package/dist/lib/testing/storyboard/runner.js +94 -25
  122. package/dist/lib/testing/storyboard/runner.mjs +94 -25
  123. package/dist/lib/testing/storyboard/signer-grader/grader.js +2 -7
  124. package/dist/lib/testing/storyboard/signer-grader/grader.mjs +2 -7
  125. package/dist/lib/testing/storyboard/types.d.mts +6 -0
  126. package/dist/lib/testing/storyboard/types.d.ts +6 -0
  127. package/dist/lib/testing/storyboard/validations.d.mts +1 -1
  128. package/dist/lib/testing/storyboard/validations.d.ts +1 -1
  129. package/dist/lib/types/enums.generated.d.mts +3 -0
  130. package/dist/lib/types/enums.generated.d.ts +3 -0
  131. package/dist/lib/types/enums.generated.js +9 -0
  132. package/dist/lib/types/enums.generated.mjs +6 -0
  133. package/dist/lib/validation/schema-loader.js +25 -0
  134. package/dist/lib/validation/schema-loader.mjs +24 -0
  135. package/dist/lib/version.d.mts +3 -3
  136. package/dist/lib/version.d.ts +3 -3
  137. package/dist/lib/version.js +3 -3
  138. package/dist/lib/version.mjs +3 -3
  139. package/docs/TYPE-SUMMARY.md +28 -5
  140. package/docs/guides/DISCOVERY-CACHE-AND-SESSION-REUSE.md +3 -2
  141. package/docs/guides/REPORTING-GCS-FENCE.md +3 -3
  142. package/docs/guides/REPORTING-GCS-MANAGED.md +4 -4
  143. package/docs/guides/REPORTING-LEDGER-CUTOVER.md +7 -7
  144. package/docs/guides/REPORTING-LEDGER.md +107 -51
  145. package/docs/guides/REPORTING-OPERATIONS.md +66 -5
  146. package/docs/guides/REPORTING-STABILITY.md +36 -32
  147. package/docs/guides/UNIVERSAL-MACRO-COMPILATION.md +38 -0
  148. package/docs/guides/VALIDATE-YOUR-AGENT.md +12 -0
  149. package/docs/llms.txt +4 -3
  150. package/docs/migration-14.x-rc-worksheet.md +4 -7
  151. package/docs/migration-reporting-storage-package.md +186 -0
  152. package/examples/README.md +1 -1
  153. package/package.json +14 -78
  154. package/dist/lib/reporting/azure/index.d.mts +0 -31
  155. package/dist/lib/reporting/azure/index.d.ts +0 -31
  156. package/dist/lib/reporting/azure/index.js +0 -266
  157. package/dist/lib/reporting/azure/index.mjs +0 -249
  158. package/dist/lib/reporting/bigquery/index.d.mts +0 -246
  159. package/dist/lib/reporting/bigquery/index.d.ts +0 -246
  160. package/dist/lib/reporting/bigquery/index.js +0 -633
  161. package/dist/lib/reporting/bigquery/index.mjs +0 -594
  162. package/dist/lib/reporting/gcs/adapter.d.mts +0 -38
  163. package/dist/lib/reporting/gcs/adapter.d.ts +0 -38
  164. package/dist/lib/reporting/gcs/adapter.js +0 -342
  165. package/dist/lib/reporting/gcs/adapter.mjs +0 -325
  166. package/dist/lib/reporting/gcs/bucket-policy.d.mts +0 -3
  167. package/dist/lib/reporting/gcs/bucket-policy.d.ts +0 -3
  168. package/dist/lib/reporting/gcs/bucket-policy.mjs +0 -7
  169. package/dist/lib/reporting/gcs/errors.d.mts +0 -11
  170. package/dist/lib/reporting/gcs/errors.d.ts +0 -11
  171. package/dist/lib/reporting/gcs/errors.mjs +0 -16
  172. package/dist/lib/reporting/gcs/fence.d.mts +0 -41
  173. package/dist/lib/reporting/gcs/fence.d.ts +0 -41
  174. package/dist/lib/reporting/gcs/fence.js +0 -250
  175. package/dist/lib/reporting/gcs/fence.mjs +0 -230
  176. package/dist/lib/reporting/gcs/index.d.mts +0 -18
  177. package/dist/lib/reporting/gcs/index.d.ts +0 -18
  178. package/dist/lib/reporting/gcs/index.js +0 -44
  179. package/dist/lib/reporting/gcs/index.mjs +0 -14
  180. package/dist/lib/reporting/gcs/io.d.mts +0 -7
  181. package/dist/lib/reporting/gcs/io.d.ts +0 -7
  182. package/dist/lib/reporting/gcs/io.js +0 -95
  183. package/dist/lib/reporting/gcs/io.mjs +0 -69
  184. package/dist/lib/reporting/gcs/reader.d.mts +0 -67
  185. package/dist/lib/reporting/gcs/reader.d.ts +0 -67
  186. package/dist/lib/reporting/gcs/reader.js +0 -193
  187. package/dist/lib/reporting/gcs/reader.mjs +0 -169
  188. package/dist/lib/reporting/gcs/row-provider.d.mts +0 -39
  189. package/dist/lib/reporting/gcs/row-provider.d.ts +0 -39
  190. package/dist/lib/reporting/gcs/row-provider.js +0 -225
  191. package/dist/lib/reporting/gcs/row-provider.mjs +0 -208
  192. package/dist/lib/reporting/gcs/validation.d.mts +0 -5
  193. package/dist/lib/reporting/gcs/validation.d.ts +0 -5
  194. package/dist/lib/reporting/gcs/validation.js +0 -49
  195. package/dist/lib/reporting/gcs/validation.mjs +0 -25
  196. package/dist/lib/reporting/ledger/change-feed.d.mts +0 -69
  197. package/dist/lib/reporting/ledger/change-feed.d.ts +0 -69
  198. package/dist/lib/reporting/ledger/change-feed.js +0 -107
  199. package/dist/lib/reporting/ledger/change-feed.mjs +0 -80
  200. package/dist/lib/reporting/ledger/managed-postgres.d.mts +0 -293
  201. package/dist/lib/reporting/ledger/managed-postgres.d.ts +0 -293
  202. package/dist/lib/reporting/ledger/managed-postgres.js +0 -2346
  203. package/dist/lib/reporting/ledger/managed-postgres.mjs +0 -2332
  204. package/dist/lib/reporting/ledger/managed-router.d.mts +0 -148
  205. package/dist/lib/reporting/ledger/managed-router.d.ts +0 -148
  206. package/dist/lib/reporting/ledger/managed-router.js +0 -280
  207. package/dist/lib/reporting/ledger/managed-router.mjs +0 -258
  208. package/dist/lib/reporting/ledger/managed.d.mts +0 -535
  209. package/dist/lib/reporting/ledger/managed.d.ts +0 -535
  210. package/dist/lib/reporting/ledger/managed.js +0 -761
  211. package/dist/lib/reporting/ledger/managed.mjs +0 -729
  212. package/dist/lib/reporting/ledger/notification-activity.d.mts +0 -332
  213. package/dist/lib/reporting/ledger/notification-activity.d.ts +0 -332
  214. package/dist/lib/reporting/ledger/notification-activity.js +0 -1366
  215. package/dist/lib/reporting/ledger/notification-activity.mjs +0 -1337
  216. package/dist/lib/reporting/ledger/object-writes.d.mts +0 -128
  217. package/dist/lib/reporting/ledger/object-writes.d.ts +0 -128
  218. package/dist/lib/reporting/ledger/object-writes.js +0 -147
  219. package/dist/lib/reporting/ledger/object-writes.mjs +0 -114
  220. package/dist/lib/reporting/ledger/postgres.d.mts +0 -689
  221. package/dist/lib/reporting/ledger/postgres.d.ts +0 -689
  222. package/dist/lib/reporting/ledger/postgres.js +0 -4462
  223. package/dist/lib/reporting/ledger/postgres.mjs +0 -4462
  224. package/dist/lib/reporting/ledger/row-storage-migration.d.mts +0 -59
  225. package/dist/lib/reporting/ledger/row-storage-migration.d.ts +0 -59
  226. package/dist/lib/reporting/ledger/row-storage-migration.js +0 -365
  227. package/dist/lib/reporting/ledger/row-storage-migration.mjs +0 -339
  228. package/dist/lib/reporting/ledger/row-storage-object.d.mts +0 -203
  229. package/dist/lib/reporting/ledger/row-storage-object.d.ts +0 -203
  230. package/dist/lib/reporting/ledger/row-storage-object.js +0 -379
  231. package/dist/lib/reporting/ledger/row-storage-object.mjs +0 -335
  232. package/dist/lib/reporting/ledger/row-storage-provider-io.d.mts +0 -44
  233. package/dist/lib/reporting/ledger/row-storage-provider-io.d.ts +0 -44
  234. package/dist/lib/reporting/ledger/row-storage-provider-io.js +0 -142
  235. package/dist/lib/reporting/ledger/row-storage-provider-io.mjs +0 -111
  236. package/dist/lib/reporting/ledger/row-storage.d.mts +0 -316
  237. package/dist/lib/reporting/ledger/row-storage.d.ts +0 -316
  238. package/dist/lib/reporting/ledger/row-storage.js +0 -812
  239. package/dist/lib/reporting/ledger/row-storage.mjs +0 -802
  240. package/dist/lib/reporting/s3/index.d.mts +0 -34
  241. package/dist/lib/reporting/s3/index.d.ts +0 -34
  242. package/dist/lib/reporting/s3/index.js +0 -347
  243. package/dist/lib/reporting/s3/index.mjs +0 -340
  244. package/dist/lib/reporting/service/maintenance.d.mts +0 -148
  245. package/dist/lib/reporting/service/maintenance.d.ts +0 -148
  246. package/dist/lib/reporting/service/maintenance.js +0 -185
  247. package/dist/lib/reporting/service/maintenance.mjs +0 -159
  248. package/examples/reliable-reporting-service/README.md +0 -169
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Scheduler primitives shared by `createReliableReportingService` and by services composed with it
3
+ * (for example `@adcp/reporting-storage/service`). They are exported so a composition can pace its own
4
+ * background passes and report failures the same way the Core scheduler does.
5
+ */
6
+ import type { ReportingLedgerStore } from '../ledger/types.mjs';
7
+ /**
8
+ * The error's own message only, credential-redacted, bounded, and total.
9
+ *
10
+ * Stacks and error objects can carry request payloads and upstream credentials
11
+ * into a log sink the adopter did not choose, so only `message` is read. Every
12
+ * step is guarded because the value is arbitrary: `String(Object.create(null))`
13
+ * throws, a `Symbol.toPrimitive` or `message` getter can throw or run adopter
14
+ * code, and a Proxy can trap the prototype walk `instanceof` performs. This
15
+ * function runs while building the diagnostic, outside the catch that guards
16
+ * the logger call, so a throw here escaped `reportSchedulerError`, rejected the
17
+ * scheduler loop, and surfaced as an unhandled rejection — killing the
18
+ * background loop, or the host, over an error object's shape.
19
+ */
20
+ export declare function reportingSchedulerErrorMessage(error: unknown): string;
21
+ export declare function reportingSchedulerDelay(milliseconds: number, signal: AbortSignal): Promise<void>;
22
+ /** Start each pass one tenant further along so no fixed order can starve. */
23
+ export declare function rotateReportingRoster<T>(values: readonly T[], by: number): T[];
24
+ /**
25
+ * Every account the ledger currently holds a configuration for. This is the
26
+ * roster a deployment-wide worker is authorized over, so it is also the roster
27
+ * the per-account budgets apply to.
28
+ */
29
+ export declare function reportingDeploymentWideAccountIds(store: ReportingLedgerStore): Promise<string[]>;
30
+ /** The parts of the scheduler options that failure reporting reads. */
31
+ export interface ReportingSchedulerReportingOptionsV1 {
32
+ onError?: (error: unknown) => void | Promise<void>;
33
+ logger?: {
34
+ warn: (message: string) => void;
35
+ };
36
+ }
37
+ /** Where in the scheduler loop a failure happened. */
38
+ export interface ReportingSchedulerFailureSiteV1 {
39
+ readonly phase: 'roster' | 'cycle' | 'maintenance';
40
+ readonly accountId?: string | undefined;
41
+ }
42
+ export declare function reportReportingSchedulerError(options: ReportingSchedulerReportingOptionsV1, signal: AbortSignal, error: unknown, site: ReportingSchedulerFailureSiteV1): Promise<void>;
43
+ export declare function warnReportingSchedulerFailure(options: ReportingSchedulerReportingOptionsV1, site: ReportingSchedulerFailureSiteV1, error: unknown, observerError?: unknown): void;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Scheduler primitives shared by `createReliableReportingService` and by services composed with it
3
+ * (for example `@adcp/reporting-storage/service`). They are exported so a composition can pace its own
4
+ * background passes and report failures the same way the Core scheduler does.
5
+ */
6
+ import type { ReportingLedgerStore } from '../ledger/types';
7
+ /**
8
+ * The error's own message only, credential-redacted, bounded, and total.
9
+ *
10
+ * Stacks and error objects can carry request payloads and upstream credentials
11
+ * into a log sink the adopter did not choose, so only `message` is read. Every
12
+ * step is guarded because the value is arbitrary: `String(Object.create(null))`
13
+ * throws, a `Symbol.toPrimitive` or `message` getter can throw or run adopter
14
+ * code, and a Proxy can trap the prototype walk `instanceof` performs. This
15
+ * function runs while building the diagnostic, outside the catch that guards
16
+ * the logger call, so a throw here escaped `reportSchedulerError`, rejected the
17
+ * scheduler loop, and surfaced as an unhandled rejection — killing the
18
+ * background loop, or the host, over an error object's shape.
19
+ */
20
+ export declare function reportingSchedulerErrorMessage(error: unknown): string;
21
+ export declare function reportingSchedulerDelay(milliseconds: number, signal: AbortSignal): Promise<void>;
22
+ /** Start each pass one tenant further along so no fixed order can starve. */
23
+ export declare function rotateReportingRoster<T>(values: readonly T[], by: number): T[];
24
+ /**
25
+ * Every account the ledger currently holds a configuration for. This is the
26
+ * roster a deployment-wide worker is authorized over, so it is also the roster
27
+ * the per-account budgets apply to.
28
+ */
29
+ export declare function reportingDeploymentWideAccountIds(store: ReportingLedgerStore): Promise<string[]>;
30
+ /** The parts of the scheduler options that failure reporting reads. */
31
+ export interface ReportingSchedulerReportingOptionsV1 {
32
+ onError?: (error: unknown) => void | Promise<void>;
33
+ logger?: {
34
+ warn: (message: string) => void;
35
+ };
36
+ }
37
+ /** Where in the scheduler loop a failure happened. */
38
+ export interface ReportingSchedulerFailureSiteV1 {
39
+ readonly phase: 'roster' | 'cycle' | 'maintenance';
40
+ readonly accountId?: string | undefined;
41
+ }
42
+ export declare function reportReportingSchedulerError(options: ReportingSchedulerReportingOptionsV1, signal: AbortSignal, error: unknown, site: ReportingSchedulerFailureSiteV1): Promise<void>;
43
+ export declare function warnReportingSchedulerFailure(options: ReportingSchedulerReportingOptionsV1, site: ReportingSchedulerFailureSiteV1, error: unknown, observerError?: unknown): void;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var scheduler_support_exports = {};
20
+ __export(scheduler_support_exports, {
21
+ reportReportingSchedulerError: () => reportReportingSchedulerError,
22
+ reportingDeploymentWideAccountIds: () => reportingDeploymentWideAccountIds,
23
+ reportingSchedulerDelay: () => reportingSchedulerDelay,
24
+ reportingSchedulerErrorMessage: () => reportingSchedulerErrorMessage,
25
+ rotateReportingRoster: () => rotateReportingRoster,
26
+ warnReportingSchedulerFailure: () => warnReportingSchedulerFailure
27
+ });
28
+ module.exports = __toCommonJS(scheduler_support_exports);
29
+ var import_redact_credential_patterns = require('../../utils/redact-credential-patterns.js');
30
+ const MAX_SCHEDULER_MESSAGE_CHARS = 512;
31
+ const MAX_SCHEDULER_SCAN_CHARS = 8192;
32
+ const UNREPORTABLE_SCHEDULER_ERROR = "<unreportable error>";
33
+ function reportingSchedulerErrorMessage(error) {
34
+ try {
35
+ const raw = rawMessage(error);
36
+ const redacted = (0, import_redact_credential_patterns.redactCredentialPatterns)(raw.slice(0, MAX_SCHEDULER_SCAN_CHARS));
37
+ const text = typeof redacted === "string" && redacted.length > 0 ? redacted : UNREPORTABLE_SCHEDULER_ERROR;
38
+ return text.length > MAX_SCHEDULER_MESSAGE_CHARS ? `${text.slice(0, MAX_SCHEDULER_MESSAGE_CHARS)}\u2026` : text;
39
+ } catch {
40
+ return UNREPORTABLE_SCHEDULER_ERROR;
41
+ }
42
+ }
43
+ function rawMessage(error) {
44
+ switch (typeof error) {
45
+ case "string":
46
+ return error;
47
+ case "number":
48
+ case "boolean":
49
+ case "bigint":
50
+ return String(error);
51
+ case "undefined":
52
+ return "undefined";
53
+ case "symbol":
54
+ return error.description ?? "symbol";
55
+ default:
56
+ break;
57
+ }
58
+ if (error === null) return "null";
59
+ const message = error.message;
60
+ return typeof message === "string" ? message : "non-Error scheduler failure";
61
+ }
62
+ const MAX_TIMER_DELAY_MILLISECONDS = 2147483647;
63
+ async function reportingSchedulerDelay(milliseconds, signal) {
64
+ let remaining = milliseconds;
65
+ while (remaining > 0 && !signal.aborted) {
66
+ const chunk = Math.min(remaining, MAX_TIMER_DELAY_MILLISECONDS);
67
+ await abortableTimeout(chunk, signal);
68
+ remaining -= chunk;
69
+ }
70
+ }
71
+ function abortableTimeout(milliseconds, signal) {
72
+ return new Promise((resolve) => {
73
+ const timer = setTimeout(done, milliseconds);
74
+ function done() {
75
+ clearTimeout(timer);
76
+ signal.removeEventListener("abort", done);
77
+ resolve();
78
+ }
79
+ signal.addEventListener("abort", done, { once: true });
80
+ });
81
+ }
82
+ function rotateReportingRoster(values, by) {
83
+ if (values.length < 2) return [...values];
84
+ const offset = (by % values.length + values.length) % values.length;
85
+ return [...values.slice(offset), ...values.slice(0, offset)];
86
+ }
87
+ async function reportingDeploymentWideAccountIds(store) {
88
+ const configurations = await store.listConfigurations();
89
+ return [...new Set(configurations.map((value) => value.account.account_id))].sort();
90
+ }
91
+ async function reportReportingSchedulerError(options, signal, error, site) {
92
+ if (signal.aborted) return;
93
+ if (options.onError) {
94
+ try {
95
+ await options.onError(error);
96
+ } catch (observerError) {
97
+ warnReportingSchedulerFailure(options, site, error, observerError);
98
+ }
99
+ return;
100
+ }
101
+ warnReportingSchedulerFailure(options, site, error);
102
+ }
103
+ function warnReportingSchedulerFailure(options, site, error, observerError) {
104
+ const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.phase === "maintenance" ? "ledger maintenance failed; the scheduler continues" : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
105
+ const observed = observerError === void 0 ? "" : ` (the configured onError also threw: ${reportingSchedulerErrorMessage(observerError)})`;
106
+ const message = `[adcp/reporting] scheduler ${where}: ${reportingSchedulerErrorMessage(error)}${observed}`;
107
+ const logger = options.logger;
108
+ try {
109
+ if (logger !== void 0) logger.warn(message);
110
+ else defaultSchedulerWarn(message);
111
+ } catch {
112
+ }
113
+ }
114
+ function defaultSchedulerWarn(message) {
115
+ console.warn(message);
116
+ }
117
+ // Annotate the CommonJS export names for ESM import in node:
118
+ 0 && (module.exports = {
119
+ reportReportingSchedulerError,
120
+ reportingDeploymentWideAccountIds,
121
+ reportingSchedulerDelay,
122
+ reportingSchedulerErrorMessage,
123
+ rotateReportingRoster,
124
+ warnReportingSchedulerFailure
125
+ });
@@ -0,0 +1,96 @@
1
+ import { redactCredentialPatterns } from "../../utils/redact-credential-patterns.mjs";
2
+ const MAX_SCHEDULER_MESSAGE_CHARS = 512;
3
+ const MAX_SCHEDULER_SCAN_CHARS = 8192;
4
+ const UNREPORTABLE_SCHEDULER_ERROR = "<unreportable error>";
5
+ function reportingSchedulerErrorMessage(error) {
6
+ try {
7
+ const raw = rawMessage(error);
8
+ const redacted = redactCredentialPatterns(raw.slice(0, MAX_SCHEDULER_SCAN_CHARS));
9
+ const text = typeof redacted === "string" && redacted.length > 0 ? redacted : UNREPORTABLE_SCHEDULER_ERROR;
10
+ return text.length > MAX_SCHEDULER_MESSAGE_CHARS ? `${text.slice(0, MAX_SCHEDULER_MESSAGE_CHARS)}\u2026` : text;
11
+ } catch {
12
+ return UNREPORTABLE_SCHEDULER_ERROR;
13
+ }
14
+ }
15
+ function rawMessage(error) {
16
+ switch (typeof error) {
17
+ case "string":
18
+ return error;
19
+ case "number":
20
+ case "boolean":
21
+ case "bigint":
22
+ return String(error);
23
+ case "undefined":
24
+ return "undefined";
25
+ case "symbol":
26
+ return error.description ?? "symbol";
27
+ default:
28
+ break;
29
+ }
30
+ if (error === null) return "null";
31
+ const message = error.message;
32
+ return typeof message === "string" ? message : "non-Error scheduler failure";
33
+ }
34
+ const MAX_TIMER_DELAY_MILLISECONDS = 2147483647;
35
+ async function reportingSchedulerDelay(milliseconds, signal) {
36
+ let remaining = milliseconds;
37
+ while (remaining > 0 && !signal.aborted) {
38
+ const chunk = Math.min(remaining, MAX_TIMER_DELAY_MILLISECONDS);
39
+ await abortableTimeout(chunk, signal);
40
+ remaining -= chunk;
41
+ }
42
+ }
43
+ function abortableTimeout(milliseconds, signal) {
44
+ return new Promise((resolve) => {
45
+ const timer = setTimeout(done, milliseconds);
46
+ function done() {
47
+ clearTimeout(timer);
48
+ signal.removeEventListener("abort", done);
49
+ resolve();
50
+ }
51
+ signal.addEventListener("abort", done, { once: true });
52
+ });
53
+ }
54
+ function rotateReportingRoster(values, by) {
55
+ if (values.length < 2) return [...values];
56
+ const offset = (by % values.length + values.length) % values.length;
57
+ return [...values.slice(offset), ...values.slice(0, offset)];
58
+ }
59
+ async function reportingDeploymentWideAccountIds(store) {
60
+ const configurations = await store.listConfigurations();
61
+ return [...new Set(configurations.map((value) => value.account.account_id))].sort();
62
+ }
63
+ async function reportReportingSchedulerError(options, signal, error, site) {
64
+ if (signal.aborted) return;
65
+ if (options.onError) {
66
+ try {
67
+ await options.onError(error);
68
+ } catch (observerError) {
69
+ warnReportingSchedulerFailure(options, site, error, observerError);
70
+ }
71
+ return;
72
+ }
73
+ warnReportingSchedulerFailure(options, site, error);
74
+ }
75
+ function warnReportingSchedulerFailure(options, site, error, observerError) {
76
+ const where = site.phase === "roster" ? "could not resolve its account roster, so this pass ran no tenants" : site.phase === "maintenance" ? "ledger maintenance failed; the scheduler continues" : site.accountId === void 0 ? "deployment-wide cycle failed; the scheduler continues" : `cycle failed for account ${site.accountId}; later tenants continue`;
77
+ const observed = observerError === void 0 ? "" : ` (the configured onError also threw: ${reportingSchedulerErrorMessage(observerError)})`;
78
+ const message = `[adcp/reporting] scheduler ${where}: ${reportingSchedulerErrorMessage(error)}${observed}`;
79
+ const logger = options.logger;
80
+ try {
81
+ if (logger !== void 0) logger.warn(message);
82
+ else defaultSchedulerWarn(message);
83
+ } catch {
84
+ }
85
+ }
86
+ function defaultSchedulerWarn(message) {
87
+ console.warn(message);
88
+ }
89
+ export {
90
+ reportReportingSchedulerError,
91
+ reportingDeploymentWideAccountIds,
92
+ reportingSchedulerDelay,
93
+ reportingSchedulerErrorMessage,
94
+ rotateReportingRoster,
95
+ warnReportingSchedulerFailure
96
+ };
@@ -4,5 +4,5 @@
4
4
  "source_sha": "4e553ad955f83b49c7d221ab5c3ff78237ad02e3",
5
5
  "source_tarball_sha256": "580656d6466ef9f0d1119985e6726c2efea718dc671e2ad30957fcb2fd54af0f",
6
6
  "upstream_adcp_version": "2.5.3",
7
- "synced_at": "2026-10-15T16:11:40.051Z"
7
+ "synced_at": "2026-10-16T14:47:18.668Z"
8
8
  }
@@ -60,6 +60,10 @@ export declare function buildSignatureBase(components: ReadonlyArray<string>, re
60
60
  * meaning as in {@link buildSignatureBase}.
61
61
  */
62
62
  export declare function buildResponseSignatureBase(components: ReadonlyArray<string>, response: ResponseLike, params: SignatureParams, signatureParamsValue?: string): string;
63
+ /**
64
+ * Serialize the `@signature-params` inner list (RFC 9421 §2.3) with the
65
+ * structured-field serializer, in the canonical AdCP parameter order.
66
+ */
63
67
  export declare function formatSignatureParams(components: ReadonlyArray<string>, params: SignatureParams): string;
64
68
  /**
65
69
  * Raw non-ASCII bytes in the URL authority (IDN U-label) are a parse-time
@@ -60,6 +60,10 @@ export declare function buildSignatureBase(components: ReadonlyArray<string>, re
60
60
  * meaning as in {@link buildSignatureBase}.
61
61
  */
62
62
  export declare function buildResponseSignatureBase(components: ReadonlyArray<string>, response: ResponseLike, params: SignatureParams, signatureParamsValue?: string): string;
63
+ /**
64
+ * Serialize the `@signature-params` inner list (RFC 9421 §2.3) with the
65
+ * structured-field serializer, in the canonical AdCP parameter order.
66
+ */
63
67
  export declare function formatSignatureParams(components: ReadonlyArray<string>, params: SignatureParams): string;
64
68
  /**
65
69
  * Raw non-ASCII bytes in the URL authority (IDN U-label) are a parse-time
@@ -28,6 +28,7 @@ __export(canonicalize_exports, {
28
28
  rejectNonAsciiHost: () => rejectNonAsciiHost
29
29
  });
30
30
  module.exports = __toCommonJS(canonicalize_exports);
31
+ var import_structured_headers = require("structured-headers");
31
32
  var import_errors = require('./errors.js');
32
33
  const DEFAULT_PARAM_ORDER = [
33
34
  "created",
@@ -37,7 +38,6 @@ const DEFAULT_PARAM_ORDER = [
37
38
  "alg",
38
39
  "tag"
39
40
  ];
40
- const STRING_PARAMS = /* @__PURE__ */ new Set(["nonce", "keyid", "alg", "tag"]);
41
41
  const SUPPORTED_DERIVED = /* @__PURE__ */ new Set(["@method", "@target-uri", "@authority", "@status"]);
42
42
  function canonicalTargetUri(rawUrl, profile = "legacy") {
43
43
  const u = parseCanonicalUrl(rawUrl, profile);
@@ -127,14 +127,17 @@ function buildResponseSignatureBase(components, response, params, signatureParam
127
127
  return lines.join("\n");
128
128
  }
129
129
  function formatSignatureParams(components, params) {
130
- const componentList = components.map(formatComponentIdentifier).join(" ");
131
- const paramPairs = [];
130
+ const parameters = /* @__PURE__ */ new Map();
132
131
  for (const key of DEFAULT_PARAM_ORDER) {
133
132
  const raw = params[key];
134
- if (raw === void 0) continue;
135
- paramPairs.push(STRING_PARAMS.has(key) ? `${key}="${raw}"` : `${key}=${raw}`);
133
+ if (raw !== void 0) parameters.set(key, raw);
134
+ }
135
+ try {
136
+ return (0, import_structured_headers.serializeInnerList)([components.map(componentItem), parameters]);
137
+ } catch (error) {
138
+ if (!(error instanceof import_structured_headers.SerializeError)) throw error;
139
+ throw new TypeError(`Signature parameters are not RFC 8941 serializable: ${error.message}`);
136
140
  }
137
- return `(${componentList});${paramPairs.join(";")}`;
138
141
  }
139
142
  function parseComponentIdentifier(component) {
140
143
  if (!component.includes(";")) return { bare: component, requestBound: false };
@@ -152,9 +155,12 @@ function parseComponentIdentifier(component) {
152
155
  requestBound: params.includes("req")
153
156
  };
154
157
  }
155
- function formatComponentIdentifier(component) {
158
+ function componentItem(component) {
156
159
  const { bare, requestBound } = parseComponentIdentifier(component);
157
- return `"${bare}"${requestBound ? ";req" : ""}`;
160
+ return [bare, new Map(requestBound ? [["req", true]] : [])];
161
+ }
162
+ function formatComponentIdentifier(component) {
163
+ return (0, import_structured_headers.serializeItem)(componentItem(component));
158
164
  }
159
165
  function resolveResponseComponentValue(bare, requestBound, response, requestView) {
160
166
  if (bare === "@status") {
@@ -1,3 +1,4 @@
1
+ import { SerializeError, serializeInnerList, serializeItem } from "structured-headers";
1
2
  import { RequestSignatureError } from "./errors.mjs";
2
3
  const DEFAULT_PARAM_ORDER = [
3
4
  "created",
@@ -7,7 +8,6 @@ const DEFAULT_PARAM_ORDER = [
7
8
  "alg",
8
9
  "tag"
9
10
  ];
10
- const STRING_PARAMS = /* @__PURE__ */ new Set(["nonce", "keyid", "alg", "tag"]);
11
11
  const SUPPORTED_DERIVED = /* @__PURE__ */ new Set(["@method", "@target-uri", "@authority", "@status"]);
12
12
  function canonicalTargetUri(rawUrl, profile = "legacy") {
13
13
  const u = parseCanonicalUrl(rawUrl, profile);
@@ -97,14 +97,17 @@ function buildResponseSignatureBase(components, response, params, signatureParam
97
97
  return lines.join("\n");
98
98
  }
99
99
  function formatSignatureParams(components, params) {
100
- const componentList = components.map(formatComponentIdentifier).join(" ");
101
- const paramPairs = [];
100
+ const parameters = /* @__PURE__ */ new Map();
102
101
  for (const key of DEFAULT_PARAM_ORDER) {
103
102
  const raw = params[key];
104
- if (raw === void 0) continue;
105
- paramPairs.push(STRING_PARAMS.has(key) ? `${key}="${raw}"` : `${key}=${raw}`);
103
+ if (raw !== void 0) parameters.set(key, raw);
104
+ }
105
+ try {
106
+ return serializeInnerList([components.map(componentItem), parameters]);
107
+ } catch (error) {
108
+ if (!(error instanceof SerializeError)) throw error;
109
+ throw new TypeError(`Signature parameters are not RFC 8941 serializable: ${error.message}`);
106
110
  }
107
- return `(${componentList});${paramPairs.join(";")}`;
108
111
  }
109
112
  function parseComponentIdentifier(component) {
110
113
  if (!component.includes(";")) return { bare: component, requestBound: false };
@@ -122,9 +125,12 @@ function parseComponentIdentifier(component) {
122
125
  requestBound: params.includes("req")
123
126
  };
124
127
  }
125
- function formatComponentIdentifier(component) {
128
+ function componentItem(component) {
126
129
  const { bare, requestBound } = parseComponentIdentifier(component);
127
- return `"${bare}"${requestBound ? ";req" : ""}`;
130
+ return [bare, new Map(requestBound ? [["req", true]] : [])];
131
+ }
132
+ function formatComponentIdentifier(component) {
133
+ return serializeItem(componentItem(component));
128
134
  }
129
135
  function resolveResponseComponentValue(bare, requestBound, response, requestView) {
130
136
  if (bare === "@status") {
@@ -2,6 +2,14 @@ export type SfBinaryEncoding = 'rfc8941-base64' | 'legacy-base64url';
2
2
  /** Select the request-signing binary profile from a trusted endpoint pin. */
3
3
  export declare function requestSigningEncodingForVersion(adcpVersion: string): SfBinaryEncoding;
4
4
  export declare function computeContentDigest(body: string | Uint8Array, encoding?: SfBinaryEncoding): string;
5
+ /**
6
+ * Serialize a one-member Dictionary whose value is a byte sequence, e.g.
7
+ * `sig1=:...:` in `Signature` or `sha-256=:...:` in `Content-Digest`. The
8
+ * RFC 8941 form comes from the structured-field serializer. The AdCP 3.0/3.1
9
+ * profile wrote byte sequences in unpadded Base64URL, which is not an RFC 8941
10
+ * `sf-binary` and no serializer emits, so that legacy form stays hand-written.
11
+ */
12
+ export declare function serializeByteSequenceMember(key: string, bytes: Uint8Array | ArrayBuffer, encoding: SfBinaryEncoding): string;
5
13
  /**
6
14
  * Extract the `sha-256` member from an RFC 9530 Content-Digest header. The
7
15
  * header is an RFC 8941 Dictionary and MAY list multiple algorithms; we look
@@ -2,6 +2,14 @@ export type SfBinaryEncoding = 'rfc8941-base64' | 'legacy-base64url';
2
2
  /** Select the request-signing binary profile from a trusted endpoint pin. */
3
3
  export declare function requestSigningEncodingForVersion(adcpVersion: string): SfBinaryEncoding;
4
4
  export declare function computeContentDigest(body: string | Uint8Array, encoding?: SfBinaryEncoding): string;
5
+ /**
6
+ * Serialize a one-member Dictionary whose value is a byte sequence, e.g.
7
+ * `sig1=:...:` in `Signature` or `sha-256=:...:` in `Content-Digest`. The
8
+ * RFC 8941 form comes from the structured-field serializer. The AdCP 3.0/3.1
9
+ * profile wrote byte sequences in unpadded Base64URL, which is not an RFC 8941
10
+ * `sf-binary` and no serializer emits, so that legacy form stays hand-written.
11
+ */
12
+ export declare function serializeByteSequenceMember(key: string, bytes: Uint8Array | ArrayBuffer, encoding: SfBinaryEncoding): string;
5
13
  /**
6
14
  * Extract the `sha-256` member from an RFC 9530 Content-Digest header. The
7
15
  * header is an RFC 8941 Dictionary and MAY list multiple algorithms; we look
@@ -24,7 +24,8 @@ __export(content_digest_exports, {
24
24
  contentDigestUsesEncoding: () => contentDigestUsesEncoding,
25
25
  isPaddedStandardBase64: () => isPaddedStandardBase64,
26
26
  parseContentDigest: () => parseContentDigest,
27
- requestSigningEncodingForVersion: () => requestSigningEncodingForVersion
27
+ requestSigningEncodingForVersion: () => requestSigningEncodingForVersion,
28
+ serializeByteSequenceMember: () => serializeByteSequenceMember
28
29
  });
29
30
  module.exports = __toCommonJS(content_digest_exports);
30
31
  var import_crypto = require("crypto");
@@ -35,9 +36,13 @@ function requestSigningEncodingForVersion(adcpVersion) {
35
36
  return /^(?:2(?:\.|$)|3\.(?:0|1)(?:\.|-|$)|3$)/.test(normalized) ? "legacy-base64url" : "rfc8941-base64";
36
37
  }
37
38
  function computeContentDigest(body, encoding = "rfc8941-base64") {
38
- const buf = toBuffer(body);
39
- const hash = (0, import_crypto.createHash)("sha256").update(buf).digest(encoding === "legacy-base64url" ? "base64url" : "base64");
40
- return `sha-256=:${hash}:`;
39
+ return serializeByteSequenceMember("sha-256", (0, import_crypto.createHash)("sha256").update(toBuffer(body)).digest(), encoding);
40
+ }
41
+ function serializeByteSequenceMember(key, bytes, encoding) {
42
+ const buf = Buffer.from(bytes);
43
+ if (encoding === "legacy-base64url") return `${key}=:${buf.toString("base64url")}:`;
44
+ const exact = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
45
+ return (0, import_structured_headers.serializeDictionary)(/* @__PURE__ */ new Map([[key, [exact, /* @__PURE__ */ new Map()]]]));
41
46
  }
42
47
  function parseContentDigest(header) {
43
48
  try {
@@ -81,5 +86,6 @@ function toBuffer(body) {
81
86
  contentDigestUsesEncoding,
82
87
  isPaddedStandardBase64,
83
88
  parseContentDigest,
84
- requestSigningEncodingForVersion
89
+ requestSigningEncodingForVersion,
90
+ serializeByteSequenceMember
85
91
  });
@@ -1,14 +1,18 @@
1
1
  import { createHash, timingSafeEqual } from "crypto";
2
- import { parseDictionary } from "structured-headers";
2
+ import { parseDictionary, serializeDictionary } from "structured-headers";
3
3
  const SHA256_MEMBER_RE = /(?:^|[,\s])sha-256=:([A-Za-z0-9+/_-]+={0,2}):/;
4
4
  function requestSigningEncodingForVersion(adcpVersion) {
5
5
  const normalized = adcpVersion.trim().replace(/^v/, "");
6
6
  return /^(?:2(?:\.|$)|3\.(?:0|1)(?:\.|-|$)|3$)/.test(normalized) ? "legacy-base64url" : "rfc8941-base64";
7
7
  }
8
8
  function computeContentDigest(body, encoding = "rfc8941-base64") {
9
- const buf = toBuffer(body);
10
- const hash = createHash("sha256").update(buf).digest(encoding === "legacy-base64url" ? "base64url" : "base64");
11
- return `sha-256=:${hash}:`;
9
+ return serializeByteSequenceMember("sha-256", createHash("sha256").update(toBuffer(body)).digest(), encoding);
10
+ }
11
+ function serializeByteSequenceMember(key, bytes, encoding) {
12
+ const buf = Buffer.from(bytes);
13
+ if (encoding === "legacy-base64url") return `${key}=:${buf.toString("base64url")}:`;
14
+ const exact = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
15
+ return serializeDictionary(/* @__PURE__ */ new Map([[key, [exact, /* @__PURE__ */ new Map()]]]));
12
16
  }
13
17
  function parseContentDigest(header) {
14
18
  try {
@@ -51,5 +55,6 @@ export {
51
55
  contentDigestUsesEncoding,
52
56
  isPaddedStandardBase64,
53
57
  parseContentDigest,
54
- requestSigningEncodingForVersion
58
+ requestSigningEncodingForVersion,
59
+ serializeByteSequenceMember
55
60
  };
@@ -2,3 +2,18 @@ import { type KeyObject } from 'crypto';
2
2
  import type { AdcpJsonWebKey } from './types.mjs';
3
3
  export declare function jwkToPublicKey(jwk: AdcpJsonWebKey): KeyObject;
4
4
  export declare function verifySignature(alg: string, publicKey: KeyObject, data: Uint8Array, signature: Uint8Array): boolean;
5
+ /**
6
+ * Verify with WebCrypto when available. ES256 uses `crypto.subtle`, whose
7
+ * ECDSA signatures are IEEE P1363 (r||s) natively, so edge runtimes such as
8
+ * Cloudflare workerd verify without node:crypto option-shape differences
9
+ * (#3243). Other algorithms, and runtimes without WebCrypto, use
10
+ * {@link verifySignature}.
11
+ */
12
+ export declare function verifySignatureAsync(alg: string, publicKey: KeyObject | AdcpJsonWebKey, data: Uint8Array, signature: Uint8Array): Promise<boolean>;
13
+ /**
14
+ * Sign with a private JWK. ES256 output is IEEE P1363 (r||s). The node:crypto
15
+ * path passes the key as a JWK so workerd accepts it (#3243).
16
+ */
17
+ export declare function signWithPrivateJwk(alg: string, privateJwk: AdcpJsonWebKey, data: Uint8Array): Uint8Array;
18
+ /** {@link signWithPrivateJwk}, preferring WebCrypto for ES256 when available. */
19
+ export declare function signWithPrivateJwkAsync(alg: string, privateJwk: AdcpJsonWebKey, data: Uint8Array): Promise<Uint8Array>;
@@ -2,3 +2,18 @@ import { type KeyObject } from 'crypto';
2
2
  import type { AdcpJsonWebKey } from './types';
3
3
  export declare function jwkToPublicKey(jwk: AdcpJsonWebKey): KeyObject;
4
4
  export declare function verifySignature(alg: string, publicKey: KeyObject, data: Uint8Array, signature: Uint8Array): boolean;
5
+ /**
6
+ * Verify with WebCrypto when available. ES256 uses `crypto.subtle`, whose
7
+ * ECDSA signatures are IEEE P1363 (r||s) natively, so edge runtimes such as
8
+ * Cloudflare workerd verify without node:crypto option-shape differences
9
+ * (#3243). Other algorithms, and runtimes without WebCrypto, use
10
+ * {@link verifySignature}.
11
+ */
12
+ export declare function verifySignatureAsync(alg: string, publicKey: KeyObject | AdcpJsonWebKey, data: Uint8Array, signature: Uint8Array): Promise<boolean>;
13
+ /**
14
+ * Sign with a private JWK. ES256 output is IEEE P1363 (r||s). The node:crypto
15
+ * path passes the key as a JWK so workerd accepts it (#3243).
16
+ */
17
+ export declare function signWithPrivateJwk(alg: string, privateJwk: AdcpJsonWebKey, data: Uint8Array): Uint8Array;
18
+ /** {@link signWithPrivateJwk}, preferring WebCrypto for ES256 when available. */
19
+ export declare function signWithPrivateJwkAsync(alg: string, privateJwk: AdcpJsonWebKey, data: Uint8Array): Promise<Uint8Array>;