refactor(apple): remove unsafe from Token (#10968)

Convert static query dictionary to a computed property, eliminating the
need for nonisolated(unsafe).

Also fixes a bug where kSecAttrLabel used a hardcoded string instead of
the label property (which differs between debug and release builds).
This commit is contained in:
Mariusz Klochowicz
2025-11-25 15:35:07 +10:30
committed by GitHub
parent d6080e3ab1
commit 5db7eebbb2

View File

@@ -15,14 +15,14 @@ public struct Token: CustomStringConvertible {
private static let label = "Firezone token"
#endif
/// Thread-safe: Immutable dictionary initialised at compile time.
/// CFString keys and constant string values are both Sendable.
private nonisolated(unsafe) static let query: [CFString: Any] = [
kSecAttrLabel: "Firezone token",
kSecAttrAccount: "1",
kSecAttrService: BundleHelper.appGroupId,
kSecAttrDescription: "Firezone access token",
]
private static var query: [CFString: Any] {
[
kSecAttrLabel: label,
kSecAttrAccount: "1",
kSecAttrService: BundleHelper.appGroupId,
kSecAttrDescription: "Firezone access token",
]
}
private var data: Data