src/keyring/keyring.js
function emailCheck(email, key) {
  email = email.toLowerCase();
  // escape email before using in regular expression
  const emailEsc = email.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  const emailRegex = new RegExp('<' + emailEsc + '>');
  const userIds = key.getUserIds();
  for (let i = 0; i < userIds.length; i++) {
    const userId = userIds[i].toLowerCase();
    if (email === userId || emailRegex.test(userId)) {
      return true;
    }
  }
  return false;
}
function emailCheck(email, key) {
  email = email.toLowerCase();
  // escape email before using in regular expression
  const emailEsc = email.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
  const emailRegex = new RegExp('<' + emailEsc + '>');
  const userIds = key.getUserIds();
  for (let i = 0; i < userIds.length; i++) {
    const userId = userIds[i].toLowerCase();
    if (email === userId || emailRegex.test(userId)) {
      return true;
    }
  }
  return false;
}
function emailCheck ( email , key ) { email = email . toLowerCase ( ) ; // escape email before using in regular expression const emailEsc = email . replace ( / [.*+?^${}()|[\]\\] / g , "\\$&" ) ; const emailRegex = new RegExp ( '<' + emailEsc + '>' ) ; const userIds = key . getUserIds ( ) ; for ( let i = 0 ; i < userIds . length ; i ++ ) { const userId = userIds [ i ] . toLowerCase ( ) ; if ( email === userId || emailRegex . test ( userId ) ) { return true ; } } return false ; }
Checks a key to see if it matches the specified email address
@private
@param {String} email email address to search for
@param {module:key.Key} key The key to be checked.
@returns {Boolean} True if the email address is defined in the specified key
Checks a key to see if it matches the specified email address