multi-layers-encryption
v1.0.0
Published
Encryption and decryption with multiple configurable layers
Downloads
3
Maintainers
Readme
multi-layers-encryption
Flexible encryption/decryption library with multiple configurable layers.
รองรับการเข้ารหัสหลายชั้น (Multi-layer) สามารถเลือก algorithm, secret key และ salt ได้เองในแต่ละชั้น
Features
- Choose multiple algorithms (AES, 3DES, etc.)
- Set secret key and salt per layer
.encrypt(content)→ encrypt through all layers.decrypt(content)→ decrypt back through all layers
Installation
npm install multi-layers-encryptionfor yarn:
yarn add multi-layers-encryptionExample:
JavaScript / TypeScript
import MultiLayerEncryption from "multi-layers-encryption";
const layers = [
{ algorithm: "aes-256-cbc", key: "layer1Key", salt: "layer1Salt" },
{ algorithm: "aes-192-cbc", key: "layer2Key", salt: "layer2Salt" }
];
const enc = new MultiLayerEncryption(layers);
const secret = "Hello Multi-Layer!";
const encrypted = enc.encrypt(secret);
const decrypted = enc.decrypt(encrypted);
console.log("Encrypted:", encrypted);
console.log("Decrypted:", decrypted);Output
Encrypted: {"algorithm":"aes-192-cbc","iv":"...","data":"..."}
Decrypted: Hello Multi-Layer!Algorithms Supported
Depends on Node.js crypto module (commonly supports):
- aes-256-cbc
- aes-192-cbc
- aes-128-cbc
- des-ede3-cbc
