[PR #6347] [MERGED] [PM-30703] Introduce CXF payload parser and update to alpha05 #37007

Closed
opened 2026-04-21 04:05:26 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6347
Author: @SaintPatrck
Created: 1/12/2026
Status: Merged
Merged: 2/17/2026
Merged by: @SaintPatrck

Base: mainHead: cred-exchange/dep-updates


📝 Commits (5)

  • 18bd555 [PM-30703] Update Credential Exchange to alpha04 and introduce payload parser
  • e1956ef [PM-30703] Add Timber log for import ciphers validation errors
  • 112204e [PM-30703] Parse all CXF accounts and update to alpha05
  • 9cba6da [PM-30703] Fix unclosed InputStream and add missing test coverage in CXF
  • 4cb594e Refactored credential exchange import and added logging

📊 Changes

24 files changed (+1018 additions, -654 deletions)

View changed files

📝 app/src/main/kotlin/com/x8bit/bitwarden/MainViewModel.kt (+2 -1)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerImpl.kt (+71 -108)
📝 app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt (+3 -3)
📝 app/src/test/kotlin/com/x8bit/bitwarden/MainViewModelTest.kt (+15 -2)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/util/SpecialCircumstanceExtensionsTest.kt (+2 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerTest.kt (+416 -427)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt (+4 -2)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/SelectAccountScreenTest.kt (+2 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/SelectAccountViewModelTest.kt (+2 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/reviewexport/ReviewExportScreenTest.kt (+2 -1)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/reviewexport/ReviewExportViewModelTest.kt (+2 -1)
📝 cxf/build.gradle.kts (+4 -0)
cxf/src/main/kotlin/com/bitwarden/cxf/di/CxfModule.kt (+24 -0)
📝 cxf/src/main/kotlin/com/bitwarden/cxf/importer/CredentialExchangeImporterImpl.kt (+24 -43)
📝 cxf/src/main/kotlin/com/bitwarden/cxf/manager/CredentialExchangeCompletionManagerImpl.kt (+1 -24)
cxf/src/main/kotlin/com/bitwarden/cxf/model/CredentialExchangePayload.kt (+25 -0)
📝 cxf/src/main/kotlin/com/bitwarden/cxf/model/ImportCredentialsRequestData.kt (+4 -2)
cxf/src/main/kotlin/com/bitwarden/cxf/parser/CredentialExchangePayloadParser.kt (+14 -0)
cxf/src/main/kotlin/com/bitwarden/cxf/parser/CredentialExchangePayloadParserImpl.kt (+79 -0)
📝 cxf/src/main/kotlin/com/bitwarden/cxf/registry/CredentialExchangeRegistryImpl.kt (+17 -0)

...and 4 more files

📄 Description

🎟️ Tracking

PM-30703

📔 Objective

Update the Credential Exchange (CXF/CXP) implementation to align with the androidx.credentials.providerevents:1.0.0-alpha04 library. The previous implementation was based on alpha03 and is now obsolete.

The primary behavioral change is the removal of the two-layered JSON structure (CXP wrapping CXF). The alpha04 specification simplifies this to a single, direct JSON payload for credential exchange.

Specific changes include:

  • Dependency Update:

    • Upgraded androidx.credentials.providerevents from 1.0.0-alpha03 to 1.0.0-alpha05.
  • Payload Parsing:

    • Introduced a CredentialExchangePayloadParser to handle the new direct JSON payload structure. This parser validates the CXF version, checks for the presence of accounts, and handles various error conditions.
    • The CredentialExchangeImportManager is refactored to use this new parser, removing the now-unnecessary logic for decoding the two-layered, base64-encoded payload.
  • Import/Export Flow:

    • CredentialExchangeImporterImpl: Updated to use the modern ImportCredentialsRequest builder, which no longer requires manual JSON construction.
    • CredentialExchangeCompletionManagerImpl: Modified to return the new, simplified direct JSON response, removing the CXP wrapper and base64 encoding.
    • CredentialExchangeRegistryImpl: Aligned with alpha04 by including a default export_matcher.bin (a WASM binary from Google) in the registration request.
  • DI and Module Structure:

    • Added a new CxfModule to provide the CredentialExchangePayloadParser.
    • Updated build.gradle.kts for the cxf module to include Hilt dependencies for DI.
  • Testing:

    • Added extensive unit tests for the new CredentialExchangePayloadParser to cover valid payloads, version checks, and various error states.
    • Updated existing tests for CredentialExchangeImporterTest and CredentialExchangeImportManagerTest to reflect the API and structural changes from the library update.

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) 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/6347 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 1/12/2026 **Status:** ✅ Merged **Merged:** 2/17/2026 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `main` ← **Head:** `cred-exchange/dep-updates` --- ### 📝 Commits (5) - [`18bd555`](https://github.com/bitwarden/android/commit/18bd555a1b07c67dba6a31c7c859d1cd3bdc05f8) [PM-30703] Update Credential Exchange to alpha04 and introduce payload parser - [`e1956ef`](https://github.com/bitwarden/android/commit/e1956ef1bc6068f974180576f9e868d634def22d) [PM-30703] Add Timber log for import ciphers validation errors - [`112204e`](https://github.com/bitwarden/android/commit/112204e45078718e7333e0110f60d6dbd33b8375) [PM-30703] Parse all CXF accounts and update to alpha05 - [`9cba6da`](https://github.com/bitwarden/android/commit/9cba6da435327ae2c0d0e6566a767c19a8a3cdc3) [PM-30703] Fix unclosed InputStream and add missing test coverage in CXF - [`4cb594e`](https://github.com/bitwarden/android/commit/4cb594e9a889da7874612a78368fa5338ae7d5ac) Refactored credential exchange import and added logging ### 📊 Changes **24 files changed** (+1018 additions, -654 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/kotlin/com/x8bit/bitwarden/MainViewModel.kt` (+2 -1) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerImpl.kt` (+71 -108) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt` (+3 -3) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/MainViewModelTest.kt` (+15 -2) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/platform/manager/util/SpecialCircumstanceExtensionsTest.kt` (+2 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/data/vault/manager/CredentialExchangeImportManagerTest.kt` (+416 -427) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt` (+4 -2) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/SelectAccountScreenTest.kt` (+2 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/SelectAccountViewModelTest.kt` (+2 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/reviewexport/ReviewExportScreenTest.kt` (+2 -1) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/exportitems/reviewexport/ReviewExportViewModelTest.kt` (+2 -1) 📝 `cxf/build.gradle.kts` (+4 -0) ➕ `cxf/src/main/kotlin/com/bitwarden/cxf/di/CxfModule.kt` (+24 -0) 📝 `cxf/src/main/kotlin/com/bitwarden/cxf/importer/CredentialExchangeImporterImpl.kt` (+24 -43) 📝 `cxf/src/main/kotlin/com/bitwarden/cxf/manager/CredentialExchangeCompletionManagerImpl.kt` (+1 -24) ➕ `cxf/src/main/kotlin/com/bitwarden/cxf/model/CredentialExchangePayload.kt` (+25 -0) 📝 `cxf/src/main/kotlin/com/bitwarden/cxf/model/ImportCredentialsRequestData.kt` (+4 -2) ➕ `cxf/src/main/kotlin/com/bitwarden/cxf/parser/CredentialExchangePayloadParser.kt` (+14 -0) ➕ `cxf/src/main/kotlin/com/bitwarden/cxf/parser/CredentialExchangePayloadParserImpl.kt` (+79 -0) 📝 `cxf/src/main/kotlin/com/bitwarden/cxf/registry/CredentialExchangeRegistryImpl.kt` (+17 -0) _...and 4 more files_ </details> ### 📄 Description ## 🎟️ Tracking PM-30703 ## 📔 Objective Update the Credential Exchange (CXF/CXP) implementation to align with the `androidx.credentials.providerevents:1.0.0-alpha04` library. The previous implementation was based on `alpha03` and is now obsolete. The primary behavioral change is the removal of the two-layered JSON structure (CXP wrapping CXF). The `alpha04` specification simplifies this to a single, direct JSON payload for credential exchange. Specific changes include: - **Dependency Update:** - Upgraded `androidx.credentials.providerevents` from `1.0.0-alpha03` to `1.0.0-alpha05`. - **Payload Parsing:** - Introduced a `CredentialExchangePayloadParser` to handle the new direct JSON payload structure. This parser validates the CXF version, checks for the presence of accounts, and handles various error conditions. - The `CredentialExchangeImportManager` is refactored to use this new parser, removing the now-unnecessary logic for decoding the two-layered, base64-encoded payload. - **Import/Export Flow:** - `CredentialExchangeImporterImpl`: Updated to use the modern `ImportCredentialsRequest` builder, which no longer requires manual JSON construction. - `CredentialExchangeCompletionManagerImpl`: Modified to return the new, simplified direct JSON response, removing the CXP wrapper and base64 encoding. - `CredentialExchangeRegistryImpl`: Aligned with `alpha04` by including a default `export_matcher.bin` (a WASM binary from Google) in the registration request. - **DI and Module Structure:** - Added a new `CxfModule` to provide the `CredentialExchangePayloadParser`. - Updated `build.gradle.kts` for the `cxf` module to include Hilt dependencies for DI. - **Testing:** - Added extensive unit tests for the new `CredentialExchangePayloadParser` to cover valid payloads, version checks, and various error states. - Updated existing tests for `CredentialExchangeImporterTest` and `CredentialExchangeImportManagerTest` to reflect the API and structural changes from the library update. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) 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 --- <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 04:05:26 -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#37007