coding / coding/Webhook.v2.Demo
使用Egg.js始终无法校验成功
Open
- Dominant language
- JavaScript
- Stars
- 4
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
```
verifyWebhook() {
const { ctx } = this;
if (!ctx.request.headers['user-agent'].includes('Coding.net Hook')) {
return false;
}
const theirSignature = ctx.request.headers['x-coding-signature'];
const payload = JSON.stringify(ctx.request.body);
const secret = '123';
const ourSignature = `sha1=${crypto.createHmac('sha1', secret).update(payload).digest('hex')}`;
return crypto.timingSafeEqual(Buffer.from(theirSignature), Buffer.from(ourSignature));
// 始终返回false,怎么回事??
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.