xdl
Version:
The Expo Development Library
48 lines (47 loc) • 2.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validateProvisioningProfile = validateProvisioningProfile;
function _crypto() {
const data = _interopRequireDefault(require("crypto"));
_crypto = function () {
return data;
};
return data;
}
function _minimatch() {
const data = _interopRequireDefault(require("minimatch"));
_minimatch = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function validateProvisioningProfile(plistData, {
distCertFingerprint,
bundleIdentifier
}) {
_ensureDeveloperCertificateIsValid(plistData, distCertFingerprint);
_ensureBundleIdentifierIsValid(plistData, bundleIdentifier);
}
function _ensureDeveloperCertificateIsValid(plistData, distCertFingerprint) {
const devCertBase64 = plistData.DeveloperCertificates[0];
const devCertFingerprint = _genDerCertFingerprint(devCertBase64);
if (devCertFingerprint !== distCertFingerprint) {
throw new Error('validateProvisioningProfile: provisioning profile is not associated with uploaded distribution certificate');
}
}
function _genDerCertFingerprint(certBase64) {
const certBuffer = Buffer.from(certBase64, 'base64');
return _crypto().default.createHash('sha1').update(certBuffer).digest('hex').toUpperCase();
}
function _ensureBundleIdentifierIsValid(plistData, expectedBundleIdentifier) {
var _exec;
const actualApplicationIdentifier = plistData.Entitlements['application-identifier'];
const actualBundleIdentifier = (_exec = /\.(.+)/.exec(actualApplicationIdentifier)) === null || _exec === void 0 ? void 0 : _exec[1];
if (!actualBundleIdentifier || !(0, _minimatch().default)(expectedBundleIdentifier, actualBundleIdentifier)) {
throw new Error(`validateProvisioningProfile: wrong bundleIdentifier found in provisioning profile; expected: ${expectedBundleIdentifier}, found (in provisioning profile): ${actualBundleIdentifier}`);
}
}
//# sourceMappingURL=IosCodeSigning.js.map