Skip to content

PM-31118: feat: Add support for SDK pin unlock - #7289

Merged
david-livefront merged 1 commit into
mainfrom
PM-31118-sdk-pin-unlock
Aug 24, 2026
Merged

PM-31118: feat: Add support for SDK pin unlock#7289
david-livefront merged 1 commit into
mainfrom
PM-31118-sdk-pin-unlock

Conversation

@david-livefront

@david-livefront david-livefront commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

🎟️ Tracking

PM-31118

📔 Objective

This PR add support for SDK pin unlock.

@david-livefront
david-livefront requested a review from a team as a code owner August 20, 2026 22:02
@github-actions github-actions Bot added app:password-manager Bitwarden Password Manager app context app:authenticator Bitwarden Authenticator app context t:feature Change Type - Feature Development labels Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: REQUEST CHANGES

This PR gates PIN unlock behind a new SdkPinUnlock feature flag, routing unlock through InitUserCryptoMethod.PinState when enabled and restructuring the legacy-key/envelope fallback in VaultRepositoryImpl.unlockVaultWithPin. The flag plumbing (FlagKey, debug menu list item, non-localized string, DI wiring) is complete and consistent with existing flags. The main gap is on the test side: the new required featureFlagManager constructor parameter is not reflected in VaultRepositoryTest, which breaks compilation of the :app test source set and leaves the new flag branch uncovered.

Code Review Details
  • ❌ : New required featureFlagManager constructor parameter breaks :app test compilation; existing PIN tests still assert envelope-first ordering and the new SdkPinUnlock branch is untested
    • app/src/main/kotlin/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryImpl.kt:87
    • app/src/test/kotlin/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryTest.kt:122
  • ❓ : Legacy pin-protected user key now takes precedence over the envelope even when the flag is off — intentional?
    • app/src/main/kotlin/com/x8bit/bitwarden/data/vault/repository/VaultRepositoryImpl.kt:381

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.35%. Comparing base (d817f6b) to head (948beac).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...arden/data/vault/repository/VaultRepositoryImpl.kt 90.47% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7289   +/-   ##
=======================================
  Coverage   86.35%   86.35%           
=======================================
  Files         893      893           
  Lines       65488    65496    +8     
  Branches     9861     9863    +2     
=======================================
+ Hits        56550    56557    +7     
  Misses       5464     5464           
- Partials     3474     3475    +1     
Flag Coverage Δ
app-data 17.90% <90.47%> (+<0.01%) ⬆️
app-ui-auth-tools 18.96% <0.00%> (-0.01%) ⬇️
app-ui-platform 16.37% <0.00%> (-0.01%) ⬇️
app-ui-vault 27.29% <0.00%> (-0.01%) ⬇️
authenticator 6.09% <0.00%> (-0.01%) ⬇️
lib-core-network-bridge 4.09% <0.00%> (+0.01%) ⬆️
lib-data-ui 1.20% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

if (featureFlagManager.getFeatureFlag(key = FlagKey.SdkPinUnlock)) {
this.unlockVaultForUser(
userId = userId,
initUserCryptoMethod = InitUserCryptoMethod.PinState(pin = pin),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

With this new init method, the SDK will retrieve the pinProtectedUserKeyEnvelope using the SdkStateBridge.

Comment thread ui/src/main/res/values/strings_non_localized.xml Outdated

@andrebispo5 andrebispo5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⛏️ 💭 A few of these tests call prepareStateForUnlocking() and then immediately null out the keys it just seeded. Could the helper take pinProtectedUserKey and pinProtectedUserKeyEnvelope params (defaulting to "mockKey-1") so each test just passes null for the one it wants missing? Would trim the setup blocks a bit and quiet the storePinProtectedUserKey deprecation warnings.

@david-livefront
david-livefront force-pushed the PM-31118-sdk-pin-unlock branch from b764623 to 948beac Compare August 24, 2026 14:51

@andrebispo5 andrebispo5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👌

@david-livefront

Copy link
Copy Markdown
Collaborator Author

Thanks @andrebispo5

@david-livefront
david-livefront added this pull request to the merge queue Aug 24, 2026
Merged via the queue into main with commit 7bb2247 Aug 24, 2026
32 of 36 checks passed
@david-livefront
david-livefront deleted the PM-31118-sdk-pin-unlock branch August 24, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants