Skip to content

Commit c1095c9

Browse files
authored
fix(auth): expose KeychainLocalStorage with default init params (#519)
1 parent f093294 commit c1095c9

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

Sources/Auth/Storage/AuthLocalStorage.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@ public protocol AuthLocalStorage: Sendable {
88

99
extension AuthClient.Configuration {
1010
#if !os(Linux) && !os(Windows)
11-
public static let defaultLocalStorage: any AuthLocalStorage = KeychainLocalStorage(
12-
service: "supabase.gotrue.swift",
13-
accessGroup: nil
14-
)
11+
public static let defaultLocalStorage: any AuthLocalStorage = KeychainLocalStorage()
1512
#elseif os(Windows)
16-
public static let defaultLocalStorage: any AuthLocalStorage =
17-
WinCredLocalStorage(service: "supabase.gotrue.swift")
13+
public static let defaultLocalStorage: any AuthLocalStorage = WinCredLocalStorage()
1814
#endif
1915
}

Sources/Auth/Storage/KeychainLocalStorage.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#if !os(Windows) && !os(Linux)
22
import Foundation
33

4+
/// ``AuthLocalStorage`` implementation using Keychain. This is the default local storage used by the library.
45
public struct KeychainLocalStorage: AuthLocalStorage {
56
private let keychain: Keychain
67

7-
public init(service: String, accessGroup: String?) {
8+
public init(service: String = "supabase.gotrue.swift", accessGroup: String? = nil) {
89
keychain = Keychain(service: service, accessGroup: accessGroup)
910
}
1011

Sources/Auth/Storage/WinCredLocalStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
private let credentialType: DWORD
1414
private let credentialPersistence: DWORD
1515

16-
public init(service: String) {
16+
public init(service: String = "supabase.gotrue.swift") {
1717
self.service = service
1818
credentialType = DWORD(CRED_TYPE_GENERIC)
1919
credentialPersistence = DWORD(CRED_PERSIST_LOCAL_MACHINE)

0 commit comments

Comments
 (0)