import { DeviceKeys , GenericKeys , KeyClaim , KeyClaimResponse , KeyQueryResults , OlmEngine , OTKCounts , ToDeviceMessages , } from "@turt2live/matrix-sdk-crypto-nodejs" ; import { MatrixClient } from "../MatrixClient" ; import { OTKAlgorithm } from "../models/Crypto" ; category export class SdkOlmEngine implements OlmEngine { public constructor ( private client ) { } public claimOneTimeKeys ( claim ) { const reconstructed = { } ; for ( const userId of Object . keys ( claim ) ) { if ( ! reconstructed [ userId ] ) reconstructed [ userId ] = { } ; for ( const deviceId of Object . keys ( claim [ userId ] ) ) { reconstructed [ userId ] [ deviceId ] = claim [ userId ] [ deviceId ] as OTKAlgorithm ; } } return this . client . claimOneTimeKeys ( reconstructed ) ; } public queryOneTimeKeys ( userIds ) { return this . client . getUserDevices ( userIds ) ; } public uploadOneTimeKeys ( body ) { return this . client . doRequest ( "POST" , "/_matrix/client/r0/keys/upload" , null , body ) ; } public getEffectiveJoinedUsersInRoom ( roomId ) { return this . client . getJoinedRoomMembers ( roomId ) ; } public sendToDevices ( eventType , messages ) { return this . client . sendToDevices ( eventType , messages ) ; } }