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

Function verifyMessage

src/modules/pgpModel.js:251–272  ·  view source on GitHub ↗
({armored, keyringId, senderAddress, lookupKey})

Source from the content-addressed store, hash-verified

249}
250
251export async function verifyMessage({armored, keyringId, senderAddress, lookupKey}) {
252 try {
253 const message = await readCleartextMessage(armored);
254 const signingKeyIds = message.getSigningKeyIDs();
255 if (!signingKeyIds.length) {
256 throw new MvError('No signatures found');
257 }
258 const keyring = await getPreferredKeyring(keyringId);
259 await syncPublicKeys({keyring, keyIds: signingKeyIds, keyringId});
260 if (senderAddress) {
261 for (const signingKeyId of signingKeyIds) {
262 await acquireSigningKeys({senderAddress, keyring, lookupKey, keyId: signingKeyId});
263 }
264 }
265 const {data, signatures} = await keyring.getPgpBackend().verify({armored, message, keyring});
266 await updateKeyBinding(keyring, senderAddress, signatures);
267 await addSignatureDetails({signatures, keyring, senderAddress});
268 return {data, signatures};
269 } catch (e) {
270 throw new MvError(l10n.get('verify_error', [e]), 'VERIFY_ERROR');
271 }
272}
273
274export async function verifyDetachedSignature({plaintext, senderAddress, detachedSignature, keyringId, lookupKey}) {
275 try {

Callers 3

pgpModel-test.jsFile · 0.90
pgpModel.test.jsFile · 0.90
onArmoredMessageMethod · 0.90

Calls 9

getPreferredKeyringFunction · 0.90
syncPublicKeysFunction · 0.90
updateKeyBindingFunction · 0.90
readCleartextMessageFunction · 0.85
acquireSigningKeysFunction · 0.85
addSignatureDetailsFunction · 0.85
verifyMethod · 0.80
getPgpBackendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected