You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-23 17:02:25 +03:00
Groundwork for supporting migration from libolm to rust crypto. (#3977)
* `getOwnDeviceKeys`: use `olmMachine.identityKeys` This is simpler, and doesn't rely on us having done a device query to work. * Factor out `requestKeyBackupVersion` utility * Factor out `makeMatrixHttpApi` function * Convert `initRustCrypto` to take a params object * Improve logging in startup ... to help figure out what is taking so long.
This commit is contained in:
committed by
GitHub
parent
c115e055c6
commit
d030c83cee
@@ -315,18 +315,8 @@ export class RustCrypto extends TypedEventEmitter<RustCryptoEvents, RustCryptoEv
|
||||
* Implementation of {@link CryptoApi#getOwnDeviceKeys}.
|
||||
*/
|
||||
public async getOwnDeviceKeys(): Promise<OwnDeviceKeys> {
|
||||
const device: RustSdkCryptoJs.Device = await this.olmMachine.getDevice(
|
||||
this.olmMachine.userId,
|
||||
this.olmMachine.deviceId,
|
||||
);
|
||||
// could be undefined if there is no such algorithm for that device.
|
||||
if (device.curve25519Key && device.ed25519Key) {
|
||||
return {
|
||||
ed25519: device.ed25519Key.toBase64(),
|
||||
curve25519: device.curve25519Key.toBase64(),
|
||||
};
|
||||
}
|
||||
throw new Error("Device keys not found");
|
||||
const keys = this.olmMachine.identityKeys;
|
||||
return { ed25519: keys.ed25519.toBase64(), curve25519: keys.curve25519.toBase64() };
|
||||
}
|
||||
|
||||
public prepareToEncrypt(room: Room): void {
|
||||
|
||||
Reference in New Issue
Block a user