puntersedge 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/webhook.ts CHANGED
@@ -33,8 +33,9 @@
33
33
  * });
34
34
  * ```
35
35
  *
36
- * Uses WebCrypto, so it runs unchanged on Node 18+, Deno, Bun, Cloudflare Workers and in the
37
- * browser, with no dependency on `node:crypto`.
36
+ * Uses WebCrypto, so it runs unchanged on Node 19+, Deno, Bun, Cloudflare Workers and in the
37
+ * browser, with no dependency on `node:crypto`. Node 18 is the one exception: it has no
38
+ * `globalThis.crypto`, so pass `crypto: webcrypto` from `node:crypto` there.
38
39
  */
39
40
 
40
41
  export interface VerifyOptions {
@@ -91,8 +92,9 @@ export async function verifyWebhookSignature(options: VerifyOptions): Promise<bo
91
92
  const subtle = (options.crypto ?? globalThis.crypto)?.subtle;
92
93
  if (!subtle) {
93
94
  throw new Error(
94
- "No WebCrypto available. Use Node 18 or later, or pass one: " +
95
- "verifyWebhookSignature({ crypto, ... }).",
95
+ "No WebCrypto available. Node 19+, Deno, Bun, Workers and browsers have it as a " +
96
+ "global; Node 18 does not, so pass one: import { webcrypto } from 'node:crypto' " +
97
+ "then verifyWebhookSignature({ crypto: webcrypto, ... }).",
96
98
  );
97
99
  }
98
100