Skip to content

fix(auth): allow to pass a Keychain storage without a service defined #730

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Sources/Auth/Internal/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import Security

struct Keychain {
let service: String
let service: String?
let accessGroup: String?

init(
service: String,
service: String?,
accessGroup: String? = nil
) {
self.service = service
Expand Down Expand Up @@ -55,8 +55,10 @@
private func baseQuery(withKey key: String? = nil, data: Data? = nil) -> [String: Any] {
var query: [String: Any] = [:]
query[kSecClass as String] = kSecClassGenericPassword
query[kSecAttrService as String] = service

if let service {
query[kSecAttrService as String] = service
}
if let key {
query[kSecAttrAccount as String] = key
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Auth/Storage/KeychainLocalStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public struct KeychainLocalStorage: AuthLocalStorage {
private let keychain: Keychain

public init(service: String = "supabase.gotrue.swift", accessGroup: String? = nil) {
public init(service: String? = "supabase.gotrue.swift", accessGroup: String? = nil) {
keychain = Keychain(service: service, accessGroup: accessGroup)
}

Expand Down
Loading