@upstash/qstash 2.1.1 → 2.1.2-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __knownSymbol = (name, symbol) => {
8
+ if (symbol = Symbol[name])
9
+ return symbol;
10
+ throw Error("Symbol." + name + " is not defined");
11
+ };
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __async = (__this, __arguments, generator) => {
26
+ return new Promise((resolve, reject) => {
27
+ var fulfilled = (value) => {
28
+ try {
29
+ step(generator.next(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var rejected = (value) => {
35
+ try {
36
+ step(generator.throw(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
42
+ step((generator = generator.apply(__this, __arguments)).next());
43
+ });
44
+ };
45
+ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
46
+
47
+ // src/receiver.ts
48
+ var _jose = require('jose'); var jose = _interopRequireWildcard(_jose);
49
+ var _cryptojs = require('crypto-js'); var crypto = _interopRequireWildcard(_cryptojs);
50
+ var SignatureError = class extends Error {
51
+ constructor(message) {
52
+ super(message);
53
+ this.name = "SignatureError";
54
+ }
55
+ };
56
+ var Receiver = class {
57
+ constructor(config) {
58
+ this.currentSigningKey = config.currentSigningKey;
59
+ this.nextSigningKey = config.nextSigningKey;
60
+ }
61
+ /**
62
+ * Verify the signature of a request.
63
+ *
64
+ * Tries to verify the signature with the current signing key.
65
+ * If that fails, maybe because you have rotated the keys recently, it will
66
+ * try to verify the signature with the next signing key.
67
+ *
68
+ * If that fails, the signature is invalid and a `SignatureError` is thrown.
69
+ */
70
+ verify(req) {
71
+ return __async(this, null, function* () {
72
+ const isValid = yield this.verifyWithKey(this.currentSigningKey, req);
73
+ if (isValid) {
74
+ return true;
75
+ }
76
+ return this.verifyWithKey(this.nextSigningKey, req);
77
+ });
78
+ }
79
+ /**
80
+ * Verify signature with a specific signing key
81
+ */
82
+ verifyWithKey(key, req) {
83
+ return __async(this, null, function* () {
84
+ const jwt = yield jose.jwtVerify(req.signature, new TextEncoder().encode(key), {
85
+ issuer: "Upstash",
86
+ clockTolerance: req.clockTolerance
87
+ }).catch((e) => {
88
+ throw new SignatureError(e.message);
89
+ });
90
+ const p = jwt.payload;
91
+ if (typeof req.url !== "undefined" && p.sub !== req.url) {
92
+ throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);
93
+ }
94
+ const bodyHash = crypto.SHA256(req.body).toString(crypto.enc.Base64url);
95
+ const padding = new RegExp(/=+$/);
96
+ if (p.body.replace(padding, "") !== bodyHash.replace(padding, "")) {
97
+ throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);
98
+ }
99
+ return true;
100
+ });
101
+ }
102
+ };
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__async = __async; exports.__forAwait = __forAwait; exports.SignatureError = SignatureError; exports.Receiver = Receiver;
112
+ //# sourceMappingURL=chunk-EQTYEU4U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/receiver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,UAAU;AACtB,YAAY,YAAY;AA0CjB,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAIO,IAAM,WAAN,MAAe;AAAA,EAIpB,YAAY,QAAwB;AAClC,SAAK,oBAAoB,OAAO;AAChC,SAAK,iBAAiB,OAAO;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWa,OAAO,KAAsC;AAAA;AACxD,YAAM,UAAU,MAAM,KAAK,cAAc,KAAK,mBAAmB,GAAG;AACpE,UAAI,SAAS;AACX,eAAO;AAAA,MACT;AACA,aAAO,KAAK,cAAc,KAAK,gBAAgB,GAAG;AAAA,IACpD;AAAA;AAAA;AAAA;AAAA;AAAA,EAKc,cAAc,KAAa,KAAsC;AAAA;AAC7E,YAAM,MAAM,MACT,eAAU,IAAI,WAAW,IAAI,YAAY,EAAE,OAAO,GAAG,GAAG;AAAA,QACvD,QAAQ;AAAA,QACR,gBAAgB,IAAI;AAAA,MACtB,CAAC,EACA,MAAM,CAAC,MAAM;AACZ,cAAM,IAAI,eAAgB,EAAY,OAAO;AAAA,MAC/C,CAAC;AAEH,YAAM,IAAI,IAAI;AAUd,UAAI,OAAO,IAAI,QAAQ,eAAe,EAAE,QAAQ,IAAI,KAAK;AACvD,cAAM,IAAI,eAAe,oBAAoB,EAAE,GAAG,WAAW,IAAI,GAAG,EAAE;AAAA,MACxE;AAEA,YAAM,WAAkB,cAAO,IAAI,IAAc,EAAE,SAAgB,WAAI,SAAS;AAEhF,YAAM,UAAU,IAAI,OAAO,KAAK;AAEhC,UAAI,EAAE,KAAK,QAAQ,SAAS,EAAE,MAAM,SAAS,QAAQ,SAAS,EAAE,GAAG;AACjE,cAAM,IAAI,eAAe,mCAAmC,EAAE,IAAI,UAAU,QAAQ,EAAE;AAAA,MACxF;AAEA,aAAO;AAAA,IACT;AAAA;AACF","sourcesContent":["import * as jose from \"jose\";\nimport * as crypto from \"crypto-js\";\n\n/**\n * Necessary to verify the signature of a request.\n */\nexport type ReceiverConfig = {\n /**\n * The current signing key. Get it from `https://console.upstash.com/qstash\n */\n currentSigningKey: string;\n /**\n * The next signing key. Get it from `https://console.upstash.com/qstash\n */\n nextSigningKey: string;\n};\n\nexport type VerifyRequest = {\n /**\n * The signature from the `upstash-signature` header.\n */\n signature: string;\n\n /**\n * The raw request body.\n */\n body: string;\n\n /**\n * URL of the endpoint where the request was sent to.\n *\n * Omit empty to disable checking the url.\n */\n url?: string;\n\n /**\n * Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers\n *\n * @default 0\n */\n clockTolerance?: number;\n};\n\nexport class SignatureError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SignatureError\";\n }\n}\n/**\n * Receiver offers a simlpe way to verify the signature of a request.\n */\nexport class Receiver {\n private readonly currentSigningKey: string;\n private readonly nextSigningKey: string;\n\n constructor(config: ReceiverConfig) {\n this.currentSigningKey = config.currentSigningKey;\n this.nextSigningKey = config.nextSigningKey;\n }\n\n /**\n * Verify the signature of a request.\n *\n * Tries to verify the signature with the current signing key.\n * If that fails, maybe because you have rotated the keys recently, it will\n * try to verify the signature with the next signing key.\n *\n * If that fails, the signature is invalid and a `SignatureError` is thrown.\n */\n public async verify(req: VerifyRequest): Promise<boolean> {\n const isValid = await this.verifyWithKey(this.currentSigningKey, req);\n if (isValid) {\n return true;\n }\n return this.verifyWithKey(this.nextSigningKey, req);\n }\n\n /**\n * Verify signature with a specific signing key\n */\n private async verifyWithKey(key: string, req: VerifyRequest): Promise<boolean> {\n const jwt = await jose\n .jwtVerify(req.signature, new TextEncoder().encode(key), {\n issuer: \"Upstash\",\n clockTolerance: req.clockTolerance,\n })\n .catch((e) => {\n throw new SignatureError((e as Error).message);\n });\n\n const p = jwt.payload as {\n iss: string;\n sub: string;\n exp: number;\n nbf: number;\n iat: number;\n jti: string;\n body: string;\n };\n\n if (typeof req.url !== \"undefined\" && p.sub !== req.url) {\n throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);\n }\n\n const bodyHash = crypto.SHA256(req.body as string).toString(crypto.enc.Base64url);\n\n const padding = new RegExp(/=+$/);\n\n if (p.body.replace(padding, \"\") !== bodyHash.replace(padding, \"\")) {\n throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);\n }\n\n return true;\n }\n}\n"]}
@@ -0,0 +1,112 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __knownSymbol = (name, symbol) => {
8
+ if (symbol = Symbol[name])
9
+ return symbol;
10
+ throw Error("Symbol." + name + " is not defined");
11
+ };
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __async = (__this, __arguments, generator) => {
26
+ return new Promise((resolve, reject) => {
27
+ var fulfilled = (value) => {
28
+ try {
29
+ step(generator.next(value));
30
+ } catch (e) {
31
+ reject(e);
32
+ }
33
+ };
34
+ var rejected = (value) => {
35
+ try {
36
+ step(generator.throw(value));
37
+ } catch (e) {
38
+ reject(e);
39
+ }
40
+ };
41
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
42
+ step((generator = generator.apply(__this, __arguments)).next());
43
+ });
44
+ };
45
+ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
46
+
47
+ // src/receiver.ts
48
+ import * as jose from "jose";
49
+ import * as crypto from "crypto-js";
50
+ var SignatureError = class extends Error {
51
+ constructor(message) {
52
+ super(message);
53
+ this.name = "SignatureError";
54
+ }
55
+ };
56
+ var Receiver = class {
57
+ constructor(config) {
58
+ this.currentSigningKey = config.currentSigningKey;
59
+ this.nextSigningKey = config.nextSigningKey;
60
+ }
61
+ /**
62
+ * Verify the signature of a request.
63
+ *
64
+ * Tries to verify the signature with the current signing key.
65
+ * If that fails, maybe because you have rotated the keys recently, it will
66
+ * try to verify the signature with the next signing key.
67
+ *
68
+ * If that fails, the signature is invalid and a `SignatureError` is thrown.
69
+ */
70
+ verify(req) {
71
+ return __async(this, null, function* () {
72
+ const isValid = yield this.verifyWithKey(this.currentSigningKey, req);
73
+ if (isValid) {
74
+ return true;
75
+ }
76
+ return this.verifyWithKey(this.nextSigningKey, req);
77
+ });
78
+ }
79
+ /**
80
+ * Verify signature with a specific signing key
81
+ */
82
+ verifyWithKey(key, req) {
83
+ return __async(this, null, function* () {
84
+ const jwt = yield jose.jwtVerify(req.signature, new TextEncoder().encode(key), {
85
+ issuer: "Upstash",
86
+ clockTolerance: req.clockTolerance
87
+ }).catch((e) => {
88
+ throw new SignatureError(e.message);
89
+ });
90
+ const p = jwt.payload;
91
+ if (typeof req.url !== "undefined" && p.sub !== req.url) {
92
+ throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);
93
+ }
94
+ const bodyHash = crypto.SHA256(req.body).toString(crypto.enc.Base64url);
95
+ const padding = new RegExp(/=+$/);
96
+ if (p.body.replace(padding, "") !== bodyHash.replace(padding, "")) {
97
+ throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);
98
+ }
99
+ return true;
100
+ });
101
+ }
102
+ };
103
+
104
+ export {
105
+ __spreadValues,
106
+ __spreadProps,
107
+ __async,
108
+ __forAwait,
109
+ SignatureError,
110
+ Receiver
111
+ };
112
+ //# sourceMappingURL=chunk-G4FL5XMG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/receiver.ts"],"sourcesContent":["import * as jose from \"jose\";\nimport * as crypto from \"crypto-js\";\n\n/**\n * Necessary to verify the signature of a request.\n */\nexport type ReceiverConfig = {\n /**\n * The current signing key. Get it from `https://console.upstash.com/qstash\n */\n currentSigningKey: string;\n /**\n * The next signing key. Get it from `https://console.upstash.com/qstash\n */\n nextSigningKey: string;\n};\n\nexport type VerifyRequest = {\n /**\n * The signature from the `upstash-signature` header.\n */\n signature: string;\n\n /**\n * The raw request body.\n */\n body: string;\n\n /**\n * URL of the endpoint where the request was sent to.\n *\n * Omit empty to disable checking the url.\n */\n url?: string;\n\n /**\n * Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers\n *\n * @default 0\n */\n clockTolerance?: number;\n};\n\nexport class SignatureError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SignatureError\";\n }\n}\n/**\n * Receiver offers a simlpe way to verify the signature of a request.\n */\nexport class Receiver {\n private readonly currentSigningKey: string;\n private readonly nextSigningKey: string;\n\n constructor(config: ReceiverConfig) {\n this.currentSigningKey = config.currentSigningKey;\n this.nextSigningKey = config.nextSigningKey;\n }\n\n /**\n * Verify the signature of a request.\n *\n * Tries to verify the signature with the current signing key.\n * If that fails, maybe because you have rotated the keys recently, it will\n * try to verify the signature with the next signing key.\n *\n * If that fails, the signature is invalid and a `SignatureError` is thrown.\n */\n public async verify(req: VerifyRequest): Promise<boolean> {\n const isValid = await this.verifyWithKey(this.currentSigningKey, req);\n if (isValid) {\n return true;\n }\n return this.verifyWithKey(this.nextSigningKey, req);\n }\n\n /**\n * Verify signature with a specific signing key\n */\n private async verifyWithKey(key: string, req: VerifyRequest): Promise<boolean> {\n const jwt = await jose\n .jwtVerify(req.signature, new TextEncoder().encode(key), {\n issuer: \"Upstash\",\n clockTolerance: req.clockTolerance,\n })\n .catch((e) => {\n throw new SignatureError((e as Error).message);\n });\n\n const p = jwt.payload as {\n iss: string;\n sub: string;\n exp: number;\n nbf: number;\n iat: number;\n jti: string;\n body: string;\n };\n\n if (typeof req.url !== \"undefined\" && p.sub !== req.url) {\n throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);\n }\n\n const bodyHash = crypto.SHA256(req.body as string).toString(crypto.enc.Base64url);\n\n const padding = new RegExp(/=+$/);\n\n if (p.body.replace(padding, \"\") !== bodyHash.replace(padding, \"\")) {\n throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${bodyHash}`);\n }\n\n return true;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,UAAU;AACtB,YAAY,YAAY;AA0CjB,IAAM,iBAAN,cAA6B,MAAM;AAAA,EACxC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAIO,IAAM,WAAN,MAAe;AAAA,EAIpB,YAAY,QAAwB;AAClC,SAAK,oBAAoB,OAAO;AAChC,SAAK,iBAAiB,OAAO;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWa,OAAO,KAAsC;AAAA;AACxD,YAAM,UAAU,MAAM,KAAK,cAAc,KAAK,mBAAmB,GAAG;AACpE,UAAI,SAAS;AACX,eAAO;AAAA,MACT;AACA,aAAO,KAAK,cAAc,KAAK,gBAAgB,GAAG;AAAA,IACpD;AAAA;AAAA;AAAA;AAAA;AAAA,EAKc,cAAc,KAAa,KAAsC;AAAA;AAC7E,YAAM,MAAM,MACT,eAAU,IAAI,WAAW,IAAI,YAAY,EAAE,OAAO,GAAG,GAAG;AAAA,QACvD,QAAQ;AAAA,QACR,gBAAgB,IAAI;AAAA,MACtB,CAAC,EACA,MAAM,CAAC,MAAM;AACZ,cAAM,IAAI,eAAgB,EAAY,OAAO;AAAA,MAC/C,CAAC;AAEH,YAAM,IAAI,IAAI;AAUd,UAAI,OAAO,IAAI,QAAQ,eAAe,EAAE,QAAQ,IAAI,KAAK;AACvD,cAAM,IAAI,eAAe,oBAAoB,EAAE,GAAG,WAAW,IAAI,GAAG,EAAE;AAAA,MACxE;AAEA,YAAM,WAAkB,cAAO,IAAI,IAAc,EAAE,SAAgB,WAAI,SAAS;AAEhF,YAAM,UAAU,IAAI,OAAO,KAAK;AAEhC,UAAI,EAAE,KAAK,QAAQ,SAAS,EAAE,MAAM,SAAS,QAAQ,SAAS,EAAE,GAAG;AACjE,cAAM,IAAI,eAAe,mCAAmC,EAAE,IAAI,UAAU,QAAQ,EAAE;AAAA,MACxF;AAEA,aAAO;AAAA,IACT;AAAA;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,3 @@
1
- import { NextApiHandler } from 'next';
2
- import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
3
-
4
1
  /**
5
2
  * Necessary to verify the signature of a request.
6
3
  */
@@ -559,34 +556,4 @@ declare class QstashError extends Error {
559
556
  constructor(message: string);
560
557
  }
561
558
 
562
- type VerifySignaturConfig = {
563
- currentSigningKey?: string;
564
- nextSigningKey?: string;
565
- /**
566
- * The url of this api route, including the protocol.
567
- *
568
- * If you omit this, the url will be automatically determined by checking the `VERCEL_URL` env variable and assuming `https`
569
- */
570
- url?: string;
571
- /**
572
- * Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers
573
- *
574
- * @default 0
575
- */
576
- clockTolerance?: number;
577
- };
578
- declare function verifySignature(handler: NextApiHandler, config?: VerifySignaturConfig): NextApiHandler;
579
- declare function verifySignatureEdge(handler: (req: NextRequest, nfe: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignaturConfig): (req: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>;
580
-
581
- type nextjs_VerifySignaturConfig = VerifySignaturConfig;
582
- declare const nextjs_verifySignature: typeof verifySignature;
583
- declare const nextjs_verifySignatureEdge: typeof verifySignatureEdge;
584
- declare namespace nextjs {
585
- export {
586
- nextjs_VerifySignaturConfig as VerifySignaturConfig,
587
- nextjs_verifySignature as verifySignature,
588
- nextjs_verifySignatureEdge as verifySignatureEdge,
589
- };
590
- }
591
-
592
- export { AddEndpointsRequest, Client, CreateScheduleRequest, Endpoint, Event, EventsRequest, GetEventsResponse, Message, Messages, nextjs as Nextjs, PublishJsonRequest, PublishRequest, QstashError, Receiver, ReceiverConfig, RemoveEndpointsRequest, Schedule, Schedules, SignatureError, State, Topic, Topics, VerifyRequest, WithCursor };
559
+ export { AddEndpointsRequest, Client, CreateScheduleRequest, Endpoint, Event, EventsRequest, GetEventsResponse, Message, Messages, PublishJsonRequest, PublishRequest, QstashError, Receiver, ReceiverConfig, RemoveEndpointsRequest, Schedule, Schedules, SignatureError, State, Topic, Topics, VerifyRequest, WithCursor };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { NextApiHandler } from 'next';
2
- import { NextRequest, NextFetchEvent, NextResponse } from 'next/server';
3
-
4
1
  /**
5
2
  * Necessary to verify the signature of a request.
6
3
  */
@@ -559,34 +556,4 @@ declare class QstashError extends Error {
559
556
  constructor(message: string);
560
557
  }
561
558
 
562
- type VerifySignaturConfig = {
563
- currentSigningKey?: string;
564
- nextSigningKey?: string;
565
- /**
566
- * The url of this api route, including the protocol.
567
- *
568
- * If you omit this, the url will be automatically determined by checking the `VERCEL_URL` env variable and assuming `https`
569
- */
570
- url?: string;
571
- /**
572
- * Number of seconds to tolerate when checking `nbf` and `exp` claims, to deal with small clock differences among different servers
573
- *
574
- * @default 0
575
- */
576
- clockTolerance?: number;
577
- };
578
- declare function verifySignature(handler: NextApiHandler, config?: VerifySignaturConfig): NextApiHandler;
579
- declare function verifySignatureEdge(handler: (req: NextRequest, nfe: NextFetchEvent) => NextResponse | Promise<NextResponse>, config?: VerifySignaturConfig): (req: NextRequest, nfe: NextFetchEvent) => Promise<NextResponse<unknown>>;
580
-
581
- type nextjs_VerifySignaturConfig = VerifySignaturConfig;
582
- declare const nextjs_verifySignature: typeof verifySignature;
583
- declare const nextjs_verifySignatureEdge: typeof verifySignatureEdge;
584
- declare namespace nextjs {
585
- export {
586
- nextjs_VerifySignaturConfig as VerifySignaturConfig,
587
- nextjs_verifySignature as verifySignature,
588
- nextjs_verifySignatureEdge as verifySignatureEdge,
589
- };
590
- }
591
-
592
- export { AddEndpointsRequest, Client, CreateScheduleRequest, Endpoint, Event, EventsRequest, GetEventsResponse, Message, Messages, nextjs as Nextjs, PublishJsonRequest, PublishRequest, QstashError, Receiver, ReceiverConfig, RemoveEndpointsRequest, Schedule, Schedules, SignatureError, State, Topic, Topics, VerifyRequest, WithCursor };
559
+ export { AddEndpointsRequest, Client, CreateScheduleRequest, Endpoint, Event, EventsRequest, GetEventsResponse, Message, Messages, PublishJsonRequest, PublishRequest, QstashError, Receiver, ReceiverConfig, RemoveEndpointsRequest, Schedule, Schedules, SignatureError, State, Topic, Topics, VerifyRequest, WithCursor };