(privKey, passwd)
| 254 | } |
| 255 | |
| 256 | async function unlockKey(privKey, passwd) { |
| 257 | try { |
| 258 | return await decryptKey({privateKey: privKey, passphrase: passwd}); |
| 259 | } catch ({message = ''}) { |
| 260 | if (message.includes('Incorrect key passphrase')) { |
| 261 | throw new MvError('Could not unlock key: wrong password', 'WRONG_PASSWORD'); |
| 262 | } else if (message.includes('Key packet is already decrypted')) { |
| 263 | return privKey; |
| 264 | } else { |
| 265 | throw new MvError(`Error in openpgp.decryptKey. ${message}`); |
| 266 | } |
| 267 | } |
| 268 | } |
no outgoing calls
no test coverage detected