Skip to content

Commit

Permalink
fix(macos): added keychain flag to getProvisioningProfileAsync (#4332)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTendik authored and develar committed Oct 22, 2019
1 parent f0bf67c commit 965392b
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,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(async function (result) {
// todo read directly
const tempFile = path.join(os.tmpdir(), `${require('crypto').createHash('sha1').update(filePath).digest("hex")}.plist`)
Expand Down Expand Up @@ -150,7 +157,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 965392b

Please sign in to comment.