import { MatrixClient } from "../MatrixClient" ; import { CryptoClient } from "./CryptoClient" ; category export function requiresCrypto ( ) { return function ( target , propertyKey , descriptor ) { const originalMethod = descriptor . value ; descriptor . value = function ( ... args ) { const client = this ; if ( ! client . crypto ) { throw new Error ( "End-to-end encryption is not enabled" ) ; } return originalMethod . apply ( this , args ) ; } ; } ; } category export function requiresReady ( ) { return function ( target , propertyKey , descriptor ) { const originalMethod = descriptor . value ; descriptor . value = function ( ... args ) { const crypto = this ; if ( ! crypto . isReady ) { throw new Error ( "End-to-end encryption has not initialized" ) ; } return originalMethod . apply ( this , args ) ; } ; } ; }