How to use the simple-plist.parse function in simple-plist

To help you get started, we’ve selected a few simple-plist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nowsecure / node-applesign / lib / session.js View on Github external
adjustEntitlements (file, entMobProv, next) {
    const teamId = entMobProv['com.apple.developer.team-identifier'];
    const appId = entMobProv['application-identifier'];
    /* TODO: check if this supports binary plist too */
    let ent = machoEntitlements.parseFile(file);
    if (ent === null) {
      console.error('Cannot find entitlements in binary. Using defaults');
      ent = defaultEntitlements(appId, teamId);
      // return next();
    }
    let entMacho = plist.parse(ent.toString().trim());
    if (this.config.selfSignedProvision) { /* */
      this.emit('message', 'Using an unsigned provisioning');
      const newEntitlementsFile = file + '.entitlements';
      const newEntitlements = plistBuild(entMacho).toString();
      fs.writeFileSync(newEntitlementsFile, newEntitlements);
      this.config.entitlement = newEntitlementsFile;
      return next();
    }
    let changed = false;
    if (this.config.cloneEntitlements) {
      this.emit('message', 'Cloning entitlements');
      entMacho = entMobProv;
      changed = true;
    } else {
      const k = 'com.apple.developer.icloud-container-identifiers';
      if (entMacho[k]) {
github nowsecure / node-applesign / lib / session.js View on Github external
return tools.getMobileProvisionPlist(this.config.mobileprovision, (err, data) => {
          if (err) {
            return next(err);
          }
          const mainBin = path.join(this.config.appdir, getExecutable(this.config.appdir));
          let ent = machoEntitlements.parseFile(mainBin);
          if (ent === null) {
            console.error('Cannot find entitlements in binary. Using defaults');
            const entMobProv = data['Entitlements'];
            const teamId = entMobProv['com.apple.developer.team-identifier'];
            const appId = entMobProv['application-identifier'];
            ent = defaultEntitlements(appId, teamId);
          }
          data['Entitlements'] = plist.parse(ent.toString().trim());
          fs.writeFileSync(mobileProvision, plistBuild(data).toString());
          /* TODO: self-sign mobile provisioning */
          next();
        });
      }
github nowsecure / node-applesign / lib / tools.js View on Github external
async function getMobileProvisionPlist (file) {
  var res;
  if (file === undefined) {
    throw new Error('No mobile provisioning file available.');
  }
  if (useOpenSSL === true) {
    /* portable using openssl */
    const args = [ 'cms', '-in', file, '-inform', 'der', '-verify' ];
    res = await execProgram(cmd.openssl, args, null);
  } else {
    /* OSX specific using security */
    const args = [ 'cms', '-D', '-i', file ];
    res = await execProgram(cmd.security, args, null);
  }
  return plist.parse(res.stdout);
}
github nowsecure / node-applesign / index.js View on Github external
adjustEntitlementsSync (file, entMobProv) {
    fchk(arguments, ['string', 'object']);
    const teamId = entMobProv['com.apple.developer.team-identifier'];
    const appId = entMobProv['application-identifier'];
    let ent = bin.entitlements(file);
    if (ent === null) {
      console.error('Cannot find entitlements in binary. Using defaults');
      ent = defaultEntitlements(appId, teamId);
    }
    let entMacho = plist.parse(ent.toString().trim());
    if (this.config.selfSignedProvision) {
      this.emit('message', 'Using an unsigned provisioning');
      const newEntitlementsFile = file + '.entitlements';
      const newEntitlements = plistBuild(entMacho).toString();
      fs.writeFileSync(newEntitlementsFile, newEntitlements);
      this.config.entitlement = newEntitlementsFile;
      return;
    }
    let changed = false;
    if (this.config.cloneEntitlements) {
      this.emit('message', 'Cloning entitlements');
      entMacho = entMobProv;
      changed = true;
    } else {
      const k = 'com.apple.developer.icloud-container-identifiers';
      if (entMacho[k]) {
github NativeScript / nativescript-cloud / lib / services / cloud-build-service.ts View on Github external
private getMobileProvisionData(provisionPath: string): IMobileProvisionData {
		const provisionText = this.$fs.readText(path.resolve(provisionPath));
		const provisionPlistText = provisionText.substring(provisionText.indexOf(constants.CRYPTO.PLIST_HEADER), provisionText.indexOf(constants.CRYPTO.PLIST_FOOTER) + constants.CRYPTO.PLIST_FOOTER.length);
		return plist.parse(provisionPlistText);
	}
github microsoft / app-metadata / src / ipaContent.ts View on Github external
} else {
            provisionPath = provisionName;
        }
        let absolutePath = path.resolve(path.join(tempDir, provisionPath));
        const exists = await fse.pathExists(absolutePath);
        if (!exists) {
            throw new ExtractError('provisioning file in filelist, but not on disk');
        }
        const data = await fse.readFile(absolutePath, "utf8");
        provision.absolutePath = absolutePath;
        await this.persistFile(provision, 'absolutePath');
        provision.mobileProvisionFileContent = data;
        const start = data.indexOf(Constants.PROVISION_START);
        const end = data.indexOf(Constants.PROVISION_END) + Constants.PROVISION_END.length;
        const goodData = data.substring(start, end);
        const provisionData = plist.parse(goodData);
        return provisionData;
    }
    private mapProvision(provision: ProvisioningProfile, provisionData: any) {
github NativeScript / nativescript-cloud / lib / cloud-build-helper.ts View on Github external
public getMobileProvisionData(provisionPath: string): IMobileProvisionData {
		const provisionText = this.$fs.readText(path.resolve(provisionPath));
		const provisionPlistText = provisionText.substring(provisionText.indexOf(constants.CRYPTO.PLIST_HEADER), provisionText.indexOf(constants.CRYPTO.PLIST_FOOTER) + constants.CRYPTO.PLIST_FOOTER.length);
		return plist.parse(provisionPlistText);
	}
github nowsecure / node-applesign / lib / session.js View on Github external
function defaultEntitlements (appid, devid) {
  const ent = plist.parse(entitlementTemplate.trim());
  ent['application-identifier'] = appid;
  ent['com.apple.developer.team-identifier'] = devid;
  ent['keychain-access-groups'] = [ appid ];
  ent['com.apple.developer.ubiquity-kvstore-identifier'] = appid;
  delete ent['aps-environment'];
  ent['com.apple.developer.icloud-container-identifiers'] = 'iCloud.' + devid;
  return plistBuild(ent).toString();
}

simple-plist

A wrapper utility for interacting with plist data.

MIT
Latest version published 2 years ago

Package Health Score

67 / 100
Full package analysis