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

Add CryptoApi.getBackupInfo #4512

Conversation

florianduros
Copy link
Contributor

@florianduros florianduros commented Nov 12, 2024

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

Task element-hq/element-web#26922

Deprecated #4505 and we don't have any equivalent in the cryptoApi.
Add CryptoApi.getBackupInfo which is returning the key backup info the current key backup.

I wrongly advised to use CryptoApi.getActiveSessionBackupVersion which is returning the key backup version while we are expecting a key backup info.
Test for the old crypto is useless but I need it to reach more than 80% coverage.

@florianduros florianduros force-pushed the florianduros/rip-out-legacy-crypto/add-crypto-api-getbackupinfo branch 2 times, most recently from 1103cf0 to 3a17421 Compare November 12, 2024 13:09
@florianduros florianduros force-pushed the florianduros/rip-out-legacy-crypto/add-crypto-api-getbackupinfo branch 2 times, most recently from 34f63bc to 34f9785 Compare November 12, 2024 13:22
@florianduros florianduros marked this pull request as ready for review November 12, 2024 13:36
@florianduros florianduros requested review from a team as code owners November 12, 2024 13:36
Copy link
Contributor

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

Looks fine, but Rich will know the context.

@florianduros
Copy link
Contributor Author

florianduros commented Nov 12, 2024

@andybalaam Yep thx! I'm waiting for his opinion about it

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

needs better documentation please!

@@ -516,6 +516,14 @@ export interface CryptoApi {
*/
isKeyBackupTrusted(info: KeyBackupInfo): Promise<BackupTrustInfo>;

/**
* Get information about the current key backup.
Copy link
Member

Choose a reason for hiding this comment

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

We should define what "current" means here. The version we are currently using for automatic backup? The version we are currently using for automatic restore? The most recent backup on the server? Most recent on the server when we last checked? What if we haven't checked yet? Does it depend on whether we "trusted" the backup or not? How does it relate to getActiveSessionBackupVersion ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied the documentation of https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/rust-crypto/backup.ts#L111 since we are just calling this function.

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm

@florianduros florianduros added this pull request to the merge queue Nov 18, 2024
Merged via the queue into develop with commit 781c3b0 Nov 18, 2024
28 checks passed
@florianduros florianduros deleted the florianduros/rip-out-legacy-crypto/add-crypto-api-getbackupinfo branch November 18, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants