mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-05-02 14:16:59 +02:00
Cross-signing: Detect when cross-signing keys have been changed
This commit is contained in:
@@ -227,6 +227,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
@property (nonatomic, weak) id userDidSignInOnNewDeviceObserver;
|
||||
@property (weak, nonatomic) UIAlertController *userNewSignInAlertController;
|
||||
|
||||
@property (nonatomic, weak) id userDidChangeCrossSigningKeysObserver;
|
||||
|
||||
/**
|
||||
Related push notification service instance. Will be created when launch finished.
|
||||
*/
|
||||
@@ -1773,6 +1775,8 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
// Register to user new device sign in notification
|
||||
[self registerUserDidSignInOnNewDeviceNotificationForSession:mxSession];
|
||||
|
||||
[self registerDidChangeCrossSigningKeysNotificationForSession:mxSession];
|
||||
|
||||
// Register to new key verification request
|
||||
[self registerNewRequestNotificationForSession:mxSession];
|
||||
|
||||
@@ -4263,6 +4267,29 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
|
||||
self.userNewSignInAlertController = alert;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Cross-signing reset detection
|
||||
|
||||
- (void)registerDidChangeCrossSigningKeysNotificationForSession:(MXSession*)session
|
||||
{
|
||||
MXCrossSigning *crossSigning = session.crypto.crossSigning;
|
||||
|
||||
if (!crossSigning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self.userDidChangeCrossSigningKeysObserver = [NSNotificationCenter.defaultCenter addObserverForName:MXCrossSigningDidChangeCrossSigningKeysNotification
|
||||
object:crossSigning
|
||||
queue:[NSOperationQueue mainQueue]
|
||||
usingBlock:^(NSNotification *notification)
|
||||
{
|
||||
NSLog(@"[AppDelegate] registerDidChangeCrossSigningKeysNotificationForSession");
|
||||
[self.masterTabBarController presentVerifyCurrentSessionAlertIfNeededWithSession:session];
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Complete security
|
||||
|
||||
- (BOOL)presentCompleteSecurityForSession:(MXSession*)mxSession
|
||||
|
||||
Reference in New Issue
Block a user