mirror of
https://github.com/itsnaveenk/bazar3.git
synced 2025-12-19 19:37:06 +00:00
17 lines
467 B
JavaScript
17 lines
467 B
JavaScript
const crypto = require('crypto');
|
|
|
|
module.exports = {
|
|
// IP Anonymization
|
|
anonymizeIP: (req, res, next) => {
|
|
const ip = req.ip || '127.0.0.1';
|
|
const salt = Math.floor(Date.now() / 3600000); // Hourly salt
|
|
req.anonymizedIP = crypto.createHash('sha3-256')
|
|
.update(ip + salt + process.env.IP_PEPPER)
|
|
.digest('hex');
|
|
next();
|
|
},
|
|
sanitizeInput: (req, res, next) => {
|
|
// ...implement input sanitization if needed...
|
|
next();
|
|
}
|
|
}; |