feat: add gitea/forgejo support

This commit is contained in:
RhenCloud committed 2026-08-11 22:01:04 +08:00
1 parent ace036c209
commit aec0d1a257
43 files changed
+683 -130

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
import { hmacSha256Hex, timingSafeEqual } from "../hmac";
/**
* Gitea signs webhooks with the HMAC-SHA256 hex digest of the raw body in the
* `X-Gitea-Signature` header (no `sha256=` prefix, unlike GitHub).
*/
export async function verifyGiteaSignature(
payload: string,
signature: string | undefined,
secret: string | undefined,
): Promise<boolean> {
if (!signature || !secret) return false;
const expected = await hmacSha256Hex(secret, payload);
return timingSafeEqual(signature, expected);
}