openvibers/openvibe.live Commits
payments: use the module's crypto import
Changes
@@@ -206,10 +206,9 @@ function ccbillVerify(query) {const secret = s('ccbill_webhook_secret');if (!secret) return false;// Constant-time: compare SHA-256 digests so neither length nor content leaks through timing.-- const nodeCrypto = require('crypto');-- const a = nodeCrypto.createHash('sha256').update(String(query.secret || '')).digest();-- const b = nodeCrypto.createHash('sha256').update(String(secret)).digest();-- return nodeCrypto.timingSafeEqual(a, b);++ const a = crypto.createHash('sha256').update(String(query.secret || '')).digest();++ const b = crypto.createHash('sha256').update(String(secret)).digest();++ return crypto.timingSafeEqual(a, b);}// ══════════════════════════════════════════ CRYPTO (NOWPayments) ══
@@ -206,10 +206,9 @@ function ccbillVerify(query) {
@@ -206,10 +206,9 @@ function ccbillVerify(query) {
const secret = s('ccbill_webhook_secret');
const secret = s('ccbill_webhook_secret');
if (!secret) return false;
if (!secret) return false;
// Constant-time: compare SHA-256 digests so neither length nor content leaks through timing.
// Constant-time: compare SHA-256 digests so neither length nor content leaks through timing.
- const nodeCrypto = require('crypto');
- const a = nodeCrypto.createHash('sha256').update(String(query.secret || '')).digest();
- const b = nodeCrypto.createHash('sha256').update(String(secret)).digest();
- return nodeCrypto.timingSafeEqual(a, b);
+ const a = crypto.createHash('sha256').update(String(query.secret || '')).digest();
+ const b = crypto.createHash('sha256').update(String(secret)).digest();
+ return crypto.timingSafeEqual(a, b);
}
}
// ══════════════════════════════════════════ CRYPTO (NOWPayments) ══
// ══════════════════════════════════════════ CRYPTO (NOWPayments) ══