reply.github.com 如何工作?我注意到你可以回复Github的电子邮件,例如:
Reply-To: example/foobar <reply+000bafafcb72e8dc89884bda7ce639d101cc16b69010bcaa92cf0000000117ad897992a169ce14271668@reply.github.com>
X-Auto-Response-Suppress: All
回复+${84_chars}@reply.github.com
这足以附加您的消息:
- 特定的 Github 问题
- 在您的姓名或用户 ID 中
我的问题是,那是什么编码?
这不是HMAC,因为我相信您需要使用该编码发送未加密的消息。
毕竟HMAC就是答案。没有必要隐藏我试图验证的数据。消息身份验证代码 (MAC( 成为我在后端验证的签名组件。
const crypto = require('crypto')
const secret = process.env.API_ACCESS_TOKEN
function genreply (bugID, secret) {
const hash = crypto.createHmac('sha256', secret)
.update(bugID)
.digest('hex')
return `reply+${bugID}-${hash}@example.com`
}
console.log(genreply('61825', secret))