[PM-37877] feat: Implement SDK KM state bridge - #2940
Open
matt-livefront wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #2940 +/- ##
===========================================
- Coverage 79.46% 39.58% -39.88%
===========================================
Files 1172 363 -809
Lines 75057 17106 -57951
===========================================
- Hits 59643 6772 -52871
+ Misses 15414 10334 -5080 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
quexten
approved these changes
Aug 10, 2026
|
|
||
| // MARK: SdkStateBridgeStateService | ||
|
|
||
| extension DefaultStateService: SdkStateBridgeStateService { |
Contributor
There was a problem hiding this comment.
Disclaimer: I don't know the standards for swift. Question (non-blocking): Is there a reason we have another layer of indirection here rather than making the SdkStateBridge impl directly perform these?
| func clearAccountMasterPasswordUnlockData(userId: String) async { | ||
| do { | ||
| try updateAccountProfile(userId: userId) { profile in | ||
| profile.userDecryptionOptions?.masterPasswordUnlock = nil |
Contributor
There was a problem hiding this comment.
Non-blocking: User decryption options should really be separate from synced unlock options. At least, they are on clients.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎟️ Tracking
PM-37877
📔 Objective
Implements the SDK's
StateBridgeForeignImplinterface on iOS and wires it to real mobile state, so the SDK can read/write the user key, PIN envelopes, encrypted PIN, V2 upgrade token, account cryptographic state, and master password unlock data without mobile passing it explicitly on every call.SdkStateBridge, a per-user type conforming toStateBridgeForeignImpl, registered viaclient.kmStateBridge().registerBridgeImpl(bridgeImpl:)inDefaultClientService.configureNewClient(_:for:)for every user-scopedClient(covers the main app + AutoFill/Action/Share extensions + watchOS, which all share this one path).kmStateBridge()passthrough toBitwardenSdkClient/Client, matching the existingauth()/crypto()/platform()pattern.SdkStateBridgeStateServiceprotocol (mirroringAutofillStateService/ServerCommunicationConfigStateService) that narrowsSdkStateBridge's dependency down from the fullStateServiceto just what it needs:accountCryptographicState,v2UpgradeToken,encryptedPin,persistentPinEnvelope/ephemeralPinEnvelope(the latter backed by the existing in-memoryaccountVolatileDataslot),setAccountMasterPasswordUnlock/getAccountMasterPasswordUnlock, andclearAccountMasterPasswordUnlockData.v2UpgradeToken(userId:)/setV2UpgradeToken(_:userId:)storage toAppSettingsStore.userKeyslot is in-memory only on the bridge instance and is never persisted (Keychain-only guardrail for unwrapped key material).