1.0.7 • Published 9 months ago

pii-agent-js v1.0.7

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
9 months ago

AGENT PII (Javascript)

API Client

  • encryptWithAes
  • decryptWithAes
  • buildHeap
  • AesCipher
  • buildBlindIndex
  • searchContents
  • searchContentFullText

Installation this package to your project

  1. Run npm or yarn to install:

    npm i pii-agent-js
  2. 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: 'john.doe@example.com',
    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.


1.0.7

9 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago