MCPcopy Create free account
hub / github.com/Devographics/Monorepo / verifyGhWebhookSignature

Function verifyGhWebhookSignature

api/src/external_apis/github.ts:79–84  ·  view source on GitHub ↗
(secret: string, body: any, xHubSignature256: string)

Source from the content-addressed store, hash-verified

77// Web hooks
78
79const verifyGhWebhookSignature = (secret: string, body: any, xHubSignature256: string) => {
80 const signature = crypto.createHmac('sha256', secret).update(JSON.stringify(body)).digest('hex')
81 let trusted = Buffer.from(`sha256=${signature}`, 'ascii')
82 let untrusted = Buffer.from(xHubSignature256, 'ascii')
83 return crypto.timingSafeEqual(trusted, untrusted)
84}
85
86/**
87 * GitHub webhooks allow reloading the API on locales/entities/surveys changes

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected