twb-zhash
v3.0.8
Published
ZHash. Encrypt without doing encryption
Downloads
135
Readme
Twb-ZHash
Encrypt without doing encryption
1. Installation
npm i twb-zhash
2. Basic
import {
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. Example
Cd to ./example
, index.ts for server-side and req.ts for client-side.