Skip to content

feat: Data transfer support - #825

Open
LouisCAD wants to merge 44 commits into
mainfrom
data-transfer-support
Open

feat: Data transfer support#825
LouisCAD wants to merge 44 commits into
mainfrom
data-transfer-support

Conversation

@LouisCAD

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI 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.

Pull request overview

Adds account data-transfer recovery by detecting device changes and re-deriving restored authentication tokens.

Changes:

  • Persists Android ID bindings for user tokens via Room.
  • Adds restoration orchestration, request blocking, retry/give-up UI, and error handling.
  • Moves token derivation into Auth and updates account APIs.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
CrossAppLogin/README.md Updates account-removal guidance.
CrossAppLogin/Back/.../SharedDeviceIdStorage.kt Reuses the shared Android ID helper.
CrossAppLogin/Back/.../BaseCrossAppLoginViewModel.kt Uses Auth token derivation APIs.
Common/.../AndroidId.kt Adds the shared Android ID helper.
Auth/.../UserAccountUtils.kt Stores token-device bindings.
Auth/.../TokenInterceptor.kt Waits for restoration handling.
Auth/.../room/UserDatabase.kt Adds the binding entity and migration.
Auth/.../room/UserDao.kt Adds binding queries and user-list APIs.
Auth/.../PersistedCurrentUserAccountUtils.kt Accepts deferred cleanup providers.
Auth/.../models/TokenDeviceBinding.kt Defines token-device persistence.
Auth/.../DerivedTokenGeneratorImpl.kt Moves derivation implementation into Auth.
Auth/.../DerivedTokenGenerator.kt Exposes the derivation contract.
Auth/.../DerivedTokenGenerator.IssueExtensions.kt Centralizes issue policies.
Auth/.../CredentialManager.kt Integrates modern account utilities.
Auth/.../backup/RestoringFromBackupFailedScreen.kt Adds restoration failure UI.
Auth/.../backup/RestoreFromBackupManagerImpl.kt Implements restoration handling.
Auth/.../backup/RestoreFromBackupManager.kt Defines restoration state and API.
Auth/.../AbstractCurrentUserAccountUtils.kt Accepts deferred cleanup providers.
Auth/schemas/.../9.json Records Room schema version 9.
Auth/build.gradle.kts Adds Compose UI dependencies.

Comment thread Auth/src/main/kotlin/com/infomaniak/core/auth/UserAccountUtils.kt
Comment thread Auth/src/main/kotlin/com/infomaniak/core/auth/CredentialManager.kt
Comment thread Auth/src/main/kotlin/com/infomaniak/core/auth/room/UserDao.kt
Comment thread Auth/src/main/kotlin/com/infomaniak/core/auth/UserAccountUtils.kt Outdated
@LouisCAD

Copy link
Copy Markdown
Contributor Author

TODO: Ensure we can disable this for the Authenticator app.

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@LouisCAD I've opened a new pull request, #826, to work on those changes. Once the pull request is ready, I'll request review from you.

Comment thread Auth/src/main/kotlin/com/infomaniak/core/auth/UserAccountUtils.kt
@LouisCAD
LouisCAD force-pushed the data-transfer-support branch 2 times, most recently from 87eb958 to bee0f91 Compare August 11, 2026 10:47
@LouisCAD
LouisCAD requested a review from tevincent August 12, 2026 07:32
@LouisCAD
LouisCAD force-pushed the data-transfer-support branch 2 times, most recently from 66a859f to de52876 Compare August 17, 2026 09:41
@LouisCAD
LouisCAD force-pushed the data-transfer-support branch from aef2078 to baef596 Compare August 17, 2026 16:39
@LouisCAD
LouisCAD force-pushed the data-transfer-support branch 2 times, most recently from 7cdab93 to c22047b Compare August 19, 2026 12:43
@LouisCAD

Copy link
Copy Markdown
Contributor Author

Should be merged once all apps have a ready pending PR with the proper backup rules.

  • kDrive
  • Mail
  • Authenticator
  • SwissTransfer
  • Euria

LouisCAD and others added 28 commits August 20, 2026 10:40
We are not going to allow reusing them.
However, we will probably consider using the "standard" API (over the "classic" one),
to allow generating many tokens for cheaper thanks to the shared costly operation.
This makes restoreAccounts more digest.
Make RestoreFromBackupManagerImpl accept injectable userDatabase and
tokenGenerator constructor parameters (defaulting to the existing
production singletons) so the class can be exercised in isolation.

Add RestoreFromBackupManagerImplTest covering the full state-machine:
- No users → Settled immediately
- Same-device users → Settled immediately (no derivation)
- Pre-v9 users with missing binding → binding added, Settled
- Multiple users, all missing bindings → bindings added, Settled
- Transferred device with successful derivation → token & binding updated
- Multiple transferred users, all succeed
- Mixed (same-device + transferred)
- Derivation failure → RestoringFromBackupFailed state emitted
- Failure then retry (generator swapped to success) → Settled
- Failure then give-up → failed user removed, Settled
- Partial failure (one same-device, one transferred-and-failed) → only
  failed user removed
@LouisCAD
LouisCAD force-pushed the data-transfer-support branch from c8c224c to ffb65bd Compare August 20, 2026 08:41
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants