Skip to content

Commit

Permalink
element-hq/element-ios/issues/4255 - Removed extra device unpickling.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Sep 10, 2021
1 parent dd57fea commit 9ff1073
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
19 changes: 2 additions & 17 deletions MatrixSDK/Crypto/Dehydration/MXDehydrationService.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,7 @@ - (void)rehydrateDeviceWithMatrixRestClient:(MXRestClient*)restClient
failure([NSError errorWithDomain:MXDehydrationServiceErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: @"Wrong algorithm for dehydrated device"}]);
return;
}

NSError *error = nil;
MXLogDebug(@"[MXDehydrationService] Unpickling dehydrated device.");
OLMAccount *account = [[OLMAccount alloc] initWithSerializedData:device.account key:dehydrationKey error:&error];

MXLogDebug(@"[MXDehydrationService] Account %@ deserialized with keys %@", device.deviceId, account.identityKeys);

if (error)
{
MXLogError(@"[MXDehydrationService] Failed to unpickling device account with error: %@.", error);
failure([NSError errorWithDomain:MXDehydrationServiceErrorDomain code:0 userInfo:@{NSLocalizedDescriptionKey: @"Failed to unpickle device account"}]);
return;
}

MXLogDebug(@"[MXDehydrationService] Device unpickled %@", account);


[restClient claimDehydratedDeviceWithId:device.deviceId Success:^(BOOL isClaimed) {
if (!isClaimed)
{
Expand All @@ -181,7 +166,7 @@ - (void)rehydrateDeviceWithMatrixRestClient:(MXRestClient*)restClient
dispatch_async(dispatch_get_main_queue(), ^{
if (stored)
{
MXLogDebug(@"[MXDehydrationService] Successfully rehydrated device %@ with identity keys %@", device.deviceId, account.identityKeys);
MXLogDebug(@"[MXDehydrationService] Successfully rehydrated device %@", device.deviceId);
success(device.deviceId);
}
else
Expand Down
1 change: 1 addition & 0 deletions changelog.d/4255. change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cross-signing device backups and dehydrated device info.

0 comments on commit 9ff1073

Please sign in to comment.