Skip to content

Commit c21ba45

Browse files
committed
Remove default local storage
1 parent fd81928 commit c21ba45

File tree

8 files changed

+11
-19
lines changed

8 files changed

+11
-19
lines changed

Sources/Auth/AuthClient.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public actor AuthClient {
3434
url: URL,
3535
headers: [String: String] = [:],
3636
flowType: AuthFlowType = Configuration.defaultFlowType,
37-
localStorage: AuthLocalStorage = Configuration.defaultLocalStorage,
37+
localStorage: AuthLocalStorage,
3838
encoder: JSONEncoder = AuthClient.Configuration.jsonEncoder,
3939
decoder: JSONDecoder = AuthClient.Configuration.jsonDecoder,
4040
fetch: @escaping FetchHandler = { try await URLSession.shared.data(for: $0) }
@@ -101,7 +101,7 @@ public actor AuthClient {
101101
url: URL,
102102
headers: [String: String] = [:],
103103
flowType: AuthFlowType = AuthClient.Configuration.defaultFlowType,
104-
localStorage: AuthLocalStorage = AuthClient.Configuration.defaultLocalStorage,
104+
localStorage: AuthLocalStorage,
105105
encoder: JSONEncoder = AuthClient.Configuration.jsonEncoder,
106106
decoder: JSONDecoder = AuthClient.Configuration.jsonDecoder,
107107
fetch: @escaping FetchHandler = { try await URLSession.shared.data(for: $0) }

Sources/Auth/Defaults.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,4 @@ extension AuthClient.Configuration {
6262

6363
/// The default ``AuthFlowType`` used when initializing a ``AuthClient`` instance.
6464
public static let defaultFlowType: AuthFlowType = .pkce
65-
66-
/// The default ``AuthLocalStorage`` instance used by the ``AuthClient``.
67-
public static let defaultLocalStorage: AuthLocalStorage = KeychainLocalStorage(
68-
service: "supabase.gotrue.swift",
69-
accessGroup: nil
70-
)
7165
}

Sources/GoTrue/Storage/GoTrueLocalStorage.swift renamed to Sources/Auth/Storage/AuthLocalStorage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Foundation
22

3-
public protocol GoTrueLocalStorage: Sendable {
3+
public protocol AuthLocalStorage: Sendable {
44
func store(key: String, value: Data) throws
55
func retrieve(key: String) throws -> Data?
66
func remove(key: String) throws

Sources/GoTrue/Storage/KeychainLocalStorage.swift renamed to Sources/Auth/Storage/KeychainLocalStorage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import Foundation
33
@preconcurrency import KeychainAccess
44

5-
struct KeychainLocalStorage: GoTrueLocalStorage {
5+
struct KeychainLocalStorage: AuthLocalStorage {
66
private let keychain: Keychain
77

88
init(service: String, accessGroup: String?) {
@@ -25,4 +25,4 @@ struct KeychainLocalStorage: GoTrueLocalStorage {
2525
try keychain.remove(key)
2626
}
2727
}
28-
#endif
28+
#endif

Sources/GoTrue/Storage/LocalStorageEngines.swift renamed to Sources/Auth/Storage/LocalStorageEngines.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import Foundation
22

33
public enum LocalStorageEngines {
44
#if os(iOS) || os(macOS) || os(watchOS) || os(tvOS)
5-
public static let keychain: some GoTrueLocalStorage = {
5+
public static let keychain: some AuthLocalStorage = {
66
KeychainLocalStorage(service: "supabase.gotrue.swift", accessGroup: nil)
77
}()
88
#endif
99

1010
#if os(Windows)
11-
public static let wincred: some GoTrueLocalStorage = {
11+
public static let wincred: some AuthLocalStorage = {
1212
WinCredLocalStorage(service: "supabase.gotrue.swift")
1313
}()
1414
#endif
15-
}
15+
}

Sources/GoTrue/Storage/WinCredLocalStorage.swift renamed to Sources/Auth/Storage/WinCredLocalStorage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enum WinCredLocalStorageError: Error {
77
case other(Int)
88
}
99

10-
public struct WinCredLocalStorage: GoTrueLocalStorage {
10+
public struct WinCredLocalStorage: AuthLocalStorage {
1111
private let service: String
1212

1313
private let credentialType: DWORD
@@ -79,4 +79,4 @@ public struct WinCredLocalStorage: GoTrueLocalStorage {
7979
}
8080
}
8181
}
82-
#endif
82+
#endif

Sources/PostgREST/PostgrestClient.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import Foundation
55
import FoundationNetworking
66
#endif
77

8-
let version = _Helpers.version
9-
108
/// PostgREST client.
119
public actor PostgrestClient {
1210
public typealias FetchHandler = @Sendable (_ request: URLRequest) async throws -> (

Sources/Supabase/Types.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public struct SupabaseClientOptions: Sendable {
4848
public let decoder: JSONDecoder
4949

5050
public init(
51-
storage: AuthLocalStorage = AuthClient.Configuration.defaultLocalStorage,
51+
storage: AuthLocalStorage,
5252
flowType: AuthFlowType = AuthClient.Configuration.defaultFlowType,
5353
encoder: JSONEncoder = AuthClient.Configuration.jsonEncoder,
5454
decoder: JSONDecoder = AuthClient.Configuration.jsonDecoder

0 commit comments

Comments
 (0)