diff --git a/Config/App.xcconfig b/Config/App.xcconfig
index 95083ec..cd5e16d 100644
--- a/Config/App.xcconfig
+++ b/Config/App.xcconfig
@@ -1,5 +1,9 @@
#include "Project.xcconfig"
-PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample
+PRODUCT_BUNDLE_IDENTIFIER = $(BASE_BUNDLE_ID)
INFOPLIST_KEY_CFBundleDisplayName = SecureStorage
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES
+INFOPLIST_KEY_BaseBundleID = $(BASE_BUNDLE_ID)
+INFOPLIST_KEY_TeamID = $(TEAM_ID)
+
+CODE_SIGN_ENTITLEMENTS = SecureStorageSample/SecureStorageSample.entitlements
diff --git a/Config/Project.xcconfig b/Config/Project.xcconfig
index 3ddcae4..3eadd55 100644
--- a/Config/Project.xcconfig
+++ b/Config/Project.xcconfig
@@ -1,7 +1,10 @@
// Shared project settings
DEVELOPMENT_TEAM = 6R7KLBPBLZ
+TEAM_ID = $(DEVELOPMENT_TEAM)
MARKETING_VERSION = 1.0
CURRENT_PROJECT_VERSION = 1
// Default Bundle ID Prefix
APP_BUNDLE_ID_PREFIX = com.mbrucedogs
+BASE_BUNDLE_ID = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample
+APP_GROUP_ID = group.$(BASE_BUNDLE_ID)
diff --git a/Config/WatchApp.xcconfig b/Config/WatchApp.xcconfig
index c5fb437..40ac0d3 100644
--- a/Config/WatchApp.xcconfig
+++ b/Config/WatchApp.xcconfig
@@ -2,7 +2,11 @@
PRODUCT_BUNDLE_IDENTIFIER = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample.watchkitapp
INFOPLIST_KEY_CFBundleDisplayName = SecureStorage Watch
-INFOPLIST_KEY_WKCompanionAppBundleIdentifier = $(APP_BUNDLE_ID_PREFIX).SecureStorageSample
+INFOPLIST_KEY_WKCompanionAppBundleIdentifier = $(BASE_BUNDLE_ID)
SKIP_INSTALL = YES
WATCHOS_DEPLOYMENT_TARGET = 10.0
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES
+INFOPLIST_KEY_BaseBundleID = $(BASE_BUNDLE_ID)
+INFOPLIST_KEY_TeamID = $(TEAM_ID)
+
+CODE_SIGN_ENTITLEMENTS = SecureStorageSample Watch App/SecureStorageSample Watch App.entitlements
diff --git a/SecureStorageSample Watch App/SecureStorageSample Watch App.entitlements b/SecureStorageSample Watch App/SecureStorageSample Watch App.entitlements
new file mode 100644
index 0000000..1e342d2
--- /dev/null
+++ b/SecureStorageSample Watch App/SecureStorageSample Watch App.entitlements
@@ -0,0 +1,14 @@
+
+
+
+
+ com.apple.security.application-groups
+
+ $(APP_GROUP_ID)
+
+ keychain-access-groups
+
+ $(AppIdentifierPrefix)$(BASE_BUNDLE_ID)
+
+
+
diff --git a/SecureStorageSample.xcodeproj/project.pbxproj b/SecureStorageSample.xcodeproj/project.pbxproj
index 582b354..5da6fb1 100644
--- a/SecureStorageSample.xcodeproj/project.pbxproj
+++ b/SecureStorageSample.xcodeproj/project.pbxproj
@@ -670,7 +670,6 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
- CODE_SIGN_ENTITLEMENTS = SecureStorageSample/SecureStorageSample.entitlements;
CODE_SIGN_STYLE = Automatic;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
@@ -701,7 +700,6 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
- CODE_SIGN_ENTITLEMENTS = SecureStorageSample/SecureStorageSample.entitlements;
CODE_SIGN_STYLE = Automatic;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
diff --git a/SecureStorageSample/SecureStorageSample.entitlements b/SecureStorageSample/SecureStorageSample.entitlements
index 15107bb..1e342d2 100644
--- a/SecureStorageSample/SecureStorageSample.entitlements
+++ b/SecureStorageSample/SecureStorageSample.entitlements
@@ -4,7 +4,11 @@
com.apple.security.application-groups
- group.com.mbrucedogs.securestorage
+ $(APP_GROUP_ID)
+
+ keychain-access-groups
+
+ $(AppIdentifierPrefix)$(BASE_BUNDLE_ID)
diff --git a/localPackages/SharedPackage/Sources/SharedKit/Constants/StorageServiceIdentifiers.swift b/localPackages/SharedPackage/Sources/SharedKit/Constants/StorageServiceIdentifiers.swift
index 19c6d55..dca545f 100644
--- a/localPackages/SharedPackage/Sources/SharedKit/Constants/StorageServiceIdentifiers.swift
+++ b/localPackages/SharedPackage/Sources/SharedKit/Constants/StorageServiceIdentifiers.swift
@@ -2,7 +2,16 @@ import Foundation
public enum StorageServiceIdentifiers {
public static var bundleIdentifier: String {
- Bundle.main.bundleIdentifier ?? "com.example.securestorage"
+ Bundle.main.object(forInfoDictionaryKey: "BaseBundleID") as? String ??
+ Bundle.main.bundleIdentifier ??
+ "com.example.securestorage"
+ }
+
+ private static var teamIDPrefix: String {
+ if let teamID = Bundle.main.object(forInfoDictionaryKey: "TeamID") as? String, !teamID.isEmpty {
+ return "\(teamID)."
+ }
+ return ""
}
public static var appGroupIdentifier: String {
@@ -10,18 +19,18 @@ public enum StorageServiceIdentifiers {
}
public static var keychainCredentials: String {
- bundleIdentifier
+ "\(teamIDPrefix)\(bundleIdentifier)"
}
public static var keychainAPIToken: String {
- "\(bundleIdentifier).api"
+ "\(teamIDPrefix)\(bundleIdentifier).api"
}
public static var keychainExternalKeyMaterial: String {
- "\(bundleIdentifier).externalkey"
+ "\(teamIDPrefix)\(bundleIdentifier).externalkey"
}
public static var keychainLocation: String {
- "\(bundleIdentifier).security"
+ "\(teamIDPrefix)\(bundleIdentifier).security"
}
}