Fix examples in README

This commit is contained in:
Tankred Hase 2016-02-18 12:57:16 +07:00
parent 5fc6167730
commit 5f7ce38be7

View File

@ -59,8 +59,8 @@ options = {
passwords: ['secret stuff'] // multiple passwords possible passwords: ['secret stuff'] // multiple passwords possible
}; };
openpgp.encrypt(options).then(function(armored) { openpgp.encrypt(options).then(function(ciphertext) {
encrypted = armored; // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----' encrypted = ciphertext.data; // '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'
}); });
``` ```
@ -71,7 +71,7 @@ options = {
}; };
openpgp.decrypt(options).then(function(plaintext) { openpgp.decrypt(options).then(function(plaintext) {
// return 'Hello, World!' return plaintext.data; // 'Hello, World!'
}); });
``` ```
@ -90,8 +90,8 @@ options = {
armor: false // don't ASCII armor armor: false // don't ASCII armor
}; };
openpgp.encrypt(options).then(function(message) { openpgp.encrypt(options).then(function(ciphertext) {
encrypted = message.packets.write(); // get raw encrypted packets as Uint8Array encrypted = ciphertext.message.packets.write(); // get raw encrypted packets as Uint8Array
}); });
``` ```
@ -104,7 +104,7 @@ options = {
}; };
openpgp.decrypt(options).then(function(plaintext) { openpgp.decrypt(options).then(function(plaintext) {
// return Uint8Array([0x01, 0x01, 0x01]) return plaintext.data // Uint8Array([0x01, 0x01, 0x01])
}); });
``` ```