(secret: string, body: any, xHubSignature256: string)
| 77 | // Web hooks |
| 78 | |
| 79 | const 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 |
no outgoing calls
no test coverage detected