You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-31 15:24:23 +03:00
Element-R: Add current version of the rust-sdk and vodozemac (#3825)
* Add current version of the rust-sdk and vodozemac * Return OlmVersion in `CryptoApi#getVersion` for old crypto * Add `Olm` prefix * Fix documentation * Review changes
This commit is contained in:
@ -115,6 +115,16 @@ describe("Crypto", function () {
|
|||||||
expect(Crypto.getOlmVersion()[0]).toEqual(3);
|
expect(Crypto.getOlmVersion()[0]).toEqual(3);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("getVersion() should return the current version of the olm library", async () => {
|
||||||
|
const client = new TestClient("@alice:example.com", "deviceid").client;
|
||||||
|
await client.initCrypto();
|
||||||
|
|
||||||
|
const olmVersionTuple = Crypto.getOlmVersion();
|
||||||
|
expect(client.getCrypto()?.getVersion()).toBe(
|
||||||
|
`Olm ${olmVersionTuple[0]}.${olmVersionTuple[1]}.${olmVersionTuple[2]}`,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
describe("encrypted events", function () {
|
describe("encrypted events", function () {
|
||||||
it("provides encryption information for events from unverified senders", async function () {
|
it("provides encryption information for events from unverified senders", async function () {
|
||||||
const client = new TestClient("@alice:example.com", "deviceid").client;
|
const client = new TestClient("@alice:example.com", "deviceid").client;
|
||||||
|
@ -132,6 +132,12 @@ describe("initRustCrypto", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("RustCrypto", () => {
|
describe("RustCrypto", () => {
|
||||||
|
it("getVersion() should return the current version of the rust sdk and vodozemac", async () => {
|
||||||
|
const rustCrypto = await makeTestRustCrypto();
|
||||||
|
const versions = RustSdkCryptoJs.getVersions();
|
||||||
|
expect(rustCrypto.getVersion()).toBe(`Rust SDK ${versions.matrix_sdk_crypto}, Vodozemac ${versions.vodozemac}`);
|
||||||
|
});
|
||||||
|
|
||||||
describe(".importRoomKeys and .exportRoomKeys", () => {
|
describe(".importRoomKeys and .exportRoomKeys", () => {
|
||||||
let rustCrypto: RustCrypto;
|
let rustCrypto: RustCrypto;
|
||||||
|
|
||||||
|
@ -39,6 +39,13 @@ export interface CryptoApi {
|
|||||||
*/
|
*/
|
||||||
globalBlacklistUnverifiedDevices: boolean;
|
globalBlacklistUnverifiedDevices: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current version of the crypto module.
|
||||||
|
* For example: `Rust SDK ${versions.matrix_sdk_crypto}, Vodozemac ${versions.vodozemac}`.
|
||||||
|
* @returns the formatted version
|
||||||
|
*/
|
||||||
|
getVersion(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform any background tasks that can be done before a message is ready to
|
* Perform any background tasks that can be done before a message is ready to
|
||||||
* send, in order to speed up sending of the message.
|
* send, in order to speed up sending of the message.
|
||||||
|
@ -610,6 +610,14 @@ export class Crypto extends TypedEventEmitter<CryptoEvent, CryptoEventHandlerMap
|
|||||||
this.backupManager.checkAndStart();
|
this.backupManager.checkAndStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of {@link CryptoApi#getVersion}.
|
||||||
|
*/
|
||||||
|
public getVersion(): string {
|
||||||
|
const olmVersionTuple = Crypto.getOlmVersion();
|
||||||
|
return `Olm ${olmVersionTuple[0]}.${olmVersionTuple[1]}.${olmVersionTuple[2]}`;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to trust a others users signatures of their devices.
|
* Whether to trust a others users signatures of their devices.
|
||||||
* If false, devices will only be considered 'verified' if we have
|
* If false, devices will only be considered 'verified' if we have
|
||||||
|
@ -327,6 +327,14 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
|
|||||||
|
|
||||||
public globalBlacklistUnverifiedDevices = false;
|
public globalBlacklistUnverifiedDevices = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of {@link CryptoApi#getVersion}.
|
||||||
|
*/
|
||||||
|
public getVersion(): string {
|
||||||
|
const versions = RustSdkCryptoJs.getVersions();
|
||||||
|
return `Rust SDK ${versions.matrix_sdk_crypto}, Vodozemac ${versions.vodozemac}`;
|
||||||
|
}
|
||||||
|
|
||||||
public prepareToEncrypt(room: Room): void {
|
public prepareToEncrypt(room: Room): void {
|
||||||
const encryptor = this.roomEncryptors[room.roomId];
|
const encryptor = this.roomEncryptors[room.roomId];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user