pii-agent-js
v1.0.7
Published
FABD Horizontal PII Agent Libraries
Downloads
48
Readme
AGENT PII (Javascript)
API Client
- [x]
encryptWithAes
- [x]
decryptWithAes
- [x]
buildHeap
- [x]
AesCipher
- [ ]
buildBlindIndex
- [ ]
searchContents
- [ ]
searchContentFullText
Installation this package to your project
Run
npm
oryarn
to install:npm i pii-agent-js
Set the keys in your
.env
file:CRYPTO_AES_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CRYPTO_HMAC_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Usage Examples
Test Encrypt and Decrypt
const CryptoJs = require('../index')
const data = 'Mohamad Ali Farhan'
// encrypt
const encryptedHex = CryptoJs.encryptWithAes('AES_256_CBC', data);
console.log('Encrypted Data (Hex):', encryptedHex);
// decrypt
const decryptedData = CryptoJs.decryptWithAes('AES_256_CBC', encryptedHex.Value);
console.log('Decrypt Data:', decryptedData);
Test Build Heap
const CryptoJs = require('../index');
const createUser = async (userData) => {
const email = await CryptoJs.buildHeap(userData.email);
const phone = await CryptoJs.buildHeap(userData.phone);
const nik = await CryptoJs.buildHeap(userData.nik);
console.log(email);
console.log(phone);
console.log(nik);
};
createUser({
name: 'John Doe',
email: '[email protected]',
phone: '081234567890',
nik: '3215012306970009',
});
Change Log
See Changelog for more information.
Contributing
Contributions are welcome! See Contributing.
Author
License
Licensed under the MIT License - see the LICENSE file for details.