Skip to content

Commit

Permalink
added keychain arg to GetProvisioningProfileAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
jtendik committed Oct 30, 2019
1 parent 912ca2c commit 4b3dc51
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions util-provisioning-profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,21 @@ Object.defineProperty(ProvisioningProfile.prototype, 'type', {
* Returns a promise resolving to a ProvisioningProfile instance based on file.
* @function
* @param {string} filePath - Path to provisioning profile.
* @param {string} keychain - Keychain to use when unlocking provisioning profile.
* @returns {Promise} Promise.
*/
var getProvisioningProfileAsync = module.exports.getProvisioningProfileAsync = function (filePath) {
return execFileAsync('security', [
var getProvisioningProfileAsync = module.exports.getProvisioningProfileAsync = function (filePath, keychain = null) {
var securityArgs = [
'cms',
'-D', // Decode a CMS message
'-i', filePath // Use infile as source of data
])
];

if (keychain) {
securityArgs.push('-k', keychain);
}

return execFileAsync('security', securityArgs)
.then(function (result) {
var provisioningProfile = new ProvisioningProfile(filePath, plist.parse(result))
debuglog('Provisioning profile:', '\n',
Expand Down Expand Up @@ -144,7 +151,7 @@ module.exports.preEmbedProvisioningProfile = function (opts) {
if (opts['provisioning-profile'] instanceof ProvisioningProfile) {
return embedProvisioningProfile()
} else {
return getProvisioningProfileAsync(opts['provisioning-profile'])
return getProvisioningProfileAsync(opts['provisioning-profile'], opts['keychain'])
.then(function (provisioningProfile) {
opts['provisioning-profile'] = provisioningProfile
})
Expand Down

0 comments on commit 4b3dc51

Please sign in to comment.