[PR #5091] [MERGED] [PM-20549] Introduce BitwardenServiceClient #5471

Closed
opened 2025-11-27 00:02:36 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/5091
Author: @SaintPatrck
Created: 4/23/2025
Status: Merged
Merged: 4/25/2025
Merged by: @SaintPatrck

Base: mainHead: network-module/bitwarden-service-client


📝 Commits (1)

  • bc0dc4a [PM-20549] Refactor network layer to use BitwardenServiceClient

📊 Changes

43 files changed (+814 additions, -670 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/disk/AuthDiskSource.kt (+2 -8)
📝 app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/di/AuthNetworkModule.kt (+15 -52)
📝 app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt (+46 -28)
📝 app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/GetTokenResponseExtensions.kt (+1 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/autofill/fido2/datasource/network/di/Fido2NetworkModule.kt (+3 -9)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/authenticator/AuthenticatorProvider.kt (+2 -10)
app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/authenticator/RefreshAuthenticator.kt (+0 -73)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/di/PlatformNetworkModule.kt (+28 -62)
app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/ssl/SslManager.kt (+0 -20)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt (+3 -3)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/manager/network/NetworkConfigManagerImpl.kt (+3 -4)
📝 app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/network/di/VaultNetworkModule.kt (+11 -47)
📝 app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt (+1 -1)
📝 app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/GetTokenResponseExtensionsTest.kt (+2 -1)
📝 app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/JwtTokenUtilsTest.kt (+2 -1)
📝 app/src/test/java/com/x8bit/bitwarden/data/platform/manager/network/NetworkConfigManagerTest.kt (+7 -4)
📝 app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt (+2 -2)
📝 authenticator/src/main/kotlin/com/bitwarden/authenticator/data/auth/datasource/disk/AuthDiskSource.kt (+3 -1)
📝 authenticator/src/main/kotlin/com/bitwarden/authenticator/data/auth/datasource/disk/AuthDiskSourceImpl.kt (+13 -0)
📝 authenticator/src/main/kotlin/com/bitwarden/authenticator/data/platform/datasource/network/di/PlatformNetworkModule.kt (+43 -23)

...and 23 more files

📄 Description

🎟️ Tracking

PM-20549

📔 Objective

Introduce BitwardenServiceClient as the primary access point for Bitwarden services.

Key changes include:

  • BitwardenServiceClient: Introduced BitwardenServiceClient and its implementation BitwardenServiceClientImpl. This class centralizes access to all Bitwarden API services and handles the underlying networking logic.
  • Service Consolidation: All network service interfaces (e.g., AccountsService, ConfigService, etc.) are now accessed through the BitwardenServiceClient.
  • BitwardenServiceClientConfig: Added BitwardenServiceClientConfig to provide a structured way to configure the BitwardenServiceClient, including client data, authentication, and other settings.
  • RefreshTokenProvider: Introduced RefreshTokenProvider and AppIdProvider interfaces for handling refresh tokens and app IDs, respectively.
  • RefreshAuthenticator: Created RefreshAuthenticator to manage token refresh logic using RefreshTokenProvider.
  • Retrofit Refactoring: Moved Retrofits and RetrofitsImpl to the network module. RetrofitsImpl now supports an optional RefreshAuthenticator.
  • Module Updates:
    • Moved JwtTokenUtils, Retrofits, BitwardenX509ExtendedKeyManager to the network module.
    • Updated AuthDiskSource to implement AppIdProvider.
    • Updated AuthenticatorProvider to implement RefreshTokenProvider.
    • Updated Fido2NetworkModule to use BitwardenServiceClient.
  • Usage Updates: Updated dependent modules (e.g., authenticator, app) to use the new BitwardenServiceClient and its services.
  • Dependencies: Updated dependencies between modules to reflect the changes.
  • AppId provider: Added AppIdProvider and the logic to generate unique appId in AuthDiskSource.

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/5091 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 4/23/2025 **Status:** ✅ Merged **Merged:** 4/25/2025 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `main` ← **Head:** `network-module/bitwarden-service-client` --- ### 📝 Commits (1) - [`bc0dc4a`](https://github.com/bitwarden/android/commit/bc0dc4a8f718df641d6e8ab6daa538ac63703a76) [PM-20549] Refactor network layer to use BitwardenServiceClient ### 📊 Changes **43 files changed** (+814 additions, -670 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/disk/AuthDiskSource.kt` (+2 -8) 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/di/AuthNetworkModule.kt` (+15 -52) 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt` (+46 -28) 📝 `app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/GetTokenResponseExtensions.kt` (+1 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/autofill/fido2/datasource/network/di/Fido2NetworkModule.kt` (+3 -9) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/authenticator/AuthenticatorProvider.kt` (+2 -10) ➖ `app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/authenticator/RefreshAuthenticator.kt` (+0 -73) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/di/PlatformNetworkModule.kt` (+28 -62) ➖ `app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/ssl/SslManager.kt` (+0 -20) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt` (+3 -3) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/network/NetworkConfigManagerImpl.kt` (+3 -4) 📝 `app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/network/di/VaultNetworkModule.kt` (+11 -47) 📝 `app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt` (+1 -1) 📝 `app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/GetTokenResponseExtensionsTest.kt` (+2 -1) 📝 `app/src/test/java/com/x8bit/bitwarden/data/auth/repository/util/JwtTokenUtilsTest.kt` (+2 -1) 📝 `app/src/test/java/com/x8bit/bitwarden/data/platform/manager/network/NetworkConfigManagerTest.kt` (+7 -4) 📝 `app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt` (+2 -2) 📝 `authenticator/src/main/kotlin/com/bitwarden/authenticator/data/auth/datasource/disk/AuthDiskSource.kt` (+3 -1) 📝 `authenticator/src/main/kotlin/com/bitwarden/authenticator/data/auth/datasource/disk/AuthDiskSourceImpl.kt` (+13 -0) 📝 `authenticator/src/main/kotlin/com/bitwarden/authenticator/data/platform/datasource/network/di/PlatformNetworkModule.kt` (+43 -23) _...and 23 more files_ </details> ### 📄 Description ## 🎟️ Tracking PM-20549 ## 📔 Objective Introduce `BitwardenServiceClient` as the primary access point for Bitwarden services. Key changes include: - **`BitwardenServiceClient`:** Introduced `BitwardenServiceClient` and its implementation `BitwardenServiceClientImpl`. This class centralizes access to all Bitwarden API services and handles the underlying networking logic. - **Service Consolidation:** All network service interfaces (e.g., `AccountsService`, `ConfigService`, etc.) are now accessed through the `BitwardenServiceClient`. - **`BitwardenServiceClientConfig`:** Added `BitwardenServiceClientConfig` to provide a structured way to configure the `BitwardenServiceClient`, including client data, authentication, and other settings. - **`RefreshTokenProvider`:** Introduced `RefreshTokenProvider` and `AppIdProvider` interfaces for handling refresh tokens and app IDs, respectively. - **`RefreshAuthenticator`:** Created `RefreshAuthenticator` to manage token refresh logic using `RefreshTokenProvider`. - **Retrofit Refactoring:** Moved `Retrofits` and `RetrofitsImpl` to the `network` module. `RetrofitsImpl` now supports an optional `RefreshAuthenticator`. - **Module Updates:** - Moved `JwtTokenUtils`, `Retrofits`, `BitwardenX509ExtendedKeyManager` to the `network` module. - Updated `AuthDiskSource` to implement `AppIdProvider`. - Updated `AuthenticatorProvider` to implement `RefreshTokenProvider`. - Updated `Fido2NetworkModule` to use `BitwardenServiceClient`. - **Usage Updates:** Updated dependent modules (e.g., `authenticator`, `app`) to use the new `BitwardenServiceClient` and its services. - **Dependencies:** Updated dependencies between modules to reflect the changes. - **AppId provider:** Added `AppIdProvider` and the logic to generate unique appId in `AuthDiskSource`. ## ⏰ 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 2025-11-27 00:02:36 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#5471