code: function parseDomains(cert) {
      const altNames = [];
      let commonName = null;
      const commonNameMatch = cert.match(/Subject:.*? CN\s?=\s?([^\s,;/]+)/);
      const altNamesMatch = cert.match(/X509v3 Subject Alternative Name:\s?\n\s*([^\n]+)\n/);
  
      /* Subject common name */
      if (commonNameMatch) {
          commonName = commonNameMatch[1];
      }
  
      /* Alternative names */
      if (altNamesMatch) {
          altNamesMatch[1].split(/,\s*/).forEach((altName) => {
              if (altName.match(/^DNS:/)) {
                  altNames.push(altName.replace(/^DNS:/, ''));
              }
          });
      }
  
      return {
          commonName,
          altNames
      };
  }
docs: Parse domain names from a certificate or CSR
  
  @private
  @param {string} cert Certificate or CSR
  @returns {object} {commonName, altNames}