[PR #3609] [MERGED] PM-9532: pt2. separate vault unlock logic and fail out on error during login. #34779

Closed
opened 2026-04-21 02:16:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/3609
Author: @dseverns-livefront
Created: 7/23/2024
Status: Merged
Merged: 8/6/2024
Merged by: @dseverns-livefront

Base: mainHead: PM-9532/vault-error-not-propagated-on-login


📝 Commits (8)

📊 Changes

13 files changed (+716 additions, -149 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt (+185 -103)
app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt (+15 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceImpl.kt (+4 -2)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/InitializeCryptoResult.kt (+3 -1)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/repository/model/VaultUnlockResult.kt (+10 -3)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/repository/util/VaultUnlockResultExtensions.kt (+6 -1)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt (+25 -22)
📝 app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt (+1 -1)
📝 app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt (+417 -3)
app/src/test/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensionsTest.kt (+33 -0)
📝 app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceTest.kt (+10 -6)
📝 app/src/test/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerTest.kt (+4 -4)
📝 app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModelTest.kt (+3 -3)

📄 Description

🎟️ Tracking

PM-9532

📔 Objective

If a user is able to authenticate successfully with the server but there is an issue in the SDK when unlocking the vault (or related SDK operation like initializing crypto) they will be in a sort of limbo state where they will immediately be take to the unlock screen but unable to proceed. To prevent this and match iOS behavior we want to propagate any error from the SDK that occurs in the vault unlock process to the LoginResult and prevent a "successful" login, if they are unable to access the vault due to the issue stated above.

NOTE

The repro step which originally highlighted this issue has been fixed in the SDK according to the info on the ticket. To recreate you can force the result of VaultSdkSourceImpl.initializeCrypto to return a failure and see the difference on main vs this branch. Also testing to make sure no regression is added in the separation of some of the vault unlock logic from the storage of keys.

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/3609 **Author:** [@dseverns-livefront](https://github.com/dseverns-livefront) **Created:** 7/23/2024 **Status:** ✅ Merged **Merged:** 8/6/2024 **Merged by:** [@dseverns-livefront](https://github.com/dseverns-livefront) **Base:** `main` ← **Head:** `PM-9532/vault-error-not-propagated-on-login` --- ### 📝 Commits (8) - [`d9ad02f`](https://github.com/bitwarden/android/commit/d9ad02f04abfb68dbfc1925ec3e7a134df4a0e5a) PM-9532/pt2-separate-vault-unlock-for-result-on-login - [`46529a2`](https://github.com/bitwarden/android/commit/46529a2787bf8bba82edfb3b7a429b83e4f7b1c6) detekt - [`4c66e1d`](https://github.com/bitwarden/android/commit/4c66e1d24bac23a1d77bb94453bc9e1960668c43) named args - [`b3213d4`](https://github.com/bitwarden/android/commit/b3213d4ecb980ab890a5f01820ea1041ecdeb3b4) after rebase - [`e1bf70e`](https://github.com/bitwarden/android/commit/e1bf70e813db99e5b907481fac99064270f7a946) feedback - [`d8f368c`](https://github.com/bitwarden/android/commit/d8f368cf0d4706bf6b32145606f57447f037f062) feedback - [`5914a6d`](https://github.com/bitwarden/android/commit/5914a6dd8766ac8233392b3be07be9bd32a14bd1) style - [`7e72776`](https://github.com/bitwarden/android/commit/7e72776aeed396f3e8f9b22b47e0b6bc671677ab) cleanup cleanup ### 📊 Changes **13 files changed** (+716 additions, -149 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt` (+185 -103) ➕ `app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt` (+15 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceImpl.kt` (+4 -2) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/InitializeCryptoResult.kt` (+3 -1) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/repository/model/VaultUnlockResult.kt` (+10 -3) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/repository/util/VaultUnlockResultExtensions.kt` (+6 -1) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/trusteddevice/TrustedDeviceScreen.kt` (+25 -22) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt` (+1 -1) 📝 `app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt` (+417 -3) ➕ `app/src/test/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensionsTest.kt` (+33 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSourceTest.kt` (+10 -6) 📝 `app/src/test/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerTest.kt` (+4 -4) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModelTest.kt` (+3 -3) </details> ### 📄 Description ## 🎟️ Tracking [PM-9532](https://bitwarden.atlassian.net/browse/PM-9532) <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective If a user is able to authenticate successfully with the server but there is an issue in the SDK when unlocking the vault (or related SDK operation like initializing crypto) they will be in a sort of limbo state where they will immediately be take to the unlock screen but unable to proceed. To prevent this and match iOS behavior we want to propagate any error from the SDK that occurs in the vault unlock process to the `LoginResult` and prevent a "successful" login, if they are unable to access the vault due to the issue stated above. <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> ## NOTE The repro step which originally highlighted this issue has been fixed in the SDK according to the info on the ticket. To recreate you can force the result of `VaultSdkSourceImpl.initializeCrypto` to return a failure and see the difference on `main` vs this branch. Also testing to make sure no regression is added in the separation of some of the vault unlock logic from the storage of keys. <!-- Required for any UI changes; delete if not applicable. Use fixed width images for better display. --> ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes [PM-9532]: https://bitwarden.atlassian.net/browse/PM-9532?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-21 02:16:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#34779