@passageidentity/passage-react-native
Version:
Passkey Complete for React Native - Go completely passwordless with a standalone auth solution in your React Native app with Passage by 1Password
33 lines (32 loc) • 1.65 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var config_plugins_1 = require("@expo/config-plugins");
var modifyIOSEntitlementsPlist = function (configuration) {
console.log('Passage: Checking iOS Entitlements for required associated domains.');
var associatedDomain = process.env.ASSOCIATED_DOMAIN;
if (!associatedDomain) {
console.error('Passage: ASSOCIATED_DOMAIN is not defined in your .env. This is required for Passage.');
return configuration;
}
return (0, config_plugins_1.withEntitlementsPlist)(configuration, function (config) {
var webCredEntitlement = "webcredentials:".concat(associatedDomain);
var appLinksEntitlement = "applinks:".concat(associatedDomain);
var key = 'com.apple.developer.associated-domains';
// Get existing associated domains or initialize an empty array
var domains = config.modResults[key] || [];
// Add the new domains if they are not already present
if (!domains.includes(webCredEntitlement)) {
console.log("Passage: Adding web credential entitlement: ".concat(webCredEntitlement));
domains.push(webCredEntitlement);
}
if (!domains.includes(appLinksEntitlement)) {
console.log("Passage: Adding app link entitlement: ".concat(appLinksEntitlement));
domains.push(appLinksEntitlement);
}
// Update the plist with the new domains
config.modResults[key] = domains;
console.log('Passage: iOS Entitlements check complete.');
return config;
});
};
exports.default = modifyIOSEntitlementsPlist;
;