ZHash. Encrypt without doing encryption
npm install twb-zhashbash
npm i twb-zhash
`$3
`typescriptimport {
zHashGuard,
zDecodeGuard,
zhashGuardValidation
} from "twb-zhash";
// must be as ENV in both side, FE-BE
const zKey: IZKey = {
key: "fShewpyamBky7dEP",
iv: "thisismysampleiv"
}
(async () => {
// encode
const deviceId = uuidv4()
const hashCode = await zHashGuard(payloadHit, zKey);
// decode
console.log("decode", await zDecodeGuard(hashCode, zKey))
// validate encoded hash
console.log("validation", await zhashGuardValidation(hashCode, zKey));
})()
`$3
Cd to ./example`, index.ts for server-side and req.ts for client-side.