Upgrade octokit to v4.1.2
This commit is contained in:
parent
dbbcbe019d
commit
c1745a9831
1214 changed files with 160765 additions and 0 deletions
26
node_modules/@octokit/webhooks-methods/dist-src/node/verify.js
generated
vendored
Normal file
26
node_modules/@octokit/webhooks-methods/dist-src/node/verify.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { timingSafeEqual } from "node:crypto";
|
||||
import { Buffer } from "node:buffer";
|
||||
import { sign } from "./sign.js";
|
||||
import { VERSION } from "../version.js";
|
||||
async function verify(secret, eventPayload, signature) {
|
||||
if (!secret || !eventPayload || !signature) {
|
||||
throw new TypeError(
|
||||
"[@octokit/webhooks-methods] secret, eventPayload & signature required"
|
||||
);
|
||||
}
|
||||
if (typeof eventPayload !== "string") {
|
||||
throw new TypeError(
|
||||
"[@octokit/webhooks-methods] eventPayload must be a string"
|
||||
);
|
||||
}
|
||||
const signatureBuffer = Buffer.from(signature);
|
||||
const verificationBuffer = Buffer.from(await sign(secret, eventPayload));
|
||||
if (signatureBuffer.length !== verificationBuffer.length) {
|
||||
return false;
|
||||
}
|
||||
return timingSafeEqual(signatureBuffer, verificationBuffer);
|
||||
}
|
||||
verify.VERSION = VERSION;
|
||||
export {
|
||||
verify
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue