[PM-37888] refactor: Remove unused AccountEncryptionKeys wrapper - #2861
[PM-37888] refactor: Remove unused AccountEncryptionKeys wrapper#2861matt-livefront wants to merge 4 commits into
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the removal of the Code Review Details
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2861 +/- ##
==========================================
+ Coverage 79.45% 81.72% +2.26%
==========================================
Files 1172 1048 -124
Lines 75100 67768 -7332
==========================================
- Hits 59670 55382 -4288
+ Misses 15430 12386 -3044 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| appSettingsStore.setFillAssistCachedData(nil, userId: knownUserId) | ||
| appSettingsStore.setFillAssistLastFetchTimestamp(nil, userId: knownUserId) |
There was a problem hiding this comment.
❓ QUESTION: These two fill-assist lines look like a merge artifact — were they intended in this PR?
Details
The diff replaces appSettingsStore.setEncryptedUserKey(key: nil, userId: knownUserId) with two fill-assist clears that don't exist on main. main's logoutAccount has no fill-assist cleanup — PM-38443 (#2811 added it here, #2812 moved it out) relocated that responsibility to FillAssistRepository.clearRules(userId:), which AuthRepository.logout already calls before stateService.logoutAccount.
So on the normal logout path this is now duplicated, and it also isn't mentioned in the PR description for an otherwise pure AccountEncryptionKeys refactor. If it wasn't intentional, dropping both lines restores parity with main.
(Note: deleteAccount() calls logoutAccount directly without going through AuthRepository.logout, so if the intent was to cover that path, a comment or a call to clearRules would make it explicit — and the keychain fillAssistRulesFingerprint is still left behind either way.)
🎟️ Tracking
PM-37888
📔 Objective
Follow-up to #2780 and #2764, which moved all real consumers off of
AccountEncryptionKeys.encryptedUserKey. This removes theAccountEncryptionKeyswrapper struct since every explicit constructor already passedencryptedUserKey: nil, and the sole consumer of anAccountEncryptionKeysvalue (initializeUserCrypto) only ever readcryptographicState.WrappedAccountCryptographicStatecan be used directly whereverAccountEncryptionKeyswas used.AccountEncryptionKeys; replaceStateService.get/setAccountEncryptionKeyswithget/setAccountCryptographicStatereturning/takingWrappedAccountCryptographicStatedirectlyresponseModel:-based factory ontoWrappedAccountCryptographicStateitself (WrappedAccountCryptographicState+Extensions.swift)AuthRepository,AuthService,SyncService,KeyConnectorService, andAuthenticatorSyncServiceencryptedUserKeystorage inAppSettingsStore(unused since the master-password-unlock key moved toMasterPasswordUnlockResponseModelin [PM-37888] refactor: Read masterKeyWrappedUserKey from masterPasswordUnlock #2780)key: String?fromAccountKeysResponseModelProtocol,ProfileResponseModel, andSetAccountKeysResponseModel.IdentityTokenResponseModel.keyis kept — it's still used inAuthService.unlockMethod(for:)for the key connector unlock path