59 lines
2.2 KiB
TypeScript
59 lines
2.2 KiB
TypeScript
import { OlmMachine } from "@matrix-org/matrix-sdk-crypto-wasm";
|
|
import { IContent, MatrixEvent } from "../models/event";
|
|
import { Room } from "../models/room";
|
|
import { KeyClaimManager } from "./KeyClaimManager";
|
|
import { RoomMember } from "../models/room-member";
|
|
import { OutgoingRequestProcessor } from "./OutgoingRequestProcessor";
|
|
/**
|
|
* RoomEncryptor: responsible for encrypting messages to a given room
|
|
*
|
|
* @internal
|
|
*/
|
|
export declare class RoomEncryptor {
|
|
private readonly olmMachine;
|
|
private readonly keyClaimManager;
|
|
private readonly outgoingRequestProcessor;
|
|
private readonly room;
|
|
private encryptionSettings;
|
|
private readonly prefixedLogger;
|
|
/**
|
|
* @param olmMachine - The rust-sdk's OlmMachine
|
|
* @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests
|
|
* @param room - The room we want to encrypt for
|
|
* @param encryptionSettings - body of the m.room.encryption event currently in force in this room
|
|
*/
|
|
constructor(olmMachine: OlmMachine, keyClaimManager: KeyClaimManager, outgoingRequestProcessor: OutgoingRequestProcessor, room: Room, encryptionSettings: IContent);
|
|
/**
|
|
* Handle a new `m.room.encryption` event in this room
|
|
*
|
|
* @param config - The content of the encryption event
|
|
*/
|
|
onCryptoEvent(config: IContent): void;
|
|
/**
|
|
* Handle a new `m.room.member` event in this room
|
|
*
|
|
* @param member - new membership state
|
|
*/
|
|
onRoomMembership(member: RoomMember): void;
|
|
/**
|
|
* Prepare to encrypt events in this room.
|
|
*
|
|
* This ensures that we have a megolm session ready to use and that we have shared its key with all the devices
|
|
* in the room.
|
|
*/
|
|
ensureEncryptionSession(): Promise<void>;
|
|
/**
|
|
* Discard any existing group session for this room
|
|
*/
|
|
forceDiscardSession(): Promise<void>;
|
|
/**
|
|
* Encrypt an event for this room
|
|
*
|
|
* This will ensure that we have a megolm session for this room, share it with the devices in the room, and
|
|
* then encrypt the event using the session.
|
|
*
|
|
* @param event - Event to be encrypted.
|
|
*/
|
|
encryptEvent(event: MatrixEvent): Promise<void>;
|
|
}
|
|
//# sourceMappingURL=RoomEncryptor.d.ts.map
|