diff options
Diffstat (limited to 'includes/external/matrix/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts')
-rw-r--r-- | includes/external/matrix/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/includes/external/matrix/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts b/includes/external/matrix/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts new file mode 100644 index 0000000..fe94fdc --- /dev/null +++ b/includes/external/matrix/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.d.ts @@ -0,0 +1,87 @@ +import * as RustSdkCryptoJs from "@matrix-org/matrix-sdk-crypto-js"; +import type { IEventDecryptionResult, IMegolmSessionData } from "../@types/crypto"; +import type { IToDeviceEvent } from "../sync-accumulator"; +import type { IEncryptedEventInfo } from "../crypto/api"; +import { MatrixEvent } from "../models/event"; +import { Room } from "../models/room"; +import { RoomMember } from "../models/room-member"; +import { CryptoBackend, OnSyncCompletedData } from "../common-crypto/CryptoBackend"; +import { IHttpOpts, MatrixHttpApi } from "../http-api"; +import { DeviceTrustLevel, UserTrustLevel } from "../crypto/CrossSigning"; +/** + * An implementation of {@link CryptoBackend} using the Rust matrix-sdk-crypto. + */ +export declare class RustCrypto implements CryptoBackend { + private readonly olmMachine; + globalErrorOnUnknownDevices: boolean; + /** whether {@link stop} has been called */ + private stopped; + /** whether {@link outgoingRequestLoop} is currently running */ + private outgoingRequestLoopRunning; + /** mapping of roomId → encryptor class */ + private roomEncryptors; + private keyClaimManager; + private outgoingRequestProcessor; + constructor(olmMachine: RustSdkCryptoJs.OlmMachine, http: MatrixHttpApi<IHttpOpts & { + onlyData: true; + }>, _userId: string, _deviceId: string); + stop(): void; + encryptEvent(event: MatrixEvent, _room: Room): Promise<void>; + decryptEvent(event: MatrixEvent): Promise<IEventDecryptionResult>; + getEventEncryptionInfo(event: MatrixEvent): IEncryptedEventInfo; + checkUserTrust(userId: string): UserTrustLevel; + checkDeviceTrust(userId: string, deviceId: string): DeviceTrustLevel; + globalBlacklistUnverifiedDevices: boolean; + userHasCrossSigningKeys(): Promise<boolean>; + prepareToEncrypt(room: Room): void; + forceDiscardSession(roomId: string): Promise<void>; + exportRoomKeys(): Promise<IMegolmSessionData[]>; + /** + * Apply sync changes to the olm machine + * @param events - the received to-device messages + * @param oneTimeKeysCounts - the received one time key counts + * @param unusedFallbackKeys - the received unused fallback keys + * @returns A list of preprocessed to-device messages. + */ + private receiveSyncChanges; + /** 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 to preprocess one time key counts + * + * @param oneTimeKeysCounts - the received one time key counts + * @returns A list of preprocessed to-device messages. + */ + preprocessOneTimeKeyCounts(oneTimeKeysCounts: Map<string, number>): Promise<void>; + /** called by the sync loop to preprocess unused fallback keys + * + * @param unusedFallbackKeys - the received unused fallback keys + * @returns A list of preprocessed to-device messages. + */ + preprocessUnusedFallbackKeys(unusedFallbackKeys: Set<string>): Promise<void>; + /** called by the sync loop on m.room.encrypted events + * + * @param room - in which the event was received + * @param event - encryption event to be processed + */ + onCryptoEvent(room: Room, event: MatrixEvent): Promise<void>; + /** 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; + /** called by the MatrixClient on a room membership event + * + * @param event - The matrix event which caused this event to fire. + * @param member - The member whose RoomMember.membership changed. + * @param oldMembership - The previous membership state. Null if it's a new member. + */ + onRoomMembership(event: MatrixEvent, member: RoomMember, oldMembership?: string): void; + private outgoingRequestLoop; +} +//# sourceMappingURL=rust-crypto.d.ts.map
\ No newline at end of file |