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

Manual key export / import with Crypto V2 #1608

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Conversation

Anderas
Copy link
Contributor

@Anderas Anderas commented Oct 17, 2022

  • Implement manual export / import of room keys via a file
  • Implement export / import of cross signing keys
  • Remove some old unused methods to export / import room keys without a passphrase

@Anderas Anderas requested review from a team and aringenbach and removed request for a team October 17, 2022 14:48
@codecov
Copy link

codecov bot commented Oct 18, 2022

Codecov Report

Base: 15.92% // Head: 25.92% // Increases project coverage by +9.99% 🎉

Coverage data is based on head (a8e2a76) compared to base (3f8efad).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1608      +/-   ##
===========================================
+ Coverage    15.92%   25.92%   +9.99%     
===========================================
  Files          575      575              
  Lines        91072    91037      -35     
  Branches     38407    39511    +1104     
===========================================
+ Hits         14507    23604    +9097     
+ Misses       76097    66670    -9427     
- Partials       468      763     +295     
Impacted Files Coverage Δ
...trixSDK/Crypto/CryptoMachine/MXCryptoMachine.swift 0.00% <0.00%> (ø)
...pto/KeyBackup/Engine/MXCryptoKeyBackupEngine.swift 0.00% <0.00%> (-49.49%) ⬇️
MatrixSDK/Crypto/MXCrypto.m 64.66% <ø> (+62.66%) ⬆️
MatrixSDK/Crypto/MXCryptoV2.swift 0.90% <0.00%> (-0.03%) ⬇️
...K/Crypto/SecretStorage/MXCryptoSecretStoreV2.swift 0.00% <0.00%> (ø)
...s/Crypto/CryptoMachine/MXCryptoProtocolStubs.swift 0.00% <0.00%> (-61.20%) ⬇️
MatrixSDKTests/MXCryptoTests.m 63.68% <ø> (+63.68%) ⬆️
MatrixSDK/Data/Filters/MXFilter.m 0.00% <0.00%> (-100.00%) ⬇️
MatrixSDKTests/MXErrorUnitTests.m 0.00% <0.00%> (-100.00%) ⬇️
MatrixSDKTests/MXToolsUnitTests.m 0.00% <0.00%> (-100.00%) ⬇️
... and 339 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Anderas Anderas requested review from a team and alfogrillo and removed request for aringenbach and a team October 18, 2022 11:27
Copy link
Contributor

@alfogrillo alfogrillo left a comment

Choose a reason for hiding this comment

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

IGTM!

// MARK: - Manual export / import

func exportRoomKeys(passphrase: String) throws -> Data {
return try backup.exportRoomKeys(passphrase: passphrase)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return try backup.exportRoomKeys(passphrase: passphrase)
try backup.exportRoomKeys(passphrase: passphrase)

}

func importRoomKeys(_ data: Data, passphrase: String) throws -> KeysImportResult {
return try backup.importRoomKeys(data, passphrase: passphrase, progressListener: self)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return try backup.importRoomKeys(data, passphrase: passphrase, progressListener: self)
try backup.importRoomKeys(data, passphrase: passphrase, progressListener: self)

@@ -228,6 +231,14 @@ class CryptoBackupStub: MXCryptoBackup {
roomKeysSpy = roomKeys
return KeysImportResult(imported: Int64(roomKeys.count), total: Int64(roomKeys.count), keys: [:])
}

func exportRoomKeys(passphrase: String) throws -> Data {
return Data()
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return Data()
.init()

}

func importRoomKeys(_ data: Data, passphrase: String, progressListener: ProgressListener) throws -> KeysImportResult {
return KeysImportResult(imported: 0, total: 0, keys: [:])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return KeysImportResult(imported: 0, total: 0, keys: [:])
.init(imported: 0, total: 0, keys: [:])

@Anderas Anderas merged commit 5960e8b into develop Oct 24, 2022
@Anderas Anderas deleted the andy/final_backups branch October 24, 2022 11:37
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.

None yet

2 participants