Add telemetry support from via Judd
This commit is contained in:
parent
536eeedff5
commit
227002a9ef
19 changed files with 4110 additions and 4 deletions
14
judd/middleware/validate-boss-digest.js
Normal file
14
judd/middleware/validate-boss-digest.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
const crypto = require('crypto');
|
||||
|
||||
function validateBOSSDigestMiddleware(request, response, next) {
|
||||
const calculatedHash = crypto.createHash('sha1').update(request.rawBody).digest('hex');
|
||||
const expectedHash = request.headers['x-boss-digest'];
|
||||
|
||||
if (calculatedHash !== expectedHash) {
|
||||
return next('Provided BOSS digest does not match the calculated hash');
|
||||
}
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
module.exports = validateBOSSDigestMiddleware;
|
||||
Loading…
Reference in a new issue