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

Element-R: Add current version of the rust-sdk and vodozemac #3825

Merged
merged 7 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions spec/unit/rust-crypto/rust-crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ describe("RustCrypto", () => {
10000,
);

it("should return the current version of the rust sdk and vodozemac", async () => {
florianduros marked this conversation as resolved.
Show resolved Hide resolved
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;
Expand Down
7 changes: 7 additions & 0 deletions src/crypto-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions src/crypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,15 @@ export class Crypto extends TypedEventEmitter<CryptoEvent, CryptoEventHandlerMap
this.backupManager.checkAndStart();
}

/**
* Implementation of {@link CryptoApi#getVersion}.
*/
public getVersion(): null {
// `Crypto.getOlmVersion()` is used for the old crypto
richvdh marked this conversation as resolved.
Show resolved Hide resolved
// This API is for the new crypto
return null;
}

/**
* Whether to trust a others users signatures of their devices.
* If false, devices will only be considered 'verified' if we have
Expand Down
8 changes: 8 additions & 0 deletions src/rust-crypto/rust-crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv

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 {
const encryptor = this.roomEncryptors[room.roomId];

Expand Down
Loading