mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Key backup Rust API adoption (#1952)
* Adopt Rust side secure backup APIs (incomplete, based on poljar/backup-pr) * Implement the home screen recovery key confirmation banner. * Update with the latest Rust changes. The loading button for .unknown was incorrect. It should be treated as disabled. --------- Co-authored-by: Doug <douglase@element.io>
This commit is contained in:
@@ -28,6 +28,8 @@ enum SecureBackupRecoveryKeyState {
|
||||
}
|
||||
|
||||
enum SecureBackupKeyBackupState {
|
||||
/// Any state where backups couldn't have been enabled but we didn't explicitly disable them on this client.
|
||||
/// For all intents and purposes, within the client, this can be treated as `disabled`.
|
||||
case unknown
|
||||
case enabling
|
||||
case enabled
|
||||
@@ -36,11 +38,13 @@ enum SecureBackupKeyBackupState {
|
||||
}
|
||||
|
||||
enum SecureBackupControllerError: Error {
|
||||
case failedEnablingKeyBackup
|
||||
case failedDisablingKeyBackup
|
||||
case failedEnablingBackup
|
||||
case failedDisablingBackup
|
||||
|
||||
case failedGeneratingRecoveryKey
|
||||
case failedConfirmingRecoveryKey
|
||||
|
||||
case failedFetchingSessionState
|
||||
}
|
||||
|
||||
// sourcery: AutoMockable
|
||||
@@ -49,14 +53,14 @@ protocol SecureBackupControllerProtocol {
|
||||
|
||||
var keyBackupState: CurrentValuePublisher<SecureBackupKeyBackupState, Never> { get }
|
||||
|
||||
var isLastSession: Bool { get }
|
||||
|
||||
func enableBackup() async -> Result<Void, SecureBackupControllerError>
|
||||
func disableBackup() async -> Result<Void, SecureBackupControllerError>
|
||||
func enable() async -> Result<Void, SecureBackupControllerError>
|
||||
func disable() async -> Result<Void, SecureBackupControllerError>
|
||||
|
||||
func generateRecoveryKey() async -> Result<String, SecureBackupControllerError>
|
||||
func confirmRecoveryKey(_ key: String) async -> Result<Void, SecureBackupControllerError>
|
||||
|
||||
func isLastSession() async -> Result<Bool, SecureBackupControllerError>
|
||||
|
||||
func waitForKeyBackup() async
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user