diff --git a/spec/unit/rust-crypto/rust-crypto.spec.ts b/spec/unit/rust-crypto/rust-crypto.spec.ts index d8eae7f4d48..52376a03ff5 100644 --- a/spec/unit/rust-crypto/rust-crypto.spec.ts +++ b/spec/unit/rust-crypto/rust-crypto.spec.ts @@ -143,6 +143,13 @@ describe("RustCrypto", () => { 10000, ); + it("should return the current version of the rust sdk and vodozemac", async () => { + const versions = RustSdkCryptoJs.getVersions(); + expect(rustCrypto.getVersion()).toBe( + `Rust SDK ${versions.matrix_sdk_crypto}, Vodozemac ${versions.vodozemac}`, + ); + }); + it("should import and export keys", async () => { const someRoomKeys = testData.MEGOLM_SESSION_DATA_ARRAY; let importTotal = 0; diff --git a/src/crypto-api.ts b/src/crypto-api.ts index b698fc296e6..10555cc5858 100644 --- a/src/crypto-api.ts +++ b/src/crypto-api.ts @@ -39,6 +39,13 @@ export interface CryptoApi { */ globalBlacklistUnverifiedDevices: boolean; + /** + * Return the current version of the Rust SDK and the Vodozemac library + * @returns the version in the format `Rust SDK ${versions.matrix_sdk_crypto}, Vodozemac ${versions.vodozemac}` + * XXXX: Remove `null` when the old crypto is removed + */ + getVersion(): string | null; + /** * Perform any background tasks that can be done before a message is ready to * send, in order to speed up sending of the message. diff --git a/src/crypto/index.ts b/src/crypto/index.ts index a2a6469feda..e559df50f17 100644 --- a/src/crypto/index.ts +++ b/src/crypto/index.ts @@ -610,6 +610,15 @@ export class Crypto extends TypedEventEmitter