If your application used the legacy MatrixClient.initLegacyCrypto() stack, you must migrate existing devices to the Rust stack.
Migration Steps:
- When calling
sdk.createClient, provide the legacy cryptoStore and pickleKey in the options object. - Call
await matrixClient.initRustCrypto(). The migration will trigger automatically.
Monitoring Progress:
You can listen to the CryptoEvent.LegacyCryptoStoreMigrationProgress event. The migration is complete when both progress and total equal -1.
Note: The legacy MatrixClient.crypto object is deprecated. You should now use MatrixClient.getCrypto() and migrate any calls to deprecated MatrixClient methods to the CryptoApi interface.
// You should provide the legacy crypto store and the pickle key to the matrix client in order to migrate the data.
const matrixClient = sdk.createClient({
cryptoStore: myCryptoStore,
pickleKey: myPickleKey,
baseUrl: "http://localhost:8008",
accessToken: myAccessToken,
userId: myUserId,
});
// The migration will be done automatically when you call `initRustCrypto`.
await matrixClient.initRustCrypto();
// To follow the migration progress, listen to the LegacyCryptoStoreMigrationProgress event:
matrixClient.on(CryptoEvent.LegacyCryptoStoreMigrationProgress, (progress, total) => {
// When progress === total === -1, the migration is finished.
});