server test

This commit is contained in:
2024-06-20 17:59:40 +01:00
parent 67bf94c851
commit 952e44d834

View File

@@ -69,7 +69,9 @@ app.post('/api', (req, res) => {
const digest = hmac.update(payload).digest('hex');
const bufferSignature = Buffer.from(signature, 'hex');
const bufferDigest = Buffer.from(digest, 'hex');
console.log(bufferSignature.length, bufferDigest.length)
if (bufferSignature.length === bufferDigest.length && crypto.timingSafeEqual(bufferSignature, bufferDigest)) {
// Secret is valid, update the repository
res.status(200).send('Repository updated successfully');