-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Data transfer support #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
f55a959
chore: Move DerivedTokenGenerator to the Auth module
LouisCAD 8e0d9e8
feat: Introduce the RestoreFromBackupManager interface
LouisCAD 168a96c
chore: Add suspending allUsers() in UserDao
LouisCAD a65d485
feat: Add WIP RestoreFromBackupManagerImpl
LouisCAD 833d251
chore: Forward issues from DerivedTokenGenerator in RestoreFromBackup…
LouisCAD 621be18
chore: Store user token to device association in the db instead of a …
LouisCAD 4524930
chore: Move ensureRestorationIsHandled from impl to the sealed class
LouisCAD 890d8e0
chore: Add `shouldShowRestorationScreen` helper in RestoreFromBackupM…
LouisCAD ff0c5b2
feat: Auto retry post-restoration token derivation if appropriate
LouisCAD 8f41981
fix: Use a getter to get the up-to-date userDataCleanableList
LouisCAD 4c04e37
feat: Remove relevant users when the user gives up backup restoration
LouisCAD f88fd22
docs: Update CrossAppLogin README.md
LouisCAD 5062360
fix: Fix crashes and race condition
LouisCAD 9ccb9e2
feat: Add barebones RestoringFromBackupFailedScreen
LouisCAD 19cfd5e
feat: Move landscape UI of backup restoration failed to the end
LouisCAD a9ff1f0
fix: Fix AccountUtils tests
LouisCAD 392d7bc
fix: Ensure attestation tokens cannot be reused
LouisCAD 42efec6
feat: Add strings
Elouan1411 eac4ad3
fix: Update UI
Elouan1411 b818fa1
chore: Extract nested when
LouisCAD c98e234
fix: Don't auto-retry if we received http 401
LouisCAD 3b6b759
chore: Add braces to if branch
LouisCAD ce3de05
chore: Add fast-path for not set up app
LouisCAD 2bb2848
feat: Support the Authenticator app
LouisCAD 20da144
chore: Fix compilation by adding a default parameter value
LouisCAD 66a859f
chore: Ensure we don't auto-retry http 400 requests
LouisCAD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
203 changes: 203 additions & 0 deletions
203
Auth/schemas/com.infomaniak.core.auth.room.UserDatabase/9.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| { | ||
| "formatVersion": 1, | ||
| "database": { | ||
| "version": 9, | ||
| "identityHash": "5c16489c4961bd978d19b0d0c0bacb8d", | ||
| "entities": [ | ||
| { | ||
| "tableName": "User", | ||
| "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `displayName` TEXT, `firstname` TEXT NOT NULL, `lastname` TEXT NOT NULL, `email` TEXT NOT NULL, `avatar` TEXT, `login` TEXT NOT NULL, `isStaff` INTEGER NOT NULL DEFAULT false, `organizations` TEXT NOT NULL, `preferences_security_score` INTEGER DEFAULT 0, `preferences_security_dateLastChangedPassword` INTEGER DEFAULT 0, `preferences_organizationPreference_currentOrganizationId` INTEGER NOT NULL DEFAULT 0, `accessToken` TEXT NOT NULL, `refreshToken` TEXT, `tokenType` TEXT NOT NULL, `expiresIn` INTEGER NOT NULL, `userId` INTEGER NOT NULL, `scope` TEXT, `expiresAt` INTEGER, `isTemporary` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`id`))", | ||
| "fields": [ | ||
| { | ||
| "fieldPath": "id", | ||
| "columnName": "id", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "displayName", | ||
| "columnName": "displayName", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "firstname", | ||
| "columnName": "firstname", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "lastname", | ||
| "columnName": "lastname", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "email", | ||
| "columnName": "email", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "avatar", | ||
| "columnName": "avatar", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "login", | ||
| "columnName": "login", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "isStaff", | ||
| "columnName": "isStaff", | ||
| "affinity": "INTEGER", | ||
| "notNull": true, | ||
| "defaultValue": "false" | ||
| }, | ||
| { | ||
| "fieldPath": "organizations", | ||
| "columnName": "organizations", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "preferences.security.score", | ||
| "columnName": "preferences_security_score", | ||
| "affinity": "INTEGER", | ||
| "defaultValue": "0" | ||
| }, | ||
| { | ||
| "fieldPath": "preferences.security.dateLastChangedPassword", | ||
| "columnName": "preferences_security_dateLastChangedPassword", | ||
| "affinity": "INTEGER", | ||
| "defaultValue": "0" | ||
| }, | ||
| { | ||
| "fieldPath": "preferences.organizationPreference.currentOrganizationId", | ||
| "columnName": "preferences_organizationPreference_currentOrganizationId", | ||
| "affinity": "INTEGER", | ||
| "notNull": true, | ||
| "defaultValue": "0" | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.accessToken", | ||
| "columnName": "accessToken", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.refreshToken", | ||
| "columnName": "refreshToken", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.tokenType", | ||
| "columnName": "tokenType", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.expiresIn", | ||
| "columnName": "expiresIn", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.userId", | ||
| "columnName": "userId", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.scope", | ||
| "columnName": "scope", | ||
| "affinity": "TEXT" | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.expiresAt", | ||
| "columnName": "expiresAt", | ||
| "affinity": "INTEGER" | ||
| }, | ||
| { | ||
| "fieldPath": "apiToken.isTemporary", | ||
| "columnName": "isTemporary", | ||
| "affinity": "INTEGER", | ||
| "notNull": true, | ||
| "defaultValue": "0" | ||
| } | ||
| ], | ||
| "primaryKey": { | ||
| "autoGenerate": false, | ||
| "columnNames": [ | ||
| "id" | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "tableName": "CurrentUserId", | ||
| "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER, `uniqueKey` TEXT NOT NULL, PRIMARY KEY(`uniqueKey`))", | ||
| "fields": [ | ||
| { | ||
| "fieldPath": "id", | ||
| "columnName": "id", | ||
| "affinity": "INTEGER" | ||
| }, | ||
| { | ||
| "fieldPath": "uniqueKey", | ||
| "columnName": "uniqueKey", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| } | ||
| ], | ||
| "primaryKey": { | ||
| "autoGenerate": false, | ||
| "columnNames": [ | ||
| "uniqueKey" | ||
| ] | ||
| } | ||
| }, | ||
| { | ||
| "tableName": "TokenDeviceBinding", | ||
| "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`userId` INTEGER NOT NULL, `androidId` TEXT NOT NULL, PRIMARY KEY(`userId`), FOREIGN KEY(`userId`) REFERENCES `User`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", | ||
| "fields": [ | ||
| { | ||
| "fieldPath": "userId", | ||
| "columnName": "userId", | ||
| "affinity": "INTEGER", | ||
| "notNull": true | ||
| }, | ||
| { | ||
| "fieldPath": "androidId", | ||
| "columnName": "androidId", | ||
| "affinity": "TEXT", | ||
| "notNull": true | ||
| } | ||
| ], | ||
| "primaryKey": { | ||
| "autoGenerate": false, | ||
| "columnNames": [ | ||
| "userId" | ||
| ] | ||
| }, | ||
| "foreignKeys": [ | ||
| { | ||
| "table": "User", | ||
| "onDelete": "CASCADE", | ||
| "onUpdate": "NO ACTION", | ||
| "columns": [ | ||
| "userId" | ||
| ], | ||
| "referencedColumns": [ | ||
| "id" | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "setupQueries": [ | ||
| "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
| "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5c16489c4961bd978d19b0d0c0bacb8d')" | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Auth/src/main/kotlin/com/infomaniak/core/auth/DerivedTokenGenerator.IssueExtensions.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * Infomaniak Core - Android | ||
| * Copyright (C) 2026 Infomaniak Network SA | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
| package com.infomaniak.core.auth | ||
|
|
||
| import com.infomaniak.core.appintegrity.AppIntegrityIssue | ||
| import com.infomaniak.core.auth.DerivedTokenGenerator.Issue | ||
|
|
||
| fun Issue.shouldReport(): Boolean = when (this) { | ||
| is Issue.AppIntegrityCheckFailed -> false | ||
| is Issue.ErrorResponse -> response.code !in 500..599 | ||
| is Issue.NetworkIssue -> false | ||
| is Issue.OtherIssue -> true | ||
| } | ||
|
|
||
| internal fun Issue.shouldRetryAutomatically(): Boolean = when (this) { | ||
| is Issue.AppIntegrityCheckFailed -> shouldRetryAutomatically() | ||
| is Issue.ErrorResponse -> shouldRetryAutomatically() | ||
| is Issue.NetworkIssue -> true | ||
| is Issue.OtherIssue -> false | ||
| } | ||
|
|
||
| private fun Issue.AppIntegrityCheckFailed.shouldRetryAutomatically(): Boolean = when (details.issue) { | ||
| is AppIntegrityIssue.RetryLater, is AppIntegrityIssue.Internal -> true | ||
| is AppIntegrityIssue.DeviceIssue, is AppIntegrityIssue.DevError, is AppIntegrityIssue.SuspiciousError -> false | ||
| } | ||
|
|
||
| private fun Issue.ErrorResponse.shouldRetryAutomatically(): Boolean = when (response.code) { | ||
| 400, 401 -> false | ||
| else -> true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.