@upstash/qstash 2.8.4 → 2.9.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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Receiver,
3
3
  serve
4
- } from "./chunk-RQPZUJXG.mjs";
4
+ } from "./chunk-QYBCXZKB.mjs";
5
5
 
6
6
  // node_modules/defu/dist/defu.mjs
7
7
  function isPlainObject(value) {
@@ -329,15 +329,10 @@ var H3Response = globalThis.Response;
329
329
  // platforms/h3.ts
330
330
  var verifySignatureH3 = (handler, config) => {
331
331
  const currentSigningKey = config?.currentSigningKey ?? process.env.QSTASH_CURRENT_SIGNING_KEY;
332
- if (!currentSigningKey) {
333
- throw new Error(
334
- "currentSigningKey is required, either in the config or as env variable QSTASH_CURRENT_SIGNING_KEY"
335
- );
336
- }
337
332
  const nextSigningKey = config?.nextSigningKey ?? process.env.QSTASH_NEXT_SIGNING_KEY;
338
- if (!nextSigningKey) {
333
+ if (!currentSigningKey && !nextSigningKey && !process.env.QSTASH_REGION) {
339
334
  throw new Error(
340
- "nextSigningKey is required, either in the config or as env variable QSTASH_NEXT_SIGNING_KEY"
335
+ "currentSigningKey and nextSigningKey are required, either in the config or as env variables (QSTASH_CURRENT_SIGNING_KEY and QSTASH_NEXT_SIGNING_KEY)"
341
336
  );
342
337
  }
343
338
  const receiver = new Receiver({
@@ -352,11 +347,13 @@ var verifySignatureH3 = (handler, config) => {
352
347
  if (typeof signature !== "string") {
353
348
  throw new TypeError("`Upstash-Signature` header is not a string");
354
349
  }
350
+ const upstashRegion = getHeader(event, "upstash-region");
355
351
  const body = await readRawBody(event);
356
352
  const isValid = await receiver.verify({
357
353
  signature,
358
354
  body: JSON.stringify(body),
359
- clockTolerance: config?.clockTolerance
355
+ clockTolerance: config?.clockTolerance,
356
+ upstashRegion: typeof upstashRegion === "string" ? upstashRegion : void 0
360
357
  });
361
358
  if (!isValid) {
362
359
  return { status: 403, body: "invalid signature" };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseProvider
3
- } from "./chunk-RQPZUJXG.mjs";
3
+ } from "./chunk-QYBCXZKB.mjs";
4
4
 
5
5
  // src/client/api/email.ts
6
6
  var EmailProvider = class extends BaseProvider {