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

Function decrypt

src/modules/openpgpjs.js:21–31  ·  view source on GitHub ↗
({message, keyring, encryptionKeyIds, unlockKey, format})

Source from the content-addressed store, hash-verified

19 * @return {Object}
20 */
21export async function decrypt({message, keyring, encryptionKeyIds, unlockKey, format}) {
22 let privateKey = keyring.getPrivateKeyByIds(encryptionKeyIds);
23 privateKey = await unlockKey({key: privateKey});
24 const verificationKeys = keyring.keystore.getAllKeys();
25 const result = await pgpDecrypt({message, decryptionKeys: privateKey, verificationKeys, format});
26 result.signatures = await mapSignatures(result.signatures, keyring);
27 if (format === 'binary') {
28 result.data = Uint8Array2str(result.data);
29 }
30 return result;
31}
32
33async function mapSignatures(signatures, keyring) {
34 return Promise.all(signatures.map(async signature => {

Callers

nothing calls this directly

Calls 5

Uint8Array2strFunction · 0.90
getPrivateKeyByIdsMethod · 0.80
getAllKeysMethod · 0.80
unlockKeyFunction · 0.70
mapSignaturesFunction · 0.70

Tested by

no test coverage detected