matrix-js-sdk
Version:
Matrix Client-Server SDK for Javascript
43 lines • 1.91 kB
TypeScript
import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-js";
import type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto";
import type { IToDeviceEvent } from "../sync-accumulator";
import { MatrixEvent } from "../models/event";
import { CryptoBackend, OnSyncCompletedData } from "../common-crypto/CryptoBackend";
import { IHttpOpts, MatrixHttpApi } from "../http-api";
/**
* An implementation of {@link CryptoBackend} using the Rust matrix-sdk-crypto.
*/
export declare class RustCrypto implements CryptoBackend {
private readonly olmMachine;
private readonly http;
globalBlacklistUnverifiedDevices: boolean;
globalErrorOnUnknownDevices: boolean;
/** whether {@link stop} has been called */
private stopped;
/** whether {@link outgoingRequestLoop} is currently running */
private outgoingRequestLoopRunning;
constructor(olmMachine: RustSdkCryptoJs.OlmMachine, http: MatrixHttpApi<IHttpOpts & {
onlyData: true;
}>, _userId: string, _deviceId: string);
stop(): void;
decryptEvent(event: MatrixEvent): Promise<IEventDecryptionResult>;
userHasCrossSigningKeys(): Promise<boolean>;
exportRoomKeys(): Promise<IMegolmSessionData[]>;
/** called by the sync loop to preprocess incoming to-device messages
*
* @param events - the received to-device messages
* @returns A list of preprocessed to-device messages.
*/
preprocessToDeviceMessages(events: IToDeviceEvent[]): Promise<IToDeviceEvent[]>;
/** called by the sync loop after processing each sync.
*
* TODO: figure out something equivalent for sliding sync.
*
* @param syncState - information on the completed sync.
*/
onSyncCompleted(syncState: OnSyncCompletedData): void;
private outgoingRequestLoop;
private doOutgoingRequest;
private rawJsonRequest;
}
//# sourceMappingURL=rust-crypto.d.ts.map