code: function parseDomains(obj) {
      let commonName = null;
      let altNames = [];
      let altNamesDict = [];
  
      const commonNameObject = (obj.subject.attributes || []).find(a => a.name === 'commonName');
      const rootAltNames = (obj.extensions || []).find(e => 'altNames' in e);
      const rootExtensions = (obj.attributes || []).find(a => 'extensions' in a);
  
      if (rootAltNames && rootAltNames.altNames && rootAltNames.altNames.length) {
          altNamesDict = rootAltNames.altNames;
      }
      else if (rootExtensions && rootExtensions.extensions && rootExtensions.extensions.length) {
          const extAltNames = rootExtensions.extensions.find(e => 'altNames' in e);
  
          if (extAltNames && extAltNames.altNames && extAltNames.altNames.length) {
              altNamesDict = extAltNames.altNames;
          }
      }
  
      if (commonNameObject) {
          commonName = commonNameObject.value;
      }
  
      if (altNamesDict) {
          altNames = altNamesDict.map(a => a.value);
      }
  
      return {
          commonName,
          altNames
      };
  }
docs: Parse domain names from a certificate or CSR
  
  @private
  @param {object} obj Forge certificate or CSR
  @returns {object} {commonName, altNames}