Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated code and OLMKit dependency #1880

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

Velin92
Copy link
Member

@Velin92 Velin92 commented Sep 16, 2024

This is better reviewed commit by commit.
This is a massive PR about removing legacy code, might split it in multiple PRs, but this is actually the first stable state in which I was able to make everything compile and work

What is done and what is missing:

  • 
 Remove all sharedHistory code
  • 
 Remove MX_CRYPTO macros
  • 
 MXUserTrustLevel can be removed and replaced with a single isVerified boolean, given that we no longer need to distinguish local and crossSigning trust status
  • 
 NSCoding implementations from MXCrossSigningInfo and others can be removed, as they are no longer persisted on the iOS side, but rather rust side
  • 
 Remove a number of unnecessary options from MXSDKOptions, such as enableRoomSharedHistoryOnInvite or enableSymmetricBackup
  • 
 A large number of integration tests access a legacyCrypto or legacyCrossSigning property which should be removed. These tests then have to be either refactored or removed entirely
  • 
 Remove MXBackgroundCryptoStore
  • 
 Legacy MXCryptoStore and MXRealmCryptoStore need to remain in place for the purpose of data migration to rust crypto, but only a few methods are required. (NOTE: I actually removed them since we don’t want to allow migration anymore)
  • 
 Remove MXSecretShareManager, and the requestPrivateKeys in MXKeyBackup which is no longer used
  • 
 This will enable the removal of many other associated classes, such as MXLegacySasTransaction, MXMegolmEncryption, MXMegolmDecryption etc
  • Remove main ...Legacy... classes such as MXLegacyCrypto, MXLegacyCrossSigning, MXLegacyKeyVerificationManager etc

@Velin92 Velin92 marked this pull request as draft September 16, 2024 22:37
@Velin92 Velin92 marked this pull request as ready for review September 17, 2024 08:00
Copy link
Member

@pixlwave pixlwave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff 👏

A lot of this goes over my head but we had a chat in a call about it and I've left some summary comments. Definitely needs an approval by someone with more crypto knowledge before merging but looks decent to me.

(Its a shame so many tests are going but they're all clearly based around the legacy crypto stack).

@@ -24,143 +24,3 @@
#pragma mark - Constants

NSString *const MXCrossSigningToolsErrorDomain = @"org.matrix.sdk.crosssigning.tools";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all the imports above given this is all that is all that is left?

Comment on lines -389 to -397
{
NSString *threePidConcatenation = [NSString stringWithFormat:@"%@ %@ %@", threepid, medium, pepper];

OLMUtility *olmUtility = [OLMUtility new];
NSString *hashedSha256ThreePid = [olmUtility sha256:[threePidConcatenation dataUsingEncoding:NSUTF8StringEncoding]];
hashedTreePid = [MXBase64Tools base64ToBase64Url:hashedSha256ThreePid];

threePidArrayByThreePidConcatHash[hashedTreePid] = threepidArray;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think where you have a removal of the plain OLMUtility in an existing class, we should find a replacement using system libraries. E.g. this looks like just a SHA256 which we should still be doing for the identity server.

Comment on lines -560 to -579
// Validate the secret before storing it
if ([self checkSecret:secret withSecretId:secretId])
{
if (![secret isEqualToString:[self.dependencies.secretStore secretWithSecretId:secretId]])
{
MXLogDebug(@"[MXRecoveryService] recoverSecrets: Recovered secret %@", secretId);

[updatedSecrets addObject:secretId];
[self.dependencies.secretStore storeSecret:secret withSecretId:secretId];
}
else
{
MXLogDebug(@"[MXRecoveryService] recoverSecrets: Secret %@ was already known", secretId);
}
}
else
{
MXLogDebug(@"[MXRecoveryService] recoverSecrets: Secret %@ is invalid", secretId);
[invalidSecrets addObject:secretId];
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that Rust will validate these secrets for us?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed in a call that we should check whether these MXOlm…GroupSession classes are used with Rust crypto or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants