Skip to content

e.isPrivate is not a function #1511

Answered by larabr
NxtDaemon asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @NxtDaemon, the openpgp functions you are calling return promises, so you need to await them. The error you are seeing is thrown by openpgp.decryptKey as a result. Note that you are also missing the passphrase option for key decryption:

const publicKey = await openpgp.readKey({ armoredKey: publicKeyArmored });
const privateKey = await openpgp.decryptKey({
  privateKey: await openpgp.readPrivateKey({ armoredKey: privateKeyArmored }),
  passphrase: ... // this is required
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by twiss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1510 on April 04, 2022 15:20.