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

Rust crypto: ensure we persist the key backup version #3770

Merged
merged 9 commits into from
Oct 4, 2023

Conversation

BillCarsonFr
Copy link
Member

@BillCarsonFr BillCarsonFr commented Oct 3, 2023

Fixes element-hq/element-web#26259

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

This change is marked as an internal change (Task), so will not be included in the changelog.

@BillCarsonFr BillCarsonFr marked this pull request as ready for review October 3, 2023 11:55
@BillCarsonFr BillCarsonFr requested a review from a team as a code owner October 3, 2023 11:55
@BillCarsonFr BillCarsonFr requested review from dbkr and richvdh October 3, 2023 11:55
src/crypto-api.ts Outdated Show resolved Hide resolved
const base64Key = encodeBase64(key);

// TODO get version from backupManager
await this.olmMachine.saveBackupDecryptionKey(RustSdkCryptoJs.BackupDecryptionKey.fromBase64(base64Key), "");
const activeVersion = version ?? (await this.backupManager.requestKeyBackupVersion())?.version;
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to avoid the call to requestKeyBackupVersion. Can we just make version mandatory? AFAICT the caller should always have it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I was a bit hesitant, wasn't it part of API? Mainly why I kept the existing one as deprecated

Copy link
Member

@richvdh richvdh Oct 3, 2023

Choose a reason for hiding this comment

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

We need to keep the old one working for old crypto. It doesn't mean we have to keep the old one working with rust crypto provided the new one works with the react-sdk.

@richvdh richvdh changed the title Fix 26259 Rust crypto: ensure we persist the key backup version Oct 3, 2023
src/crypto-api.ts Show resolved Hide resolved
src/crypto/index.ts Outdated Show resolved Hide resolved
src/rust-crypto/rust-crypto.ts Outdated Show resolved Hide resolved
src/crypto/CrossSigning.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
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 otherwise, thanks!

src/crypto-api.ts Outdated Show resolved Hide resolved
src/crypto-api.ts Outdated Show resolved Hide resolved
src/crypto-api.ts Outdated Show resolved Hide resolved
@BillCarsonFr BillCarsonFr enabled auto-merge October 3, 2023 15:08
@BillCarsonFr BillCarsonFr added this pull request to the merge queue Oct 3, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 3, 2023
@richvdh richvdh added this pull request to the merge queue Oct 3, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 3, 2023
@richvdh richvdh added this pull request to the merge queue Oct 3, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 3, 2023
@richvdh richvdh added this pull request to the merge queue Oct 4, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 4, 2023
@richvdh richvdh merged commit 95baccf into develop Oct 4, 2023
@richvdh richvdh deleted the valere/element-r/backup/fix_26259 branch October 4, 2023 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Element-R: restoring individual keys from backup doesn't work
2 participants