Facebook Conceal for node and browser written in ts
npm install facebook-concealCompatible with Facebook Conceal 2.0
``js
const { Conceal } = require('facebook-conceal');
const conceal = new Conceal('my-password');
// or
const conceal = new Conceal('my-password', myKey, encoding);
// encoding: hex or base64
// myKey: 32 bytes with ${encoding} encoded string
`
`js`
const plain = 'hello world @ 2020';
const encrypted = conceal.encryptStr(plain);
const decrypted = conceal.decryptStr(encrypted);
`js${srcFilePath}.enc
const srcFilePath = 'test/xxy007.png';
const encFilePath = ;dec.${srcFilePath}
const decFilePath = ;
conceal
.encryptFile(path, encFilePath)
.then(() => conceal.decryptFile(encFilePath, decFilePath))
.then(() => {
console.log('done');
})
.catch((err) => {
console.log(err);
});
`
`html
``