MCPcopy
hub / github.com/mailvelope/mailvelope / filterUserIdsByEmail

Function filterUserIdsByEmail

src/modules/key.js:438–452  ·  view source on GitHub ↗
(key, filterEmail)

Source from the content-addressed store, hash-verified

436 * @return {openpgp.key.Key} The key with only matching userIds
437 */
438export function filterUserIdsByEmail(key, filterEmail) {
439 if (!filterEmail) {
440 return key;
441 }
442 key.users = key.users.filter(user => {
443 if (!user.userID) {
444 return;
445 }
446 const {userID: userId, name, email} = user.userID;
447 const id = {userId, name, email};
448 parseUserId(id);
449 return id.email.toLowerCase() === filterEmail.toLowerCase();
450 });
451 return key;
452}
453
454/**
455 * Filter out invalid keys and user IDs

Callers 4

key-test.jsFile · 0.90
lookupFunction · 0.90
parseKeysForEMailFunction · 0.90
lookupFunction · 0.90

Calls 1

parseUserIdFunction · 0.85

Tested by

no test coverage detected