Skip to content

Commit

Permalink
Merge pull request #6555 from vector-im/ismail/symmetric_backup
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailgulek authored Aug 12, 2022
2 parents 963febd + 971ecf0 commit 6f0d796
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ final class KeyBackupRecoverCoordinator: KeyBackupRecoverCoordinatorType {
let coordinator: Coordinator & Presentable

// Check if a passphrase has been set for given backup
if let megolmBackupAuthData = MXMegolmBackupAuthData(fromJSON: self.keyBackupVersion.authData), megolmBackupAuthData.privateKeySalt != nil {
if self.keyBackupVersion.authData["private_key_salt"] != nil {
coordinator = self.createRecoverFromPassphraseCoordinator()
} else {
coordinator = self.createRecoverFromRecoveryKeyCoordinator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ final class KeyBackupSetupCoordinator: KeyBackupSetupCoordinatorType {
return
}

keyBackup.prepareKeyBackupVersion(withPassword: nil, success: { megolmBackupCreationInfo in
keyBackup.prepareKeyBackupVersion(withPassword: nil, algorithm: nil, success: { megolmBackupCreationInfo in
keyBackup.createKeyBackupVersion(megolmBackupCreationInfo, success: { _ in
recoveryService.updateRecovery(forSecrets: [MXSecretId.keyBackup.takeUnretainedValue() as String], withPrivateKey: privateKey) {
completion(.success(Void()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ final class KeyBackupSetupPassphraseViewModel: KeyBackupSetupPassphraseViewModel

self.update(viewState: .loading)

self.keyBackup.prepareKeyBackupVersion(withPassword: passphrase, success: { [weak self] (megolmBackupCreationInfo) in
self.keyBackup.prepareKeyBackupVersion(withPassword: passphrase, algorithm: nil, success: { [weak self] (megolmBackupCreationInfo) in
guard let sself = self else {
return
}
Expand All @@ -122,7 +122,7 @@ final class KeyBackupSetupPassphraseViewModel: KeyBackupSetupPassphraseViewModel
private func setupRecoveryKey() {
self.update(viewState: .loading)

self.keyBackup.prepareKeyBackupVersion(withPassword: nil, success: { [weak self] (megolmBackupCreationInfo) in
self.keyBackup.prepareKeyBackupVersion(withPassword: nil, algorithm: nil, success: { [weak self] (megolmBackupCreationInfo) in
guard let sself = self else {
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ - (void)updateTextViewText
NSString *claimedKey = _mxEvent.keysClaimed[@"ed25519"];
NSString *algorithm = _mxEvent.wireContent[@"algorithm"];
NSString *sessionId = _mxEvent.wireContent[@"session_id"];
NSString *untrusted = _mxEvent.isUntrusted ? [VectorL10n userVerificationSessionsListSessionUntrusted] : [VectorL10n userVerificationSessionsListSessionTrusted];

NSString *decryptionError;
if (_mxEvent.decryptionError)
Expand Down Expand Up @@ -277,6 +278,16 @@ - (void)updateTextViewText
attributes:@{NSForegroundColorAttributeName: _defaultTextColor,
NSFontAttributeName: [UIFont systemFontOfSize:14]}]];
[eventInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]];

[eventInformationString appendAttributedString:[[NSMutableAttributedString alloc]
initWithString:[NSString stringWithFormat:@"%@\n", [VectorL10n sslTrust]]
attributes:@{NSForegroundColorAttributeName: _defaultTextColor,
NSFontAttributeName: [UIFont boldSystemFontOfSize:14]}]];
[eventInformationString appendAttributedString:[[NSMutableAttributedString alloc]
initWithString:untrusted
attributes:@{NSForegroundColorAttributeName: _defaultTextColor,
NSFontAttributeName: [UIFont systemFontOfSize:14]}]];
[eventInformationString appendAttributedString:[MXKEncryptionInfoView verticalWhitespace]];

[textViewAttributedString appendAttributedString:eventInformationString];
}
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-6555.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
KeyBackup: Adapt changes from sdk, add an entry into encryption info view of a message.

0 comments on commit 6f0d796

Please sign in to comment.