Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split out cli logic from minilock implementation #1

Open
max-mapper opened this issue Jul 26, 2015 · 1 comment
Open

split out cli logic from minilock implementation #1

max-mapper opened this issue Jul 26, 2015 · 1 comment

Comments

@max-mapper
Copy link

hey this is super cool, but I am interested in requiring() the minilock parts. it would be really nice to have a separate JS API from the CLI API (e.g. separate files) in the future. thanks :)

@mjethani
Copy link
Owner

You can now use the miniLock-cli module to write simple programs to encrypt and decrypt files.

Here's an example:

import * as miniLock from 'minilock-cli/module';

const fromEmail = '[email protected]';
const fromPassphrase = 'hello';

const toId = '29H7h4xLAjMsxA9Jv5SMNkCCNvpftFm825mjesN9h74MTw';

miniLock.getKeyPair(fromPassphrase, fromEmail, keyPair => {
  miniLock.encryptStream(keyPair, process.stdin, process.stdout, [ toId ], {
    armor: true
  }, (error, outputByteCount) => {
    if (error) {
      console.error(error.toString());
    } else {
      console.error(`Wrote ${outputByteCount} bytes.`);
    }
  })
});

The above program reads from standard input and writes the encrypted data to standard output.

This is still under development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants