@upstash/qstash 0.1.8 → 0.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/README.md +7 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/fnv32.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/fnv64.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/index.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/util.js +0 -0
- package/esm/deps/deno.land/std@0.163.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs +3299 -0
- package/esm/deps/deno.land/{std@0.161.0/crypto/_wasm_crypto → std@0.163.0/crypto/_wasm}/mod.js +1 -1
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/keystack.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/mod.js +1 -1
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/timing_safe_equal.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/util.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/base64.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/base64url.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/hex.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/fmt/colors.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/_diff.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/_format.js +0 -0
- package/esm/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/asserts.js +0 -0
- package/esm/entrypoints/nextjs.js +5 -1
- package/esm/pkg/receiver.js +3 -3
- package/package.json +1 -1
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/fnv32.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/fnv64.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/index.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/util.js +0 -0
- package/script/deps/deno.land/std@0.163.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.mjs +3307 -0
- package/script/deps/deno.land/{std@0.161.0/crypto/_wasm_crypto → std@0.163.0/crypto/_wasm}/mod.js +1 -1
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/keystack.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/mod.js +1 -1
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/timing_safe_equal.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/util.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/base64.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/base64url.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/hex.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/fmt/colors.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/_diff.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/_format.js +0 -0
- package/script/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/asserts.js +0 -0
- package/script/entrypoints/nextjs.js +5 -1
- package/script/pkg/receiver.js +3 -3
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/fnv32.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/fnv64.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/index.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/_fnv/util.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0/crypto/_wasm_crypto → std@0.163.0/crypto/_wasm}/lib/deno_std_wasm_crypto.generated.d.mts +0 -0
- package/types/deps/deno.land/{std@0.161.0/crypto/_wasm_crypto → std@0.163.0/crypto/_wasm}/mod.d.ts +2 -2
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/keystack.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/mod.d.ts +1 -1
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/timing_safe_equal.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/crypto/util.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/base64.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/base64url.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/encoding/hex.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/fmt/colors.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/_diff.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/_format.d.ts +0 -0
- package/types/deps/deno.land/{std@0.161.0 → std@0.163.0}/testing/asserts.d.ts +0 -0
- package/types/entrypoints/nextjs.d.ts +6 -0
- package/types/pkg/receiver.d.ts +7 -1
- package/esm/deps/deno.land/std@0.161.0/crypto/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs +0 -3253
- package/script/deps/deno.land/std@0.161.0/crypto/_wasm_crypto/lib/deno_std_wasm_crypto.generated.mjs +0 -3261
package/esm/deps/deno.land/{std@0.161.0/crypto/_wasm_crypto → std@0.163.0/crypto/_wasm}/mod.js
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
|
2
2
|
export { DigestContext, instantiate as instantiateWasm, } from "./lib/deno_std_wasm_crypto.generated.js";
|
|
3
3
|
/**
|
|
4
|
-
* All cryptographic hash/digest algorithms supported by std/
|
|
4
|
+
* All cryptographic hash/digest algorithms supported by std/crypto/_wasm.
|
|
5
5
|
*
|
|
6
6
|
* For algorithms that are supported by WebCrypto, the name here must match the
|
|
7
7
|
* one used by WebCrypto. Otherwise we should prefer the formatting used in the
|
|
File without changes
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
20
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
21
|
-
import { digestAlgorithms as wasmDigestAlgorithms, instantiateWasm, } from "./
|
|
21
|
+
import { digestAlgorithms as wasmDigestAlgorithms, instantiateWasm, } from "./_wasm/mod.js";
|
|
22
22
|
import { timingSafeEqual } from "./timing_safe_equal.js";
|
|
23
23
|
import { fnv } from "./_fnv/index.js";
|
|
24
24
|
export { KeyStack } from "./keystack.js";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -35,7 +35,11 @@ export function verifySignature(handler, config) {
|
|
|
35
35
|
// req.url!,
|
|
36
36
|
// `https://${process.env.VERCEL_URL}`,
|
|
37
37
|
// ).href;
|
|
38
|
-
const isValid = await receiver.verify({
|
|
38
|
+
const isValid = await receiver.verify({
|
|
39
|
+
signature,
|
|
40
|
+
body,
|
|
41
|
+
clockTolerance: config?.clockTolerance,
|
|
42
|
+
});
|
|
39
43
|
if (!isValid) {
|
|
40
44
|
res.status(400);
|
|
41
45
|
res.send("Invalid signature");
|
package/esm/pkg/receiver.js
CHANGED
|
@@ -70,18 +70,18 @@ export class Receiver {
|
|
|
70
70
|
throw new SignatureError(`invalid subject: ${p.sub}, want: ${req.url}`);
|
|
71
71
|
}
|
|
72
72
|
const now = Math.floor(Date.now() / 1000);
|
|
73
|
-
if (now > p.exp) {
|
|
73
|
+
if (now - (req.clockTolerance ?? 0) > p.exp) {
|
|
74
74
|
console.log({ now, exp: p.exp });
|
|
75
75
|
throw new SignatureError("token has expired");
|
|
76
76
|
}
|
|
77
|
-
if (now < p.nbf) {
|
|
77
|
+
if (now - (req.clockTolerance ?? 0) < p.nbf) {
|
|
78
78
|
throw new SignatureError("token is not yet valid");
|
|
79
79
|
}
|
|
80
80
|
const bodyHash = await this.subtleCrypto.digest("SHA-256", typeof req.body === "string"
|
|
81
81
|
? new TextEncoder().encode(req.body)
|
|
82
82
|
: req.body);
|
|
83
83
|
const padding = new RegExp(/=+$/);
|
|
84
|
-
if (p.body.replace(padding, "")
|
|
84
|
+
if (p.body.replace(padding, "") !==
|
|
85
85
|
base64Url.encode(bodyHash).replace(padding, "")) {
|
|
86
86
|
throw new SignatureError(`body hash does not match, want: ${p.body}, got: ${base64Url.encode(bodyHash)}`);
|
|
87
87
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|