@octokit/webhooks-methods
Advanced tools
Comparing version 5.0.0-beta.3 to 5.0.0-beta.4
@@ -6,3 +6,2 @@ // pkg/dist-src/node/sign.js | ||
var Algorithm = /* @__PURE__ */ ((Algorithm2) => { | ||
Algorithm2["SHA1"] = "sha1"; | ||
Algorithm2["SHA256"] = "sha256"; | ||
@@ -13,3 +12,3 @@ return Algorithm2; | ||
// pkg/dist-src/version.js | ||
var VERSION = "5.0.0-beta.3"; | ||
var VERSION = "5.0.0-beta.4"; | ||
@@ -32,3 +31,3 @@ // pkg/dist-src/node/sign.js | ||
throw new TypeError( | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha1' or 'sha256'` | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha256'` | ||
); | ||
@@ -43,9 +42,2 @@ } | ||
import { Buffer } from "node:buffer"; | ||
// pkg/dist-src/utils.js | ||
var getAlgorithm = (signature) => { | ||
return signature.startsWith("sha256=") ? "sha256" : "sha1"; | ||
}; | ||
// pkg/dist-src/node/verify.js | ||
async function verify(secret, eventPayload, signature) { | ||
@@ -63,3 +55,3 @@ if (!secret || !eventPayload || !signature) { | ||
const signatureBuffer = Buffer.from(signature); | ||
const algorithm = getAlgorithm(signature); | ||
const algorithm = "sha256"; | ||
const verificationBuffer = Buffer.from( | ||
@@ -66,0 +58,0 @@ await sign({ secret, algorithm }, eventPayload) |
@@ -19,3 +19,3 @@ import { createHmac } from "node:crypto"; | ||
throw new TypeError( | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha1' or 'sha256'` | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha256'` | ||
); | ||
@@ -22,0 +22,0 @@ } |
@@ -5,3 +5,2 @@ import { timingSafeEqual } from "node:crypto"; | ||
import { VERSION } from "../version.js"; | ||
import { getAlgorithm } from "../utils.js"; | ||
async function verify(secret, eventPayload, signature) { | ||
@@ -19,3 +18,3 @@ if (!secret || !eventPayload || !signature) { | ||
const signatureBuffer = Buffer.from(signature); | ||
const algorithm = getAlgorithm(signature); | ||
const algorithm = "sha256"; | ||
const verificationBuffer = Buffer.from( | ||
@@ -22,0 +21,0 @@ await sign({ secret, algorithm }, eventPayload) |
var Algorithm = /* @__PURE__ */ ((Algorithm2) => { | ||
Algorithm2["SHA1"] = "sha1"; | ||
Algorithm2["SHA256"] = "sha256"; | ||
@@ -4,0 +3,0 @@ return Algorithm2; |
@@ -1,4 +0,4 @@ | ||
const VERSION = "5.0.0-beta.3"; | ||
const VERSION = "5.0.0-beta.4"; | ||
export { | ||
VERSION | ||
}; |
import { Algorithm } from "./types.js"; | ||
import { getAlgorithm } from "./utils.js"; | ||
const enc = new TextEncoder(); | ||
@@ -16,3 +15,2 @@ function hexToUInt8Array(string) { | ||
return { | ||
[Algorithm.SHA1]: "SHA-1", | ||
[Algorithm.SHA256]: "SHA-256" | ||
@@ -52,3 +50,3 @@ }[algorithm]; | ||
throw new TypeError( | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha1' or 'sha256'` | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha256'` | ||
); | ||
@@ -74,3 +72,3 @@ } | ||
} | ||
const algorithm = getAlgorithm(signature); | ||
const algorithm = "sha256"; | ||
return await crypto.subtle.verify( | ||
@@ -77,0 +75,0 @@ "HMAC", |
export declare enum Algorithm { | ||
SHA1 = "sha1", | ||
SHA256 = "sha256" | ||
} | ||
export type AlgorithmLike = Algorithm | "sha1" | "sha256"; | ||
export type AlgorithmLike = Algorithm | "sha256"; | ||
export type SignOptions = { | ||
@@ -7,0 +6,0 @@ secret: string; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "5.0.0-beta.3"; | ||
export declare const VERSION = "5.0.0-beta.4"; |
// pkg/dist-src/types.js | ||
var Algorithm = /* @__PURE__ */ ((Algorithm2) => { | ||
Algorithm2["SHA1"] = "sha1"; | ||
Algorithm2["SHA256"] = "sha256"; | ||
@@ -8,7 +7,2 @@ return Algorithm2; | ||
// pkg/dist-src/utils.js | ||
var getAlgorithm = (signature) => { | ||
return signature.startsWith("sha256=") ? "sha256" : "sha1"; | ||
}; | ||
// pkg/dist-src/web.js | ||
@@ -28,3 +22,2 @@ var enc = new TextEncoder(); | ||
return { | ||
[Algorithm.SHA1]: "SHA-1", | ||
[Algorithm.SHA256]: "SHA-256" | ||
@@ -64,3 +57,3 @@ }[algorithm]; | ||
throw new TypeError( | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha1' or 'sha256'` | ||
`[@octokit/webhooks] Algorithm ${algorithm} is not supported. Must be 'sha256'` | ||
); | ||
@@ -86,3 +79,3 @@ } | ||
} | ||
const algorithm = getAlgorithm(signature); | ||
const algorithm = "sha256"; | ||
return await crypto.subtle.verify( | ||
@@ -89,0 +82,0 @@ "HMAC", |
@@ -7,3 +7,3 @@ { | ||
"type": "module", | ||
"version": "5.0.0-beta.3", | ||
"version": "5.0.0-beta.4", | ||
"description": "Methods to handle GitHub Webhook requests", | ||
@@ -10,0 +10,0 @@ "repository": "github:octokit/webhooks-methods.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27770
19
360