mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-23 00:21:28 +00:00
feat: add gitea/forgejo support
This commit is contained in:
parent
ace036c209
commit
aec0d1a257
43 changed files with 683 additions and 130 deletions
11
src/providers/github/verify.ts
Normal file
11
src/providers/github/verify.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { hmacSha256Hex, timingSafeEqual } from "../hmac";
|
||||
|
||||
export async function verifySignature(
|
||||
payload: string,
|
||||
signature: string | undefined,
|
||||
secret: string,
|
||||
): Promise<boolean> {
|
||||
if (!signature || !secret) return false;
|
||||
const expected = `sha256=${await hmacSha256Hex(secret, payload)}`;
|
||||
return timingSafeEqual(signature, expected);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue