Last active
February 26, 2019 19:09
-
-
Save gaboelnuevo/7525e686cb03e01605ea0a50f92fa71a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hash = require("object-hash"); | |
export const generate = (req: any) => { | |
const company = req.payload && req.payload.user.company._id.toString(); | |
const obj = { | |
method: req.method, | |
originalUrl: req.originalUrl, | |
auth: req.header("Authorization"), | |
device: req.header("Device-Unique-Id"), | |
body: req.body && hash(req.body) | |
}; | |
const digest = hash(obj); | |
return `${company}:${digest}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment