kbpgp icon indicating copy to clipboard operation
kbpgp copied to clipboard

TypeError: undefined is not a function

Open jaredallard opened this issue 8 years ago • 3 comments

Using NW.js 0.12.3 x64 on Win32.

Uncaught TypeError: undefined is not a function C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\lib\openpgp\burner.js:375 
Burner._encrypt_session_key_once.iced.Deferrals.parent C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\lib\openpgp\burner.js:386 
(anonymous function) C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:86 
exports.Deferrals.Deferrals._call C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:98 
(anonymous function) C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:64 
exports.trampoline.trampoline C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:96 
exports.Deferrals.Deferrals._fulfill C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:29 
ret C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-error\index.js:92 exports.make_esc.make_esc C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\pgp-utils\lib\util.js:78 
(anonymous function) C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:86 
exports.Deferrals.Deferrals._call C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:98 
(anonymous function) C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:64 
exports.trampoline.trampoline C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:96 
exports.Deferrals.Deferrals._fulfill C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:29 
ret C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\pgp-utils\lib\util.js:104 (anonymous function) C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:86 
exports.Deferrals.Deferrals._call C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:98 
(anonymous function) C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:64 
exports.trampoline.trampoline C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:96 
exports.Deferrals.Deferrals._fulfill C:\Users\jared\Desktop\mp2pcc\node_modules\kbpgp\node_modules\iced-runtime\lib\runtime.js:29 
rettimers.js:90 
listOnTimeout

Code:

        var params = {
          msg: content,
          encrypt_for: key,
          sign_with: that.key
        };

        kbpgp.box(params, function(err, result_string, result_buffer) {
          if(err) {
            console.log(err);
            return false;
          }
          console.log(result_string);
        });

Key: (it's a pub key)

KeyManager {primary: Primary, subkeys: Array[0], userids: Array[1], armored_pgp_public: "-----BEGIN PGP PUBLIC KEY BLOCK-----↵Version: Keyb…ZIfZcQ==↵=dwA/↵-----END PGP PUBLIC KEY BLOCK-----", armored_pgp_private: undefined…}_signed: truearmored_pgp_private: undefinedarmored_pgp_public: "-----BEGIN PGP PUBLIC KEY BLOCK-----↵Version: Keybase OpenPGP v2.0.44↵Comment: https://keybase.io/crypto↵↵xm8EVe0ZQxMFK4EEACIDAwQ7Eq/lc9r/cL3kQBuu1lTfyFSqmta7nt9Rz2l246v1↵Dk/qby3AXKxVb/oSvKKQ7mVEn8TRZisD2bRY2meaqdX0T2gsbjx/qxO8+BoVbAh3↵RQ5p1iV/64dlJugiCxmMtSrNK3JhaW5ib3dkYXNoZGNfMiA8cmFpbmJvd2Rhc2hk↵Y18yQDEyNy4wLjAuMT7ClgQTEwoAHgUCVe0ZQwIbLwMLCQcDFQoIAh4BAheAAxYC↵AQIZAQAKCRD+ohd3szLuZEEpAYCC/9HTzUaqQiUQuXN/hNzBL9CjJshZMnnuzWzQ↵c5rdBO3mgsDa3bm8Od/d8z5mMwYBfi4oOjMC1ThcT/JjzI1uYrwsw+5DjwJP0GZN↵CN8xEvioMxC6tHplMnY/I/RJZIfZcQ==↵=dwA/↵-----END PGP PUBLIC KEY BLOCK-----"engines: Array[1]p3skb: nullpgp: PgpEngineprimary: Primarysubkeys: Array[0]user_attributes: Array[0]userids: Array[1]__proto__: ctor

that.key: (freshly generated ECC key, so pub & priv)

KeyManager {primary: Primary, subkeys: Array[0], userids: Array[1], armored_pgp_public: "-----BEGIN PGP PUBLIC KEY BLOCK-----↵Version: Keyb…yQj9EQC↵=lIH/↵-----END PGP PUBLIC KEY BLOCK-----↵", armored_pgp_private: undefined…}_signed: truearmored_pgp_private: undefinedarmored_pgp_public: "-----BEGIN PGP PUBLIC KEY BLOCK-----↵Version: Keybase OpenPGP v2.0.44↵Comment: https://keybase.io/crypto↵↵xm8EVe0a1BMFK4EEACIDAwRr0Y85ZAwtn3lca47M2RoM/0HQq2NHDpAklob/lMIu↵JjEi1HMVMIrwhk8Oa6qWqYMJmWsDHeCz4zE9ETtMNo7qm8vCtnDGLvTNim/3S8eb↵pnjm5gXSVa6mOiRQMABGHijNJ3JhaW5ib3dkYXNoZGMgPHJhaW5ib3dkYXNoZGNA↵MTI3LjAuMC4xPsKWBBMTCgAeBQJV7RrUAhsvAwsJBwMVCggCHgECF4ADFgIBAhkB↵AAoJEFlwja3ig4kxYEABgPjLp4esaUX4LNuVdr9qJG/XJ0Bd4kK14Xvz1VdZgwNh↵hEeSjjJ6R95KJ9vO9/q2lAF/SsTF3pAsumvg3Qw6bfKnXmp5zD6GQ7Gjtjrys0cp↵etvqluuqSDtzMQOTqyQj9EQC↵=lIH/↵-----END PGP PUBLIC KEY BLOCK-----↵"engines: Array[1]p3skb: nullpgp: PgpEngineprimary: Primarysubkeys: Array[0]user_attributes: undefineduserids: Array[1]__proto__: ctor

UPDATE: I can sign message, which returned something like this: (Yes, it's not from the same key as any of those (they are randomly generated))

-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.44
Comment: https://keybase.io/crypto
nyKMCeJw7wsvMwCUceHXnJP8icxbG0zylDKFvZU0yUnNy8hUP1bEwCHMxsLEygcQY\
nuDgFYAr75BirmNzefL7zZYJ/3A1upWTJzrygiDdX7CO4Dl1zPV/17Hdt7rZ3xeV7\
nuf1ybkzxS3yXpbKGsT64qWVC+82WAqYc6ahZTCsuBXXLvi/k5hVZHy7uoHUh6RfP
MfeZk/f6W/d+s6qTOJ8/CwD03j/N=Cd97
-----END PGP MESSAGE-----

UPDATE: It works now that it has sub-keys. Is this required?

jaredallard avatar Sep 07 '15 05:09 jaredallard

Yes, subkeys are definitely required for ECC keys, since you can't encrypt with ECDSA. We can of course use a better error message, but that's all we could do here.

maxtaco avatar Sep 08 '15 00:09 maxtaco

Learn something new everyday, awesome, well a better error message is probably the best in this situation!

jaredallard avatar Sep 08 '15 16:09 jaredallard

Hi @jaredallard

Were you getting the following message?

TypeError: this.sign_with.find_signing_pgp_key is not a function

santos22 avatar Feb 26 '17 23:02 santos22