facebook-conceal
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    Facebook Conceal for node.js

    Compatible with Facebook Conceal 2.0

    Usage

    Conceal

    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

    String

    const plain = 'hello world @ 2020';
    const encrypted = conceal.encryptStr(plain);
    const decrypted = conceal.decryptStr(encrypted);

    File

    const srcFilePath = 'test/xxy007.png';
    const encFilePath = `${srcFilePath}.enc`;
    const decFilePath = `dec.${srcFilePath}`;
     
    conceal
      .encryptFile(path, encFilePath)
      .then(() => conceal.decryptFile(encFilePath, decFilePath))
      .then(() => {
        console.log('done');
      })
      .catch((err) => {
        console.log(err);
      });

    Using is Browser

    <script src="https://cdn.jsdelivr.net/npm/almond@0.3.3/almond.min.js"></script>
    <script src="./facebook-conceal.bundle.js"></script>
     
    <script>
      const { Conceal } = require('facebook-conceal');
      const conceal = new Conceal('my-password');
     
      (async () => {
        const plain = 'hello world @ 2020';
        const encrypted = await conceal.encryptStr(plain);
        const decrypted = await conceal.decryptStr(encrypted);
      })();
    </script> 

    Keywords

    none

    Install

    npm i facebook-conceal

    DownloadsWeekly Downloads

    0

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    35.3 kB

    Total Files

    17

    Last publish

    Collaborators

    • keng42