Fix keychain access on macOS. (#354)

This commit is contained in:
Doug
2022-12-06 17:39:15 +00:00
committed by GitHub
parent 7f91852291
commit b97e6f7a98
13 changed files with 31 additions and 7 deletions
@@ -20,6 +20,7 @@ struct InfoPlistReader {
private enum Keys {
static let appGroupIdentifier = "appGroupIdentifier"
static let baseBundleIdentifier = "baseBundleIdentifier"
static let keychainAccessGroupIdentifier = "keychainAccessGroupIdentifier"
static let bundleShortVersion = "CFBundleShortVersionString"
static let bundleDisplayName = "CFBundleDisplayName"
}
@@ -44,6 +45,11 @@ struct InfoPlistReader {
var baseBundleIdentifier: String {
infoPlistStringValue(forKey: Keys.baseBundleIdentifier)
}
/// Keychain access group identifier set in Info.plist of the target
var keychainAccessGroupIdentifier: String {
infoPlistStringValue(forKey: Keys.keychainAccessGroupIdentifier)
}
/// Bundle executable of the target
var bundleExecutable: String {
@@ -30,7 +30,7 @@ class UserSessionStore: UserSessionStoreProtocol {
init(backgroundTaskService: BackgroundTaskServiceProtocol) {
keychainController = KeychainController(service: .sessions,
accessGroup: InfoPlistReader.target.appGroupIdentifier)
accessGroup: InfoPlistReader.target.keychainAccessGroupIdentifier)
self.backgroundTaskService = backgroundTaskService
baseDirectory = .sessionsBaseDirectory
MXLog.debug("Setup base directory at: \(baseDirectory)")
@@ -14,5 +14,9 @@
</array>
<key>com.apple.security.network.client</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER)</string>
</array>
</dict>
</plist>
+2
View File
@@ -39,5 +39,7 @@
<string>$(APP_GROUP_IDENTIFIER)</string>
<key>baseBundleIdentifier</key>
<string>$(BASE_BUNDLE_IDENTIFIER)</string>
<key>keychainAccessGroupIdentifier</key>
<string>$(KEYCHAIN_ACCESS_GROUP_IDENTIFIER)</string>
</dict>
</plist>
+1
View File
@@ -54,6 +54,7 @@ targets:
]
appGroupIdentifier: $(APP_GROUP_IDENTIFIER)
baseBundleIdentifier: $(BASE_BUNDLE_IDENTIFIER)
keychainAccessGroupIdentifier: $(KEYCHAIN_ACCESS_GROUP_IDENTIFIER)
ITSAppUsesNonExemptEncryption: false
NSUserActivityTypes: [
INSendMessageIntent