egg-cipher
Cipher for egg.
Install
npm i egg-cipher --save
Edit config/plugin.js
exportscipher = enable: true package: 'egg-cipher';
Examples
const letter = "Across the Great Wall we can reach every corner in the world.";const encryptedLetter = thisappcipher;const decryptedLetter = thisappcipher;console;
TTL for encrypted data: expire after one hour
const letter = "Across the Great Wall we can reach every corner in the world.";const encryptedLetter = thisappcipher;const decryptedLetter = thisappcipher;console;
config
config/config.default.js
configcipher = client: // required, passphrase is the encoding key passphrase: 'nKJzOSeabeaOsIV4cK3H0lEO07U4DzGf' // default bf-cbc cipher: 'bf-cbc' // default input encoding: utf-8 inputEncoding: 'utf8' // default output encoding: hex outputEncoding: 'hex' // default ttl:0, means never expires. defaultTTL: 0 // default iv length 8 for bf-cbc ivLength: 8 ;