Skip to content

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

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

grdsdev
Copy link
Collaborator

@grdsdev grdsdev commented Jun 9, 2025

What kind of change does this PR introduce?

Enhancement

What is the current behavior?

When creating a custom KeychainLocalStorage it isn't possible to define the service as nil to make it use the default app keychain instance.

What is the new behavior?

Allow to pass nil on the service param.

Additional context

Add any other context or screenshots.

@grdsdev grdsdev requested a review from Copilot June 9, 2025 22:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR enables passing nil as the service parameter when initializing a KeychainLocalStorage instance so that the default app keychain instance is used.

  • Updated KeychainLocalStorage initializer to accept an optional service parameter.
  • Adjusted Keychain struct to conditionally add the service attribute in queries when a service is provided.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Sources/Auth/Storage/KeychainLocalStorage.swift Modified the initializer to allow a nil service parameter.
Sources/Auth/Internal/Keychain.swift Changed the service property to optional and updated baseQuery to add it only when non-nil.
Comments suppressed due to low confidence (2)

Sources/Auth/Storage/KeychainLocalStorage.swift:8

  • Consider updating the initializer's documentation to explicitly state that passing nil for the service parameter will cause the default app keychain instance to be used.
public init(service: String? = "supabase.gotrue.swift", accessGroup: String? = nil) {

Sources/Auth/Internal/Keychain.swift:59

  • Adding a brief comment here to explain that the kSecAttrService attribute is only included when a service is provided would enhance clarity.
if let service {

@grdsdev grdsdev enabled auto-merge (squash) June 9, 2025 22:42
@coveralls
Copy link

Pull Request Test Coverage Report for Build 15546173105

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on guilherme/fix-allow-default-service at 75.659%

Totals Coverage Status
Change from base Build 15390678797: 75.7%
Covered Lines: 5225
Relevant Lines: 6906

💛 - Coveralls

@grdsdev grdsdev requested a review from dshukertjr June 10, 2025 08:24
@grdsdev grdsdev merged commit 6b1d60f into main Jun 10, 2025
23 checks passed
@grdsdev grdsdev deleted the guilherme/fix-allow-default-service branch June 10, 2025 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants