pgp-simple
v0.0.2
Published
Simplified wrapper around OpenPGP.js for secure encryption and decryption.
Downloads
52
Readme
pgp-simple
Simplified wrapper around OpenPGP.js for secure encryption and decryption.
Installation
npm install pgp-simple
Usage
const PGP = require('pgp-simple');
(async () => {
let key1 = await PGP.generateKey("pa$$phrase1");
let key2 = await PGP.generateKey("pa$$phrase2");
let pgp1 = new PGP(key1);
let pgp2 = new PGP(key2);
let message = 'Hello world; this is a very simple way of using PGP';
let encrypted = await pgp1.encrypt(key2.publicKey, message);
let decrypted = await pgp2.decrypt(key1.publicKey, encrypted);
console.log(encrypted);
console.log(decrypted);
})();
Browser
Build for browser:
npm run build
<script src="dist/openpgp.min.js"></script>
<script src="dist/pgp-simple.js"></script>
<script>
PGP.generateKey().then(console.log);
</script>