0.1.1 • Published 4 years ago
mercantil-crypto v0.1.1
Mercantil API encryption module for Node.js
For Mercantil API integration, we recommend mercantil-api by the same people.
Highlights
- AES algorithm
- ECB mode
- PKCS#7 padding
- Base64 encryption
- UTF-8 decryption
- Actively maintained
Install
$ yarn add mercantil-crypto
Usage
import MercantilCrypto from 'mercantil-crypto';
const encryptionKey = process.env.MERCANTIL_ENCRYPTION_KEY as string;
const instance = new MercantilCrypto(encryptionKey);
const textToEncrypt = '1234';
const encrypted = instance.encrypt(textToEncrypt);
console.log(encrypted); // 'F5zai+S5sgmbdNPDEVRlVg=='
const decrypted = instance.decrypt(encrypted);
console.log(decrypted); // '1234'
Related
- mercantil-api - Got convenience wrapper to interact with the Mercantil API
- Mercantil external documentation - Mercantil extended documentation
Maintainer
Miguel Padrino |