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 MatrixClient.initLegacyCrypto #4620

Conversation

florianduros
Copy link
Contributor

@florianduros florianduros commented Jan 16, 2025

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
Part of #4653
First step to delete definitively the legacy crypto stack. We deprecated during the past months the legacy crypto and now it is time to begin to delete it.

The removal will be in multiple phases and this PR has the unique goal to remove MatrixClient.initLegacyCrypto, the tests and documentation with direct references.

The legacy tests, integration tests, code will be removed or cleaned in other PRs.

@florianduros florianduros changed the title Remove MatrixClient.initLegacyCrypto Remove MatrixClient.initLegacyCrypto Jan 16, 2025
@florianduros florianduros force-pushed the florianduros/rip-out-legacy-crypto/remove-initLegacyCrypto branch from 8dcf73c to ba1ca5c Compare January 16, 2025 13:50
@florianduros florianduros marked this pull request as ready for review January 16, 2025 13:55
@florianduros florianduros requested review from a team as code owners January 16, 2025 13:55
@t3chguy
Copy link
Member

t3chguy commented Jan 16, 2025

I imagine that this will have very bad results on our coverage, as you are deleting the tests for code which is not yet deleted. Will this cause any breaches of contract? Do we still have any contracts to uphold coverage beyond a certain level? SonarCloud is only not complaining as it only looks at new code, of which there is none.

@florianduros
Copy link
Contributor Author

Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

IMO this should remove all related exported entrypoints, all deprecated & now-unused symbols. Otherwise we will need a 2nd follow-up Breaking Change release to clean up the tech debt to maintain the contract around semver.

.e.g. https://matrix-org.github.io/matrix-js-sdk/enums/matrix.CryptoEvent.html and most things in the crypto dir.

…-initLegacyCrypto

# Conflicts:
#	spec/integ/matrix-client-syncing.spec.ts
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.

This looks broadly good to me, but I would rather see #4622 / #4624 land first.

I don't agree that we should rip out all of the legacy crypto code at once (and also, ftr, don't agree that removing things in the crypto directory would necessarily result in a major version bump, though it's true that updating CryptoEvent would), but I guess we should discuss that elsewhere.

…-initLegacyCrypto

# Conflicts:
#	spec/integ/sliding-sync-sdk.spec.ts
@florianduros
Copy link
Contributor Author

florianduros commented Jan 17, 2025

@richvdh I agree to land #4624 first (which did) however #4622 should land after in my opinion.

#4622 removes the support of the legacy crypto in the sync module. If we don't remove initLegacyCrypto before, we just break the sync in legacy crypto. Also, it is breaking existing legacy crypto tests.

@richvdh richvdh self-requested a review January 17, 2025 16:11
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 changed the base branch from develop to florianduros/rip-out-legacy-crypto/remove-sync-legacy January 23, 2025 15:22
@florianduros florianduros changed the base branch from florianduros/rip-out-legacy-crypto/remove-sync-legacy to florianduros/rip-out-legacy-crypto/remove-legacy-crypto January 23, 2025 15:24
@florianduros florianduros requested a review from t3chguy January 23, 2025 15:24
@florianduros
Copy link
Contributor Author

florianduros commented Jan 23, 2025

IMO this should remove all related exported entrypoints, all deprecated & now-unused symbols. Otherwise we will need a 2nd follow-up Breaking Change release to clean up the tech debt to maintain the contract around semver.

.e.g. matrix-org.github.io/matrix-js-sdk/enums/matrix.CryptoEvent.html and most things in the crypto dir.

I changed the base branch to florianduros/rip-out-legacy-crypto/remove-legacy-crypto (PR) which is the feature branch.

@florianduros florianduros merged commit 1129c45 into florianduros/rip-out-legacy-crypto/remove-legacy-crypto Jan 27, 2025
81 of 82 checks passed
@florianduros florianduros deleted the florianduros/rip-out-legacy-crypto/remove-initLegacyCrypto branch January 27, 2025 09:34
github-merge-queue bot pushed a commit that referenced this pull request Feb 7, 2025
* Remove deprecated calls in `webrtc/call.ts`

* Throw error when legacy call was used

