1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
|