48 lines
1.5 KiB
Swift
48 lines
1.5 KiB
Swift
import Foundation
|
|
|
|
public enum StorageServiceIdentifiers {
|
|
public static var bundleIdentifier: String {
|
|
let identifier = Bundle.main.object(forInfoDictionaryKey: "BaseBundleID") as? String ??
|
|
Bundle.main.bundleIdentifier ??
|
|
"com.example.securestorage"
|
|
return identifier
|
|
}
|
|
|
|
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 {
|
|
let identifier = Bundle.main.object(forInfoDictionaryKey: "AppGroupID") as? String ??
|
|
"group.\(bundleIdentifier)"
|
|
return identifier
|
|
}
|
|
|
|
public static func logConfiguration() {
|
|
Logger.debug("--- STORAGE CONFIGURATION ---")
|
|
Logger.debug("Bundle ID: \(bundleIdentifier)")
|
|
Logger.debug("Team ID Prefix: \(teamIDPrefix)")
|
|
Logger.debug("App Group ID: \(appGroupIdentifier)")
|
|
Logger.debug("---------------------------")
|
|
}
|
|
|
|
public static var keychainCredentials: String {
|
|
"\(teamIDPrefix)\(bundleIdentifier)"
|
|
}
|
|
|
|
public static var keychainAPIToken: String {
|
|
"\(teamIDPrefix)\(bundleIdentifier).api"
|
|
}
|
|
|
|
public static var keychainExternalKeyMaterial: String {
|
|
"\(teamIDPrefix)\(bundleIdentifier).externalkey"
|
|
}
|
|
|
|
public static var keychainLocation: String {
|
|
"\(teamIDPrefix)\(bundleIdentifier).security"
|
|
}
|
|
}
|