* Remove `MatrixClient.initLegacyCrypto` (#4620)

* Remove `MatrixClient.initLegacyCrypto`

* Remove `MatrixClient.initLegacyCrypto` in README.md

* Remove tests using `MatrixClient.initLegacyCrypto`

* Remove legacy crypto support in `sync` api (#4622)

* Remove deprecated `DeviceInfo` in `webrtc/call.ts` (#4654)

* chore(legacy call): Remove `DeviceInfo` usage

* refactor(legacy call): throw `GroupCallUnknownDeviceError` at the end of `initOpponentCrypto`

* Remove deprecated methods and attributes of `MatrixClient` (#4659)

* feat(legacy crypto)!: remove deprecated methods of `MatrixClient`

* test(legacy crypto): update existing tests to not use legacy crypto

- `Embedded.spec.ts`: casting since `encryptAndSendToDevices` is removed from `MatrixClient`.
- `room.spec.ts`: remove deprecated usage of `MatrixClient.crypto`
- `matrix-client.spec.ts` & `matrix-client-methods.spec.ts`: remove calls of deprecated methods of `MatrixClient`

* test(legacy crypto): remove test files using `MatrixClient` deprecated methods

* test(legacy crypto): update existing integ tests to run successfully

* feat(legacy crypto!): remove `ICreateClientOpts.deviceToImport`.

`ICreateClientOpts.deviceToImport` was used in the legacy cryto. The rust crypto doesn't support to import devices in this way.

* feat(legacy crypto!): remove `{get,set}GlobalErrorOnUnknownDevices`

`globalErrorOnUnknownDevices` is not used in the rust-crypto. The API is marked as unstable, we can remove it.

* Remove usage of legacy crypto in `event.ts` (#4666)

* feat(legacy crypto!): remove legacy crypto usage in `event.ts`

* test(legacy crypto): update event.spec.ts to not use legacy crypto types

* Remove legacy crypto export in `matrix.ts` (#4667)

* feat(legacy crypto!): remove legacy crypto export in `matrix.ts`

* test(legacy crypto): update `megolm-backup.spec.ts` to import directly `CryptoApi`

* Remove usage of legacy crypto in integ tests (#4669)

* Clean up legacy stores (#4663)

* feat(legacy crypto!): keep legacy methods used in lib olm migration

The rust cryto needs these legacy stores in order to do the migration from the legacy crypto to the rust crypto. We keep the following methods of the stores:
- Used in `libolm_migration.ts`.
- Needed in the legacy store tests.
- Needed in the rust crypto test migration.

* feat(legacy crypto): extract legacy crypto types in legacy stores

In order to be able to delete the legacy crypto, these stores shouldn't rely on the legacy crypto. We need to extract the used types.

* feat(crypto store): remove `CryptoStore` functions used only by tests

* test(crypto store): use legacy `MemoryStore` type

* Remove deprecated methods of `CryptoBackend` (#4671)

* feat(CryptoBackend)!: remove deprecated methods

* feat(rust-crypto)!: remove deprecated methods of `CryptoBackend`

* test(rust-crypto): remove tests of deprecated methods of `CryptoBackend`

* Remove usage of legacy crypto in `embedded.ts` (#4668)

The interface of `encryptAndSendToDevices` changes because `DeviceInfo` is from the legacy crypto. In fact `encryptAndSendToDevices` only need pairs of userId and deviceId.

* Remove legacy crypto files (#4672)

* fix(legacy store): fix legacy store typing

In #4663, the storeXXX methods were removed of the CryptoStore interface but they are used internally by IndexedDBCryptoStore.

* feat(legacy crypto)!: remove content of `crypto/*` except legacy stores

* test(legacy crypto): remove `spec/unit/crypto/*` except legacy store tests

* refactor: remove unused types

* doc: fix broken link

* doc: remove link tag when typedoc is unable to find the CryptoApi

* Clean up integ test after legacy crypto removal (#4682)

* test(crypto): remove `newBackendOnly` test closure

* test(crypto): fix duplicate test name

* test(crypto): remove `oldBackendOnly` test closure

* test(crypto): remove `rust-sdk` comparison

* test(crypto): remove iteration on `CRYPTO_BACKEND`

* test(crypto): remove old legacy comments and tests

* test(crypto): fix documentations and removed unused expect

* Restore broken link to `CryptoApi` (#4692)

* chore: fix linting and formatting due to merge

* Remove unused crypto type and missing doc (#4696)

* chore(crypto): remove unused types

* doc(crypto): add missing link

* test(call): add test when crypto is enabled
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