MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / unlockKey

Function unlockKey

src/modules/pwdCache.js:256–268  ·  view source on GitHub ↗
(privKey, passwd)

Source from the content-addressed store, hash-verified

254}
255
256async 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}

Callers 8

decryptMessageFunction · 0.70
decryptFileFunction · 0.70
decryptFunction · 0.70
encryptFunction · 0.70
signFunction · 0.70
unlockFunction · 0.70
setKeyPwdMethod · 0.50
validateKeyPasswordMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected