Skip to content

[PM-34106] chore: Consolidate KeychainItem into BitwardenKit via protocol#2492

Merged
KatherineInCode merged 14 commits intomainfrom
pm-34106/consolidate-keychainitem
Mar 26, 2026
Merged

[PM-34106] chore: Consolidate KeychainItem into BitwardenKit via protocol#2492
KatherineInCode merged 14 commits intomainfrom
pm-34106/consolidate-keychainitem

Conversation

@KatherineInCode
Copy link
Copy Markdown
Contributor

@KatherineInCode KatherineInCode commented Mar 25, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-34106

📔 Objective

This expands what was the KeychainStorageKeyPossessing protocol to include other properties from KeychainItem, and then renames it to KeychainItem while also renaming the former KeychainItem classes to BitwardenKeychainItem and AuthenticatorKeychainItem. This will make it easier to do further refactoring of our keychain code by making it easier to consolidate more things into BitwardenKit.

I considered turning this into a struct with extensions with static members, like FeatureFlag, but because many KeychainItem enum cases take an associated value (usually of the user ID), those would have to become static functions instead of static variables, and I wasn't particularly fond of that. However, I do think if we're good with the static functions, we could take that route instead, though I feel like it's six of one and half dozen of another.

@KatherineInCode KatherineInCode requested review from a team and matt-livefront as code owners March 25, 2026 18:54
@github-actions github-actions bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context labels Mar 25, 2026
@KatherineInCode KatherineInCode changed the title [PM-34106] Consolidate KeychainItem into BitwardenKit via protocol [PM-34106] chore: Consolidate KeychainItem into BitwardenKit via protocol Mar 25, 2026
@KatherineInCode KatherineInCode added the ai-review-vnext Request a Claude code review using the vNext workflow label Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Logo
Checkmarx One – Scan Summary & Details895f600f-1e02-410d-adc8-e7cfa784f8bc

Great job! No new security vulnerabilities introduced in this pull request

@github-actions github-actions bot added the t:tech-debt Change Type - Tech debt label Mar 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 25, 2026

Overall Assessment: APPROVE

Reviewed the consolidation of KeychainStorageKeyPossessing into a richer KeychainItem protocol in BitwardenKit, adding accessControlFlags and protection properties alongside the existing unformattedKey. The rename of concrete enum types to BitwardenKeychainItem and AuthenticatorKeychainItem is applied consistently across all 17 changed files. Verified that the protection values on each concrete type match the previously hardcoded keychain accessibility constants, ensuring no behavioral change. The previous finding regarding the SharedKeychainItem.protection mismatch has been resolved.

Code Review Details

No findings.

Comment thread AuthenticatorBridgeKit/SharedKeychain/SharedKeychainStorage.swift Outdated
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.80%. Comparing base (09df387) to head (c3526b1).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...Shared/Core/Auth/Services/KeychainRepository.swift 0.00% 13 Missing ⚠️
.../Services/TestHelpers/MockKeychainRepository.swift 0.00% 6 Missing ⚠️
...Shared/Core/Auth/Services/KeychainRepository.swift 75.00% 3 Missing ⚠️
...idgeKit/SharedKeychain/SharedKeychainStorage.swift 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2492      +/-   ##
==========================================
- Coverage   86.91%   85.80%   -1.11%     
==========================================
  Files        1846     2076     +230     
  Lines      163345   178294   +14949     
==========================================
+ Hits       141971   152989   +11018     
- Misses      21374    25305    +3931     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@KatherineInCode KatherineInCode added the hold This shouldn't be merged yet label Mar 25, 2026
Base automatically changed from pm-34052/consolidate-bitwardenerror to main March 26, 2026 13:29
@KatherineInCode KatherineInCode removed the hold This shouldn't be merged yet label Mar 26, 2026
Comment thread AuthenticatorShared/Core/Auth/Services/KeychainRepository.swift Outdated
@KatherineInCode KatherineInCode merged commit 293a51e into main Mar 26, 2026
20 checks passed
@KatherineInCode KatherineInCode deleted the pm-34106/consolidate-keychainitem branch March 26, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review-vnext Request a Claude code review using the vNext workflow app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:tech-debt Change Type - Tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants