jeudi 26 mars 2015

TypeError: undefined is not a function while using node js

Have a problem with printing out the pgpMessage to console.


I have my on PGP public key in the original code.


Any thoughts how to solve this?



TypeError: undefined is not a function


at Object.getPreferredSymAlgo (/Users/user/Desktop/a/node_modules/openpgp/src/key.js:1017:31)


at Message.encrypt (/Users/user/Desktop/a/node_modules/openpgp/src/message.js:150:27)




var openpgp = require('openpgp');
var key = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----';
var publicKey = openpgp.key.readArmored(key);
openpgp.encryptMessage(publicKey.keys, 'Hello, World!').then(function(pgpMessage) {
console.log("Encrypted message:\n\n" + pgpMessage + "\n\n");
}).catch(function(error) {
//error
});

Aucun commentaire:

Enregistrer un commentaire