mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add a recovery key screen hook. (#5684)
update generateRecoveryKey to take a passphrase option Wire up AppHooks with recovery key hook Update xcodeproj Review fixups Review fixups Make the `SecureBackupRecoveryState.viewMode` extension private Bump the enterprise submodule
This commit is contained in:
@@ -110,19 +110,18 @@ class SecureBackupController: SecureBackupControllerProtocol {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
func generateRecoveryKey() async -> Result<String, SecureBackupControllerError> {
|
||||
func generateRecoveryKey(withPassphrase passphrase: String?) async -> Result<String, SecureBackupControllerError> {
|
||||
do {
|
||||
guard recoveryState.value == .disabled else {
|
||||
if recoveryState.value == .disabled {
|
||||
MXLog.info("Enabling recovery")
|
||||
} else {
|
||||
MXLog.info("Resetting recovery key")
|
||||
|
||||
let key = try await encryption.resetRecoveryKey()
|
||||
return .success(key)
|
||||
}
|
||||
|
||||
MXLog.info("Enabling recovery")
|
||||
|
||||
var keyUploadErrored = false
|
||||
let recoveryKey = try await encryption.enableRecovery(waitForBackupsToUpload: false, passphrase: nil, progressListener: SDKListener { [weak self] state in
|
||||
// Note: `enableRecovery` also handles the reset case (equivalent to `resetRecoveryKey`).
|
||||
// Despite the name, it is the correct call for both initial setup and key rotation.
|
||||
let recoveryKey = try await encryption.enableRecovery(waitForBackupsToUpload: false, passphrase: passphrase, progressListener: SDKListener { [weak self] state in
|
||||
guard let self else { return }
|
||||
|
||||
switch state {
|
||||
|
||||
@@ -55,7 +55,7 @@ protocol SecureBackupControllerProtocol {
|
||||
func enable() async -> Result<Void, SecureBackupControllerError>
|
||||
func disable() async -> Result<Void, SecureBackupControllerError>
|
||||
|
||||
func generateRecoveryKey() async -> Result<String, SecureBackupControllerError>
|
||||
func generateRecoveryKey(withPassphrase passphrase: String?) async -> Result<String, SecureBackupControllerError>
|
||||
func confirmRecoveryKey(_ key: String) async -> Result<Void, SecureBackupControllerError>
|
||||
|
||||
func waitForKeyBackupUpload(uploadStateSubject: CurrentValueSubject<SecureBackupSteadyState, Never>) async -> Result<Void, SecureBackupControllerError>
|
||||
|
||||
Reference in New Issue
Block a user