react-native-openpgp icon indicating copy to clipboard operation
react-native-openpgp copied to clipboard

Incorrect example in README for asymmetric encryption

Open bitsal opened this issue 7 years ago • 0 comments

Encryption Current version

options = {
...  
    privateKeys: openpgp.readArmoredKey(privkey).keys, // for signing (optional)
...
};

but should be

options = {
  ...
  privateKeys: openpgp.readArmoredKey(privkey).keys
        .map(key =>  openpgp.decryptKey({
                          privateKey: key,
                          passphrase: <passphrase>
                  }).key
         )  // for signing (optional)
...
};

Decryption Current version

options = {
...
  privateKey: openpgp.readArmoredKey(privkey).keys[0], // for decryption
...
};

but should be

options = {
  ...
  privateKey: openpgp.decryptKey({
                          privateKey: openpgp.readArmoredKey(privkey).keys[0],
                          passphrase: <passphrase>
                  }).key 
           // for decryption
...
};

bitsal avatar Jun 01 '17 18:06 bitsal