1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Use cryptoBackend in client.ts for new rust-crypto implementation (#3576)

* Use `cryptoBackend` in `client.ts` for new rust-crypto implementation for backward compatibility

* Use `cryptoBackend` in `client.ts` for new rust-crypto implementation for backward compatibility
This commit is contained in:
Florian Duros
2023-07-11 16:13:53 +02:00
committed by GitHub
parent a5e606a1e7
commit d5b22e1deb

View File

@@ -2854,12 +2854,14 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* @returns Object with public key metadata, encoded private * @returns Object with public key metadata, encoded private
* recovery key which should be disposed of after displaying to the user, * recovery key which should be disposed of after displaying to the user,
* and raw private key to avoid round tripping if needed. * and raw private key to avoid round tripping if needed.
*
* @deprecated Prefer {@link CryptoApi.createRecoveryKeyFromPassphrase | `CryptoApi.createRecoveryKeyFromPassphrase`}.
*/ */
public createRecoveryKeyFromPassphrase(password?: string): Promise<IRecoveryKey> { public createRecoveryKeyFromPassphrase(password?: string): Promise<IRecoveryKey> {
if (!this.crypto) { if (!this.cryptoBackend) {
throw new Error("End-to-end encryption disabled"); throw new Error("End-to-end encryption disabled");
} }
return this.crypto.createRecoveryKeyFromPassphrase(password); return this.cryptoBackend.createRecoveryKeyFromPassphrase(password);
} }
/** /**
@@ -2874,7 +2876,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* return true. * return true.
* *
* @returns True if secret storage is ready to be used on this device * @returns True if secret storage is ready to be used on this device
* @deprecated Prefer {@link CryptoApi.isSecretStorageReady | `CryptoApi.isSecretStorageReady`}: * @deprecated Prefer {@link CryptoApi.isSecretStorageReady | `CryptoApi.isSecretStorageReady`}.
*/ */
public isSecretStorageReady(): Promise<boolean> { public isSecretStorageReady(): Promise<boolean> {
if (!this.cryptoBackend) { if (!this.cryptoBackend) {
@@ -2896,13 +2898,13 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* - migrates Secure Secret Storage to use the latest algorithm, if an outdated * - migrates Secure Secret Storage to use the latest algorithm, if an outdated
* algorithm is found * algorithm is found
* *
* @deprecated Use {@link CryptoApi#bootstrapSecretStorage}. * @deprecated Use {@link CryptoApi.bootstrapSecretStorage | `CryptoApi.bootstrapSecretStorage`}.
*/ */
public bootstrapSecretStorage(opts: ICreateSecretStorageOpts): Promise<void> { public bootstrapSecretStorage(opts: ICreateSecretStorageOpts): Promise<void> {
if (!this.crypto) { if (!this.cryptoBackend) {
throw new Error("End-to-end encryption disabled"); throw new Error("End-to-end encryption disabled");
} }
return this.crypto.bootstrapSecretStorage(opts); return this.cryptoBackend.bootstrapSecretStorage(opts);
} }
/** /**