From 0b7309565d118eb0a7c538825c4c2a2f1af2b860 Mon Sep 17 00:00:00 2001
From: Brant DeBow <125889545+brant-livefront@users.noreply.github.com>
Date: Tue, 10 Sep 2024 08:39:12 -0400
Subject: [PATCH] [BITAU-118] [BITAU-159] Setup New Shared App Group
Entitlements and Feature Flag (#910)
---
Bitwarden/Application/Support/Bitwarden.entitlements | 1 +
Bitwarden/Application/Support/Info.plist | 2 ++
.../Core/Platform/Extensions/Bundle+Extensions.swift | 6 ++++++
BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift | 6 +++++-
Configs/Common.xcconfig | 2 ++
Scripts/select_variant.sh | 3 +++
6 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/Bitwarden/Application/Support/Bitwarden.entitlements b/Bitwarden/Application/Support/Bitwarden.entitlements
index 1f53ef29a..3535cef19 100644
--- a/Bitwarden/Application/Support/Bitwarden.entitlements
+++ b/Bitwarden/Application/Support/Bitwarden.entitlements
@@ -26,6 +26,7 @@
com.apple.security.application-groups
group.$(BASE_BUNDLE_ID)
+ $(SHARED_APP_GROUP_IDENTIFIER)
keychain-access-groups
diff --git a/Bitwarden/Application/Support/Info.plist b/Bitwarden/Application/Support/Info.plist
index c76c2c294..784c074c0 100644
--- a/Bitwarden/Application/Support/Info.plist
+++ b/Bitwarden/Application/Support/Info.plist
@@ -150,5 +150,7 @@
XSAppIconAssets
Resources/Assets.xcassets/AppIcons.appiconset
+ BitwardenAuthenticatorSharedAppGroup
+ ${SHARED_APP_GROUP_IDENTIFIER}
diff --git a/BitwardenShared/Core/Platform/Extensions/Bundle+Extensions.swift b/BitwardenShared/Core/Platform/Extensions/Bundle+Extensions.swift
index 52e05475c..3a0c7f31d 100644
--- a/BitwardenShared/Core/Platform/Extensions/Bundle+Extensions.swift
+++ b/BitwardenShared/Core/Platform/Extensions/Bundle+Extensions.swift
@@ -37,4 +37,10 @@ extension Bundle {
var keychainAccessGroup: String {
infoDictionary?["BitwardenKeychainAccessGroup"] as? String ?? appIdentifier
}
+
+ /// Return's the shared app group identifier. This App Group is shared between the
+ /// main Bitwarden app and the Authenticator app.
+ var sharedAppGroupIdentifier: String {
+ infoDictionary?["BitwardenAuthenticatorSharedAppGroup"] as? String ?? groupIdentifier
+ }
}
diff --git a/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift b/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift
index 862563819..0d610854d 100644
--- a/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift
+++ b/BitwardenShared/Core/Platform/Models/Enum/FeatureFlag.swift
@@ -5,6 +5,9 @@ import Foundation
/// An enum to represent a feature flag sent by the server
///
enum FeatureFlag: String, Codable {
+ /// Flag to enable/disable the ability to sync TOTP codes with the Authenticator app.
+ case authenticatorSyncEnabled = "authenticator-sync-enabled"
+
/// Flag to enable/disable email verification during registration
/// This flag introduces a new flow for account creation
case emailVerification = "email-verification"
@@ -28,7 +31,8 @@ enum FeatureFlag: String, Codable {
/// Whether this feature can be enabled remotely.
var isRemotelyConfigured: Bool {
switch self {
- case .nativeCarouselFlow,
+ case .authenticatorSyncEnabled,
+ .nativeCarouselFlow,
.nativeCreateAccountFlow,
.testLocalFeatureFlag:
false
diff --git a/Configs/Common.xcconfig b/Configs/Common.xcconfig
index 071bf82ee..e0ce1c237 100644
--- a/Configs/Common.xcconfig
+++ b/Configs/Common.xcconfig
@@ -1,6 +1,7 @@
CODE_SIGN_STYLE = Automatic
DEVELOPMENT_TEAM = LTZ2PFU5D6
ORGANIZATION_IDENTIFIER = com.8bit
+SHARED_APP_GROUP_IDENTIFIER = group.com.bitwarden.bitwarden-authenticator
BASE_BUNDLE_ID = $(ORGANIZATION_IDENTIFIER).bitwarden
APPICON_NAME = AppIcon
@@ -11,6 +12,7 @@ APPICON_NAME = AppIcon
//
// DEVELOPMENT_TEAM =
// ORGANIZATION_IDENTIFIER =
+// SHARED_APP_GROUP_IDENTIFIER =
// BASE_BUNDLE_ID =
// APPICON_NAME =
// PROVISIONING_PROFILE_SPECIFIER =
diff --git a/Scripts/select_variant.sh b/Scripts/select_variant.sh
index 9b8e00392..02a3525a2 100755
--- a/Scripts/select_variant.sh
+++ b/Scripts/select_variant.sh
@@ -27,11 +27,13 @@ export_options_file="Configs/export_options.plist"
case $variant in
Production)
ios_bundle_id='com.8bit.bitwarden'
+ shared_app_group_id='group.com.bitwarden.bitwarden-authenticator'
profile_prefix="Dist:"
app_icon="AppIcon"
;;
Beta)
ios_bundle_id='com.8bit.bitwarden.beta'
+ shared_app_group_id='group.com.bitwarden.bitwarden-authenticator.beta'
profile_prefix="Dist: Beta"
app_icon="AppIcon-Beta"
;;
@@ -43,6 +45,7 @@ CODE_SIGN_IDENTITY = Apple Distribution
DEVELOPMENT_TEAM = LTZ2PFU5D6
ORGANIZATION_IDENTIFIER = com.8bit
BASE_BUNDLE_ID = ${ios_bundle_id}
+SHARED_APP_GROUP_IDENTIFIER = ${shared_app_group_id}
APPICON_NAME = ${app_icon}
PROVISIONING_PROFILE_SPECIFIER = ${profile_prefix} Bitwarden
PROVISIONING_PROFILE_SPECIFIER_ACTION_EXTENSION = ${profile_prefix} Extension