{"version":3,"file":"index-CB8tGS23.js","sources":["../../node_modules/.pnpm/@matrix-org+matrix-sdk-crypto-wasm@15.3.0/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js","../../node_modules/.pnpm/@matrix-org+matrix-sdk-crypto-wasm@15.3.0/node_modules/@matrix-org/matrix-sdk-crypto-wasm/index.mjs","../../node_modules/.pnpm/another-json@0.2.0/node_modules/another-json/another-json.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js","../../node_modules/.pnpm/matrix-js-sdk@38.4.0/node_modules/matrix-js-sdk/lib/rust-crypto/index.js"],"sourcesContent":["let wasm;\nexport function __wbg_set_wasm(val) {\n    wasm = val;\n}\n\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n    if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n        cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n    }\n    return cachedUint8ArrayMemory0;\n}\n\nconst lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;\n\nlet cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n\ncachedTextDecoder.decode();\n\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n    numBytesDecoded += len;\n    if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n        cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n        cachedTextDecoder.decode();\n        numBytesDecoded = len;\n    }\n    return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nfunction getStringFromWasm0(ptr, len) {\n    ptr = ptr >>> 0;\n    return decodeText(ptr, len);\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nconst lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;\n\nconst cachedTextEncoder = new lTextEncoder('utf-8');\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n    ? function (arg, view) {\n    return cachedTextEncoder.encodeInto(arg, view);\n}\n    : function (arg, view) {\n    const buf = cachedTextEncoder.encode(arg);\n    view.set(buf);\n    return {\n        read: arg.length,\n        written: buf.length\n    };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n    if (realloc === undefined) {\n        const buf = cachedTextEncoder.encode(arg);\n        const ptr = malloc(buf.length, 1) >>> 0;\n        getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n        WASM_VECTOR_LEN = buf.length;\n        return ptr;\n    }\n\n    let len = arg.length;\n    let ptr = malloc(len, 1) >>> 0;\n\n    const mem = getUint8ArrayMemory0();\n\n    let offset = 0;\n\n    for (; offset < len; offset++) {\n        const code = arg.charCodeAt(offset);\n        if (code > 0x7F) break;\n        mem[ptr + offset] = code;\n    }\n\n    if (offset !== len) {\n        if (offset !== 0) {\n            arg = arg.slice(offset);\n        }\n        ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n        const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n        const ret = encodeString(arg, view);\n\n        offset += ret.written;\n        ptr = realloc(ptr, len, offset, 1) >>> 0;\n    }\n\n    WASM_VECTOR_LEN = offset;\n    return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n    if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n        cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n    }\n    return cachedDataViewMemory0;\n}\n\nfunction addToExternrefTable0(obj) {\n    const idx = wasm.__externref_table_alloc();\n    wasm.__wbindgen_export_4.set(idx, obj);\n    return idx;\n}\n\nfunction handleError(f, args) {\n    try {\n        return f.apply(this, args);\n    } catch (e) {\n        const idx = addToExternrefTable0(e);\n        wasm.__wbindgen_exn_store(idx);\n    }\n}\n\nfunction isLikeNone(x) {\n    return x === undefined || x === null;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n    ptr = ptr >>> 0;\n    return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nconst CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(state => {\n    wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)\n});\n\nfunction makeMutClosure(arg0, arg1, dtor, f) {\n    const state = { a: arg0, b: arg1, cnt: 1, dtor };\n    const real = (...args) => {\n        // First up with a closure we increment the internal reference\n        // count. This ensures that the Rust closure environment won't\n        // be deallocated while we're invoking it.\n        state.cnt++;\n        const a = state.a;\n        state.a = 0;\n        try {\n            return f(a, state.b, ...args);\n        } finally {\n            if (--state.cnt === 0) {\n                wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);\n                CLOSURE_DTORS.unregister(state);\n            } else {\n                state.a = a;\n            }\n        }\n    };\n    real.original = state;\n    CLOSURE_DTORS.register(real, state, state);\n    return real;\n}\n\nfunction makeClosure(arg0, arg1, dtor, f) {\n    const state = { a: arg0, b: arg1, cnt: 1, dtor };\n    const real = (...args) => {\n        // First up with a closure we increment the internal reference\n        // count. This ensures that the Rust closure environment won't\n        // be deallocated while we're invoking it.\n        state.cnt++;\n        try {\n            return f(state.a, state.b, ...args);\n        } finally {\n            if (--state.cnt === 0) {\n                wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b);\n                state.a = 0;\n                CLOSURE_DTORS.unregister(state);\n            }\n        }\n    };\n    real.original = state;\n    CLOSURE_DTORS.register(real, state, state);\n    return real;\n}\n\nfunction debugString(val) {\n    // primitive types\n    const type = typeof val;\n    if (type == 'number' || type == 'boolean' || val == null) {\n        return  `${val}`;\n    }\n    if (type == 'string') {\n        return `\"${val}\"`;\n    }\n    if (type == 'symbol') {\n        const description = val.description;\n        if (description == null) {\n            return 'Symbol';\n        } else {\n            return `Symbol(${description})`;\n        }\n    }\n    if (type == 'function') {\n        const name = val.name;\n        if (typeof name == 'string' && name.length > 0) {\n            return `Function(${name})`;\n        } else {\n            return 'Function';\n        }\n    }\n    // objects\n    if (Array.isArray(val)) {\n        const length = val.length;\n        let debug = '[';\n        if (length > 0) {\n            debug += debugString(val[0]);\n        }\n        for(let i = 1; i < length; i++) {\n            debug += ', ' + debugString(val[i]);\n        }\n        debug += ']';\n        return debug;\n    }\n    // Test for built-in\n    const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n    let className;\n    if (builtInMatches && builtInMatches.length > 1) {\n        className = builtInMatches[1];\n    } else {\n        // Failed to match the standard '[object ClassName]'\n        return toString.call(val);\n    }\n    if (className == 'Object') {\n        // we're a user defined class or Object\n        // JSON.stringify avoids problems with cycles, and is generally much\n        // easier than looping through ownProperties of `val`.\n        try {\n            return 'Object(' + JSON.stringify(val) + ')';\n        } catch (_) {\n            return 'Object';\n        }\n    }\n    // errors\n    if (val instanceof Error) {\n        return `${val.name}: ${val.message}\\n${val.stack}`;\n    }\n    // TODO we could test for more things here, like `Set`s and `Map`s.\n    return className;\n}\n\nfunction passArray8ToWasm0(arg, malloc) {\n    const ptr = malloc(arg.length * 1, 1) >>> 0;\n    getUint8ArrayMemory0().set(arg, ptr / 1);\n    WASM_VECTOR_LEN = arg.length;\n    return ptr;\n}\n\nfunction takeFromExternrefTable0(idx) {\n    const value = wasm.__wbindgen_export_4.get(idx);\n    wasm.__externref_table_dealloc(idx);\n    return value;\n}\n\nfunction _assertClass(instance, klass) {\n    if (!(instance instanceof klass)) {\n        throw new Error(`expected instance of ${klass.name}`);\n    }\n}\n\nfunction passArrayJsValueToWasm0(array, malloc) {\n    const ptr = malloc(array.length * 4, 4) >>> 0;\n    for (let i = 0; i < array.length; i++) {\n        const add = addToExternrefTable0(array[i]);\n        getDataViewMemory0().setUint32(ptr + 4 * i, add, true);\n    }\n    WASM_VECTOR_LEN = array.length;\n    return ptr;\n}\n\nfunction getArrayJsValueFromWasm0(ptr, len) {\n    ptr = ptr >>> 0;\n    const mem = getDataViewMemory0();\n    const result = [];\n    for (let i = ptr; i < ptr + 4 * len; i += 4) {\n        result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));\n    }\n    wasm.__externref_drop_slice(ptr, len);\n    return result;\n}\n\nlet cachedUint16ArrayMemory0 = null;\n\nfunction getUint16ArrayMemory0() {\n    if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {\n        cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);\n    }\n    return cachedUint16ArrayMemory0;\n}\n\nfunction getArrayU16FromWasm0(ptr, len) {\n    ptr = ptr >>> 0;\n    return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);\n}\n/**\n * Get the versions of the Rust libraries we are using.\n * @returns {Versions}\n */\nexport function getVersions() {\n    const ret = wasm.getVersions();\n    return Versions.__wrap(ret);\n}\n\n/**\n * Run some stuff when the Wasm module is instantiated.\n *\n * Right now, it does the following:\n *\n * * Redirect Rust panics to JavaScript console.\n */\nexport function start() {\n    wasm.start();\n}\n\nfunction __wbg_adapter_58(arg0, arg1, arg2) {\n    const ret = wasm.closure41_externref_shim_multivalue_shim(arg0, arg1, arg2);\n    if (ret[1]) {\n        throw takeFromExternrefTable0(ret[0]);\n    }\n}\n\nfunction __wbg_adapter_61(arg0, arg1) {\n    wasm.wasm_bindgen__convert__closures_____invoke__h8861d869601ff522(arg0, arg1);\n}\n\nfunction __wbg_adapter_64(arg0, arg1, arg2) {\n    wasm.closure756_externref_shim(arg0, arg1, arg2);\n}\n\nfunction __wbg_adapter_67(arg0, arg1, arg2) {\n    wasm.closure438_externref_shim(arg0, arg1, arg2);\n}\n\nfunction __wbg_adapter_70(arg0, arg1) {\n    wasm.wasm_bindgen__convert__closures_____invoke__hce61fd14ea1a6ce1(arg0, arg1);\n}\n\nfunction __wbg_adapter_836(arg0, arg1, arg2, arg3) {\n    wasm.closure451_externref_shim(arg0, arg1, arg2, arg3);\n}\n\n/**\n * Decryption error codes\n * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7}\n */\nexport const DecryptionErrorCode = Object.freeze({\n    /**\n     * The room key is not known\n     */\n    MissingRoomKey: 0, \"0\": \"MissingRoomKey\",\n    /**\n     * The room key is known but ratcheted\n     */\n    UnknownMessageIndex: 1, \"1\": \"UnknownMessageIndex\",\n    /**\n     * Decryption failed because of a mismatch between the identity keys of the\n     * device we received the room key from and the identity keys recorded in\n     * the plaintext of the room key to-device message.\n     */\n    MismatchedIdentityKeys: 2, \"2\": \"MismatchedIdentityKeys\",\n    /**\n     * We weren't able to link the message back to any known device.\n     */\n    UnknownSenderDevice: 3, \"3\": \"UnknownSenderDevice\",\n    /**\n     * The sender device is not cross-signed.\n     */\n    UnsignedSenderDevice: 4, \"4\": \"UnsignedSenderDevice\",\n    /**\n     * The sender's identity is unverified, but was previously verified.\n     */\n    SenderIdentityVerificationViolation: 5, \"5\": \"SenderIdentityVerificationViolation\",\n    /**\n     * Other failure.\n     */\n    UnableToDecrypt: 6, \"6\": \"UnableToDecrypt\",\n    /**\n     * The `sender` field on the event does not match the owner of the device\n     * that established the Megolm session.\n     */\n    MismatchedSender: 7, \"7\": \"MismatchedSender\",\n});\n/**\n * The basic key algorithm names in the specification.\n * @enum {0 | 1 | 3}\n */\nexport const DeviceKeyAlgorithmName = Object.freeze({\n    /**\n     * The Ed25519 signature algorithm.\n     */\n    Ed25519: 0, \"0\": \"Ed25519\",\n    /**\n     * The Curve25519 ECDH algorithm.\n     */\n    Curve25519: 1, \"1\": \"Curve25519\",\n    /**\n     * An unknown device key algorithm.\n     */\n    Unknown: 3, \"3\": \"Unknown\",\n});\n/**\n * An enum over the different key types a device can have.\n *\n * Currently devices have a curve25519 and ed25519 keypair. The keys\n * transport format is a base64 encoded string, any unknown key type\n * will be left as such a string.\n * @enum {0 | 1 | 2}\n */\nexport const DeviceKeyName = Object.freeze({\n    /**\n     * The curve25519 device key.\n     */\n    Curve25519: 0, \"0\": \"Curve25519\",\n    /**\n     * The ed25519 device key.\n     */\n    Ed25519: 1, \"1\": \"Ed25519\",\n    /**\n     * An unknown device key.\n     */\n    Unknown: 2, \"2\": \"Unknown\",\n});\n/**\n * An encryption algorithm to be used to encrypt messages sent to a\n * room.\n * @enum {0 | 1 | 2}\n */\nexport const EncryptionAlgorithm = Object.freeze({\n    /**\n     * Olm version 1 using Curve25519, AES-256, and SHA-256.\n     */\n    OlmV1Curve25519AesSha2: 0, \"0\": \"OlmV1Curve25519AesSha2\",\n    /**\n     * Megolm version 1 using AES-256 and SHA-256.\n     */\n    MegolmV1AesSha2: 1, \"1\": \"MegolmV1AesSha2\",\n    /**\n     * Unsupported algorithm.\n     *\n     * Applications should ignore this value if it is received, and should\n     * never set it.\n     */\n    Unknown: 2, \"2\": \"Unknown\",\n});\n/**\n * Who can see a room's history.\n * @enum {0 | 1 | 2 | 3}\n */\nexport const HistoryVisibility = Object.freeze({\n    /**\n     * Previous events are accessible to newly joined members from\n     * the point they were invited onwards.\n     *\n     * Events stop being accessible when the member's state changes\n     * to something other than *invite* or *join*.\n     */\n    Invited: 0, \"0\": \"Invited\",\n    /**\n     * Previous events are accessible to newly joined members from\n     * the point they joined the room onwards.\n     *\n     * Events stop being accessible when the member's state changes\n     * to something other than *join*.\n     */\n    Joined: 1, \"1\": \"Joined\",\n    /**\n     * Previous events are always accessible to newly joined members.\n     *\n     * All events in the room are accessible, even those sent when\n     * the member was not a part of the room.\n     */\n    Shared: 2, \"2\": \"Shared\",\n    /**\n     * All events while this is the `HistoryVisibility` value may be\n     * shared by any participating homeserver with anyone, regardless\n     * of whether they have ever joined the room.\n     */\n    WorldReadable: 3, \"3\": \"WorldReadable\",\n});\n/**\n * The local trust state of a device.\n * @enum {0 | 1 | 2 | 3}\n */\nexport const LocalTrust = Object.freeze({\n    /**\n     * The device has been verified and is trusted.\n     */\n    Verified: 0, \"0\": \"Verified\",\n    /**\n     * The device been blacklisted from communicating.\n     */\n    BlackListed: 1, \"1\": \"BlackListed\",\n    /**\n     * The trust state of the device is being ignored.\n     */\n    Ignored: 2, \"2\": \"Ignored\",\n    /**\n     * The trust state is unset.\n     */\n    Unset: 3, \"3\": \"Unset\",\n});\n/**\n * Logger level.\n * @enum {0 | 1 | 2 | 3 | 4}\n */\nexport const LoggerLevel = Object.freeze({\n    /**\n     * `TRACE` level.\n     *\n     * Designate very low priority, often extremely verbose,\n     * information.\n     */\n    Trace: 0, \"0\": \"Trace\",\n    /**\n     * `DEBUG` level.\n     *\n     * Designate lower priority information.\n     */\n    Debug: 1, \"1\": \"Debug\",\n    /**\n     * `INFO` level.\n     *\n     * Designate useful information.\n     */\n    Info: 2, \"2\": \"Info\",\n    /**\n     * `WARN` level.\n     *\n     * Designate hazardous situations.\n     */\n    Warn: 3, \"3\": \"Warn\",\n    /**\n     * `ERROR` level.\n     *\n     * Designate very serious errors.\n     */\n    Error: 4, \"4\": \"Error\",\n});\n/**\n * The type of a {@link ProcessedToDeviceEvent}.\n * @enum {0 | 1 | 2 | 3}\n */\nexport const ProcessedToDeviceEventType = Object.freeze({\n    /**\n     * A successfully-decrypted encrypted to-device message.\n     */\n    Decrypted: 0, \"0\": \"Decrypted\",\n    /**\n     * An encrypted to-device message which could not be decrypted.\n     */\n    UnableToDecrypt: 1, \"1\": \"UnableToDecrypt\",\n    /**\n     * An unencrypted to-device message (sent in clear).\n     */\n    PlainText: 2, \"2\": \"PlainText\",\n    /**\n     * An invalid to-device message that was ignored because it is missing some\n     * required information to be processed (like no event `type` for\n     * example)\n     */\n    Invalid: 3, \"3\": \"Invalid\",\n});\n/**\n * The mode of the QR code login.\n *\n * The QR code login mechanism supports both, the new device, as well as the\n * existing device to display the QR code.\n *\n * The different modes have an explicit one-byte identifier which gets added to\n * the QR code data.\n * @enum {0 | 1}\n */\nexport const QrCodeMode = Object.freeze({\n    /**\n     * The new device is displaying the QR code.\n     */\n    Login: 0, \"0\": \"Login\",\n    /**\n     * The existing device is displaying the QR code.\n     */\n    Reciprocate: 1, \"1\": \"Reciprocate\",\n});\n/**\n * List of `Qr` states\n * @enum {0 | 1 | 2 | 3 | 4 | 5}\n */\nexport const QrState = Object.freeze({\n    /**\n     * We have received the other device's details (from the\n     * `m.key.verification.request` or `m.key.verification.ready`) and\n     * established the shared secret, so can\n     * display the QR code.\n     */\n    Created: 0, \"0\": \"Created\",\n    /**\n     * The other side has scanned our QR code and sent an\n     * `m.key.verification.start` message with `method: m.reciprocate.v1` with\n     * matching shared secret.\n     */\n    Scanned: 1, \"1\": \"Scanned\",\n    /**\n     * Our user has confirmed that the other device scanned successfully. We\n     * have sent an `m.key.verification.done`.\n     */\n    Confirmed: 2, \"2\": \"Confirmed\",\n    /**\n     * We have scanned the other side's QR code and are able to send a\n     * `m.key.verification.start` message with `method: m.reciprocate.v1`.\n     *\n     * Call `Qr::reciprocate` to build the start message.\n     *\n     * Note that, despite the name of this state, we have not necessarily\n     * yet sent the `m.reciprocate.v1` message.\n     */\n    Reciprocated: 3, \"3\": \"Reciprocated\",\n    /**\n     * Verification complete: we have received an `m.key.verification.done`\n     * from the other side.\n     */\n    Done: 4, \"4\": \"Done\",\n    /**\n     * Verification cancelled or failed.\n     */\n    Cancelled: 5, \"5\": \"Cancelled\",\n});\n/**\n * Represent the type of a request.\n * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}\n */\nexport const RequestType = Object.freeze({\n    /**\n     * Represents a `KeysUploadRequest`.\n     */\n    KeysUpload: 0, \"0\": \"KeysUpload\",\n    /**\n     * Represents a `KeysQueryRequest`.\n     */\n    KeysQuery: 1, \"1\": \"KeysQuery\",\n    /**\n     * Represents a `KeysClaimRequest`.\n     */\n    KeysClaim: 2, \"2\": \"KeysClaim\",\n    /**\n     * Represents a `ToDeviceRequest`.\n     */\n    ToDevice: 3, \"3\": \"ToDevice\",\n    /**\n     * Represents a `SignatureUploadRequest`.\n     */\n    SignatureUpload: 4, \"4\": \"SignatureUpload\",\n    /**\n     * Represents a `RoomMessageRequest`.\n     */\n    RoomMessage: 5, \"5\": \"RoomMessage\",\n    /**\n     * Represents a `KeysBackupRequest`.\n     */\n    KeysBackup: 6, \"6\": \"KeysBackup\",\n});\n/**\n * Take a look at [`matrix_sdk_common::deserialized_responses::ShieldState`]\n * for more info.\n * @enum {0 | 1 | 2}\n */\nexport const ShieldColor = Object.freeze({\n    /**\n     * Important warning\n     */\n    Red: 0, \"0\": \"Red\",\n    /**\n     * Low warning\n     */\n    Grey: 1, \"1\": \"Grey\",\n    /**\n     * No warning\n     */\n    None: 2, \"2\": \"None\",\n});\n/**\n * A machine-readable representation of the authenticity for a `ShieldState`.\n * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6}\n */\nexport const ShieldStateCode = Object.freeze({\n    /**\n     * Not enough information available to check the authenticity.\n     */\n    AuthenticityNotGuaranteed: 0, \"0\": \"AuthenticityNotGuaranteed\",\n    /**\n     * The sending device isn't yet known by the Client.\n     */\n    UnknownDevice: 1, \"1\": \"UnknownDevice\",\n    /**\n     * The sending device hasn't been verified by the sender.\n     */\n    UnsignedDevice: 2, \"2\": \"UnsignedDevice\",\n    /**\n     * The sender hasn't been verified by the Client's user.\n     */\n    UnverifiedIdentity: 3, \"3\": \"UnverifiedIdentity\",\n    /**\n     * An unencrypted event in an encrypted room.\n     */\n    SentInClear: 4, \"4\": \"SentInClear\",\n    /**\n     * The sender was previously verified but changed their identity.\n     */\n    VerificationViolation: 5, \"5\": \"VerificationViolation\",\n    /**\n     * The `sender` field on the event does not match the owner of the device\n     * that established the Megolm session.\n     */\n    MismatchedSender: 6, \"6\": \"MismatchedSender\",\n});\n/**\n * The result of a signature check.\n * @enum {0 | 1 | 2 | 3}\n */\nexport const SignatureState = Object.freeze({\n    /**\n     * The signature is missing.\n     */\n    Missing: 0, \"0\": \"Missing\",\n    /**\n     * The signature is invalid.\n     */\n    Invalid: 1, \"1\": \"Invalid\",\n    /**\n     * The signature is valid but the device or user identity that created the\n     * signature is not trusted.\n     */\n    ValidButNotTrusted: 2, \"2\": \"ValidButNotTrusted\",\n    /**\n     * The signature is valid and the device or user identity that created the\n     * signature is trusted.\n     */\n    ValidAndTrusted: 3, \"3\": \"ValidAndTrusted\",\n});\n/**\n * Reason code for a to-device decryption failure\n * @enum {0 | 1 | 2 | 3}\n */\nexport const ToDeviceUnableToDecryptReason = Object.freeze({\n    /**\n     * An error occurred while encrypting the event. This covers all\n     * `OlmError` types.\n     */\n    DecryptionFailure: 0, \"0\": \"DecryptionFailure\",\n    /**\n     * We refused to decrypt the message because the sender's device is not\n     * verified, or more generally, the sender's identity did not match the\n     * trust requirement we were asked to provide.\n     */\n    UnverifiedSenderDevice: 1, \"1\": \"UnverifiedSenderDevice\",\n    /**\n     * We have no `OlmMachine`. This should not happen unless we forget to set\n     * things up by calling `OlmMachine::activate()`.\n     */\n    NoOlmMachine: 2, \"2\": \"NoOlmMachine\",\n    /**\n     * The Matrix SDK was compiled without encryption support.\n     */\n    EncryptionIsDisabled: 3, \"3\": \"EncryptionIsDisabled\",\n});\n/**\n * The trust level required to decrypt an event\n * @enum {0 | 1 | 2}\n */\nexport const TrustRequirement = Object.freeze({\n    /**\n     * Decrypt events from everyone regardless of trust\n     */\n    Untrusted: 0, \"0\": \"Untrusted\",\n    /**\n     * Only decrypt events from cross-signed or legacy devices\n     */\n    CrossSignedOrLegacy: 1, \"1\": \"CrossSignedOrLegacy\",\n    /**\n     * Only decrypt events from cross-signed devices\n     */\n    CrossSigned: 2, \"2\": \"CrossSigned\",\n});\n/**\n * List of available verification methods.\n * @enum {0 | 1 | 2 | 3}\n */\nexport const VerificationMethod = Object.freeze({\n    /**\n     * The `m.sas.v1` verification method.\n     *\n     * SAS means Short Authentication String.\n     */\n    SasV1: 0, \"0\": \"SasV1\",\n    /**\n     * The `m.qr_code.scan.v1` verification method.\n     */\n    QrCodeScanV1: 1, \"1\": \"QrCodeScanV1\",\n    /**\n     * The `m.qr_code.show.v1` verification method.\n     */\n    QrCodeShowV1: 2, \"2\": \"QrCodeShowV1\",\n    /**\n     * The `m.reciprocate.v1` verification method.\n     */\n    ReciprocateV1: 3, \"3\": \"ReciprocateV1\",\n});\n/**\n * List of VerificationRequestState phases\n * @enum {0 | 1 | 2 | 3 | 4 | 5}\n */\nexport const VerificationRequestPhase = Object.freeze({\n    /**\n     * The verification request has been newly created by us.\n     */\n    Created: 0, \"0\": \"Created\",\n    /**\n     * The verification request was received from the other party.\n     */\n    Requested: 1, \"1\": \"Requested\",\n    /**\n     * The verification request is ready to start a verification flow.\n     */\n    Ready: 2, \"2\": \"Ready\",\n    /**\n     * The verification request has transitioned into a concrete verification\n     * flow. For example it transitioned into the emoji based SAS\n     * verification.\n     */\n    Transitioned: 3, \"3\": \"Transitioned\",\n    /**\n     * The verification flow that was started with this request has finished.\n     */\n    Done: 4, \"4\": \"Done\",\n    /**\n     * The verification process has been cancelled.\n     */\n    Cancelled: 5, \"5\": \"Cancelled\",\n});\n\nconst __wbindgen_enum_IdbRequestReadyState = [\"pending\", \"done\"];\n\nconst __wbindgen_enum_IdbTransactionMode = [\"readonly\", \"readwrite\", \"versionchange\", \"readwriteflush\", \"cleanup\"];\n\nconst AttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_attachment_free(ptr >>> 0, 1));\n/**\n * A type to encrypt and to decrypt anything that can fit in an\n * `Uint8Array`, usually big buffer.\n */\nexport class Attachment {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        AttachmentFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_attachment_free(ptr, 0);\n    }\n    /**\n     * Encrypt the content of the `Uint8Array`.\n     *\n     * It produces an `EncryptedAttachment`, which can be used to\n     * retrieve the media encryption information, or the encrypted\n     * data.\n     * @param {Uint8Array} array\n     * @returns {EncryptedAttachment}\n     */\n    static encrypt(array) {\n        const ptr0 = passArray8ToWasm0(array, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.attachment_encrypt(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return EncryptedAttachment.__wrap(ret[0]);\n    }\n    /**\n     * Decrypt an `EncryptedAttachment`.\n     *\n     * The encrypted attachment can be created manually, or from the\n     * `encrypt` method.\n     *\n     * **Warning**: The encrypted attachment can be used only\n     * **once**! The encrypted data will still be present, but the\n     * media encryption info (which contain secrets) will be\n     * destroyed. It is still possible to get a JSON-encoded backup\n     * by calling `EncryptedAttachment.mediaEncryptionInfo`.\n     * @param {EncryptedAttachment} attachment\n     * @returns {Uint8Array}\n     */\n    static decrypt(attachment) {\n        _assertClass(attachment, EncryptedAttachment);\n        const ret = wasm.attachment_decrypt(attachment.__wbg_ptr);\n        if (ret[3]) {\n            throw takeFromExternrefTable0(ret[2]);\n        }\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n}\n\nconst BackupDecryptionKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_backupdecryptionkey_free(ptr >>> 0, 1));\n/**\n * The private part of the backup key, the one used for recovery.\n */\nexport class BackupDecryptionKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(BackupDecryptionKey.prototype);\n        obj.__wbg_ptr = ptr;\n        BackupDecryptionKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        BackupDecryptionKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_backupdecryptionkey_free(ptr, 0);\n    }\n    /**\n     * Create a new random [`BackupDecryptionKey`].\n     * @returns {BackupDecryptionKey}\n     */\n    static createRandomKey() {\n        const ret = wasm.backupdecryptionkey_createRandomKey();\n        return BackupDecryptionKey.__wrap(ret);\n    }\n    /**\n     * Try to create a [`BackupDecryptionKey`] from a base 64 encoded string.\n     * @param {string} key\n     * @returns {BackupDecryptionKey}\n     */\n    static fromBase64(key) {\n        const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.backupdecryptionkey_fromBase64(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return BackupDecryptionKey.__wrap(ret[0]);\n    }\n    /**\n     * Convert the backup decryption key to a base 64 encoded string.\n     * @returns {string}\n     */\n    toBase64() {\n        const ret = wasm.backupdecryptionkey_toBase64(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the public part of the backup key.\n     * @returns {MegolmV1BackupKey}\n     */\n    get megolmV1PublicKey() {\n        const ret = wasm.backupdecryptionkey_megolmV1PublicKey(this.__wbg_ptr);\n        return MegolmV1BackupKey.__wrap(ret);\n    }\n    /**\n     * Try to decrypt a message that was encrypted using the public part of the\n     * backup key.\n     * @param {string} ephemeral_key\n     * @param {string} mac\n     * @param {string} ciphertext\n     * @returns {string}\n     */\n    decryptV1(ephemeral_key, mac, ciphertext) {\n        let deferred5_0;\n        let deferred5_1;\n        try {\n            const ptr0 = passStringToWasm0(ephemeral_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len0 = WASM_VECTOR_LEN;\n            const ptr1 = passStringToWasm0(mac, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len1 = WASM_VECTOR_LEN;\n            const ptr2 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len2 = WASM_VECTOR_LEN;\n            const ret = wasm.backupdecryptionkey_decryptV1(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);\n            var ptr4 = ret[0];\n            var len4 = ret[1];\n            if (ret[3]) {\n                ptr4 = 0; len4 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred5_0 = ptr4;\n            deferred5_1 = len4;\n            return getStringFromWasm0(ptr4, len4);\n        } finally {\n            wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);\n        }\n    }\n}\n\nconst BackupKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_backupkeys_free(ptr >>> 0, 1));\n/**\n * Stored versions of the backup keys.\n */\nexport class BackupKeys {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(BackupKeys.prototype);\n        obj.__wbg_ptr = ptr;\n        BackupKeysFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        BackupKeysFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_backupkeys_free(ptr, 0);\n    }\n    /**\n     * The key used to decrypt backed up room keys\n     * @returns {BackupDecryptionKey | undefined}\n     */\n    get decryptionKey() {\n        const ret = wasm.__wbg_get_backupkeys_decryptionKey(this.__wbg_ptr);\n        return ret === 0 ? undefined : BackupDecryptionKey.__wrap(ret);\n    }\n    /**\n     * The key used to decrypt backed up room keys\n     * @param {BackupDecryptionKey | null} [arg0]\n     */\n    set decryptionKey(arg0) {\n        let ptr0 = 0;\n        if (!isLikeNone(arg0)) {\n            _assertClass(arg0, BackupDecryptionKey);\n            ptr0 = arg0.__destroy_into_raw();\n        }\n        wasm.__wbg_set_backupkeys_decryptionKey(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The version that we are using for backups.\n     * @returns {string | undefined}\n     */\n    get backupVersion() {\n        const ret = wasm.__wbg_get_backupkeys_backupVersion(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The version that we are using for backups.\n     * @param {string | null} [arg0]\n     */\n    set backupVersion(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupkeys_backupVersion(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The key used to decrypt backed up room keys, encoded as base64\n     *\n     * @deprecated Use `BackupKeys.decryptionKey.toBase64()`\n     * @returns {string | undefined}\n     */\n    get decryptionKeyBase64() {\n        const ret = wasm.backupkeys_decryptionKeyBase64(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst BackupSecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_backupsecretsbundle_free(ptr >>> 0, 1));\n/**\n * The backup-specific parts of a secrets bundle.\n */\nexport class BackupSecretsBundle {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(BackupSecretsBundle.prototype);\n        obj.__wbg_ptr = ptr;\n        BackupSecretsBundleFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        BackupSecretsBundleFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_backupsecretsbundle_free(ptr, 0);\n    }\n    /**\n     * The backup decryption key, encoded as unpadded base64.\n     * @returns {string}\n     */\n    get key() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_backupsecretsbundle_key(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The backup decryption key, encoded as unpadded base64.\n     * @param {string} arg0\n     */\n    set key(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The backup version which this backup decryption key is used with.\n     * @returns {string}\n     */\n    get backup_version() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_backupsecretsbundle_backup_version(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The backup version which this backup decryption key is used with.\n     * @param {string} arg0\n     */\n    set backup_version(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_backup_version(this.__wbg_ptr, ptr0, len0);\n    }\n}\n\nconst Base64EncodedPkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_base64encodedpkmessage_free(ptr >>> 0, 1));\n/**\n * The base64-encoded variant of a {@link PkMessage}.\n *\n * This can be useful if the encrypted message should be put into JSON.\n */\nexport class Base64EncodedPkMessage {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Base64EncodedPkMessage.prototype);\n        obj.__wbg_ptr = ptr;\n        Base64EncodedPkMessageFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        Base64EncodedPkMessageFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_base64encodedpkmessage_free(ptr, 0);\n    }\n    /**\n     * The base64-encoded ciphertext.\n     * @returns {string}\n     */\n    get ciphertext() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_base64encodedpkmessage_ciphertext(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The base64-encoded ciphertext.\n     * @param {string} arg0\n     */\n    set ciphertext(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The base64-encoded message authentication code (MAC).\n     * @returns {string}\n     */\n    get mac() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_base64encodedpkmessage_mac(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The base64-encoded message authentication code (MAC).\n     * @param {string} arg0\n     */\n    set mac(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_backup_version(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The base64-encoded ephemeral public key.\n     * @returns {string}\n     */\n    get ephemeralKey() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_base64encodedpkmessage_ephemeralKey(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The base64-encoded ephemeral public key.\n     * @param {string} arg0\n     */\n    set ephemeralKey(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_base64encodedpkmessage_ephemeralKey(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * Creates a new base64-encoded encrypted message from its parts.\n     * @param {string} ciphertext\n     * @param {string} mac\n     * @param {string} ephemeral_key\n     */\n    constructor(ciphertext, mac, ephemeral_key) {\n        const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passStringToWasm0(mac, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ptr2 = passStringToWasm0(ephemeral_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len2 = WASM_VECTOR_LEN;\n        const ret = wasm.base64encodedpkmessage_new(ptr0, len0, ptr1, len1, ptr2, len2);\n        this.__wbg_ptr = ret >>> 0;\n        Base64EncodedPkMessageFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst BaseMigrationDataFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_basemigrationdata_free(ptr >>> 0, 1));\n/**\n * The base dataset that is important to migrate to the Rust SDK.\n *\n * Can be imported into the rust store with {@link Migration::migrateBaseData}.\n */\nexport class BaseMigrationData {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        BaseMigrationDataFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_basemigrationdata_free(ptr, 0);\n    }\n    /**\n     * The user id of the account owner.\n     * @returns {UserId | undefined}\n     */\n    get userId() {\n        const ret = wasm.__wbg_get_basemigrationdata_userId(this.__wbg_ptr);\n        return ret === 0 ? undefined : UserId.__wrap(ret);\n    }\n    /**\n     * The user id of the account owner.\n     * @param {UserId | null} [arg0]\n     */\n    set userId(arg0) {\n        let ptr0 = 0;\n        if (!isLikeNone(arg0)) {\n            _assertClass(arg0, UserId);\n            ptr0 = arg0.__destroy_into_raw();\n        }\n        wasm.__wbg_set_basemigrationdata_userId(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The device ID of the account owner.\n     * @returns {DeviceId | undefined}\n     */\n    get deviceId() {\n        const ret = wasm.__wbg_get_basemigrationdata_deviceId(this.__wbg_ptr);\n        return ret === 0 ? undefined : DeviceId.__wrap(ret);\n    }\n    /**\n     * The device ID of the account owner.\n     * @param {DeviceId | null} [arg0]\n     */\n    set deviceId(arg0) {\n        let ptr0 = 0;\n        if (!isLikeNone(arg0)) {\n            _assertClass(arg0, DeviceId);\n            ptr0 = arg0.__destroy_into_raw();\n        }\n        wasm.__wbg_set_basemigrationdata_deviceId(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The pickle string holding the Olm Account, as returned by\n     * `olm_pickle_account` in libolm.\n     * @returns {string}\n     */\n    get pickledAccount() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_basemigrationdata_pickledAccount(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The pickle string holding the Olm Account, as returned by\n     * `olm_pickle_account` in libolm.\n     * @param {string} arg0\n     */\n    set pickledAccount(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The backup version that is currently active.\n     * @returns {string | undefined}\n     */\n    get backupVersion() {\n        const ret = wasm.__wbg_get_basemigrationdata_backupVersion(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The backup version that is currently active.\n     * @param {string | null} [arg0]\n     */\n    set backupVersion(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_backupVersion(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The backup recovery key, as a base64-encoded string.\n     * @returns {string | undefined}\n     */\n    get backupRecoveryKey() {\n        const ret = wasm.__wbg_get_basemigrationdata_backupRecoveryKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The backup recovery key, as a base64-encoded string.\n     * @param {string | null} [arg0]\n     */\n    set backupRecoveryKey(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_backupRecoveryKey(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The private, base64-encoded, master cross-signing key.\n     * @returns {string | undefined}\n     */\n    get privateCrossSigningMasterKey() {\n        const ret = wasm.__wbg_get_basemigrationdata_privateCrossSigningMasterKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The private, base64-encoded, master cross-signing key.\n     * @param {string | null} [arg0]\n     */\n    set privateCrossSigningMasterKey(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_privateCrossSigningMasterKey(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The private, base64-encoded, self-signing key.\n     * @returns {string | undefined}\n     */\n    get privateCrossSigningSelfSigningKey() {\n        const ret = wasm.__wbg_get_basemigrationdata_privateCrossSigningSelfSigningKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The private, base64-encoded, self-signing key.\n     * @param {string | null} [arg0]\n     */\n    set privateCrossSigningSelfSigningKey(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_privateCrossSigningSelfSigningKey(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The private, base64-encoded, user-signing key.\n     * @returns {string | undefined}\n     */\n    get privateCrossSigningUserSigningKey() {\n        const ret = wasm.__wbg_get_basemigrationdata_privateCrossSigningUserSigningKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The private, base64-encoded, user-signing key.\n     * @param {string | null} [arg0]\n     */\n    set privateCrossSigningUserSigningKey(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_privateCrossSigningUserSigningKey(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * Create a new `BaseMigrationData` with default values.\n     */\n    constructor() {\n        const ret = wasm.basemigrationdata_new();\n        this.__wbg_ptr = ret >>> 0;\n        BaseMigrationDataFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst CancelInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_cancelinfo_free(ptr >>> 0, 1));\n/**\n * Information about the cancellation of a verification request or\n * verification flow.\n */\nexport class CancelInfo {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(CancelInfo.prototype);\n        obj.__wbg_ptr = ptr;\n        CancelInfoFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        CancelInfoFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_cancelinfo_free(ptr, 0);\n    }\n    /**\n     * Get the human readable reason of the cancellation.\n     * @returns {string}\n     */\n    reason() {\n        const ret = wasm.cancelinfo_reason(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the `code` (e.g. `m.user`) that was used to cancel the\n     * verification.\n     * @returns {string}\n     */\n    cancelCode() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.cancelinfo_cancelCode(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Was the verification cancelled by us?\n     * @returns {boolean}\n     */\n    cancelledbyUs() {\n        const ret = wasm.cancelinfo_cancelledbyUs(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst CheckCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_checkcode_free(ptr >>> 0, 1));\n/**\n * A check code that can be used to confirm that two [`EstablishedEcies`]\n * objects share the same secret. This is supposed to be shared out-of-band to\n * protect against active Man-in-the-middle (MITM) attacks.\n *\n * Since the initiator device can always tell whether a MITM attack is in\n * progress after channel establishment, this code technically carries only a\n * single bit of information, representing whether the initiator has determined\n * that the channel is \"secure\" or \"not secure\".\n *\n * However, given this will need to be interactively confirmed by the user,\n * there is risk that the user would confirm the dialogue without paying\n * attention to its content. By expanding this single bit into a deterministic\n * two-digit check code, the user is forced to pay more attention by having to\n * enter it instead of just clicking through a dialogue.\n */\nexport class CheckCode {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(CheckCode.prototype);\n        obj.__wbg_ptr = ptr;\n        CheckCodeFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        CheckCodeFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_checkcode_free(ptr, 0);\n    }\n    /**\n     * Convert the check code to an array of two bytes.\n     *\n     * The bytes can be converted to a more user-friendly representation. The\n     * [`CheckCode::to_digit`] converts the bytes to a two-digit number.\n     * @returns {Uint8Array}\n     */\n    as_bytes() {\n        const ret = wasm.checkcode_as_bytes(this.__wbg_ptr);\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n    /**\n     * Convert the check code to two base-10 numbers.\n     *\n     * The number should be displayed with a leading 0 in case the first digit\n     * is a 0.\n     * @returns {number}\n     */\n    to_digit() {\n        const ret = wasm.checkcode_to_digit(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst CollectStrategyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_collectstrategy_free(ptr >>> 0, 1));\n/**\n * Strategy to collect the devices that should receive room keys for the\n * current discussion.\n */\nexport class CollectStrategy {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(CollectStrategy.prototype);\n        obj.__wbg_ptr = ptr;\n        CollectStrategyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        CollectStrategyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_collectstrategy_free(ptr, 0);\n    }\n    /**\n     * Tests for equality between two [`CollectStrategy`]s.\n     * @param {CollectStrategy} other\n     * @returns {boolean}\n     */\n    eq(other) {\n        _assertClass(other, CollectStrategy);\n        const ret = wasm.collectstrategy_eq(this.__wbg_ptr, other.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Device based sharing strategy.\n     *\n     * @deprecated: use one of {@link allDevices}, {@link\n     * errorOnUnverifiedUserProblem} or {@link onlyTrustedDevices}.\n     * @param {boolean} only_allow_trusted_devices\n     * @param {boolean} error_on_verified_user_problem\n     * @returns {CollectStrategy}\n     */\n    static deviceBasedStrategy(only_allow_trusted_devices, error_on_verified_user_problem) {\n        const ret = wasm.collectstrategy_deviceBasedStrategy(only_allow_trusted_devices, error_on_verified_user_problem);\n        return CollectStrategy.__wrap(ret);\n    }\n    /**\n     * Share with all (unblacklisted) devices.\n     * @returns {CollectStrategy}\n     */\n    static allDevices() {\n        const ret = wasm.collectstrategy_allDevices();\n        return CollectStrategy.__wrap(ret);\n    }\n    /**\n     * Share with all devices, except that errors for *verified* users cause\n     * sharing to fail with an error.\n     *\n     * In this strategy, if a verified user has an unsigned device, or\n     * a verified user has replaced their identity, key\n     * sharing will fail with an error.\n     *\n     * Otherwise, keys are shared with unsigned devices as normal.\n     *\n     * Once the problematic devices are blacklisted or whitelisted the\n     * caller can try sharing a second time.\n     * @returns {CollectStrategy}\n     */\n    static errorOnUnverifiedUserProblem() {\n        const ret = wasm.collectstrategy_errorOnUnverifiedUserProblem();\n        return CollectStrategy.__wrap(ret);\n    }\n    /**\n     * Share based on identity. Only distribute to devices signed by their\n     * owner. If a user has no published identity he will not receive\n     * any room keys.\n     * @returns {CollectStrategy}\n     */\n    static identityBasedStrategy() {\n        const ret = wasm.collectstrategy_identityBasedStrategy();\n        return CollectStrategy.__wrap(ret);\n    }\n    /**\n     * Only share keys with devices that we \"trust\". A device is trusted if any\n     * of the following is true:\n     *     - It was manually marked as trusted.\n     *     - It was marked as verified via interactive verification.\n     *     - It is signed by its owner identity, and this identity has been\n     *       trusted via interactive verification.\n     *     - It is the current own device of the user.\n     * @returns {CollectStrategy}\n     */\n    static onlyTrustedDevices() {\n        const ret = wasm.collectstrategy_onlyTrustedDevices();\n        return CollectStrategy.__wrap(ret);\n    }\n}\n\nconst CrossSigningBootstrapRequestsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningbootstraprequests_free(ptr >>> 0, 1));\n/**\n * A set of requests to be executed when bootstrapping cross-signing using\n * {@link OlmMachine.bootstrapCrossSigning}.\n */\nexport class CrossSigningBootstrapRequests {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(CrossSigningBootstrapRequests.prototype);\n        obj.__wbg_ptr = ptr;\n        CrossSigningBootstrapRequestsFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        CrossSigningBootstrapRequestsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_crosssigningbootstraprequests_free(ptr, 0);\n    }\n    /**\n     * An optional request to upload a device key.\n     *\n     * This will either be `undefined`, or an \"outgoing request\" as returned by\n     * {@link OlmMachine.outgoingRequests}.\n     *\n     * If it is defined, the request should be sent first, and the result sent\n     * back with {@link OlmMachine.markRequestAsSent}.\n     * @returns {any}\n     */\n    get uploadKeysRequest() {\n        const ret = wasm.__wbg_get_crosssigningbootstraprequests_uploadKeysRequest(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Request to upload the cross-signing keys.\n     *\n     * Should be sent second.\n     * @returns {UploadSigningKeysRequest}\n     */\n    get uploadSigningKeysRequest() {\n        const ret = wasm.__wbg_get_crosssigningbootstraprequests_uploadSigningKeysRequest(this.__wbg_ptr);\n        return UploadSigningKeysRequest.__wrap(ret);\n    }\n    /**\n     * Request to upload key signatures, including those for the cross-signing\n     * keys, and maybe some for the optional uploaded key too.\n     *\n     * Should be sent last.\n     * @returns {SignatureUploadRequest}\n     */\n    get uploadSignaturesRequest() {\n        const ret = wasm.__wbg_get_crosssigningbootstraprequests_uploadSignaturesRequest(this.__wbg_ptr);\n        return SignatureUploadRequest.__wrap(ret);\n    }\n}\n\nconst CrossSigningKeyExportFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningkeyexport_free(ptr >>> 0, 1));\n/**\n * A struct containing private cross signing keys that can be backed\n * up or uploaded to the secret store.\n */\nexport class CrossSigningKeyExport {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(CrossSigningKeyExport.prototype);\n        obj.__wbg_ptr = ptr;\n        CrossSigningKeyExportFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        CrossSigningKeyExportFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_crosssigningkeyexport_free(ptr, 0);\n    }\n    /**\n     * The seed of the master key encoded as unpadded base64.\n     * @returns {string | undefined}\n     */\n    get masterKey() {\n        const ret = wasm.crosssigningkeyexport_masterKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The seed of the self signing key encoded as unpadded base64.\n     * @returns {string | undefined}\n     */\n    get self_signing_key() {\n        const ret = wasm.crosssigningkeyexport_self_signing_key(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The seed of the user signing key encoded as unpadded base64.\n     * @returns {string | undefined}\n     */\n    get userSigningKey() {\n        const ret = wasm.crosssigningkeyexport_userSigningKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n}\n\nconst CrossSigningStatusFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningstatus_free(ptr >>> 0, 1));\n/**\n * Struct representing the state of our private cross signing keys,\n * it shows which private cross signing keys we have locally stored.\n */\nexport class CrossSigningStatus {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(CrossSigningStatus.prototype);\n        obj.__wbg_ptr = ptr;\n        CrossSigningStatusFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        CrossSigningStatusFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_crosssigningstatus_free(ptr, 0);\n    }\n    /**\n     * Do we have the master key?\n     * @returns {boolean}\n     */\n    get hasMaster() {\n        const ret = wasm.crosssigningstatus_hasMaster(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Do we have the self signing key? This one is necessary to sign\n     * our own devices.\n     * @returns {boolean}\n     */\n    get hasSelfSigning() {\n        const ret = wasm.crosssigningstatus_hasSelfSigning(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Do we have the user signing key? This one is necessary to sign\n     * other users.\n     * @returns {boolean}\n     */\n    get hasUserSigning() {\n        const ret = wasm.crosssigningstatus_hasUserSigning(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst Curve25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_curve25519publickey_free(ptr >>> 0, 1));\n/**\n * A Curve25519 public key.\n */\nexport class Curve25519PublicKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Curve25519PublicKey.prototype);\n        obj.__wbg_ptr = ptr;\n        Curve25519PublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        Curve25519PublicKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_curve25519publickey_free(ptr, 0);\n    }\n    /**\n     * Create a new [`Curve25519PublicKey`] from a base64 encoded string.\n     * @param {string} key\n     */\n    constructor(key) {\n        const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.curve25519publickey_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        Curve25519PublicKeyFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * The number of bytes a Curve25519 public key has.\n     * @returns {number}\n     */\n    get length() {\n        const ret = wasm.curve25519publickey_length(this.__wbg_ptr);\n        return ret >>> 0;\n    }\n    /**\n     * Serialize an Curve25519 public key to an unpadded base64\n     * representation.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.curve25519publickey_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst Curve25519SecretKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_curve25519secretkey_free(ptr >>> 0, 1));\n/**\n * A Curve25519 secret key.\n */\nexport class Curve25519SecretKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Curve25519SecretKey.prototype);\n        obj.__wbg_ptr = ptr;\n        Curve25519SecretKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        Curve25519SecretKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_curve25519secretkey_free(ptr, 0);\n    }\n    /**\n     * Generates a new random Curve25519 secret key.\n     * @returns {Curve25519SecretKey}\n     */\n    static new() {\n        const ret = wasm.curve25519secretkey_new();\n        return Curve25519SecretKey.__wrap(ret);\n    }\n    /**\n     * Creates a `Curve25519SecretKey` from a base64-encoded representation of\n     * the key.\n     * @param {string} string\n     * @returns {Curve25519SecretKey}\n     */\n    static fromBase64(string) {\n        const ptr0 = passStringToWasm0(string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.curve25519secretkey_fromBase64(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return Curve25519SecretKey.__wrap(ret[0]);\n    }\n    /**\n     * Encodes the secret key into a base64 string.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.curve25519secretkey_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Converts the secret key into a raw byte vector.\n     * @returns {Uint8Array}\n     */\n    toUint8Array() {\n        const ret = wasm.curve25519secretkey_toUint8Array(this.__wbg_ptr);\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n    /**\n     * Creates a `Curve25519SecretKey` from a raw byte slice.\n     * @param {Uint8Array} slice\n     * @returns {Curve25519SecretKey}\n     */\n    static fromUint8Array(slice) {\n        const ptr0 = passArray8ToWasm0(slice, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.curve25519secretkey_fromUint8Array(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return Curve25519SecretKey.__wrap(ret[0]);\n    }\n}\n\nconst DecryptedRoomEventFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_decryptedroomevent_free(ptr >>> 0, 1));\n/**\n * A decrypted room event.\n */\nexport class DecryptedRoomEvent {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DecryptedRoomEvent.prototype);\n        obj.__wbg_ptr = ptr;\n        DecryptedRoomEventFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DecryptedRoomEventFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_decryptedroomevent_free(ptr, 0);\n    }\n    /**\n     * The JSON-encoded decrypted event.\n     * @returns {string}\n     */\n    get event() {\n        const ret = wasm.__wbg_get_decryptedroomevent_event(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The user ID of the event sender, note this is untrusted data\n     * unless the `verification_state` is as well trusted.\n     * @returns {UserId}\n     */\n    get sender() {\n        const ret = wasm.decryptedroomevent_sender(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The device ID of the device that sent us the event, note this\n     * is untrusted data unless `verification_state` is as well\n     * trusted.\n     * @returns {DeviceId | undefined}\n     */\n    get senderDevice() {\n        const ret = wasm.decryptedroomevent_senderDevice(this.__wbg_ptr);\n        return ret === 0 ? undefined : DeviceId.__wrap(ret);\n    }\n    /**\n     * The Curve25519 key of the device that created the megolm\n     * decryption key originally.\n     * @returns {string}\n     */\n    get senderCurve25519Key() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.decryptedroomevent_senderCurve25519Key(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The signing Ed25519 key that have created the megolm key that\n     * was used to decrypt this session.\n     * @returns {string | undefined}\n     */\n    get senderClaimedEd25519Key() {\n        const ret = wasm.decryptedroomevent_senderClaimedEd25519Key(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Returns an empty array\n     *\n     * Previously, this returned the chain of Curve25519 keys through which\n     * this session was forwarded, via `m.forwarded_room_key` events.\n     * However, that is not cryptographically reliable, and clients should not\n     * be using it.\n     *\n     * @see https://github.com/matrix-org/matrix-spec/issues/1089\n     * @returns {Array<any>}\n     */\n    get forwardingCurve25519KeyChain() {\n        const ret = wasm.decryptedroomevent_forwardingCurve25519KeyChain(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The verification state of the device that sent us the event.\n     * Note this is the state of the device at the time of\n     * decryption. It may change in the future if a device gets\n     * verified or deleted.\n     * @param {boolean} strict\n     * @returns {ShieldState}\n     */\n    shieldState(strict) {\n        const ret = wasm.decryptedroomevent_shieldState(this.__wbg_ptr, strict);\n        return ShieldState.__wrap(ret);\n    }\n}\n\nconst DecryptedToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_decryptedtodeviceevent_free(ptr >>> 0, 1));\n/**\n * Represents an encrypted to-device event, after it has been decrypted.\n */\nexport class DecryptedToDeviceEvent {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DecryptedToDeviceEvent.prototype);\n        obj.__wbg_ptr = ptr;\n        DecryptedToDeviceEventFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DecryptedToDeviceEventFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_decryptedtodeviceevent_free(ptr, 0);\n    }\n    /**\n     * The decrypted event, as if it had been sent in the clear, encoded as\n     * JSON.\n     *\n     * Typically contains properties `type`, `sender` and `content`.\n     *\n     * (For room keys or secrets, some part of the content might have been\n     * zeroized).\n     * @returns {string}\n     */\n    get rawEvent() {\n        const ret = wasm.__wbg_get_decryptedtodeviceevent_rawEvent(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The encryption information for the event.\n     * @returns {ToDeviceEncryptionInfo}\n     */\n    get encryptionInfo() {\n        const ret = wasm.__wbg_get_decryptedtodeviceevent_encryptionInfo(this.__wbg_ptr);\n        return ToDeviceEncryptionInfo.__wrap(ret);\n    }\n    /**\n     * The type of processed to-device event. Always {@link\n     * ProcessedToDeviceEventType.Decrypted} for this type.\n     * @returns {ProcessedToDeviceEventType}\n     */\n    get type() {\n        const ret = wasm.decryptedtodeviceevent_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst DecryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_decryptionsettings_free(ptr >>> 0, 1));\n/**\n * Settings for decrypting messages\n */\nexport class DecryptionSettings {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DecryptionSettingsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_decryptionsettings_free(ptr, 0);\n    }\n    /**\n     * The trust level required to decrypt the event\n     * @returns {TrustRequirement}\n     */\n    get sender_device_trust_requirement() {\n        const ret = wasm.__wbg_get_decryptionsettings_sender_device_trust_requirement(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The trust level required to decrypt the event\n     * @param {TrustRequirement} arg0\n     */\n    set sender_device_trust_requirement(arg0) {\n        wasm.__wbg_set_decryptionsettings_sender_device_trust_requirement(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Create a new `DecryptionSettings` with the given trust requirement.\n     * @param {TrustRequirement} sender_device_trust_requirement\n     */\n    constructor(sender_device_trust_requirement) {\n        const ret = wasm.decryptionsettings_new(sender_device_trust_requirement);\n        this.__wbg_ptr = ret >>> 0;\n        DecryptionSettingsFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst DehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevice_free(ptr >>> 0, 1));\n/**\n * A dehydrated device that can be uploaded to the server\n */\nexport class DehydratedDevice {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DehydratedDevice.prototype);\n        obj.__wbg_ptr = ptr;\n        DehydratedDeviceFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DehydratedDeviceFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_dehydrateddevice_free(ptr, 0);\n    }\n    /**\n     * Create the request to upload the dehydrated device\n     * @param {string} initial_device_display_name\n     * @param {DehydratedDeviceKey} dehydrated_device_key\n     * @returns {Promise<PutDehydratedDeviceRequest>}\n     */\n    keysForUpload(initial_device_display_name, dehydrated_device_key) {\n        _assertClass(dehydrated_device_key, DehydratedDeviceKey);\n        const ret = wasm.dehydrateddevice_keysForUpload(this.__wbg_ptr, initial_device_display_name, dehydrated_device_key.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst DehydratedDeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevicekey_free(ptr >>> 0, 1));\n/**\n * Dehydrated device key\n */\nexport class DehydratedDeviceKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DehydratedDeviceKey.prototype);\n        obj.__wbg_ptr = ptr;\n        DehydratedDeviceKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DehydratedDeviceKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_dehydrateddevicekey_free(ptr, 0);\n    }\n    /**\n     * Generates a new random dehydrated device key.\n     * @returns {DehydratedDeviceKey}\n     */\n    static createRandomKey() {\n        const ret = wasm.dehydrateddevicekey_createRandomKey();\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return DehydratedDeviceKey.__wrap(ret[0]);\n    }\n    /**\n     * Generates a dehydrated device key from a given array.\n     * @param {Uint8Array} array\n     * @returns {DehydratedDeviceKey}\n     */\n    static createKeyFromArray(array) {\n        const ret = wasm.dehydrateddevicekey_createKeyFromArray(array);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return DehydratedDeviceKey.__wrap(ret[0]);\n    }\n    /**\n     * Convert the dehydrated device key to a base64-encoded string.\n     * @returns {string}\n     */\n    toBase64() {\n        const ret = wasm.dehydrateddevicekey_toBase64(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst DehydratedDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevices_free(ptr >>> 0, 1));\n/**\n * Struct collecting methods to create and rehydrate dehydrated devices.\n */\nexport class DehydratedDevices {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DehydratedDevices.prototype);\n        obj.__wbg_ptr = ptr;\n        DehydratedDevicesFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DehydratedDevicesFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_dehydrateddevices_free(ptr, 0);\n    }\n    /**\n     * Create a new {@link DehydratedDevice} which can be uploaded to the\n     * server.\n     * @returns {Promise<DehydratedDevice>}\n     */\n    create() {\n        const ret = wasm.dehydrateddevices_create(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Rehydrate a dehydrated device.\n     * @param {DehydratedDeviceKey} dehydrated_device_key\n     * @param {DeviceId} device_id\n     * @param {string} device_data\n     * @returns {Promise<RehydratedDevice>}\n     */\n    rehydrate(dehydrated_device_key, device_id, device_data) {\n        _assertClass(dehydrated_device_key, DehydratedDeviceKey);\n        _assertClass(device_id, DeviceId);\n        const ptr0 = passStringToWasm0(device_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.dehydrateddevices_rehydrate(this.__wbg_ptr, dehydrated_device_key.__wbg_ptr, device_id.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Get the cached dehydrated device key if any.\n     *\n     * `None` if the key was not previously cached (via\n     * {@link DehydratedDevices.saveDehydratedDeviceKey}).\n     * @returns {Promise<DehydratedDeviceKey | undefined>}\n     */\n    getDehydratedDeviceKey() {\n        const ret = wasm.dehydrateddevices_getDehydratedDeviceKey(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Store the dehydrated device key in the crypto store.\n     * @param {DehydratedDeviceKey} dehydrated_device_key\n     * @returns {Promise<void>}\n     */\n    saveDehydratedDeviceKey(dehydrated_device_key) {\n        _assertClass(dehydrated_device_key, DehydratedDeviceKey);\n        const ret = wasm.dehydrateddevices_saveDehydratedDeviceKey(this.__wbg_ptr, dehydrated_device_key.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Clear the dehydrated device key saved in the crypto store.\n     * @returns {Promise<void>}\n     */\n    deleteDehydratedDeviceKey() {\n        const ret = wasm.dehydrateddevices_deleteDehydratedDeviceKey(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst DeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_device_free(ptr >>> 0, 1));\n/**\n * A device represents a E2EE capable client of an user.\n */\nexport class Device {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Device.prototype);\n        obj.__wbg_ptr = ptr;\n        DeviceFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DeviceFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_device_free(ptr, 0);\n    }\n    /**\n     * Request an interactive verification with this device.\n     *\n     * Returns a 2-element array `[VerificationRequest, ToDeviceRequest]`.\n     * @param {any[] | null} [methods]\n     * @returns {Array<any>}\n     */\n    requestVerification(methods) {\n        var ptr0 = isLikeNone(methods) ? 0 : passArrayJsValueToWasm0(methods, wasm.__wbindgen_malloc);\n        var len0 = WASM_VECTOR_LEN;\n        const ret = wasm.device_requestVerification(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Encrypt a to-device message to be sent to this device, using Olm\n     * encryption.\n     *\n     * Prior to calling this method you must ensure that an Olm session is\n     * available for the target device. This can be done by calling\n     * {@link OlmMachine.getMissingSessions}.\n     *\n     * The caller is responsible for sending the encrypted\n     * event to the target device. If multiple messages are\n     * encrypted for the same device using this method they should be sent in\n     * the same order as they are encrypted.\n     *\n     * # Returns\n     *\n     * Returns a promise for a JSON string containing the `content` of an\n     * encrypted event, which be used to create the payload for a\n     * `/sendToDevice` API.\n     * @param {string} event_type\n     * @param {any} content\n     * @param {CollectStrategy | null} [share_strategy]\n     * @returns {Promise<string>}\n     */\n    encryptToDeviceEvent(event_type, content, share_strategy) {\n        const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        let ptr1 = 0;\n        if (!isLikeNone(share_strategy)) {\n            _assertClass(share_strategy, CollectStrategy);\n            ptr1 = share_strategy.__destroy_into_raw();\n        }\n        const ret = wasm.device_encryptToDeviceEvent(this.__wbg_ptr, ptr0, len0, content, ptr1);\n        return ret;\n    }\n    /**\n     * Is this device considered to be verified.\n     *\n     * This method returns true if either the `is_locally_trusted`\n     * method returns `true` or if the `is_cross_signing_trusted`\n     * method returns `true`.\n     * @returns {boolean}\n     */\n    isVerified() {\n        const ret = wasm.device_isVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is this device considered to be verified using cross signing.\n     * @returns {boolean}\n     */\n    isCrossSigningTrusted() {\n        const ret = wasm.device_isCrossSigningTrusted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is this device cross-signed by its owner?\n     * @returns {boolean}\n     */\n    isCrossSignedByOwner() {\n        const ret = wasm.device_isCrossSignedByOwner(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Set the local trust state of the device to the given state.\n     *\n     * This won’t affect any cross signing trust state, this only\n     * sets a flag marking to have the given trust state.\n     *\n     * `trust_state` represents the new trust state that should be\n     * set for the device.\n     * @param {LocalTrust} local_state\n     * @returns {Promise<any>}\n     */\n    setLocalTrust(local_state) {\n        const ret = wasm.device_setLocalTrust(this.__wbg_ptr, local_state);\n        return ret;\n    }\n    /**\n     * The user ID of the device owner.\n     * @returns {UserId}\n     */\n    get userId() {\n        const ret = wasm.device_userId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The unique ID of the device.\n     * @returns {DeviceId}\n     */\n    get deviceId() {\n        const ret = wasm.device_deviceId(this.__wbg_ptr);\n        return DeviceId.__wrap(ret);\n    }\n    /**\n     * Get the human readable name of the device.\n     * @returns {string | undefined}\n     */\n    get displayName() {\n        const ret = wasm.device_displayName(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * Get the key of the given key algorithm belonging to this device.\n     * @param {DeviceKeyAlgorithmName} algorithm\n     * @returns {DeviceKey | undefined}\n     */\n    getKey(algorithm) {\n        const ret = wasm.device_getKey(this.__wbg_ptr, algorithm);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return ret[0] === 0 ? undefined : DeviceKey.__wrap(ret[0]);\n    }\n    /**\n     * Get the Curve25519 key of the given device.\n     * @returns {Curve25519PublicKey | undefined}\n     */\n    get curve25519Key() {\n        const ret = wasm.device_curve25519Key(this.__wbg_ptr);\n        return ret === 0 ? undefined : Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Get the Ed25519 key of the given device.\n     * @returns {Ed25519PublicKey | undefined}\n     */\n    get ed25519Key() {\n        const ret = wasm.device_ed25519Key(this.__wbg_ptr);\n        return ret === 0 ? undefined : Ed25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Get a map containing all the device keys.\n     * @returns {Map<any, any>}\n     */\n    get keys() {\n        const ret = wasm.device_keys(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the list of algorithms this device supports.\n     *\n     * Returns `Array<EncryptionAlgorithm>`.\n     * @returns {Array<any>}\n     */\n    get algorithms() {\n        const ret = wasm.device_algorithms(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get a map containing all the device signatures.\n     * @returns {Signatures}\n     */\n    get signatures() {\n        const ret = wasm.device_signatures(this.__wbg_ptr);\n        return Signatures.__wrap(ret);\n    }\n    /**\n     * Get the trust state of the device.\n     * @returns {LocalTrust}\n     */\n    get localTrustState() {\n        const ret = wasm.device_localTrustState(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Is the device locally marked as trusted?\n     * @returns {boolean}\n     */\n    isLocallyTrusted() {\n        const ret = wasm.device_isLocallyTrusted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is the device locally marked as blacklisted?\n     *\n     * Blacklisted devices won’t receive any group sessions.\n     * @returns {boolean}\n     */\n    isBlacklisted() {\n        const ret = wasm.device_isBlacklisted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is the device deleted?\n     * @returns {boolean}\n     */\n    isDeleted() {\n        const ret = wasm.device_isDeleted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Timestamp representing the first time this device has been seen (in\n     * milliseconds).\n     * @returns {bigint}\n     */\n    firstTimeSeen() {\n        const ret = wasm.device_firstTimeSeen(this.__wbg_ptr);\n        return BigInt.asUintN(64, ret);\n    }\n    /**\n     * Mark this device as verified.\n     * Works only if the device is owned by the current user.\n     *\n     * Returns a signature upload request that needs to be sent out.\n     * @returns {Promise<any>}\n     */\n    verify() {\n        const ret = wasm.device_verify(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Whether or not the device is a dehydrated device.\n     * @returns {boolean}\n     */\n    get isDehydrated() {\n        const ret = wasm.device_isDehydrated(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst DeviceIdFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_deviceid_free(ptr >>> 0, 1));\n/**\n * A Matrix key ID.\n *\n * Device identifiers in Matrix are completely opaque character\n * sequences. This type is provided simply for its semantic value.\n */\nexport class DeviceId {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DeviceId.prototype);\n        obj.__wbg_ptr = ptr;\n        DeviceIdFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DeviceIdFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_deviceid_free(ptr, 0);\n    }\n    /**\n     * Create a new `DeviceId`.\n     * @param {string} id\n     */\n    constructor(id) {\n        const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.deviceid_new(ptr0, len0);\n        this.__wbg_ptr = ret >>> 0;\n        DeviceIdFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Return the device ID as a string.\n     * @returns {string}\n     */\n    toString() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.deviceid_toString(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst DeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_devicekey_free(ptr >>> 0, 1));\n/**\n * An enum over the different key types a device can have.\n *\n * Currently devices have a curve25519 and ed25519 keypair. The keys\n * transport format is a base64 encoded string, any unknown key type\n * will be left as such a string.\n */\nexport class DeviceKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DeviceKey.prototype);\n        obj.__wbg_ptr = ptr;\n        DeviceKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DeviceKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_devicekey_free(ptr, 0);\n    }\n    /**\n     * Get the name of the device key.\n     * @returns {DeviceKeyName}\n     */\n    get name() {\n        const ret = wasm.devicekey_name(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the value associated to the `Curve25519` device key name.\n     * @returns {Curve25519PublicKey | undefined}\n     */\n    get curve25519() {\n        const ret = wasm.devicekey_curve25519(this.__wbg_ptr);\n        return ret === 0 ? undefined : Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Get the value associated to the `Ed25519` device key name.\n     * @returns {Ed25519PublicKey | undefined}\n     */\n    get ed25519() {\n        const ret = wasm.devicekey_ed25519(this.__wbg_ptr);\n        return ret === 0 ? undefined : Ed25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Get the value associated to the `Unknown` device key name.\n     * @returns {string | undefined}\n     */\n    get unknown() {\n        const ret = wasm.devicekey_unknown(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * Convert the `DeviceKey` into a base64 encoded string.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.devicekey_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst DeviceKeyAlgorithmFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyalgorithm_free(ptr >>> 0, 1));\n/**\n * The basic key algorithms in the specification.\n */\nexport class DeviceKeyAlgorithm {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DeviceKeyAlgorithm.prototype);\n        obj.__wbg_ptr = ptr;\n        DeviceKeyAlgorithmFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DeviceKeyAlgorithmFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_devicekeyalgorithm_free(ptr, 0);\n    }\n    /**\n     * Read the device key algorithm's name. If the name is\n     * `Unknown`, one may be interested by the `to_string` method to\n     * read the original name.\n     * @returns {DeviceKeyAlgorithmName}\n     */\n    get name() {\n        const ret = wasm.devicekeyalgorithm_name(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Return the device key algorithm as a string.\n     * @returns {string}\n     */\n    toString() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.devicekeyalgorithm_toString(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst DeviceKeyIdFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyid_free(ptr >>> 0, 1));\n/**\n * A Matrix device key ID.\n *\n * A key algorithm and a device ID, combined with a ‘:’.\n */\nexport class DeviceKeyId {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(DeviceKeyId.prototype);\n        obj.__wbg_ptr = ptr;\n        DeviceKeyIdFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DeviceKeyIdFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_devicekeyid_free(ptr, 0);\n    }\n    /**\n     * Parse/validate and create a new `DeviceKeyId`.\n     * @param {string} id\n     */\n    constructor(id) {\n        const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.devicekeyid_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        DeviceKeyIdFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Returns key algorithm of the device key ID.\n     * @returns {DeviceKeyAlgorithm}\n     */\n    get algorithm() {\n        const ret = wasm.devicekeyid_algorithm(this.__wbg_ptr);\n        return DeviceKeyAlgorithm.__wrap(ret);\n    }\n    /**\n     * Returns device ID of the device key ID.\n     * @returns {DeviceId}\n     */\n    get deviceId() {\n        const ret = wasm.devicekeyid_deviceId(this.__wbg_ptr);\n        return DeviceId.__wrap(ret);\n    }\n    /**\n     * Return the device key ID as a string.\n     * @returns {string}\n     */\n    toString() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.devicekeyid_toString(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst DeviceListsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_devicelists_free(ptr >>> 0, 1));\n/**\n * Information on E2E device updates.\n */\nexport class DeviceLists {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        DeviceListsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_devicelists_free(ptr, 0);\n    }\n    /**\n     * Create an empty `DeviceLists`.\n     *\n     * `changed` and `left` must be an array of `UserId`.\n     *\n     * Items inside `changed` and `left` will be invalidated by this method. Be\n     * careful not to use the `UserId`s after this method has been called.\n     * @param {UserId[] | null} [changed]\n     * @param {UserId[] | null} [left]\n     */\n    constructor(changed, left) {\n        var ptr0 = isLikeNone(changed) ? 0 : passArrayJsValueToWasm0(changed, wasm.__wbindgen_malloc);\n        var len0 = WASM_VECTOR_LEN;\n        var ptr1 = isLikeNone(left) ? 0 : passArrayJsValueToWasm0(left, wasm.__wbindgen_malloc);\n        var len1 = WASM_VECTOR_LEN;\n        const ret = wasm.devicelists_new(ptr0, len0, ptr1, len1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        DeviceListsFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Returns true if there are no device list updates.\n     * @returns {boolean}\n     */\n    isEmpty() {\n        const ret = wasm.devicelists_isEmpty(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * List of users who have updated their device identity keys or\n     * who now share an encrypted room with the client since the\n     * previous sync\n     * @returns {UserId[]}\n     */\n    get changed() {\n        const ret = wasm.devicelists_changed(this.__wbg_ptr);\n        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n        return v1;\n    }\n    /**\n     * List of users who no longer share encrypted rooms since the\n     * previous sync response.\n     * @returns {UserId[]}\n     */\n    get left() {\n        const ret = wasm.devicelists_left(this.__wbg_ptr);\n        var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n        return v1;\n    }\n}\n\nconst EciesFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_ecies_free(ptr >>> 0, 1));\n/**\n * An unestablished ECIES session.\n */\nexport class Ecies {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EciesFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_ecies_free(ptr, 0);\n    }\n    /**\n     * Create a new, random, unestablished ECIES session.\n     *\n     * This method will use the\n     * [`MATRIX_QR_CODE_LOGIN`](https://github.com/matrix-org/matrix-spec-proposals/pull/4108)\n     * info for domain separation when creating the session.\n     */\n    constructor() {\n        const ret = wasm.ecies_new();\n        this.__wbg_ptr = ret >>> 0;\n        EciesFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get our [`Curve25519PublicKey`].\n     *\n     * This public key needs to be sent to the other side to be able to\n     * establish an ECIES channel.\n     * @returns {Curve25519PublicKey}\n     */\n    public_key() {\n        const ret = wasm.ecies_public_key(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Create a [`EstablishedEcies`] from an initial message encrypted by the\n     * other side.\n     * @param {string} initial_message\n     * @returns {InboundCreationResult}\n     */\n    establish_inbound_channel(initial_message) {\n        const ptr0 = passStringToWasm0(initial_message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.ecies_establish_inbound_channel(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return InboundCreationResult.__wrap(ret[0]);\n    }\n    /**\n     * Create an [`EstablishedEcies`] session using the other side's Curve25519\n     * public key and an initial plaintext.\n     *\n     * After the channel has been established, we can encrypt messages to send\n     * to the other side. The other side uses the initial message to\n     * establishes the same channel on its side.\n     * @param {Curve25519PublicKey} public_key\n     * @param {string} initial_message\n     * @returns {OutboundCreationResult}\n     */\n    establish_outbound_channel(public_key, initial_message) {\n        _assertClass(public_key, Curve25519PublicKey);\n        const ptr0 = passStringToWasm0(initial_message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.ecies_establish_outbound_channel(this.__wbg_ptr, public_key.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return OutboundCreationResult.__wrap(ret[0]);\n    }\n}\n\nconst Ed25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_ed25519publickey_free(ptr >>> 0, 1));\n/**\n * An Ed25519 public key, used to verify digital signatures.\n */\nexport class Ed25519PublicKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Ed25519PublicKey.prototype);\n        obj.__wbg_ptr = ptr;\n        Ed25519PublicKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        Ed25519PublicKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_ed25519publickey_free(ptr, 0);\n    }\n    /**\n     * The number of bytes an Ed25519 public key has.\n     * @returns {number}\n     */\n    get length() {\n        const ret = wasm.ed25519publickey_length(this.__wbg_ptr);\n        return ret >>> 0;\n    }\n    /**\n     * Serialize an Ed25519 public key to an unpadded base64\n     * representation.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.ed25519publickey_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst Ed25519SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_ed25519signature_free(ptr >>> 0, 1));\n/**\n * An Ed25519 digital signature, can be used to verify the\n * authenticity of a message.\n */\nexport class Ed25519Signature {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Ed25519Signature.prototype);\n        obj.__wbg_ptr = ptr;\n        Ed25519SignatureFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        Ed25519SignatureFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_ed25519signature_free(ptr, 0);\n    }\n    /**\n     * Try to create an Ed25519 signature from an unpadded base64\n     * representation.\n     * @param {string} signature\n     */\n    constructor(signature) {\n        const ptr0 = passStringToWasm0(signature, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.ed25519signature_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        Ed25519SignatureFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Serialize a Ed25519 signature to an unpadded base64\n     * representation.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.ed25519signature_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst EmojiFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_emoji_free(ptr >>> 0, 1));\n/**\n * An emoji that is used for interactive verification using a short\n * auth string.\n *\n * This will contain a single emoji and description from the list of\n * emojis from [the specification].\n *\n * [the specification]: https://spec.matrix.org/unstable/client-server-api/#sas-method-emoji\n */\nexport class Emoji {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Emoji.prototype);\n        obj.__wbg_ptr = ptr;\n        EmojiFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EmojiFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_emoji_free(ptr, 0);\n    }\n    /**\n     * The emoji symbol that represents a part of the short auth\n     * string, for example: 🐶\n     * @returns {string}\n     */\n    get symbol() {\n        const ret = wasm.emoji_symbol(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The description of the emoji, for example ‘Dog’.\n     * @returns {string}\n     */\n    get description() {\n        const ret = wasm.emoji_description(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst EncryptedAttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_encryptedattachment_free(ptr >>> 0, 1));\n/**\n * An encrypted attachment, usually created from `Attachment.encrypt`.\n */\nexport class EncryptedAttachment {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(EncryptedAttachment.prototype);\n        obj.__wbg_ptr = ptr;\n        EncryptedAttachmentFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EncryptedAttachmentFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_encryptedattachment_free(ptr, 0);\n    }\n    /**\n     * Create a new encrypted attachment manually.\n     *\n     * It needs encrypted data, stored in an `Uint8Array`, and a\n     * [media encryption\n     * information](https://docs.rs/matrix-sdk-crypto/latest/matrix_sdk_crypto/struct.MediaEncryptionInfo.html),\n     * as a JSON-encoded object.\n     *\n     * The media encryption information aren't stored as a string:\n     * they are parsed, validated and fully deserialized.\n     *\n     * See [the specification to learn\n     * more](https://spec.matrix.org/unstable/client-server-api/#extensions-to-mroommessage-msgtypes).\n     * @param {Uint8Array} encrypted_data\n     * @param {string} media_encryption_info\n     */\n    constructor(encrypted_data, media_encryption_info) {\n        const ptr0 = passArray8ToWasm0(encrypted_data, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passStringToWasm0(media_encryption_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ret = wasm.encryptedattachment_new(ptr0, len0, ptr1, len1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        EncryptedAttachmentFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * The actual encrypted data.\n     *\n     * **Warning**: It returns a **copy** of the entire encrypted\n     * data; be nice with your memory.\n     * @returns {Uint8Array}\n     */\n    get encryptedData() {\n        const ret = wasm.encryptedattachment_encryptedData(this.__wbg_ptr);\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n    /**\n     * Return the media encryption info as a JSON-encoded object. The\n     * structure is fully valid.\n     *\n     * If the media encryption info have been consumed already, it\n     * will return `null`.\n     * @returns {string | undefined}\n     */\n    get mediaEncryptionInfo() {\n        const ret = wasm.encryptedattachment_mediaEncryptionInfo(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * Check whether the media encryption info has been consumed by\n     * `Attachment.decrypt` already.\n     * @returns {boolean}\n     */\n    get hasMediaEncryptionInfoBeenConsumed() {\n        const ret = wasm.encryptedattachment_hasMediaEncryptionInfoBeenConsumed(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst EncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_encryptioninfo_free(ptr >>> 0, 1));\n/**\n * Struct containing information on how a room event was decrypted.\n */\nexport class EncryptionInfo {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(EncryptionInfo.prototype);\n        obj.__wbg_ptr = ptr;\n        EncryptionInfoFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EncryptionInfoFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_encryptioninfo_free(ptr, 0);\n    }\n    /**\n     * The user ID of the sender of the event.\n     *\n     * Note this is untrusted data unless {@link shieldState} shows that the\n     * sender is verified.\n     * @returns {UserId}\n     */\n    get sender() {\n        const ret = wasm.__wbg_get_encryptioninfo_sender(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The user ID of the sender of the event.\n     *\n     * Note this is untrusted data unless {@link shieldState} shows that the\n     * sender is verified.\n     * @param {UserId} arg0\n     */\n    set sender(arg0) {\n        _assertClass(arg0, UserId);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_encryptioninfo_sender(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The device ID of the device that sent us the event.\n     *\n     * Note this is untrusted data unless {@link shieldState} shows that the\n     * sender is verified.\n     * @returns {DeviceId | undefined}\n     */\n    get senderDevice() {\n        const ret = wasm.__wbg_get_encryptioninfo_senderDevice(this.__wbg_ptr);\n        return ret === 0 ? undefined : DeviceId.__wrap(ret);\n    }\n    /**\n     * The device ID of the device that sent us the event.\n     *\n     * Note this is untrusted data unless {@link shieldState} shows that the\n     * sender is verified.\n     * @param {DeviceId | null} [arg0]\n     */\n    set senderDevice(arg0) {\n        let ptr0 = 0;\n        if (!isLikeNone(arg0)) {\n            _assertClass(arg0, DeviceId);\n            ptr0 = arg0.__destroy_into_raw();\n        }\n        wasm.__wbg_set_encryptioninfo_senderDevice(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The base64-encoded public Curve25519 key of the device that created the\n     * megolm decryption key originally.\n     * @returns {string}\n     */\n    get senderCurve25519Key() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_encryptioninfo_senderCurve25519Key(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The base64-encoded public Curve25519 key of the device that created the\n     * megolm decryption key originally.\n     * @param {string} arg0\n     */\n    set senderCurve25519Key(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The signing Ed25519 key that created the megolm key that\n     * was used to decrypt this session.\n     * @returns {string | undefined}\n     */\n    get senderClaimedEd25519Key() {\n        const ret = wasm.__wbg_get_encryptioninfo_senderClaimedEd25519Key(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The signing Ed25519 key that created the megolm key that\n     * was used to decrypt this session.\n     * @param {string | null} [arg0]\n     */\n    set senderClaimedEd25519Key(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_backupVersion(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The verification state of the device that sent us the event.\n     * Note this is the state of the device at the time of\n     * decryption. It may change in the future if a device gets\n     * verified or deleted.\n     *\n     * # Arguments\n     *\n     * * `strict` - whether to enable \"strict mode\" verification. In non-strict\n     *   mode, unverified users are given no shield, and keys that have been\n     *   forwarded or restored from an insecure backup are given a grey shield\n     *   (both get a red shield in strict mode).\n     * @param {boolean} strict\n     * @returns {ShieldState}\n     */\n    shieldState(strict) {\n        const ret = wasm.encryptioninfo_shieldState(this.__wbg_ptr, strict);\n        return ShieldState.__wrap(ret);\n    }\n}\n\nconst EncryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_encryptionsettings_free(ptr >>> 0, 1));\n/**\n * Settings for an encrypted room.\n *\n * This determines the algorithm and rotation periods of a group\n * session.\n */\nexport class EncryptionSettings {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EncryptionSettingsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_encryptionsettings_free(ptr, 0);\n    }\n    /**\n     * The encryption algorithm that should be used in the room.\n     * @returns {EncryptionAlgorithm}\n     */\n    get algorithm() {\n        const ret = wasm.__wbg_get_encryptionsettings_algorithm(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The encryption algorithm that should be used in the room.\n     * @param {EncryptionAlgorithm} arg0\n     */\n    set algorithm(arg0) {\n        wasm.__wbg_set_encryptionsettings_algorithm(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Whether state event encryption is enabled.\n     * @returns {boolean}\n     */\n    get encryptStateEvents() {\n        const ret = wasm.__wbg_get_encryptionsettings_encryptStateEvents(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Whether state event encryption is enabled.\n     * @param {boolean} arg0\n     */\n    set encryptStateEvents(arg0) {\n        wasm.__wbg_set_encryptionsettings_encryptStateEvents(this.__wbg_ptr, arg0);\n    }\n    /**\n     * How long the session should be used before changing it,\n     * expressed in microseconds.\n     * @returns {bigint}\n     */\n    get rotationPeriod() {\n        const ret = wasm.__wbg_get_encryptionsettings_rotationPeriod(this.__wbg_ptr);\n        return BigInt.asUintN(64, ret);\n    }\n    /**\n     * How long the session should be used before changing it,\n     * expressed in microseconds.\n     * @param {bigint} arg0\n     */\n    set rotationPeriod(arg0) {\n        wasm.__wbg_set_encryptionsettings_rotationPeriod(this.__wbg_ptr, arg0);\n    }\n    /**\n     * How many messages should be sent before changing the session.\n     * @returns {bigint}\n     */\n    get rotationPeriodMessages() {\n        const ret = wasm.__wbg_get_encryptionsettings_rotationPeriodMessages(this.__wbg_ptr);\n        return BigInt.asUintN(64, ret);\n    }\n    /**\n     * How many messages should be sent before changing the session.\n     * @param {bigint} arg0\n     */\n    set rotationPeriodMessages(arg0) {\n        wasm.__wbg_set_encryptionsettings_rotationPeriodMessages(this.__wbg_ptr, arg0);\n    }\n    /**\n     * The history visibility of the room when the session was\n     * created.\n     * @returns {HistoryVisibility}\n     */\n    get historyVisibility() {\n        const ret = wasm.__wbg_get_encryptionsettings_historyVisibility(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The history visibility of the room when the session was\n     * created.\n     * @param {HistoryVisibility} arg0\n     */\n    set historyVisibility(arg0) {\n        wasm.__wbg_set_encryptionsettings_historyVisibility(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Should untrusted devices receive the room key, or should they be\n     * excluded from the conversation.\n     * @returns {CollectStrategy}\n     */\n    get sharingStrategy() {\n        const ret = wasm.__wbg_get_encryptionsettings_sharingStrategy(this.__wbg_ptr);\n        return CollectStrategy.__wrap(ret);\n    }\n    /**\n     * Should untrusted devices receive the room key, or should they be\n     * excluded from the conversation.\n     * @param {CollectStrategy} arg0\n     */\n    set sharingStrategy(arg0) {\n        _assertClass(arg0, CollectStrategy);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_encryptionsettings_sharingStrategy(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * Create a new `EncryptionSettings` with default values.\n     */\n    constructor() {\n        const ret = wasm.encryptionsettings_new();\n        this.__wbg_ptr = ret >>> 0;\n        EncryptionSettingsFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst EstablishedEciesFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_establishedecies_free(ptr >>> 0, 1));\n/**\n * An established ECIES session.\n *\n * This session can be used to encrypt and decrypt messages between the two\n * sides of the channel.\n */\nexport class EstablishedEcies {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(EstablishedEcies.prototype);\n        obj.__wbg_ptr = ptr;\n        EstablishedEciesFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EstablishedEciesFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_establishedecies_free(ptr, 0);\n    }\n    /**\n     * Get our [`Curve25519PublicKey`].\n     *\n     * This public key needs to be sent to the other side so that it can\n     * complete the ECIES channel establishment.\n     * @returns {Curve25519PublicKey}\n     */\n    public_key() {\n        const ret = wasm.establishedecies_public_key(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Encrypt the given plaintext using this [`EstablishedEcies`] session.\n     * @param {string} message\n     * @returns {string}\n     */\n    encrypt(message) {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len0 = WASM_VECTOR_LEN;\n            const ret = wasm.establishedecies_encrypt(this.__wbg_ptr, ptr0, len0);\n            deferred2_0 = ret[0];\n            deferred2_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * Decrypt the given message using this [`EstablishedEcies`] session.\n     * @param {string} message\n     * @returns {string}\n     */\n    decrypt(message) {\n        let deferred3_0;\n        let deferred3_1;\n        try {\n            const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len0 = WASM_VECTOR_LEN;\n            const ret = wasm.establishedecies_decrypt(this.__wbg_ptr, ptr0, len0);\n            var ptr2 = ret[0];\n            var len2 = ret[1];\n            if (ret[3]) {\n                ptr2 = 0; len2 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred3_0 = ptr2;\n            deferred3_1 = len2;\n            return getStringFromWasm0(ptr2, len2);\n        } finally {\n            wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n        }\n    }\n    /**\n     * Get the [`CheckCode`] which uniquely identifies this\n     * [`EstablishedEcies`] session.\n     *\n     * This check code can be used to verify and confirm that both sides of the\n     * session are indeed using the same shared secret.\n     * @returns {CheckCode}\n     */\n    check_code() {\n        const ret = wasm.establishedecies_check_code(this.__wbg_ptr);\n        return CheckCode.__wrap(ret);\n    }\n}\n\nconst EventIdFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_eventid_free(ptr >>> 0, 1));\n/**\n * A Matrix [event ID].\n *\n * An `EventId` is generated randomly or converted from a string\n * slice, and can be converted back into a string as needed.\n *\n * [event ID]: https://spec.matrix.org/v1.2/appendices/#room-ids-and-event-ids\n */\nexport class EventId {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        EventIdFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_eventid_free(ptr, 0);\n    }\n    /**\n     * Parse/validate and create a new `EventId`.\n     * @param {string} id\n     */\n    constructor(id) {\n        const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.eventid_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        EventIdFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Returns the event's localpart.\n     * @returns {string}\n     */\n    get localpart() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.eventid_localpart(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Returns the server name of the event ID.\n     * @returns {ServerName | undefined}\n     */\n    get serverName() {\n        const ret = wasm.eventid_serverName(this.__wbg_ptr);\n        return ret === 0 ? undefined : ServerName.__wrap(ret);\n    }\n    /**\n     * Return the event ID as a string.\n     * @returns {string}\n     */\n    toString() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.eventid_toString(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst IdentityKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_identitykeys_free(ptr >>> 0, 1));\n/**\n * Struct holding the two public identity keys of an account.\n */\nexport class IdentityKeys {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(IdentityKeys.prototype);\n        obj.__wbg_ptr = ptr;\n        IdentityKeysFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        IdentityKeysFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_identitykeys_free(ptr, 0);\n    }\n    /**\n     * The Ed25519 public key, used for signing.\n     * @returns {Ed25519PublicKey}\n     */\n    get ed25519() {\n        const ret = wasm.__wbg_get_identitykeys_ed25519(this.__wbg_ptr);\n        return Ed25519PublicKey.__wrap(ret);\n    }\n    /**\n     * The Ed25519 public key, used for signing.\n     * @param {Ed25519PublicKey} arg0\n     */\n    set ed25519(arg0) {\n        _assertClass(arg0, Ed25519PublicKey);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_identitykeys_ed25519(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The Curve25519 public key, used for establish shared secrets.\n     * @returns {Curve25519PublicKey}\n     */\n    get curve25519() {\n        const ret = wasm.__wbg_get_identitykeys_curve25519(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * The Curve25519 public key, used for establish shared secrets.\n     * @param {Curve25519PublicKey} arg0\n     */\n    set curve25519(arg0) {\n        _assertClass(arg0, Curve25519PublicKey);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_identitykeys_curve25519(this.__wbg_ptr, ptr0);\n    }\n}\n\nconst InboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_inboundcreationresult_free(ptr >>> 0, 1));\n/**\n * The result of an inbound ECIES channel establishment.\n */\nexport class InboundCreationResult {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(InboundCreationResult.prototype);\n        obj.__wbg_ptr = ptr;\n        InboundCreationResultFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        InboundCreationResultFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_inboundcreationresult_free(ptr, 0);\n    }\n    /**\n     * The established ECIES channel.\n     * @returns {EstablishedEcies}\n     */\n    get channel() {\n        const ret = wasm.__wbg_get_inboundcreationresult_channel(this.__wbg_ptr);\n        return EstablishedEcies.__wrap(ret);\n    }\n    /**\n     * The established ECIES channel.\n     * @param {EstablishedEcies} arg0\n     */\n    set channel(arg0) {\n        _assertClass(arg0, EstablishedEcies);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_inboundcreationresult_channel(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The plaintext of the initial message.\n     * @returns {string}\n     */\n    get message() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_inboundcreationresult_message(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The plaintext of the initial message.\n     * @param {string} arg0\n     */\n    set message(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n}\n\nconst InboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_inboundgroupsession_free(ptr >>> 0, 1));\n/**\n * Inbound group session.\n *\n * Inbound group sessions are used to exchange room messages between a group of\n * participants. Inbound group sessions are used to decrypt the room messages.\n */\nexport class InboundGroupSession {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(InboundGroupSession.prototype);\n        obj.__wbg_ptr = ptr;\n        InboundGroupSessionFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        InboundGroupSessionFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_inboundgroupsession_free(ptr, 0);\n    }\n    /**\n     * The room where this session is used in.\n     * @returns {RoomId}\n     */\n    get roomId() {\n        const ret = wasm.inboundgroupsession_roomId(this.__wbg_ptr);\n        return RoomId.__wrap(ret);\n    }\n    /**\n     * The Curve25519 key of the sender of this session, as a\n     * [Curve25519PublicKey].\n     * @returns {Curve25519PublicKey}\n     */\n    get senderKey() {\n        const ret = wasm.inboundgroupsession_senderKey(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Returns the unique identifier for this session.\n     * @returns {string}\n     */\n    get sessionId() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.inboundgroupsession_sessionId(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Has the session been imported from a file or server-side backup? As\n     * opposed to being directly received as an `m.room_key` event.\n     * @returns {boolean}\n     */\n    hasBeenImported() {\n        const ret = wasm.inboundgroupsession_hasBeenImported(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst InvalidToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_invalidtodeviceevent_free(ptr >>> 0, 1));\n/**\n * Represents an invalid to-device event that was ignored (because it is\n * missing some mandatory fields, for example).\n */\nexport class InvalidToDeviceEvent {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(InvalidToDeviceEvent.prototype);\n        obj.__wbg_ptr = ptr;\n        InvalidToDeviceEventFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        InvalidToDeviceEventFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_invalidtodeviceevent_free(ptr, 0);\n    }\n    /**\n     * The original message as received from sync, encoded as JSON.\n     * @returns {string}\n     */\n    get rawEvent() {\n        const ret = wasm.__wbg_get_invalidtodeviceevent_rawEvent(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The type of processed to-device event. Always {@link\n     * ProcessedToDeviceEventType.Invalid} for this type.\n     * @returns {ProcessedToDeviceEventType}\n     */\n    get type() {\n        const ret = wasm.invalidtodeviceevent_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst KeysBackupRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_keysbackuprequest_free(ptr >>> 0, 1));\n/**\n * A request that will back up a batch of room keys to the server\n * ([specification]).\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#put_matrixclientv3room_keyskeys\n */\nexport class KeysBackupRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(KeysBackupRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        KeysBackupRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        KeysBackupRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_keysbackuprequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * @returns {string}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_keysbackuprequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `rooms`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_keysbackuprequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The backup version that these room keys should be part of.\n     * @returns {string}\n     */\n    get version() {\n        const ret = wasm.__wbg_get_keysbackuprequest_version(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `KeysBackupRequest`.\n     * @param {string} id\n     * @param {string} body\n     * @param {string} version\n     */\n    constructor(id, body, version) {\n        const ret = wasm.keysbackuprequest_new(id, body, version);\n        this.__wbg_ptr = ret >>> 0;\n        KeysBackupRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.keysbackuprequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst KeysClaimRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_keysclaimrequest_free(ptr >>> 0, 1));\n/**\n * Data for a request to the `/keys/claim` API endpoint\n * ([specification]).\n *\n * Claims one-time keys that can be used to establish 1-to-1 E2EE\n * sessions.\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv3keysclaim\n */\nexport class KeysClaimRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(KeysClaimRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        KeysClaimRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        KeysClaimRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_keysclaimrequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * @returns {string}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_keysclaimrequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `timeout`,\n     * `one_time_keys`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_keysclaimrequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `KeysClaimRequest`.\n     * @param {string} id\n     * @param {string} body\n     */\n    constructor(id, body) {\n        const ret = wasm.keysclaimrequest_new(id, body);\n        this.__wbg_ptr = ret >>> 0;\n        KeysClaimRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.keysclaimrequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst KeysQueryRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_keysqueryrequest_free(ptr >>> 0, 1));\n/**\n * Data for a request to the `/keys/query` API endpoint\n * ([specification]).\n *\n * Returns the current devices and identity keys for the given users.\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv3keysquery\n */\nexport class KeysQueryRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(KeysQueryRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        KeysQueryRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        KeysQueryRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_keysqueryrequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * @returns {string}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_keysqueryrequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `timeout`,\n     * `device_keys`, `token`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_keysqueryrequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `KeysQueryRequest`.\n     * @param {string} id\n     * @param {string} body\n     */\n    constructor(id, body) {\n        const ret = wasm.keysqueryrequest_new(id, body);\n        this.__wbg_ptr = ret >>> 0;\n        KeysQueryRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.keysqueryrequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst KeysUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_keysuploadrequest_free(ptr >>> 0, 1));\n/**\n * Outgoing Requests *\n * Data for a request to the `/keys/upload` API endpoint\n * ([specification]).\n *\n * Publishes end-to-end encryption keys for the device.\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv3keysupload\n */\nexport class KeysUploadRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(KeysUploadRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        KeysUploadRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        KeysUploadRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_keysuploadrequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * @returns {string}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_keysuploadrequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `device_keys`,\n     * `one_time_keys`, `fallback_keys`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_keysuploadrequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `KeysUploadRequest`.\n     * @param {string} id\n     * @param {string} body\n     */\n    constructor(id, body) {\n        const ret = wasm.keysuploadrequest_new(id, body);\n        this.__wbg_ptr = ret >>> 0;\n        KeysUploadRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.keysuploadrequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst MaybeSignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_maybesignature_free(ptr >>> 0, 1));\n/**\n * Represents a signature that is either valid _or_ that could not be\n * decoded.\n */\nexport class MaybeSignature {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(MaybeSignature.prototype);\n        obj.__wbg_ptr = ptr;\n        MaybeSignatureFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        MaybeSignatureFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_maybesignature_free(ptr, 0);\n    }\n    /**\n     * Check whether the signature has been successfully decoded.\n     * @returns {boolean}\n     */\n    isValid() {\n        const ret = wasm.maybesignature_isValid(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Check whether the signature could not be successfully decoded.\n     * @returns {boolean}\n     */\n    isInvalid() {\n        const ret = wasm.maybesignature_isInvalid(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * The signature, if successfully decoded.\n     * @returns {Signature | undefined}\n     */\n    get signature() {\n        const ret = wasm.maybesignature_signature(this.__wbg_ptr);\n        return ret === 0 ? undefined : Signature.__wrap(ret);\n    }\n    /**\n     * The base64 encoded string that is claimed to contain a\n     * signature but could not be decoded, if any.\n     * @returns {string | undefined}\n     */\n    get invalidSignatureSource() {\n        const ret = wasm.maybesignature_invalidSignatureSource(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n}\n\nconst MegolmDecryptionErrorFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_megolmdecryptionerror_free(ptr >>> 0, 1));\n/**\n * Js Decryption error with code.\n */\nexport class MegolmDecryptionError {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(MegolmDecryptionError.prototype);\n        obj.__wbg_ptr = ptr;\n        MegolmDecryptionErrorFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        MegolmDecryptionErrorFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_megolmdecryptionerror_free(ptr, 0);\n    }\n    /**\n     * Description code for the error. See `DecryptionErrorCode`\n     * @returns {DecryptionErrorCode}\n     */\n    get code() {\n        const ret = wasm.__wbg_get_megolmdecryptionerror_code(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * detailed description\n     * @returns {string}\n     */\n    get description() {\n        const ret = wasm.__wbg_get_megolmdecryptionerror_description(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Withheld code if any. Only for `UnknownMessageIndex` error code\n     * @returns {string | undefined}\n     */\n    get maybe_withheld() {\n        const ret = wasm.__wbg_get_megolmdecryptionerror_maybe_withheld(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst MegolmV1BackupKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_megolmv1backupkey_free(ptr >>> 0, 1));\n/**\n * The public part of the backup key.\n */\nexport class MegolmV1BackupKey {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(MegolmV1BackupKey.prototype);\n        obj.__wbg_ptr = ptr;\n        MegolmV1BackupKeyFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        MegolmV1BackupKeyFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_megolmv1backupkey_free(ptr, 0);\n    }\n    /**\n     * The actual base64 encoded public key.\n     * @returns {string}\n     */\n    get publicKeyBase64() {\n        const ret = wasm.megolmv1backupkey_publicKeyBase64(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the full name of the backup algorithm this backup key supports.\n     * @returns {string}\n     */\n    get algorithm() {\n        const ret = wasm.megolmv1backupkey_algorithm(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst MigrationFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_migration_free(ptr >>> 0, 1));\n/**\n * Migration routines\n *\n * The public methods are exposed as static methods on this class, for\n * namespacing and to enable easier mocking in unit tests.\n */\nexport class Migration {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        MigrationFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_migration_free(ptr, 0);\n    }\n    /**\n     * Import the base dataset from a libolm-based setup to a vodozemac-based\n     * setup stored in IndexedDB.\n     *\n     * Populates the user credentials, Olm account, backup data, etc. This is\n     * the first step in the migration process. Once this base data is\n     * imported, further data can be imported with {@link\n     * migrateOlmSessions}, {@link migrateMegolmSessions}, and TODO room\n     * settings.\n     *\n     * # Arguments\n     *\n     * * `data` - The data to be migrated\n     * * `pickle_key` - The libolm pickle key that was used to pickle the olm\n     *   account objects.\n     * * `store_handle` - A connection to the CryptoStore which will be used to\n     *   store the vodozemac data.\n     * * `logger` - An optional logger instance to use for writing log messages\n     *   during the migration operation. An instance of `JsLogger`.\n     * @param {BaseMigrationData} data\n     * @param {Uint8Array} pickle_key\n     * @param {StoreHandle} store_handle\n     * @param {any | null} [logger]\n     * @returns {Promise<void>}\n     */\n    static migrateBaseData(data, pickle_key, store_handle, logger) {\n        _assertClass(data, BaseMigrationData);\n        _assertClass(store_handle, StoreHandle);\n        const ret = wasm.migration_migrateBaseData(data.__wbg_ptr, pickle_key, store_handle.__wbg_ptr, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        return ret;\n    }\n    /**\n     * Migrate Olm sessions of a libolm-based setup to a vodozemac-based setup\n     * stored in an indexedDB crypto store.\n     *\n     * Before this method can be used, {@link migrateBaseData} must be used to\n     * import the base data into the crypto store.\n     *\n     * This method should be called a number of times, with separate batches of\n     * `sessions`. If a progress display is given, it can be updated after\n     * each batch is successfully imported.\n     *\n     * # Arguments\n     *\n     * * `sessions` - An `Array` of {@link PickledSession}s to import. Items\n     *   inside `sessions` will be invalidated by this method.\n     * * `pickle_key` - The libolm pickle key that was used to pickle the olm\n     *   session objects.\n     * * `store_handle` - A connection to the CryptoStore which will be used to\n     *   store the vodozemac data.\n     * * `logger` - An optional logger instance to use for writing log messages\n     *   during the migration operation. An instance of `JsLogger`.\n     * @param {PickledSession[]} sessions\n     * @param {Uint8Array} pickle_key\n     * @param {StoreHandle} store_handle\n     * @param {any | null} [logger]\n     * @returns {Promise<void>}\n     */\n    static migrateOlmSessions(sessions, pickle_key, store_handle, logger) {\n        const ptr0 = passArrayJsValueToWasm0(sessions, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(store_handle, StoreHandle);\n        const ret = wasm.migration_migrateOlmSessions(ptr0, len0, pickle_key, store_handle.__wbg_ptr, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Migrate Megolm sessions of a libolm-based setup to a vodozemac-based\n     * setup stored in an indexedDB crypto store.\n     *\n     * Before this method can be used, {@link migrateBaseData} must be used to\n     * import the base data into the crypto store.\n     *\n     * This method should be called a number of times, with separate batches of\n     * `sessions`. If a progress display is given, it can be updated after\n     * each batch is successfully imported.\n     *\n     * # Arguments\n     *\n     * * `sessions` - An `Array` of {@link PickledInboundGroupSession}s to\n     *   import. Items inside `sessions` will be invalidated by this method.\n     * * `pickle_key` - The libolm pickle key that was used to pickle the\n     *   megolm session objects.\n     * * `store_handle` - A connection to the CryptoStore which will be used to\n     *   store the vodozemac data.\n     * * `logger` - An optional logger instance to use for writing log messages\n     *   during the migration operation. An instance of `JsLogger`.\n     * @param {PickledInboundGroupSession[]} sessions\n     * @param {Uint8Array} pickle_key\n     * @param {StoreHandle} store_handle\n     * @param {any | null} [logger]\n     * @returns {Promise<void>}\n     */\n    static migrateMegolmSessions(sessions, pickle_key, store_handle, logger) {\n        const ptr0 = passArrayJsValueToWasm0(sessions, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(store_handle, StoreHandle);\n        const ret = wasm.migration_migrateMegolmSessions(ptr0, len0, pickle_key, store_handle.__wbg_ptr, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n}\n\nconst OlmMachineFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_olmmachine_free(ptr >>> 0, 1));\n/**\n * State machine implementation of the Olm/Megolm encryption protocol\n * used for Matrix end to end encryption.\n */\nexport class OlmMachine {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(OlmMachine.prototype);\n        obj.__wbg_ptr = ptr;\n        OlmMachineFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        OlmMachineFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_olmmachine_free(ptr, 0);\n    }\n    /**\n     * Constructor will always fail. To create a new `OlmMachine`, please use\n     * the `initialize` method.\n     *\n     * Why this pattern? `initialize` returns a `Promise`. Returning a\n     * `Promise` from a constructor is not idiomatic in JavaScript.\n     */\n    constructor() {\n        const ret = wasm.olmmachine_new();\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        OlmMachineFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Create a new `OlmMachine`.\n     *\n     * The created machine will keep the encryption keys either in a IndexedDB\n     * based store, or in a memory store and once the objects is dropped,\n     * the keys will be lost.\n     *\n     * # Arguments\n     *\n     * * `user_id` - represents the unique ID of the user that owns this\n     * machine.\n     *\n     * * `device_id` - represents the unique ID of the device\n     * that owns this machine.\n     *\n     * * `store_name` - The name that should be used to open the IndexedDB\n     *   based database. If this isn't provided, a memory-only store will be\n     *   used. *Note* the memory-only store will lose your E2EE keys when the\n     *   `OlmMachine` gets dropped.\n     *\n     * * `store_passphrase` - The passphrase that should be used to encrypt the\n     *   IndexedDB-based store.\n     *\n     * * `logger` - Optional logger to use for all operations on this machine.\n     *   An instance of `JsLogger`.\n     * @param {UserId} user_id\n     * @param {DeviceId} device_id\n     * @param {string | null} [store_name]\n     * @param {string | null} [store_passphrase]\n     * @param {any | null} [logger]\n     * @returns {Promise<OlmMachine>}\n     */\n    static initialize(user_id, device_id, store_name, store_passphrase, logger) {\n        _assertClass(user_id, UserId);\n        _assertClass(device_id, DeviceId);\n        var ptr0 = isLikeNone(store_name) ? 0 : passStringToWasm0(store_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        var ptr1 = isLikeNone(store_passphrase) ? 0 : passStringToWasm0(store_passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len1 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_initialize(user_id.__wbg_ptr, device_id.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        return ret;\n    }\n    /**\n     * Create a new `OlmMachine` backed by an existing store.\n     *\n     * # Arguments\n     *\n     * * `user_id` - represents the unique ID of the user that owns this\n     * machine.\n     *\n     * * `device_id` - represents the unique ID of the device\n     * that owns this machine.\n     *\n     * * `store_handle` - the connection to the crypto store to be used for\n     *   this machine.\n     *\n     * * `logger` - Optional logger to use for all operations on this machine.\n     *   An instance of `JsLogger`.\n     * @param {UserId} user_id\n     * @param {DeviceId} device_id\n     * @param {StoreHandle} store_handle\n     * @param {any | null} [logger]\n     * @returns {Promise<OlmMachine>}\n     */\n    static initFromStore(user_id, device_id, store_handle, logger) {\n        _assertClass(user_id, UserId);\n        _assertClass(device_id, DeviceId);\n        _assertClass(store_handle, StoreHandle);\n        const ret = wasm.olmmachine_initFromStore(user_id.__wbg_ptr, device_id.__wbg_ptr, store_handle.__wbg_ptr, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        return ret;\n    }\n    /**\n     * The unique user ID that owns this `OlmMachine` instance.\n     * @returns {UserId}\n     */\n    get userId() {\n        const ret = wasm.olmmachine_userId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The unique device ID that identifies this `OlmMachine`.\n     * @returns {DeviceId}\n     */\n    get deviceId() {\n        const ret = wasm.olmmachine_deviceId(this.__wbg_ptr);\n        return DeviceId.__wrap(ret);\n    }\n    /**\n     * The time, in milliseconds since the unix epoch, at which the `Account`\n     * backing this `OlmMachine` was created.\n     *\n     * An `Account` is created when an `OlmMachine` is first instantiated\n     * against a given `Store`, at which point it creates identity keys etc.\n     * This method returns the timestamp, according to the local clock, at\n     * which that happened.\n     * @returns {number}\n     */\n    get deviceCreationTimeMs() {\n        const ret = wasm.olmmachine_deviceCreationTimeMs(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the public parts of our Olm identity keys.\n     * @returns {IdentityKeys}\n     */\n    get identityKeys() {\n        const ret = wasm.olmmachine_identityKeys(this.__wbg_ptr);\n        return IdentityKeys.__wrap(ret);\n    }\n    /**\n     * Get the display name of our own device.\n     * @returns {Promise<any>}\n     */\n    get displayName() {\n        const ret = wasm.olmmachine_displayName(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Whether automatic transmission of room key requests is enabled.\n     *\n     * Room key requests allow the device to request room keys that it might\n     * have missed in the original share using `m.room_key_request`\n     * events.\n     * @returns {boolean}\n     */\n    get roomKeyRequestsEnabled() {\n        const ret = wasm.olmmachine_roomKeyRequestsEnabled(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Enable or disable automatic transmission of room key requests.\n     * @param {boolean} enabled\n     */\n    set roomKeyRequestsEnabled(enabled) {\n        wasm.olmmachine_set_roomKeyRequestsEnabled(this.__wbg_ptr, enabled);\n    }\n    /**\n     * Whether room key forwarding is enabled.\n     *\n     * If room key forwarding is enabled, we will automatically reply to\n     * incoming `m.room_key_request` messages from verified devices by\n     * forwarding the requested key (if we have it).\n     * @returns {boolean}\n     */\n    get roomKeyForwardingEnabled() {\n        const ret = wasm.olmmachine_roomKeyForwardingEnabled(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Enable or disable room key forwarding.\n     * @param {boolean} enabled\n     */\n    set roomKeyForwardingEnabled(enabled) {\n        wasm.olmmachine_set_roomKeyForwardingEnabled(this.__wbg_ptr, enabled);\n    }\n    /**\n     * Get the list of users whose devices we are currently tracking.\n     *\n     * A user can be marked for tracking using the\n     * [`update_tracked_users`](#method.update_tracked_users) method.\n     *\n     * Returns a `Set<UserId>`.\n     * @returns {Promise<any>}\n     */\n    trackedUsers() {\n        const ret = wasm.olmmachine_trackedUsers(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Update the list of tracked users.\n     *\n     * The OlmMachine maintains a list of users whose devices we are keeping\n     * track of: these are known as \"tracked users\". These must be users\n     * that we share a room with, so that the server sends us updates for\n     * their device lists.\n     *\n     * # Arguments\n     *\n     * * `users` - An array of user ids that should be added to the list of\n     *   tracked users\n     *\n     * Any users that hadn't been seen before will be flagged for a key query\n     * immediately, and whenever `receive_sync_changes` receives a\n     * \"changed\" notification for that user in the future.\n     *\n     * Users that were already in the list are unaffected.\n     *\n     * Items inside `users` will be invalidated by this method. Be careful not\n     * to use the `UserId`s after this method has been called.\n     * @param {UserId[]} users\n     * @returns {Promise<any>}\n     */\n    updateTrackedUsers(users) {\n        const ptr0 = passArrayJsValueToWasm0(users, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_updateTrackedUsers(this.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Mark all tracked users as dirty.\n     *\n     * All users *whose device lists we are tracking* are flagged as needing a\n     * key query. Users whose devices we are not tracking are ignored.\n     * @returns {Promise<void>}\n     */\n    markAllTrackedUsersAsDirty() {\n        const ret = wasm.olmmachine_markAllTrackedUsersAsDirty(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Handle to-device events and one-time key counts from a sync\n     * response.\n     *\n     * This will decrypt and handle to-device events returning the\n     * decrypted versions of them.\n     *\n     * To decrypt an event from the room timeline call\n     * `decrypt_room_event`.\n     *\n     * # Arguments\n     *\n     * * `to_device_events`: the JSON-encoded to-device evens from the `/sync`\n     *   response\n     * * `changed_devices`: the mapping of changed and left devices, from the\n     *   `/sync` response\n     * * `one_time_keys_counts`: The number of one-time keys on the server,\n     *   from the `/sync` response. A `Map` from string (encryption algorithm)\n     *   to number (number of keys).\n     * * `unused_fallback_keys`: Optionally, a `Set` of unused fallback keys on\n     *   the server, from the `/sync` response. If this is set, it is used to\n     *   determine if new fallback keys should be uploaded.\n     * * `decryption_settings`: Optionally, the settings to use when decrypting\n     *   to-device events. If not set, to-device events will be decrypted with\n     *   a {@link TrustRequirement} of `Untrusted`.\n     *\n     * # Returns\n     *\n     * A list of values, each of which can be any of:\n     *   * {@link DecryptedToDeviceEvent}\n     *   * {@link PlainTextToDeviceEvent}\n     *   * {@link UTDToDeviceEvent}\n     *   * {@link InvalidToDeviceEvent}\n     * @param {string} to_device_events\n     * @param {DeviceLists} changed_devices\n     * @param {Map<any, any>} one_time_keys_counts\n     * @param {Set<any> | null} [unused_fallback_keys]\n     * @param {DecryptionSettings | null} [decryption_settings]\n     * @returns {Promise<any>}\n     */\n    receiveSyncChanges(to_device_events, changed_devices, one_time_keys_counts, unused_fallback_keys, decryption_settings) {\n        const ptr0 = passStringToWasm0(to_device_events, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(changed_devices, DeviceLists);\n        let ptr1 = 0;\n        if (!isLikeNone(decryption_settings)) {\n            _assertClass(decryption_settings, DecryptionSettings);\n            ptr1 = decryption_settings.__destroy_into_raw();\n        }\n        const ret = wasm.olmmachine_receiveSyncChanges(this.__wbg_ptr, ptr0, len0, changed_devices.__wbg_ptr, one_time_keys_counts, isLikeNone(unused_fallback_keys) ? 0 : addToExternrefTable0(unused_fallback_keys), ptr1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Get the outgoing requests that need to be sent out.\n     *\n     * This returns a list of values, each of which can be any of:\n     *   * {@link KeysUploadRequest},\n     *   * {@link KeysQueryRequest},\n     *   * {@link KeysClaimRequest},\n     *   * {@link ToDeviceRequest},\n     *   * {@link SignatureUploadRequest},\n     *   * {@link RoomMessageRequest}, or\n     *   * {@link KeysBackupRequest}.\n     *\n     * Those requests need to be sent out to the server and the\n     * responses need to be passed back to the state machine\n     * using {@link OlmMachine.markRequestAsSent}.\n     * @returns {Promise<any>}\n     */\n    outgoingRequests() {\n        const ret = wasm.olmmachine_outgoingRequests(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Mark the request with the given request ID as sent (see\n     * `outgoing_requests`).\n     *\n     * Arguments are:\n     *\n     * * `request_id` represents the unique ID of the request that was sent\n     *   out. This is needed to couple the response with the now sent out\n     *   request.\n     * * `response_type` represents the type of the request that was sent out.\n     * * `response` represents the response that was received from the server\n     *   after the outgoing request was sent out.\n     * @param {string} request_id\n     * @param {RequestType} request_type\n     * @param {string} response\n     * @returns {Promise<any>}\n     */\n    markRequestAsSent(request_id, request_type, response) {\n        const ptr0 = passStringToWasm0(request_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passStringToWasm0(response, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_markRequestAsSent(this.__wbg_ptr, ptr0, len0, request_type, ptr1, len1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Encrypt a room message for the given room.\n     *\n     * **Note**: A room key needs to be shared with the group of users that are\n     * members in the given room. If this is not done this method will panic.\n     *\n     * The usual flow to encrypt an event using this state machine is as\n     * follows:\n     *\n     * 1. Get the one-time key claim request to establish 1:1 Olm sessions for\n     *    the room members of the room we wish to participate in. This is done\n     *    using the [`get_missing_sessions()`](Self::get_missing_sessions)\n     *    method. This method call should be locked per call.\n     *\n     * 2. Share a room key with all the room members using the\n     *    [`share_room_key()`](Self::share_room_key). This method call should\n     *    be locked per room.\n     *\n     * 3. Encrypt the event using this method.\n     *\n     * 4. Send the encrypted event to the server.\n     *\n     * After the room key is shared steps 1 and 2 will become noops, unless\n     * there's some changes in the room membership or in the list of devices a\n     * member has.\n     *\n     *\n     * `room_id` is the ID of the room for which the message should\n     * be encrypted. `event_type` is the type of the event. `content`\n     * is the plaintext content of the message that should be\n     * encrypted.\n     *\n     * # Panics\n     *\n     * Panics if a group session for the given room wasn't shared\n     * beforehand.\n     * @param {RoomId} room_id\n     * @param {string} event_type\n     * @param {string} content\n     * @returns {Promise<any>}\n     */\n    encryptRoomEvent(room_id, event_type, content) {\n        _assertClass(room_id, RoomId);\n        const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_encryptRoomEvent(this.__wbg_ptr, room_id.__wbg_ptr, ptr0, len0, ptr1, len1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Encrypt a state event for the given room.\n     *\n     * This method encrypts a state event for the specified room, using the\n     * current group session. The event will be encrypted so that only\n     * authorized room members can decrypt it.\n     *\n     * **Note**: A room key must have been shared with the group of users in\n     * the room before calling this method. If not, this method will panic.\n     *\n     * The usual flow to encrypt a state event using this machine is identical\n     * to that outlined for [`OlmMachine::encrypt_room_event`].\n     *\n     * # Arguments\n     *\n     * * `room_id` - The ID of the room for which the state event should be\n     *   encrypted.\n     * * `event_type` - The type of the state event.\n     * * `state_key` - The state key for the event.\n     * * `content` - The plaintext JSON content of the event to encrypt.\n     *\n     * # Returns\n     *\n     * A `Promise` resolving to a JSON string containing the encrypted event.\n     *\n     * # Panics\n     *\n     * Panics if a group session for the given room was not previously shared.\n     * @param {RoomId} room_id\n     * @param {string} event_type\n     * @param {string} state_key\n     * @param {string} content\n     * @returns {Promise<any>}\n     */\n    encryptStateEvent(room_id, event_type, state_key, content) {\n        _assertClass(room_id, RoomId);\n        const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passStringToWasm0(state_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ptr2 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len2 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_encryptStateEvent(this.__wbg_ptr, room_id.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Decrypt an event from a room timeline.\n     *\n     * # Arguments\n     *\n     * * `event`, the event that should be decrypted.\n     * * `room_id`, the ID of the room where the event was sent to.\n     *\n     * # Returns\n     *\n     * A `Promise` which resolves to a {@link DecryptedRoomEvent} instance, or\n     * rejects with a {@link MegolmDecryptionError} instance.\n     * @param {string} event\n     * @param {RoomId} room_id\n     * @param {DecryptionSettings} decryption_settings\n     * @returns {Promise<any>}\n     */\n    decryptRoomEvent(event, room_id, decryption_settings) {\n        const ptr0 = passStringToWasm0(event, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(room_id, RoomId);\n        _assertClass(decryption_settings, DecryptionSettings);\n        const ret = wasm.olmmachine_decryptRoomEvent(this.__wbg_ptr, ptr0, len0, room_id.__wbg_ptr, decryption_settings.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Get encryption info for a decrypted timeline event.\n     *\n     * This recalculates the `EncryptionInfo` data that is returned by\n     * `decryptRoomEvent`, based on the current\n     * verification status of the sender, etc.\n     *\n     * Returns an error for an unencrypted event.\n     *\n     * # Arguments\n     *\n     * * `event` - The event to get information for.\n     * * `room_id` - The ID of the room where the event was sent to.\n     *\n     * # Returns\n     *\n     * {@link EncryptionInfo}\n     * @param {string} event\n     * @param {RoomId} room_id\n     * @returns {Promise<any>}\n     */\n    getRoomEventEncryptionInfo(event, room_id) {\n        const ptr0 = passStringToWasm0(event, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(room_id, RoomId);\n        const ret = wasm.olmmachine_getRoomEventEncryptionInfo(this.__wbg_ptr, ptr0, len0, room_id.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Get the status of the private cross signing keys.\n     *\n     * This can be used to check which private cross signing keys we\n     * have stored locally.\n     * @returns {Promise<any>}\n     */\n    crossSigningStatus() {\n        const ret = wasm.olmmachine_crossSigningStatus(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Export all the secrets we have in the store into a {@link\n     * SecretsBundle}.\n     *\n     * This method will export all the private cross-signing keys and, if\n     * available, the private part of a backup key and its accompanying\n     * version.\n     *\n     * The method will fail if we don't have all three private cross-signing\n     * keys available.\n     *\n     * **Warning**: Only export this and share it with a trusted recipient,\n     * i.e. if an existing device is sharing this with a new device.\n     * @returns {Promise<SecretsBundle>}\n     */\n    exportSecretsBundle() {\n        const ret = wasm.olmmachine_exportSecretsBundle(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Import and persists secrets from a {@link SecretsBundle}.\n     *\n     * This method will import all the private cross-signing keys and, if\n     * available, the private part of a backup key and its accompanying\n     * version into the store.\n     *\n     * **Warning**: Only import this from a trusted source, i.e. if an existing\n     * device is sharing this with a new device. The imported cross-signing\n     * keys will create a {@link OwnUserIdentity} and mark it as verified.\n     *\n     * The backup key will be persisted in the store and can be enabled using\n     * the BackupMachine.\n     *\n     * The provided `SecretsBundle` is freed by this method; be careful not to\n     * use it once this method has been called.\n     * @param {SecretsBundle} bundle\n     * @returns {Promise<void>}\n     */\n    importSecretsBundle(bundle) {\n        _assertClass(bundle, SecretsBundle);\n        var ptr0 = bundle.__destroy_into_raw();\n        const ret = wasm.olmmachine_importSecretsBundle(this.__wbg_ptr, ptr0);\n        return ret;\n    }\n    /**\n     * Export all the private cross signing keys we have.\n     *\n     * The export will contain the seeds for the ed25519 keys as\n     * unpadded base64 encoded strings.\n     *\n     * Returns `null` if we don’t have any private cross signing keys;\n     * otherwise returns a `CrossSigningKeyExport`.\n     * @returns {Promise<any>}\n     */\n    exportCrossSigningKeys() {\n        const ret = wasm.olmmachine_exportCrossSigningKeys(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Import our private cross signing keys.\n     *\n     * The keys should be provided as unpadded-base64-encoded strings.\n     *\n     * Returns a `CrossSigningStatus`.\n     * @param {string | null} [master_key]\n     * @param {string | null} [self_signing_key]\n     * @param {string | null} [user_signing_key]\n     * @returns {Promise<any>}\n     */\n    importCrossSigningKeys(master_key, self_signing_key, user_signing_key) {\n        var ptr0 = isLikeNone(master_key) ? 0 : passStringToWasm0(master_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        var ptr1 = isLikeNone(self_signing_key) ? 0 : passStringToWasm0(self_signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len1 = WASM_VECTOR_LEN;\n        var ptr2 = isLikeNone(user_signing_key) ? 0 : passStringToWasm0(user_signing_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len2 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_importCrossSigningKeys(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);\n        return ret;\n    }\n    /**\n     * Create a new cross signing identity and get the upload request\n     * to push the new public keys to the server.\n     *\n     * Warning: This will delete any existing cross signing keys that\n     * might exist on the server and thus will reset the trust\n     * between all the devices.\n     *\n     * Uploading these keys will require user interactive auth.\n     *\n     * # Arguments\n     *\n     * * `reset`, whether the method should create a new identity or use the\n     *   existing one during the request. If set to true, the request will\n     *   attempt to upload a new identity. If set to false, the request will\n     *   attempt to upload the existing identity. Since the uploading process\n     *   requires user interactive authentication, which involves sending out\n     *   the same request multiple times, setting this argument to false\n     *   enables you to reuse the same request.\n     *\n     * Returns a {@link CrossSigningBootstrapRequests}.\n     * @param {boolean} reset\n     * @returns {Promise<any>}\n     */\n    bootstrapCrossSigning(reset) {\n        const ret = wasm.olmmachine_bootstrapCrossSigning(this.__wbg_ptr, reset);\n        return ret;\n    }\n    /**\n     * Get the cross signing user identity of a user.\n     *\n     * Returns a promise for an {@link OwnUserIdentity}, a\n     * {@link OtherUserIdentity}, or `undefined`.\n     * @param {UserId} user_id\n     * @returns {Promise<any>}\n     */\n    getIdentity(user_id) {\n        _assertClass(user_id, UserId);\n        const ret = wasm.olmmachine_getIdentity(this.__wbg_ptr, user_id.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Sign the given message using our device key and if available\n     * cross-signing master key.\n     * @param {string} message\n     * @returns {Promise<any>}\n     */\n    sign(message) {\n        const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_sign(this.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Invalidate the currently active outbound group session for the\n     * given room.\n     *\n     * Returns true if a session was invalidated, false if there was\n     * no session to invalidate.\n     * @param {RoomId} room_id\n     * @returns {Promise<any>}\n     */\n    invalidateGroupSession(room_id) {\n        _assertClass(room_id, RoomId);\n        const ret = wasm.olmmachine_invalidateGroupSession(this.__wbg_ptr, room_id.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get to-device requests to share a room key with users in a room.\n     *\n     * `room_id` is the room ID. `users` is an array of `UserId`\n     * objects. `encryption_settings` are an `EncryptionSettings`\n     * object.\n     *\n     * Note: Care should be taken that only one such request at a\n     * time is in flight for the same room, e.g. using a lock.\n     *\n     * Returns an array of `ToDeviceRequest`s.\n     *\n     * Items inside `users` will be invalidated by this method. Be careful not\n     * to use the `UserId`s after this method has been called.\n     * @param {RoomId} room_id\n     * @param {UserId[]} users\n     * @param {EncryptionSettings} encryption_settings\n     * @returns {Promise<any>}\n     */\n    shareRoomKey(room_id, users, encryption_settings) {\n        _assertClass(room_id, RoomId);\n        const ptr0 = passArrayJsValueToWasm0(users, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(encryption_settings, EncryptionSettings);\n        const ret = wasm.olmmachine_shareRoomKey(this.__wbg_ptr, room_id.__wbg_ptr, ptr0, len0, encryption_settings.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Generate an \"out-of-band\" key query request for the given set of users.\n     *\n     * This can be useful if we need the results from `getIdentity` or\n     * `getUserDevices` to be as up-to-date as possible.\n     *\n     * Returns a `KeysQueryRequest` object. The response of the request should\n     * be passed to the `OlmMachine` with the `mark_request_as_sent`.\n     *\n     * Items inside `users` will be invalidated by this method. Be careful not\n     * to use the `UserId`s after this method has been called.\n     * @param {UserId[]} users\n     * @returns {KeysQueryRequest}\n     */\n    queryKeysForUsers(users) {\n        const ptr0 = passArrayJsValueToWasm0(users, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_queryKeysForUsers(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return KeysQueryRequest.__wrap(ret[0]);\n    }\n    /**\n     * Get the a key claiming request for the user/device pairs that\n     * we are missing Olm sessions for.\n     *\n     * Returns `null` if no key claiming request needs to be sent\n     * out, otherwise it returns a `KeysClaimRequest` object.\n     *\n     * Sessions need to be established between devices so group\n     * sessions for a room can be shared with them.\n     *\n     * This should be called every time a group session needs to be\n     * shared as well as between sync calls. After a sync some\n     * devices may request room keys without us having a valid Olm\n     * session with them, making it impossible to server the room key\n     * request, thus it’s necessary to check for missing sessions\n     * between sync as well.\n     *\n     * Note: Care should be taken that only one such request at a\n     * time is in flight, e.g. using a lock.\n     *\n     * The response of a successful key claiming requests needs to be\n     * passed to the `OlmMachine` with the `mark_request_as_sent`.\n     *\n     * `users` represents the list of users that we should check if\n     * we lack a session with one of their devices. This can be an\n     * empty iterator when calling this method between sync requests.\n     *\n     * Items inside `users` will be invalidated by this method. Be careful not\n     * to use the `UserId`s after this method has been called.\n     * @param {UserId[]} users\n     * @returns {Promise<any>}\n     */\n    getMissingSessions(users) {\n        const ptr0 = passArrayJsValueToWasm0(users, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_getMissingSessions(this.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Get a map holding all the devices of a user.\n     *\n     * ### Parameters\n     *\n     * * `user_id` - The unique ID of the user that the device belongs to.\n     *\n     * * `timeout_secs` - The amount of time we should wait for a `/keys/query`\n     *   response before returning if the user's device list has been marked as\n     *   stale. **Note**, this assumes that the requests from {@link\n     *   OlmMachine.outgoingRequests} are being processed and sent out.\n     *\n     *   If unset, we will return immediately even if the device list is stale.\n     *\n     * ### Returns\n     *\n     * A {@link UserDevices} object.\n     * @param {UserId} user_id\n     * @param {number | null} [timeout_secs]\n     * @returns {Promise<any>}\n     */\n    getUserDevices(user_id, timeout_secs) {\n        _assertClass(user_id, UserId);\n        const ret = wasm.olmmachine_getUserDevices(this.__wbg_ptr, user_id.__wbg_ptr, !isLikeNone(timeout_secs), isLikeNone(timeout_secs) ? 0 : timeout_secs);\n        return ret;\n    }\n    /**\n     * Get a specific device of a user.\n     *\n     * ### Parameters\n     *\n     * * `user_id` - The unique ID of the user that the device belongs to.\n     *\n     * * `device_id` - The unique ID of the device.\n     *\n     * * `timeout_secs` - The amount of time we should wait for a `/keys/query`\n     *   response before returning if the user's device list has been marked as\n     *   stale. **Note**, this assumes that the requests from {@link\n     *   OlmMachine.outgoingRequests} are being processed and sent out.\n     *\n     *   If unset, we will return immediately even if the device list is stale.\n     *\n     * ### Returns\n     *\n     * If the device is known, a {@link Device}. Otherwise, `undefined`.\n     * @param {UserId} user_id\n     * @param {DeviceId} device_id\n     * @param {number | null} [timeout_secs]\n     * @returns {Promise<any>}\n     */\n    getDevice(user_id, device_id, timeout_secs) {\n        _assertClass(user_id, UserId);\n        _assertClass(device_id, DeviceId);\n        const ret = wasm.olmmachine_getDevice(this.__wbg_ptr, user_id.__wbg_ptr, device_id.__wbg_ptr, !isLikeNone(timeout_secs), isLikeNone(timeout_secs) ? 0 : timeout_secs);\n        return ret;\n    }\n    /**\n     * Get a verification object for the given user ID with the given\n     * flow ID (a to-device request ID if the verification has been\n     * requested by a to-device request, or a room event ID if the\n     * verification has been requested by a room event).\n     *\n     * It returns a “`Verification` object”, which is either a `Sas`\n     * or `Qr` object.\n     * @param {UserId} user_id\n     * @param {string} flow_id\n     * @returns {any}\n     */\n    getVerification(user_id, flow_id) {\n        _assertClass(user_id, UserId);\n        const ptr0 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_getVerification(this.__wbg_ptr, user_id.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Get a verification request object with the given flow ID.\n     * @param {UserId} user_id\n     * @param {string} flow_id\n     * @returns {VerificationRequest | undefined}\n     */\n    getVerificationRequest(user_id, flow_id) {\n        _assertClass(user_id, UserId);\n        const ptr0 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_getVerificationRequest(this.__wbg_ptr, user_id.__wbg_ptr, ptr0, len0);\n        return ret === 0 ? undefined : VerificationRequest.__wrap(ret);\n    }\n    /**\n     * Get all the verification requests of a given user.\n     * @param {UserId} user_id\n     * @returns {Array<any>}\n     */\n    getVerificationRequests(user_id) {\n        _assertClass(user_id, UserId);\n        const ret = wasm.olmmachine_getVerificationRequests(this.__wbg_ptr, user_id.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Receive a verification event.\n     *\n     * This method can be used to pass verification events that are happening\n     * in rooms to the `OlmMachine`. The event should be in the decrypted form.\n     * @param {string} event\n     * @param {RoomId} room_id\n     * @returns {Promise<any>}\n     */\n    receiveVerificationEvent(event, room_id) {\n        const ptr0 = passStringToWasm0(event, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        _assertClass(room_id, RoomId);\n        const ret = wasm.olmmachine_receiveVerificationEvent(this.__wbg_ptr, ptr0, len0, room_id.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Export the keys that match the given predicate.\n     *\n     * `predicate` is a closure that will be called for every known\n     * `InboundGroupSession`, which represents a room key. If the closure\n     * returns `true`, the `InboundGroupSession` will be included in the\n     * export; otherwise it won't.\n     *\n     * Returns a Promise containing a Result containing a String which is a\n     * JSON-encoded array of ExportedRoomKey objects.\n     * @param {Function} predicate\n     * @returns {Promise<any>}\n     */\n    exportRoomKeys(predicate) {\n        const ret = wasm.olmmachine_exportRoomKeys(this.__wbg_ptr, predicate);\n        return ret;\n    }\n    /**\n     * Import the given room keys into our store.\n     *\n     * Mostly, a deprecated alias for `importExportedRoomKeys`, though the\n     * return type is different.\n     *\n     * Returns a String containing a JSON-encoded object, holding three\n     * properties:\n     *  * `total_count` (the total number of keys found in the export data).\n     *  * `imported_count` (the number of keys that were imported).\n     *  * `keys` (the keys that were imported; a map from room id to a map of\n     *    the sender key to a list of session ids).\n     *\n     * @deprecated Use `importExportedRoomKeys` or `importBackedUpRoomKeys`.\n     * @param {string} exported_room_keys\n     * @param {Function} progress_listener\n     * @returns {Promise<any>}\n     */\n    importRoomKeys(exported_room_keys, progress_listener) {\n        const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_importRoomKeys(this.__wbg_ptr, ptr0, len0, progress_listener);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Import the given room keys into our store.\n     *\n     * `exported_keys` is a JSON-encoded list of previously exported keys that\n     * should be imported into our store. If we already have a better\n     * version of a key, the key will _not_ be imported.\n     *\n     * `progress_listener` is a closure that takes 2 `BigInt` arguments:\n     * `progress` and `total`, and returns nothing.\n     *\n     * Returns a {@link RoomKeyImportResult}.\n     * @param {string} exported_room_keys\n     * @param {Function} progress_listener\n     * @returns {Promise<any>}\n     */\n    importExportedRoomKeys(exported_room_keys, progress_listener) {\n        const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_importExportedRoomKeys(this.__wbg_ptr, ptr0, len0, progress_listener);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Import the given room keys into our store.\n     *\n     * # Arguments\n     *\n     * * `backed_up_room_keys`: keys that were retrieved from backup and that\n     *   should be added to our store (provided they are better than our\n     *   current versions of those keys). Specifically, it should be a Map from\n     *   {@link RoomId}, to a Map from session ID to a (decrypted) session data\n     *   structure.\n     *\n     * * `progress_listener`: an optional callback that takes 3 arguments:\n     *   `progress` (the number of keys that have successfully been imported),\n     *   `total` (the total number of keys), and `failures` (the number of keys\n     *   that failed to import), and returns nothing.\n     *\n     * # Returns\n     *\n     * A {@link RoomKeyImportResult}.\n     * @param {Map<any, any>} backed_up_room_keys\n     * @param {Function | null | undefined} progress_listener\n     * @param {string} backup_version\n     * @returns {Promise<any>}\n     */\n    importBackedUpRoomKeys(backed_up_room_keys, progress_listener, backup_version) {\n        const ptr0 = passStringToWasm0(backup_version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_importBackedUpRoomKeys(this.__wbg_ptr, backed_up_room_keys, isLikeNone(progress_listener) ? 0 : addToExternrefTable0(progress_listener), ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Store the backup decryption key in the crypto store.\n     *\n     * This is useful if the client wants to support gossiping of the backup\n     * key.\n     *\n     * Returns `Promise<void>`.\n     * @param {BackupDecryptionKey} decryption_key\n     * @param {string} version\n     * @returns {Promise<any>}\n     */\n    saveBackupDecryptionKey(decryption_key, version) {\n        _assertClass(decryption_key, BackupDecryptionKey);\n        const ptr0 = passStringToWasm0(version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_saveBackupDecryptionKey(this.__wbg_ptr, decryption_key.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Get the backup keys we have saved in our store.\n     * Returns a `Promise` for {@link BackupKeys}.\n     * @returns {Promise<any>}\n     */\n    getBackupKeys() {\n        const ret = wasm.olmmachine_getBackupKeys(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Check if the given backup has been verified by us or by another of our\n     * devices that we trust.\n     *\n     * The `backup_info` should be a Javascript object with the following\n     * format:\n     *\n     * ```json\n     * {\n     *     \"algorithm\": \"m.megolm_backup.v1.curve25519-aes-sha2\",\n     *     \"auth_data\": {\n     *         \"public_key\":\"XjhWTCjW7l59pbfx9tlCBQolfnIQWARoKOzjTOPSlWM\",\n     *         \"signatures\": {}\n     *     }\n     * }\n     * ```\n     *\n     * Returns a {@link SignatureVerification} object.\n     * @param {any} backup_info\n     * @returns {Promise<any>}\n     */\n    verifyBackup(backup_info) {\n        const ret = wasm.olmmachine_verifyBackup(this.__wbg_ptr, backup_info);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Activate the given backup key to be used with the given backup version.\n     *\n     * **Warning**: The caller needs to make sure that the given `BackupKey` is\n     * trusted, otherwise we might be encrypting room keys that a malicious\n     * party could decrypt.\n     *\n     * The {@link verifyBackup} method can be used to do so.\n     *\n     * Returns `Promise<void>`.\n     * @param {string} public_key_base_64\n     * @param {string} version\n     * @returns {Promise<any>}\n     */\n    enableBackupV1(public_key_base_64, version) {\n        const ptr0 = passStringToWasm0(public_key_base_64, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passStringToWasm0(version, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_enableBackupV1(this.__wbg_ptr, ptr0, len0, ptr1, len1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Are we able to encrypt room keys.\n     *\n     * This returns true if we have an active `BackupKey` and backup version\n     * registered with the state machine.\n     *\n     * Returns `Promise<bool>`.\n     * @returns {Promise<any>}\n     */\n    isBackupEnabled() {\n        const ret = wasm.olmmachine_isBackupEnabled(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Disable and reset our backup state.\n     *\n     * This will remove any pending backup request, remove the backup key and\n     * reset the backup state of each room key we have.\n     *\n     * Returns `Promise<void>`.\n     * @returns {Promise<any>}\n     */\n    disableBackup() {\n        const ret = wasm.olmmachine_disableBackup(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Encrypt a batch of room keys and return a request that needs to be sent\n     * out to backup the room keys.\n     *\n     * Returns an optional {@link KeysBackupRequest}.\n     * @returns {Promise<any>}\n     */\n    backupRoomKeys() {\n        const ret = wasm.olmmachine_backupRoomKeys(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the number of backed up room keys and the total number of room keys.\n     * Returns a {@link RoomKeyCounts}.\n     * @returns {Promise<any>}\n     */\n    roomKeyCounts() {\n        const ret = wasm.olmmachine_roomKeyCounts(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Encrypt the list of exported room keys using the given passphrase.\n     *\n     * `exported_room_keys` is a list of sessions that should be encrypted\n     * (it's generally returned by `export_room_keys`). `passphrase` is the\n     * passphrase that will be used to encrypt the exported room keys. And\n     * `rounds` is the number of rounds that should be used for the key\n     * derivation when the passphrase gets turned into an AES key. More rounds\n     * are increasingly computationnally intensive and as such help against\n     * brute-force attacks. Should be at least `10_000`, while values in the\n     * `100_000` ranges should be preferred.\n     * @param {string} exported_room_keys\n     * @param {string} passphrase\n     * @param {number} rounds\n     * @returns {string}\n     */\n    static encryptExportedRoomKeys(exported_room_keys, passphrase, rounds) {\n        let deferred4_0;\n        let deferred4_1;\n        try {\n            const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len0 = WASM_VECTOR_LEN;\n            const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len1 = WASM_VECTOR_LEN;\n            const ret = wasm.olmmachine_encryptExportedRoomKeys(ptr0, len0, ptr1, len1, rounds);\n            var ptr3 = ret[0];\n            var len3 = ret[1];\n            if (ret[3]) {\n                ptr3 = 0; len3 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred4_0 = ptr3;\n            deferred4_1 = len3;\n            return getStringFromWasm0(ptr3, len3);\n        } finally {\n            wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);\n        }\n    }\n    /**\n     * Try to decrypt a reader into a list of exported room keys.\n     *\n     * `encrypted_exported_room_keys` is the result from\n     * `encrypt_exported_room_keys`. `passphrase` is the passphrase that was\n     * used when calling `encrypt_exported_room_keys`.\n     * @param {string} encrypted_exported_room_keys\n     * @param {string} passphrase\n     * @returns {string}\n     */\n    static decryptExportedRoomKeys(encrypted_exported_room_keys, passphrase) {\n        let deferred4_0;\n        let deferred4_1;\n        try {\n            const ptr0 = passStringToWasm0(encrypted_exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len0 = WASM_VECTOR_LEN;\n            const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n            const len1 = WASM_VECTOR_LEN;\n            const ret = wasm.olmmachine_decryptExportedRoomKeys(ptr0, len0, ptr1, len1);\n            var ptr3 = ret[0];\n            var len3 = ret[1];\n            if (ret[3]) {\n                ptr3 = 0; len3 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred4_0 = ptr3;\n            deferred4_1 = len3;\n            return getStringFromWasm0(ptr3, len3);\n        } finally {\n            wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);\n        }\n    }\n    /**\n     * Register a callback which will be called whenever there is an update to\n     * a room key.\n     *\n     * `callback` should be a function that takes a single argument (an array\n     * of {@link RoomKeyInfo}) and returns a Promise.\n     * @param {Function} callback\n     */\n    registerRoomKeyUpdatedCallback(callback) {\n        wasm.olmmachine_registerRoomKeyUpdatedCallback(this.__wbg_ptr, callback);\n    }\n    /**\n     * Register a callback which will be called whenever we receive a\n     * notification that some room keys have been withheld.\n     *\n     * `callback` should be a function that takes a single argument (an array\n     * of {@link RoomKeyWithheldInfo}) and returns a Promise.\n     * @param {Function} callback\n     */\n    registerRoomKeysWithheldCallback(callback) {\n        wasm.olmmachine_registerRoomKeysWithheldCallback(this.__wbg_ptr, callback);\n    }\n    /**\n     * Register a callback which will be called whenever there is an update to\n     * a user identity.\n     *\n     * `callback` should be a function that takes a single argument (a {@link\n     * UserId}) and returns a Promise.\n     * @param {Function} callback\n     */\n    registerUserIdentityUpdatedCallback(callback) {\n        wasm.olmmachine_registerUserIdentityUpdatedCallback(this.__wbg_ptr, callback);\n    }\n    /**\n     * Register a callback which will be called whenever there is an update to\n     * a device.\n     *\n     * `callback` should be a function that takes a single argument (an array\n     * of user IDs as strings) and returns a Promise.\n     * @param {Function} callback\n     */\n    registerDevicesUpdatedCallback(callback) {\n        wasm.olmmachine_registerDevicesUpdatedCallback(this.__wbg_ptr, callback);\n    }\n    /**\n     * Register a callback which will be called whenever a secret\n     * (`m.secret.send`) is received.\n     *\n     * The only secret this will currently broadcast is the\n     * `m.megolm_backup.v1` (the cross signing secrets are handled internally).\n     *\n     * To request a secret from other devices, a client sends an\n     * `m.secret.request` device event with `action` set to `request` and\n     * `name` set to the identifier of the secret. A device that wishes to\n     * share the secret will reply with an `m.secret.send` event, encrypted\n     * using olm.\n     *\n     * The secrets are guaranteed to have been received over a 1-to-1 encrypted\n     * to_device message from a one of the user's own verified devices.\n     *\n     * See https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk_crypto/store/struct.Store.html#method.secrets_stream for more information.\n     *\n     * `callback` should be a function that takes 2 arguments: the secret name\n     * (string) and value (string).\n     *\n     * **Note**: if the secret is valid and handled on the javascript side, the\n     * secret inbox should be cleared by calling\n     * `delete_secrets_from_inbox`.\n     * @param {Function} callback\n     */\n    registerReceiveSecretCallback(callback) {\n        wasm.olmmachine_registerReceiveSecretCallback(this.__wbg_ptr, callback);\n    }\n    /**\n     * Get all the secrets with the given secret_name we have currently\n     * stored.\n     * The only secret this will currently return is the\n     * `m.megolm_backup.v1` secret.\n     *\n     * Usually you would just register a callback with\n     * [`register_receive_secret_callback`], but if the client is shut down\n     * before handling them, this method can be used to retrieve them.\n     * This method should therefore be called at client startup to retrieve any\n     * secrets received during the previous session.\n     *\n     * The secrets are guaranteed to have been received over a 1-to-1 encrypted\n     * to_device message from one of the user's own verified devices.\n     *\n     * Returns a `Promise` for a `Set` of `String` corresponding to the secret\n     * values.\n     *\n     * If the secret is valid and handled, the secret inbox should be cleared\n     * by calling `delete_secrets_from_inbox`.\n     * @param {string} secret_name\n     * @returns {Promise<any>}\n     */\n    getSecretsFromInbox(secret_name) {\n        const ptr0 = passStringToWasm0(secret_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_getSecretsFromInbox(this.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Delete all secrets with the given secret name from the inbox.\n     *\n     * Should be called after handling the secrets with\n     * `get_secrets_from_inbox`.\n     *\n     * # Arguments\n     *\n     * * `secret_name` - The name of the secret to delete.\n     * @param {string} secret_name\n     * @returns {Promise<any>}\n     */\n    deleteSecretsFromInbox(secret_name) {\n        const ptr0 = passStringToWasm0(secret_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_deleteSecretsFromInbox(this.__wbg_ptr, ptr0, len0);\n        return ret;\n    }\n    /**\n     * Request missing local secrets from our other trusted devices.\n     *\n     * \"Local secrets\" refers to secrets which can be shared between trusted\n     * devices, such as private cross-signing keys, and the megolm backup\n     * decryption key.\n     *\n     * This method will cause the sdk to generated outgoing secret requests\n     * (`m.secret.request`) to get the missing secrets. These requests will\n     * then be returned by a future call to {@link\n     * OlmMachine#outgoingRequests}.\n     *\n     * # Returns\n     *\n     * A `Promise` for a `bool` result, which will be true if  secrets were\n     * missing, and a request was generated.\n     * @returns {Promise<any>}\n     */\n    requestMissingSecretsIfNeeded() {\n        const ret = wasm.olmmachine_requestMissingSecretsIfNeeded(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the stored room settings, such as the encryption algorithm or\n     * whether to encrypt only for trusted devices.\n     *\n     * These settings can be modified via {@link setRoomSettings}.\n     *\n     * # Returns\n     *\n     * `Promise<RoomSettings|undefined>`\n     * @param {RoomId} room_id\n     * @returns {Promise<RoomSettings|undefined>}\n     */\n    getRoomSettings(room_id) {\n        _assertClass(room_id, RoomId);\n        const ret = wasm.olmmachine_getRoomSettings(this.__wbg_ptr, room_id.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Store encryption settings for the given room.\n     *\n     * This method checks if the new settings are \"safe\" -- ie, that they do\n     * not represent a downgrade in encryption security from any previous\n     * settings. Attempts to downgrade security will result in an error.\n     *\n     * If the settings are valid, they will be persisted to the crypto store.\n     * These settings are not used directly by this library, but the saved\n     * settings can be retrieved via {@link getRoomSettings}.\n     * @param {RoomId} room_id\n     * @param {RoomSettings} room_settings\n     * @returns {Promise<void>}\n     */\n    setRoomSettings(room_id, room_settings) {\n        _assertClass(room_id, RoomId);\n        _assertClass(room_settings, RoomSettings);\n        const ret = wasm.olmmachine_setRoomSettings(this.__wbg_ptr, room_id.__wbg_ptr, room_settings.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Manage dehydrated devices\n     * @returns {DehydratedDevices}\n     */\n    dehydratedDevices() {\n        const ret = wasm.olmmachine_dehydratedDevices(this.__wbg_ptr);\n        return DehydratedDevices.__wrap(ret);\n    }\n    /**\n     * Assemble, and encrypt, a room key bundle for sharing encrypted history,\n     * as per {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4268|MSC4268}.\n     *\n     * Returns `undefined` if there are no keys to share in the given room,\n     * otherwise an {@link EncryptedAttachment}.\n     *\n     * The data should be uploaded to the media server, and the details then\n     * passed to {@link shareRoomKeyBundleData}.\n     *\n     * @experimental\n     * @param {RoomId} room_id\n     * @returns {Promise<EncryptedAttachment | undefined>}\n     */\n    buildRoomKeyBundle(room_id) {\n        _assertClass(room_id, RoomId);\n        const ret = wasm.olmmachine_buildRoomKeyBundle(this.__wbg_ptr, room_id.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Collect the devices belonging to the given user, and send the details\n     * of a room key bundle to those devices.\n     *\n     * Returns a list of to-device requests which must be sent.\n     *\n     * @experimental\n     * @param {UserId} user\n     * @param {RoomId} room\n     * @param {string} url\n     * @param {string | null | undefined} media_encryption_info\n     * @param {CollectStrategy} sharing_strategy\n     * @returns {Promise<ToDeviceRequest[]>}\n     */\n    shareRoomKeyBundleData(user, room, url, media_encryption_info, sharing_strategy) {\n        _assertClass(user, UserId);\n        _assertClass(room, RoomId);\n        const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        var ptr1 = isLikeNone(media_encryption_info) ? 0 : passStringToWasm0(media_encryption_info, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len1 = WASM_VECTOR_LEN;\n        _assertClass(sharing_strategy, CollectStrategy);\n        var ptr2 = sharing_strategy.__destroy_into_raw();\n        const ret = wasm.olmmachine_shareRoomKeyBundleData(this.__wbg_ptr, user.__wbg_ptr, room.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * See if we have received an {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4268|MSC4268}\n     * room key bundle for the given room from the given user.\n     *\n     * Before calling this, the application must make sure that we have an\n     * up-to-date copy of the inviter's cross-signing keys, so that we can\n     * verify the device that sent us the key bundle data message. (For\n     * now, the easiest way to do that is by calling {@link queryKeysForUsers}\n     * for the inviter, and making the resultant request.)\n     *\n     * Returns either `undefined` if no suitable bundle has been received,\n     * or an {@link StoredRoomKeyBundleData}, in which case, the bundle\n     * should be downloaded, and then passed to {@link\n     * receiveRoomKeyBundle}.\n     *\n     * @experimental\n     * @param {RoomId} room_id\n     * @param {UserId} inviter\n     * @returns {Promise<StoredRoomKeyBundleData | undefined>}\n     */\n    getReceivedRoomKeyBundleData(room_id, inviter) {\n        _assertClass(room_id, RoomId);\n        _assertClass(inviter, UserId);\n        const ret = wasm.olmmachine_getReceivedRoomKeyBundleData(this.__wbg_ptr, room_id.__wbg_ptr, inviter.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Import the message keys from a downloaded room key bundle.\n     *\n     * After {@link getReceivedRoomKeyBundleData} returns a truthy result, the\n     * media file should be downloaded and then passed into this method to\n     * actually do the import.\n     *\n     * @experimental\n     * @param {StoredRoomKeyBundleData} bundle_data\n     * @param {Uint8Array} encrypted_bundle\n     * @returns {Promise<undefined>}\n     */\n    receiveRoomKeyBundle(bundle_data, encrypted_bundle) {\n        _assertClass(bundle_data, StoredRoomKeyBundleData);\n        var ptr0 = bundle_data.__destroy_into_raw();\n        const ptr1 = passArray8ToWasm0(encrypted_bundle, wasm.__wbindgen_malloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ret = wasm.olmmachine_receiveRoomKeyBundle(this.__wbg_ptr, ptr0, ptr1, len1);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Shut down the `OlmMachine`.\n     *\n     * The `OlmMachine` cannot be used after this method has been called.\n     *\n     * All associated resources will be closed too, like IndexedDB\n     * connections.\n     */\n    close() {\n        const ptr = this.__destroy_into_raw();\n        wasm.olmmachine_close(ptr);\n    }\n}\n\nconst OtherUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_otheruseridentity_free(ptr >>> 0, 1));\n/**\n * Struct representing a cross signing identity of a user.\n *\n * This is the user identity of a user that isn't our own. Other users will\n * only contain a master key and a self signing key, meaning that only device\n * signatures can be checked with this identity.\n *\n * This struct wraps a read-only version of the struct and allows verifications\n * to be requested to verify our own device with the user identity.\n */\nexport class OtherUserIdentity {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(OtherUserIdentity.prototype);\n        obj.__wbg_ptr = ptr;\n        OtherUserIdentityFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        OtherUserIdentityFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_otheruseridentity_free(ptr, 0);\n    }\n    /**\n     * Is this user identity verified?\n     * @returns {boolean}\n     */\n    isVerified() {\n        const ret = wasm.otheruseridentity_isVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Manually verify this user.\n     *\n     * This method will attempt to sign the user identity using our private\n     * cross signing key.\n     *\n     * This method fails if we don't have the private part of our user-signing\n     * key.\n     *\n     * Returns a request that needs to be sent out for the user to be marked as\n     * verified.\n     * @returns {Promise<any>}\n     */\n    verify() {\n        const ret = wasm.otheruseridentity_verify(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a `VerificationRequest` object after the verification\n     * request content has been sent out.\n     * @param {RoomId} room_id\n     * @param {EventId} request_event_id\n     * @param {any[] | null} [methods]\n     * @returns {VerificationRequest}\n     */\n    requestVerification(room_id, request_event_id, methods) {\n        _assertClass(room_id, RoomId);\n        _assertClass(request_event_id, EventId);\n        var ptr0 = isLikeNone(methods) ? 0 : passArrayJsValueToWasm0(methods, wasm.__wbindgen_malloc);\n        var len0 = WASM_VECTOR_LEN;\n        const ret = wasm.otheruseridentity_requestVerification(this.__wbg_ptr, room_id.__wbg_ptr, request_event_id.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return VerificationRequest.__wrap(ret[0]);\n    }\n    /**\n     * Send a verification request to the given user.\n     *\n     * The returned content needs to be sent out into a DM room with the given\n     * user.\n     *\n     * After the content has been sent out a VerificationRequest can be started\n     * with the `request_verification` method.\n     * @param {any[] | null} [methods]\n     * @returns {string}\n     */\n    verificationRequestContent(methods) {\n        let deferred3_0;\n        let deferred3_1;\n        try {\n            var ptr0 = isLikeNone(methods) ? 0 : passArrayJsValueToWasm0(methods, wasm.__wbindgen_malloc);\n            var len0 = WASM_VECTOR_LEN;\n            const ret = wasm.otheruseridentity_verificationRequestContent(this.__wbg_ptr, ptr0, len0);\n            var ptr2 = ret[0];\n            var len2 = ret[1];\n            if (ret[3]) {\n                ptr2 = 0; len2 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred3_0 = ptr2;\n            deferred3_1 = len2;\n            return getStringFromWasm0(ptr2, len2);\n        } finally {\n            wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n        }\n    }\n    /**\n     * Get the master key of the identity.\n     * @returns {string}\n     */\n    get masterKey() {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            const ret = wasm.otheruseridentity_masterKey(this.__wbg_ptr);\n            var ptr1 = ret[0];\n            var len1 = ret[1];\n            if (ret[3]) {\n                ptr1 = 0; len1 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred2_0 = ptr1;\n            deferred2_1 = len1;\n            return getStringFromWasm0(ptr1, len1);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * Get the self-signing key of the identity.\n     * @returns {string}\n     */\n    get selfSigningKey() {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            const ret = wasm.otheruseridentity_selfSigningKey(this.__wbg_ptr);\n            var ptr1 = ret[0];\n            var len1 = ret[1];\n            if (ret[3]) {\n                ptr1 = 0; len1 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred2_0 = ptr1;\n            deferred2_1 = len1;\n            return getStringFromWasm0(ptr1, len1);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * Pin the current identity (public part of the master signing key).\n     * @returns {Promise<any>}\n     */\n    pinCurrentMasterKey() {\n        const ret = wasm.otheruseridentity_pinCurrentMasterKey(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Has the identity changed in a way that requires approval from the user?\n     *\n     * A user identity needs approval if it changed after the crypto machine\n     * has already observed (\"pinned\") a different identity for that user,\n     * unless it is an explicitly verified identity (using for example\n     * interactive verification).\n     *\n     * This situation can be resolved by:\n     *\n     * - Verifying the new identity with {@link requestVerification}, or:\n     * - Updating the pin to the new identity with {@link pinCurrentMasterKey}.\n     * @returns {boolean}\n     */\n    identityNeedsUserApproval() {\n        const ret = wasm.otheruseridentity_identityNeedsUserApproval(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * True if we verified this identity (with any own identity, at any\n     * point).\n     *\n     * To set this latch back to false, call {@link withdrawVerification}.\n     * @returns {boolean}\n     */\n    wasPreviouslyVerified() {\n        const ret = wasm.otheruseridentity_wasPreviouslyVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Remove the requirement for this identity to be verified.\n     *\n     * If an identity was previously verified and is not anymore it will be\n     * reported to the user. In order to remove this notice users have to\n     * verify again or to withdraw the verification requirement.\n     * @returns {Promise<any>}\n     */\n    withdrawVerification() {\n        const ret = wasm.otheruseridentity_withdrawVerification(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Was this identity verified since initial observation and is not anymore?\n     *\n     * Such a violation should be reported to the local user by the\n     * application, and resolved by\n     *\n     * - Verifying the new identity with {@link requestVerification}, or:\n     * - Withdrawing the verification requirement with {@link\n     *   withdrawVerification}.\n     * @returns {boolean}\n     */\n    hasVerificationViolation() {\n        const ret = wasm.otheruseridentity_hasVerificationViolation(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst OutboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_outboundcreationresult_free(ptr >>> 0, 1));\n/**\n * The result of an outbound ECIES channel establishment.\n */\nexport class OutboundCreationResult {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(OutboundCreationResult.prototype);\n        obj.__wbg_ptr = ptr;\n        OutboundCreationResultFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        OutboundCreationResultFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_outboundcreationresult_free(ptr, 0);\n    }\n    /**\n     * The established ECIES channel.\n     * @returns {EstablishedEcies}\n     */\n    get channel() {\n        const ret = wasm.__wbg_get_inboundcreationresult_channel(this.__wbg_ptr);\n        return EstablishedEcies.__wrap(ret);\n    }\n    /**\n     * The established ECIES channel.\n     * @param {EstablishedEcies} arg0\n     */\n    set channel(arg0) {\n        _assertClass(arg0, EstablishedEcies);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_inboundcreationresult_channel(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The initial encrypted message.\n     * @returns {string}\n     */\n    get initial_message() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_outboundcreationresult_initial_message(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The initial encrypted message.\n     * @param {string} arg0\n     */\n    set initial_message(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n}\n\nconst OwnUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_ownuseridentity_free(ptr >>> 0, 1));\n/**\n * Struct representing a cross signing identity of a user.\n *\n * This is the user identity of a user that is our own.\n */\nexport class OwnUserIdentity {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(OwnUserIdentity.prototype);\n        obj.__wbg_ptr = ptr;\n        OwnUserIdentityFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        OwnUserIdentityFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_ownuseridentity_free(ptr, 0);\n    }\n    /**\n     * Is this user identity verified?\n     * @returns {boolean}\n     */\n    isVerified() {\n        const ret = wasm.ownuseridentity_isVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Mark our user identity as verified.\n     *\n     * This will mark the identity locally as verified and sign it with our own\n     * device.\n     *\n     * Returns a signature upload request that needs to be sent out.\n     * @returns {Promise<any>}\n     */\n    verify() {\n        const ret = wasm.ownuseridentity_verify(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Send a verification request to our other devices.\n     * @param {any[] | null} [methods]\n     * @returns {Promise<any>}\n     */\n    requestVerification(methods) {\n        var ptr0 = isLikeNone(methods) ? 0 : passArrayJsValueToWasm0(methods, wasm.__wbindgen_malloc);\n        var len0 = WASM_VECTOR_LEN;\n        const ret = wasm.ownuseridentity_requestVerification(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Does our user identity trust our own device, i.e. have we signed our own\n     * device keys with our self-signing key?\n     * @returns {Promise<any>}\n     */\n    trustsOurOwnDevice() {\n        const ret = wasm.ownuseridentity_trustsOurOwnDevice(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the master key of the identity.\n     * @returns {string}\n     */\n    get masterKey() {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            const ret = wasm.ownuseridentity_masterKey(this.__wbg_ptr);\n            var ptr1 = ret[0];\n            var len1 = ret[1];\n            if (ret[3]) {\n                ptr1 = 0; len1 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred2_0 = ptr1;\n            deferred2_1 = len1;\n            return getStringFromWasm0(ptr1, len1);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * Get the self-signing key of the identity.\n     * @returns {string}\n     */\n    get selfSigningKey() {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            const ret = wasm.ownuseridentity_selfSigningKey(this.__wbg_ptr);\n            var ptr1 = ret[0];\n            var len1 = ret[1];\n            if (ret[3]) {\n                ptr1 = 0; len1 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred2_0 = ptr1;\n            deferred2_1 = len1;\n            return getStringFromWasm0(ptr1, len1);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * Get the user-signing key of the identity. This is only present for our\n     * own user identity.\n     * @returns {string}\n     */\n    get userSigningKey() {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            const ret = wasm.ownuseridentity_userSigningKey(this.__wbg_ptr);\n            var ptr1 = ret[0];\n            var len1 = ret[1];\n            if (ret[3]) {\n                ptr1 = 0; len1 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred2_0 = ptr1;\n            deferred2_1 = len1;\n            return getStringFromWasm0(ptr1, len1);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * True if we verified our own identity at some point in the past.\n     *\n     * To reset this latch back to `false`, call {@link withdrawVerification}.\n     * @returns {boolean}\n     */\n    wasPreviouslyVerified() {\n        const ret = wasm.ownuseridentity_wasPreviouslyVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Remove the requirement for this identity to be verified.\n     *\n     * If an identity was previously verified and is not any longer, it will be\n     * reported to the user. In order to remove this notice users have to\n     * verify again or to withdraw the verification requirement.\n     * @returns {Promise<any>}\n     */\n    withdrawVerification() {\n        const ret = wasm.ownuseridentity_withdrawVerification(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Was this identity verified since initial observation and is not anymore?\n     *\n     * Such a violation should be reported to the local user by the\n     * application, and resolved by\n     *\n     * - Verifying the new identity with {@link requestVerification}, or:\n     * - Withdrawing the verification requirement with {@link\n     *   withdrawVerification}.\n     * @returns {boolean}\n     */\n    hasVerificationViolation() {\n        const ret = wasm.ownuseridentity_hasVerificationViolation(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst PickledInboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_pickledinboundgroupsession_free(ptr >>> 0, 1));\n/**\n * A pickled version of an `InboundGroupSession`.\n *\n * Holds all the information that needs to be stored in a database to restore\n * an InboundGroupSession.\n */\nexport class PickledInboundGroupSession {\n\n    static __unwrap(jsValue) {\n        if (!(jsValue instanceof PickledInboundGroupSession)) {\n            return 0;\n        }\n        return jsValue.__destroy_into_raw();\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PickledInboundGroupSessionFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_pickledinboundgroupsession_free(ptr, 0);\n    }\n    /**\n     * The pickle string holding the Megolm Session, as returned by\n     * `olm_pickle_inbound_group_session` in libolm.\n     * @returns {string}\n     */\n    get pickle() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_pickledinboundgroupsession_pickle(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The pickle string holding the Megolm Session, as returned by\n     * `olm_pickle_inbound_group_session` in libolm.\n     * @param {string} arg0\n     */\n    set pickle(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The public curve25519 key of the account that sent us the session.\n     * @returns {string}\n     */\n    get senderKey() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_pickledinboundgroupsession_senderKey(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The public curve25519 key of the account that sent us the session.\n     * @param {string} arg0\n     */\n    set senderKey(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_backup_version(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The public ed25519 key of the account that is believed to have initiated\n     * the session, if known.\n     *\n     * If the session was received directly from the creator via an\n     * Olm-encrypted `m.room_key` event, this value is taken from the `keys`\n     * property of the plaintext payload of that event (see\n     * [`m.olm.v1.curve25519-aes-sha2`]).\n     *\n     * If the session was forwarded to us using an [`m.forwarded_room_key`],\n     * this value is a copy of the `sender_claimed_ed25519_key` from the\n     * content of the event.\n     *\n     * [`m.olm.v1.curve25519-aes-sha2`]: https://spec.matrix.org/v1.9/client-server-api/#molmv1curve25519-aes-sha2\n     * [`m.forwarded_room_key`]: https://spec.matrix.org/v1.9/client-server-api/#mforwarded_room_key\n     * @returns {string | undefined}\n     */\n    get senderSigningKey() {\n        const ret = wasm.__wbg_get_pickledinboundgroupsession_senderSigningKey(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * The public ed25519 key of the account that is believed to have initiated\n     * the session, if known.\n     *\n     * If the session was received directly from the creator via an\n     * Olm-encrypted `m.room_key` event, this value is taken from the `keys`\n     * property of the plaintext payload of that event (see\n     * [`m.olm.v1.curve25519-aes-sha2`]).\n     *\n     * If the session was forwarded to us using an [`m.forwarded_room_key`],\n     * this value is a copy of the `sender_claimed_ed25519_key` from the\n     * content of the event.\n     *\n     * [`m.olm.v1.curve25519-aes-sha2`]: https://spec.matrix.org/v1.9/client-server-api/#molmv1curve25519-aes-sha2\n     * [`m.forwarded_room_key`]: https://spec.matrix.org/v1.9/client-server-api/#mforwarded_room_key\n     * @param {string | null} [arg0]\n     */\n    set senderSigningKey(arg0) {\n        var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_basemigrationdata_backupRecoveryKey(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The id of the room that the session is used in.\n     *\n     * Nullable so that a `PickledInboundGroupSession` can be constructed\n     * incrementally. Must be populated!\n     * @returns {RoomId | undefined}\n     */\n    get roomId() {\n        const ret = wasm.__wbg_get_pickledinboundgroupsession_roomId(this.__wbg_ptr);\n        return ret === 0 ? undefined : RoomId.__wrap(ret);\n    }\n    /**\n     * The id of the room that the session is used in.\n     *\n     * Nullable so that a `PickledInboundGroupSession` can be constructed\n     * incrementally. Must be populated!\n     * @param {RoomId | null} [arg0]\n     */\n    set roomId(arg0) {\n        let ptr0 = 0;\n        if (!isLikeNone(arg0)) {\n            _assertClass(arg0, RoomId);\n            ptr0 = arg0.__destroy_into_raw();\n        }\n        wasm.__wbg_set_pickledinboundgroupsession_roomId(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * Flag remembering if the session was directly sent to us by the sender\n     * or if it was imported.\n     * @returns {boolean}\n     */\n    get imported() {\n        const ret = wasm.__wbg_get_pickledinboundgroupsession_imported(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Flag remembering if the session was directly sent to us by the sender\n     * or if it was imported.\n     * @param {boolean} arg0\n     */\n    set imported(arg0) {\n        wasm.__wbg_set_pickledinboundgroupsession_imported(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Flag remembering if the session has been backed up.\n     * @returns {boolean}\n     */\n    get backedUp() {\n        const ret = wasm.__wbg_get_pickledinboundgroupsession_backedUp(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Flag remembering if the session has been backed up.\n     * @param {boolean} arg0\n     */\n    set backedUp(arg0) {\n        wasm.__wbg_set_pickledinboundgroupsession_backedUp(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Construct a new `PickledInboundGroupSession`, with default values.\n     */\n    constructor() {\n        const ret = wasm.pickledinboundgroupsession_new();\n        this.__wbg_ptr = ret >>> 0;\n        PickledInboundGroupSessionFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst PickledSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_pickledsession_free(ptr >>> 0, 1));\n/**\n * A pickled version of a `Session`.\n *\n * Holds all the information that needs to be stored in a database to restore\n * an Olm Session. Can be imported into the rust store with {@link\n * Migration::migrateOlmSessions}.\n */\nexport class PickledSession {\n\n    static __unwrap(jsValue) {\n        if (!(jsValue instanceof PickledSession)) {\n            return 0;\n        }\n        return jsValue.__destroy_into_raw();\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PickledSessionFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_pickledsession_free(ptr, 0);\n    }\n    /**\n     * The pickle string holding the Olm Session, as returned by\n     * `olm_pickle_session` in libolm.\n     * @returns {string}\n     */\n    get pickle() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_pickledsession_pickle(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The pickle string holding the Olm Session, as returned by\n     * `olm_pickle_session` in libolm.\n     * @param {string} arg0\n     */\n    set pickle(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The base64-encoded public curve25519 key of the other user that we share\n     * this session with.\n     * @returns {string}\n     */\n    get senderKey() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_pickledsession_senderKey(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The base64-encoded public curve25519 key of the other user that we share\n     * this session with.\n     * @param {string} arg0\n     */\n    set senderKey(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_backup_version(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * Was the session created using a fallback key?\n     * @returns {boolean}\n     */\n    get createdUsingFallbackKey() {\n        const ret = wasm.__wbg_get_pickledsession_createdUsingFallbackKey(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Was the session created using a fallback key?\n     * @param {boolean} arg0\n     */\n    set createdUsingFallbackKey(arg0) {\n        wasm.__wbg_set_pickledsession_createdUsingFallbackKey(this.__wbg_ptr, arg0);\n    }\n    /**\n     * When the session was created.\n     * @returns {Date}\n     */\n    get creationTime() {\n        const ret = wasm.__wbg_get_pickledsession_creationTime(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * When the session was created.\n     * @param {Date} arg0\n     */\n    set creationTime(arg0) {\n        wasm.__wbg_set_pickledsession_creationTime(this.__wbg_ptr, arg0);\n    }\n    /**\n     * When the session was last used.\n     * @returns {Date}\n     */\n    get lastUseTime() {\n        const ret = wasm.__wbg_get_pickledsession_lastUseTime(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * When the session was last used.\n     * @param {Date} arg0\n     */\n    set lastUseTime(arg0) {\n        wasm.__wbg_set_pickledsession_lastUseTime(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Construct a new `PickledSession`, with default values.\n     */\n    constructor() {\n        const ret = wasm.pickledsession_new();\n        this.__wbg_ptr = ret >>> 0;\n        PickledSessionFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst PkDecryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_pkdecryption_free(ptr >>> 0, 1));\n/**\n * A class representing a public-key decryption instance.\n *\n * This implements the decryption part of the\n * `m.megolm_backup.v1.curve25519-aes-sha2` algorithm described in the Matrix\n * {@link https://spec.matrix.org/v1.11/client-server-api/#backup-algorithm-mmegolm_backupv1curve25519-aes-sha2 | spec}.\n *\n * @see {@link PkEncryption}\n *\n * More details can be found in the official {@link https://docs.rs/vodozemac/latest/vodozemac/pk_encryption/ | vodozemac documentation}.\n */\nexport class PkDecryption {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(PkDecryption.prototype);\n        obj.__wbg_ptr = ptr;\n        PkDecryptionFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PkDecryptionFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_pkdecryption_free(ptr, 0);\n    }\n    /**\n     * Creates a new `PkDecryption` instance with a newly generated key pair.\n     */\n    constructor() {\n        const ret = wasm.pkdecryption_new();\n        this.__wbg_ptr = ret >>> 0;\n        PkDecryptionFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Creates a `PkDecryption` instance from a secret key.\n     * @param {Curve25519SecretKey} key\n     * @returns {PkDecryption}\n     */\n    static fromKey(key) {\n        _assertClass(key, Curve25519SecretKey);\n        const ret = wasm.pkdecryption_fromKey(key.__wbg_ptr);\n        return PkDecryption.__wrap(ret);\n    }\n    /**\n     * Returns the secret key associated with this `PkDecryption` instance.\n     * @returns {Curve25519SecretKey}\n     */\n    secretKey() {\n        const ret = wasm.pkdecryption_secretKey(this.__wbg_ptr);\n        return Curve25519SecretKey.__wrap(ret);\n    }\n    /**\n     * Returns the public key associated with this decryption instance.\n     *\n     * This can be used to construct a {@link PkEncryption} object to encrypt a\n     * message for this `PkDecryption` object.\n     * @returns {Curve25519PublicKey}\n     */\n    publicKey() {\n        const ret = wasm.pkdecryption_publicKey(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Decrypts an encrypted message and returns the plaintext as a UTF-8\n     * string.\n     * @param {PkMessage} message\n     * @returns {string}\n     */\n    decryptString(message) {\n        let deferred2_0;\n        let deferred2_1;\n        try {\n            _assertClass(message, PkMessage);\n            const ret = wasm.pkdecryption_decryptString(this.__wbg_ptr, message.__wbg_ptr);\n            var ptr1 = ret[0];\n            var len1 = ret[1];\n            if (ret[3]) {\n                ptr1 = 0; len1 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred2_0 = ptr1;\n            deferred2_1 = len1;\n            return getStringFromWasm0(ptr1, len1);\n        } finally {\n            wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);\n        }\n    }\n    /**\n     * Decrypts an encrypted message and returns the raw `Uint8Array`.\n     * @param {PkMessage} message\n     * @returns {Uint8Array}\n     */\n    decrypt(message) {\n        _assertClass(message, PkMessage);\n        const ret = wasm.pkdecryption_decrypt(this.__wbg_ptr, message.__wbg_ptr);\n        if (ret[3]) {\n            throw takeFromExternrefTable0(ret[2]);\n        }\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n}\n\nconst PkEncryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_pkencryption_free(ptr >>> 0, 1));\n/**\n * A class representing a public-key encryption instance.\n *\n * This implements the encryption part of the\n * `m.megolm_backup.v1.curve25519-aes-sha2` algorithm described in the Matrix\n * {@link https://spec.matrix.org/v1.11/client-server-api/#backup-algorithm-mmegolm_backupv1curve25519-aes-sha2 | spec}.\n *\n * @see {@link PkDecryption}\n *\n * More details can be found in the official {@link https://docs.rs/vodozemac/latest/vodozemac/pk_encryption/ | vodozemac documentation}.\n */\nexport class PkEncryption {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(PkEncryption.prototype);\n        obj.__wbg_ptr = ptr;\n        PkEncryptionFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PkEncryptionFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_pkencryption_free(ptr, 0);\n    }\n    /**\n     * Creates a new `PkEncryption` instance from a public key.\n     * @param {Curve25519PublicKey} public_key\n     * @returns {PkEncryption}\n     */\n    static fromKey(public_key) {\n        _assertClass(public_key, Curve25519PublicKey);\n        const ret = wasm.pkencryption_fromKey(public_key.__wbg_ptr);\n        return PkEncryption.__wrap(ret);\n    }\n    /**\n     * Encrypts a byte message and returns an encrypted {@link PkMessage}.\n     * @param {Uint8Array} message\n     * @returns {PkMessage}\n     */\n    encrypt(message) {\n        const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.pkencryption_encrypt(this.__wbg_ptr, ptr0, len0);\n        return PkMessage.__wrap(ret);\n    }\n    /**\n     * Encrypts a string message and returns an encrypted {@link PkMessage}.\n     * @param {string} message\n     * @returns {PkMessage}\n     */\n    encryptString(message) {\n        const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.pkencryption_encrypt(this.__wbg_ptr, ptr0, len0);\n        return PkMessage.__wrap(ret);\n    }\n}\n\nconst PkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_pkmessage_free(ptr >>> 0, 1));\n/**\n * A class representing an encrypted message using {@link PkEncryption}.\n */\nexport class PkMessage {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(PkMessage.prototype);\n        obj.__wbg_ptr = ptr;\n        PkMessageFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PkMessageFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_pkmessage_free(ptr, 0);\n    }\n    /**\n     * Returns the raw ciphertext as a `Uint8Array`.\n     * @returns {Uint8Array}\n     */\n    ciphertext() {\n        const ret = wasm.pkmessage_ciphertext(this.__wbg_ptr);\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n    /**\n     * Returns the raw message authentication code (MAC) as a `Uint8Array`.\n     * @returns {Uint8Array}\n     */\n    mac() {\n        const ret = wasm.pkmessage_mac(this.__wbg_ptr);\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n    /**\n     * Returns the ephemeral public key used during encryption.\n     * @returns {Curve25519PublicKey}\n     */\n    ephemeralKey() {\n        const ret = wasm.pkmessage_ephemeralKey(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Constructs a `PkMessage` from its parts: ciphertext, MAC, and ephemeral\n     * key.\n     * @param {Uint8Array} ciphertext\n     * @param {Uint8Array} mac\n     * @param {Curve25519PublicKey} ephemeral_key\n     * @returns {PkMessage}\n     */\n    static fromParts(ciphertext, mac, ephemeral_key) {\n        const ptr0 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passArray8ToWasm0(mac, wasm.__wbindgen_malloc);\n        const len1 = WASM_VECTOR_LEN;\n        _assertClass(ephemeral_key, Curve25519PublicKey);\n        const ret = wasm.pkmessage_fromParts(ptr0, len0, ptr1, len1, ephemeral_key.__wbg_ptr);\n        return PkMessage.__wrap(ret);\n    }\n    /**\n     * Constructs a `PkMessage` from a base64-encoded representation.\n     * @param {Base64EncodedPkMessage} message\n     * @returns {PkMessage}\n     */\n    static fromBase64(message) {\n        _assertClass(message, Base64EncodedPkMessage);\n        const ret = wasm.pkmessage_fromBase64(message.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return PkMessage.__wrap(ret[0]);\n    }\n    /**\n     * Converts the `PkMessage` into a base64-encoded representation.\n     * @returns {Base64EncodedPkMessage}\n     */\n    toBase64() {\n        const ret = wasm.pkmessage_toBase64(this.__wbg_ptr);\n        return Base64EncodedPkMessage.__wrap(ret);\n    }\n}\n\nconst PlainTextToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_plaintexttodeviceevent_free(ptr >>> 0, 1));\n/**\n * Represents a to-device event sent in the clear.\n */\nexport class PlainTextToDeviceEvent {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(PlainTextToDeviceEvent.prototype);\n        obj.__wbg_ptr = ptr;\n        PlainTextToDeviceEventFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PlainTextToDeviceEventFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_plaintexttodeviceevent_free(ptr, 0);\n    }\n    /**\n     * The to-device message, containing `type`, `sender` and `content` fields,\n     * encoded as JSON.\n     * @returns {string}\n     */\n    get rawEvent() {\n        const ret = wasm.__wbg_get_plaintexttodeviceevent_rawEvent(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The type of processed to-device event. Always {@link\n     * ProcessedToDeviceEventType.PlainText} for this type.\n     * @returns {ProcessedToDeviceEventType}\n     */\n    get type() {\n        const ret = wasm.plaintexttodeviceevent_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst PutDehydratedDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_putdehydrateddevicerequest_free(ptr >>> 0, 1));\n/**\n * A request that will upload a dehydrated device to the server.\n */\nexport class PutDehydratedDeviceRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(PutDehydratedDeviceRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        PutDehydratedDeviceRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        PutDehydratedDeviceRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_putdehydrateddevicerequest_free(ptr, 0);\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `rooms`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_putdehydrateddevicerequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `PutDehydratedDeviceRequest`\n     * @param {string} body\n     */\n    constructor(body) {\n        const ret = wasm.putdehydrateddevicerequest_new(body);\n        this.__wbg_ptr = ret >>> 0;\n        PutDehydratedDeviceRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst QrFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_qr_free(ptr >>> 0, 1));\n/**\n * QR code based verification.\n */\nexport class Qr {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Qr.prototype);\n        obj.__wbg_ptr = ptr;\n        QrFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        QrFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_qr_free(ptr, 0);\n    }\n    /**\n     * Get the current state of this request.\n     *\n     * Returns a `QrState`.\n     * @returns {QrState}\n     */\n    state() {\n        const ret = wasm.qr_state(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Has the QR verification been scanned by the other side.\n     *\n     * When the verification object is in this state it’s required\n     * that the user confirms that the other side has scanned the QR\n     * code.\n     * @returns {boolean}\n     */\n    hasBeenScanned() {\n        const ret = wasm.qr_hasBeenScanned(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Has the scanning of the QR code been confirmed by us?\n     * @returns {boolean}\n     */\n    hasBeenConfirmed() {\n        const ret = wasm.qr_hasBeenConfirmed(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Get our own user ID.\n     * @returns {UserId}\n     */\n    get userId() {\n        const ret = wasm.qr_userId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * Get the user id of the other user that is participating in\n     * this verification flow.\n     * @returns {UserId}\n     */\n    get otherUserId() {\n        const ret = wasm.qr_otherUserId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * Get the device ID of the other side.\n     * @returns {DeviceId}\n     */\n    get otherDeviceId() {\n        const ret = wasm.qr_otherDeviceId(this.__wbg_ptr);\n        return DeviceId.__wrap(ret);\n    }\n    /**\n     * Did we initiate the verification request?\n     * @returns {boolean}\n     */\n    weStarted() {\n        const ret = wasm.qr_weStarted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Get info about the cancellation if the verification flow has\n     * been cancelled.\n     * @returns {CancelInfo | undefined}\n     */\n    cancelInfo() {\n        const ret = wasm.qr_cancelInfo(this.__wbg_ptr);\n        return ret === 0 ? undefined : CancelInfo.__wrap(ret);\n    }\n    /**\n     * Has the verification flow completed?\n     * @returns {boolean}\n     */\n    isDone() {\n        const ret = wasm.qr_isDone(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Has the verification flow been cancelled?\n     * @returns {boolean}\n     */\n    isCancelled() {\n        const ret = wasm.qr_isCancelled(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is this a verification that is verifying one of our own devices?\n     * @returns {boolean}\n     */\n    isSelfVerification() {\n        const ret = wasm.qr_isSelfVerification(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Have we successfully scanned the QR code and are able to send\n     * a reciprocation event?\n     * @returns {boolean}\n     */\n    reciprocated() {\n        const ret = wasm.qr_reciprocated(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Get the unique ID that identifies this QR verification flow,\n     * be either a to-device request ID or a room event ID.\n     * @returns {string}\n     */\n    get flowId() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.qr_flowId(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Get the room id if the verification is happening inside a\n     * room.\n     * @returns {RoomId | undefined}\n     */\n    get roomId() {\n        const ret = wasm.qr_roomId(this.__wbg_ptr);\n        return ret === 0 ? undefined : RoomId.__wrap(ret);\n    }\n    /**\n     * Generate a QR code object that is representing this\n     * verification flow.\n     *\n     * The QrCode can then be rendered as an image or as an unicode\n     * string.\n     *\n     * The `to_bytes` method can be used to instead output the raw\n     * bytes that should be encoded as a QR code.\n     *\n     * Returns a `QrCode`.\n     * @returns {QrCode}\n     */\n    toQrCode() {\n        const ret = wasm.qr_toQrCode(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return QrCode.__wrap(ret[0]);\n    }\n    /**\n     * Generate a the raw bytes that should be encoded as a QR code\n     * is representing this verification flow.\n     *\n     * The `to_qr_code` method can be used to instead output a QrCode\n     * object that can be rendered.\n     * @returns {Uint8ClampedArray}\n     */\n    toBytes() {\n        const ret = wasm.qr_toBytes(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Notify the other side that we have successfully scanned the QR\n     * code and that the QR verification flow can start.\n     *\n     * This will return some OutgoingContent if the object is in the\n     * correct state to start the verification flow, otherwise None.\n     * @returns {any}\n     */\n    reciprocate() {\n        const ret = wasm.qr_reciprocate(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Confirm that the other side has scanned our QR code.\n     *\n     * Returns either an `OutgoingRequest` which should be sent out, or\n     * `undefined` if the verification is already confirmed.\n     * @returns {any}\n     */\n    confirmScanning() {\n        const ret = wasm.qr_confirmScanning(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Cancel the verification flow.\n     *\n     * Returns either an `OutgoingRequest` which should be sent out, or\n     * `undefined` if the verification is already cancelled.\n     * @returns {any}\n     */\n    cancel() {\n        const ret = wasm.qr_cancel(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Cancel the verification.\n     *\n     * This cancels the verification with given code (e.g. `m.user`).\n     *\n     * Returns either an `OutgoingRequest` which should be sent out, or\n     * `undefined` if the verification is already cancelled.\n     * @param {string} code\n     * @returns {any}\n     */\n    cancelWithCode(code) {\n        const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.qr_cancelWithCode(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Register a callback which will be called whenever there is an update to\n     * the request\n     *\n     * The `callback` is called with no parameters.\n     * @param {Function} callback\n     */\n    registerChangesCallback(callback) {\n        wasm.qr_registerChangesCallback(this.__wbg_ptr, callback);\n    }\n}\n\nconst QrCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_qrcode_free(ptr >>> 0, 1));\n/**\n * A QR code.\n */\nexport class QrCode {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(QrCode.prototype);\n        obj.__wbg_ptr = ptr;\n        QrCodeFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        QrCodeFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_qrcode_free(ptr, 0);\n    }\n    /**\n     * Render the QR code into a `Uint8ClampedArray` where 1 represents a\n     * dark pixel and 0 a white pixel.\n     * @returns {Uint8ClampedArray}\n     */\n    renderIntoBuffer() {\n        const ret = wasm.qrcode_renderIntoBuffer(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n}\n\nconst QrCodeDataFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_qrcodedata_free(ptr >>> 0, 1));\n/**\n * Data for the QR code login mechanism.\n *\n * The {@link QrCodeData} can be serialized and encoded as a QR code or it can\n * be decoded from a QR code.\n */\nexport class QrCodeData {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(QrCodeData.prototype);\n        obj.__wbg_ptr = ptr;\n        QrCodeDataFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        QrCodeDataFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_qrcodedata_free(ptr, 0);\n    }\n    /**\n     * Create new {@link QrCodeData} from a given public key, a rendezvous URL\n     * and, optionally, a server name for the homeserver.\n     *\n     * If a server name is given, then the {@link QrCodeData} mode will be\n     * {@link QrCodeMode.Reciprocate}, i.e. the QR code will contain data for\n     * the existing device to display the QR code.\n     *\n     * If no server name is given, the {@link QrCodeData} mode will be\n     * {@link QrCodeMode.Login}, i.e. the QR code will contain data for the\n     * new device to display the QR code.\n     * @param {Curve25519PublicKey} public_key\n     * @param {string} rendezvous_url\n     * @param {string | null} [server_name]\n     */\n    constructor(public_key, rendezvous_url, server_name) {\n        _assertClass(public_key, Curve25519PublicKey);\n        var ptr0 = public_key.__destroy_into_raw();\n        const ptr1 = passStringToWasm0(rendezvous_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len1 = WASM_VECTOR_LEN;\n        var ptr2 = isLikeNone(server_name) ? 0 : passStringToWasm0(server_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len2 = WASM_VECTOR_LEN;\n        const ret = wasm.qrcodedata_new(ptr0, ptr1, len1, ptr2, len2);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        QrCodeDataFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Attempt to decode a slice of bytes into a {@link QrCodeData} object.\n     *\n     * The slice of bytes would generally be returned by a QR code decoder.\n     * @param {Uint8Array} bytes\n     * @returns {QrCodeData}\n     */\n    static fromBytes(bytes) {\n        const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.qrcodedata_fromBytes(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return QrCodeData.__wrap(ret[0]);\n    }\n    /**\n     * Encode the {@link QrCodeData} into a list of bytes.\n     *\n     * The list of bytes can be used by a QR code generator to create an image\n     * containing a QR code.\n     * @returns {Uint8Array}\n     */\n    toBytes() {\n        const ret = wasm.qrcodedata_toBytes(this.__wbg_ptr);\n        var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n        wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        return v1;\n    }\n    /**\n     * Attempt to decode a base64 encoded string into a {@link QrCodeData}\n     * object.\n     * @param {string} data\n     * @returns {QrCodeData}\n     */\n    static fromBase64(data) {\n        const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.qrcodedata_fromBase64(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return QrCodeData.__wrap(ret[0]);\n    }\n    /**\n     * Encode the {@link QrCodeData} into a string using base64.\n     *\n     * This format can be used for debugging purposes and the\n     * [`QrcodeData::from_base64()`] method can be used to parse the string\n     * again.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.qrcodedata_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Get the Curve25519 public key embedded in the {@link QrCodeData}.\n     *\n     * This Curve25519 public key should be used to establish an\n     * [ECIES](https://en.wikipedia.org/wiki/Integrated_Encryption_Scheme)\n     * (Elliptic Curve Integrated Encryption Scheme) channel with the other\n     * device.\n     * @returns {Curve25519PublicKey}\n     */\n    get publicKey() {\n        const ret = wasm.qrcodedata_publicKey(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * Get the URL of the rendezvous server which will be used to exchange\n     * messages between the two devices.\n     * @returns {string}\n     */\n    get rendezvousUrl() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.qrcodedata_rendezvousUrl(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Get the server name of the homeserver which the new device will be\n     * logged in to.\n     *\n     * This will be only available if the existing device has generated the QR\n     * code and the new device is the one scanning the QR code.\n     * @returns {string | undefined}\n     */\n    get serverName() {\n        const ret = wasm.qrcodedata_serverName(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * Get the mode of this {@link QrCodeData} instance.\n     * @returns {QrCodeMode}\n     */\n    get mode() {\n        const ret = wasm.qrcodedata_mode(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst QrCodeScanFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_qrcodescan_free(ptr >>> 0, 1));\n/**\n * A scanned QR code.\n */\nexport class QrCodeScan {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(QrCodeScan.prototype);\n        obj.__wbg_ptr = ptr;\n        QrCodeScanFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        QrCodeScanFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_qrcodescan_free(ptr, 0);\n    }\n    /**\n     * Parse the decoded payload of a QR code in byte slice form.\n     *\n     * This method is useful if you would like to do your own custom QR code\n     * decoding.\n     * @param {Uint8ClampedArray} buffer\n     * @returns {QrCodeScan}\n     */\n    static fromBytes(buffer) {\n        const ret = wasm.qrcodescan_fromBytes(buffer);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return QrCodeScan.__wrap(ret[0]);\n    }\n}\n\nconst RehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_rehydrateddevice_free(ptr >>> 0, 1));\n/**\n * A rehydrated device\n *\n * This device can receive to-device events to get room keys that were send to\n * it.\n */\nexport class RehydratedDevice {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RehydratedDevice.prototype);\n        obj.__wbg_ptr = ptr;\n        RehydratedDeviceFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RehydratedDeviceFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_rehydrateddevice_free(ptr, 0);\n    }\n    /**\n     * Receive the to-device events that sent to the dehydrated device\n     *\n     * The rehydrated device will decrypt the events and pass the room keys\n     * into the `OlmMachine`.\n     *\n     * # Arguments\n     *\n     * * `to_device_events` is a JSON-encoded result of the `events` array from\n     *   `/dehydrated_device/{device_id}/events`.\n     * * `decryption_settings`: Optionally, the settings to use when decrypting\n     *   to-device events. If not set, to-device events will be decrypted with\n     *   a {@link TrustRequirement} of `Untrusted`.\n     *\n     * Returns an array of `RoomKeyInfo`, indicating the room keys that were\n     * received.\n     * @param {string} to_device_events\n     * @param {DecryptionSettings | null} [decryption_settings]\n     * @returns {Promise<Array<any>>}\n     */\n    receiveEvents(to_device_events, decryption_settings) {\n        const ptr0 = passStringToWasm0(to_device_events, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        let ptr1 = 0;\n        if (!isLikeNone(decryption_settings)) {\n            _assertClass(decryption_settings, DecryptionSettings);\n            ptr1 = decryption_settings.__destroy_into_raw();\n        }\n        const ret = wasm.rehydrateddevice_receiveEvents(this.__wbg_ptr, ptr0, len0, ptr1);\n        return ret;\n    }\n}\n\nconst RoomIdFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roomid_free(ptr >>> 0, 1));\n/**\n * A Matrix [room ID].\n *\n * [room ID]: https://spec.matrix.org/v1.2/appendices/#room-ids-and-event-ids\n */\nexport class RoomId {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomId.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomIdFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    static __unwrap(jsValue) {\n        if (!(jsValue instanceof RoomId)) {\n            return 0;\n        }\n        return jsValue.__destroy_into_raw();\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomIdFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roomid_free(ptr, 0);\n    }\n    /**\n     * Parse/validate and create a new `RoomId`.\n     * @param {string} id\n     */\n    constructor(id) {\n        const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.roomid_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        RoomIdFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Return the room ID as a string.\n     * @returns {string}\n     */\n    toString() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.roomid_toString(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst RoomKeyCountsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roomkeycounts_free(ptr >>> 0, 1));\n/**\n * Struct holding the number of room keys we have.\n */\nexport class RoomKeyCounts {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomKeyCounts.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomKeyCountsFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomKeyCountsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roomkeycounts_free(ptr, 0);\n    }\n    /**\n     * The total number of room keys.\n     * @returns {number}\n     */\n    get total() {\n        const ret = wasm.__wbg_get_roomkeycounts_total(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The total number of room keys.\n     * @param {number} arg0\n     */\n    set total(arg0) {\n        wasm.__wbg_set_roomkeycounts_total(this.__wbg_ptr, arg0);\n    }\n    /**\n     * The number of backed up room keys.\n     * @returns {number}\n     */\n    get backedUp() {\n        const ret = wasm.__wbg_get_roomkeycounts_backedUp(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The number of backed up room keys.\n     * @param {number} arg0\n     */\n    set backedUp(arg0) {\n        wasm.__wbg_set_roomkeycounts_backedUp(this.__wbg_ptr, arg0);\n    }\n}\n\nconst RoomKeyImportResultFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyimportresult_free(ptr >>> 0, 1));\n/**\n * The result of a call to {@link OlmMachine.importExportedRoomKeys} or\n * {@link OlmMachine.importBackedUpRoomKeys}.\n */\nexport class RoomKeyImportResult {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomKeyImportResult.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomKeyImportResultFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomKeyImportResultFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roomkeyimportresult_free(ptr, 0);\n    }\n    /**\n     * The number of room keys that were imported.\n     * @returns {number}\n     */\n    get importedCount() {\n        const ret = wasm.__wbg_get_roomkeyimportresult_importedCount(this.__wbg_ptr);\n        return ret >>> 0;\n    }\n    /**\n     * The total number of room keys that were found in the export.\n     * @returns {number}\n     */\n    get totalCount() {\n        const ret = wasm.__wbg_get_roomkeyimportresult_totalCount(this.__wbg_ptr);\n        return ret >>> 0;\n    }\n    /**\n     * The keys that were imported.\n     *\n     * A Map from room id to a Map of the sender key to a Set of session ids.\n     *\n     * Typescript type: `Map<string, Map<string, Set<string>>`.\n     * @returns {Map<any, any>}\n     */\n    keys() {\n        const ret = wasm.roomkeyimportresult_keys(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst RoomKeyInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyinfo_free(ptr >>> 0, 1));\n/**\n * Information on a room key that has been received or imported.\n */\nexport class RoomKeyInfo {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomKeyInfo.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomKeyInfoFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomKeyInfoFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roomkeyinfo_free(ptr, 0);\n    }\n    /**\n     * The {@link EncryptionAlgorithm} that this key is used for. Will be one\n     * of the `m.megolm.*` algorithms.\n     * @returns {EncryptionAlgorithm}\n     */\n    get algorithm() {\n        const ret = wasm.roomkeyinfo_algorithm(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The room where the key is used.\n     * @returns {RoomId}\n     */\n    get roomId() {\n        const ret = wasm.roomkeyinfo_roomId(this.__wbg_ptr);\n        return RoomId.__wrap(ret);\n    }\n    /**\n     * The Curve25519 key of the device which initiated the session originally.\n     * @returns {Curve25519PublicKey}\n     */\n    get senderKey() {\n        const ret = wasm.roomkeyinfo_senderKey(this.__wbg_ptr);\n        return Curve25519PublicKey.__wrap(ret);\n    }\n    /**\n     * The ID of the session that the key is for.\n     * @returns {string}\n     */\n    get sessionId() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.roomkeyinfo_sessionId(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst RoomKeyWithheldInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roomkeywithheldinfo_free(ptr >>> 0, 1));\n/**\n * Information on a received `m.room_key.withheld` event.\n */\nexport class RoomKeyWithheldInfo {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomKeyWithheldInfo.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomKeyWithheldInfoFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomKeyWithheldInfoFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roomkeywithheldinfo_free(ptr, 0);\n    }\n    /**\n     * The User ID of the user that sent us the `m.room_key.withheld` message.\n     * @returns {UserId}\n     */\n    get sender() {\n        const ret = wasm.roomkeywithheldinfo_sender(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The encryption algorithm of the session that is being withheld.\n     * @returns {EncryptionAlgorithm}\n     */\n    get algorithm() {\n        const ret = wasm.roomkeywithheldinfo_algorithm(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The `code` from the `m.room_key.withheld` message, such as\n     * `m.unverified`.\n     * @returns {string}\n     */\n    get withheldCode() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.roomkeywithheldinfo_withheldCode(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The room ID of the session that is being withheld.\n     * @returns {RoomId}\n     */\n    get roomId() {\n        const ret = wasm.roomkeywithheldinfo_roomId(this.__wbg_ptr);\n        return RoomId.__wrap(ret);\n    }\n    /**\n     * The session ID of the session that is being withheld.\n     * @returns {string}\n     */\n    get sessionId() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.roomkeywithheldinfo_sessionId(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst RoomMessageRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roommessagerequest_free(ptr >>> 0, 1));\n/**\n * A customized owned request type for sending out room messages\n * ([specification]).\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid\n */\nexport class RoomMessageRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomMessageRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomMessageRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomMessageRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roommessagerequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * @returns {string}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_roommessagerequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A string representing the room to send the event to.\n     * @returns {string}\n     */\n    get room_id() {\n        const ret = wasm.__wbg_get_roommessagerequest_room_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A string representing the transaction ID for this event.\n     *\n     * Clients should generate an ID unique across requests with the same\n     * access token; it will be used by the server to ensure idempotency of\n     * requests.\n     * @returns {string}\n     */\n    get txn_id() {\n        const ret = wasm.__wbg_get_roommessagerequest_txn_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A string representing the type of event to be sent.\n     * @returns {string}\n     */\n    get event_type() {\n        const ret = wasm.__wbg_get_roommessagerequest_event_type(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the message's content.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_roommessagerequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `RoomMessageRequest`.\n     * @param {string} id\n     * @param {string} room_id\n     * @param {string} txn_id\n     * @param {string} event_type\n     * @param {string} content\n     */\n    constructor(id, room_id, txn_id, event_type, content) {\n        const ret = wasm.roommessagerequest_new(id, room_id, txn_id, event_type, content);\n        this.__wbg_ptr = ret >>> 0;\n        RoomMessageRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.roommessagerequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst RoomSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_roomsettings_free(ptr >>> 0, 1));\n/**\n * Room encryption settings which are modified by state events or user options\n */\nexport class RoomSettings {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(RoomSettings.prototype);\n        obj.__wbg_ptr = ptr;\n        RoomSettingsFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        RoomSettingsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_roomsettings_free(ptr, 0);\n    }\n    /**\n     * The encryption algorithm that should be used in the room.\n     *\n     * Should be one of the members of {@link EncryptionAlgorithm}.\n     * @returns {EncryptionAlgorithm}\n     */\n    get algorithm() {\n        const ret = wasm.__wbg_get_roomsettings_algorithm(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The encryption algorithm that should be used in the room.\n     *\n     * Should be one of the members of {@link EncryptionAlgorithm}.\n     * @param {EncryptionAlgorithm} arg0\n     */\n    set algorithm(arg0) {\n        wasm.__wbg_set_roomsettings_algorithm(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Whether state event encryption is enabled.\n     * @returns {boolean}\n     */\n    get encryptStateEvents() {\n        const ret = wasm.__wbg_get_roomsettings_encryptStateEvents(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Whether state event encryption is enabled.\n     * @param {boolean} arg0\n     */\n    set encryptStateEvents(arg0) {\n        wasm.__wbg_set_roomsettings_encryptStateEvents(this.__wbg_ptr, arg0);\n    }\n    /**\n     * Whether untrusted devices should receive room keys. If this is `false`,\n     * they will be excluded from the conversation.\n     * @returns {boolean}\n     */\n    get onlyAllowTrustedDevices() {\n        const ret = wasm.__wbg_get_roomsettings_onlyAllowTrustedDevices(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Whether untrusted devices should receive room keys. If this is `false`,\n     * they will be excluded from the conversation.\n     * @param {boolean} arg0\n     */\n    set onlyAllowTrustedDevices(arg0) {\n        wasm.__wbg_set_roomsettings_onlyAllowTrustedDevices(this.__wbg_ptr, arg0);\n    }\n    /**\n     * The maximum time, in milliseconds, that an encryption session should be\n     * used for, before it is rotated.\n     * @returns {number | undefined}\n     */\n    get sessionRotationPeriodMs() {\n        const ret = wasm.__wbg_get_roomsettings_sessionRotationPeriodMs(this.__wbg_ptr);\n        return ret[0] === 0 ? undefined : ret[1];\n    }\n    /**\n     * The maximum time, in milliseconds, that an encryption session should be\n     * used for, before it is rotated.\n     * @param {number | null} [arg0]\n     */\n    set sessionRotationPeriodMs(arg0) {\n        wasm.__wbg_set_roomsettings_sessionRotationPeriodMs(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? 0 : arg0);\n    }\n    /**\n     * The maximum number of messages an encryption session should be used for,\n     * before it is rotated.\n     * @returns {number | undefined}\n     */\n    get sessionRotationPeriodMessages() {\n        const ret = wasm.__wbg_get_roomsettings_sessionRotationPeriodMessages(this.__wbg_ptr);\n        return ret[0] === 0 ? undefined : ret[1];\n    }\n    /**\n     * The maximum number of messages an encryption session should be used for,\n     * before it is rotated.\n     * @param {number | null} [arg0]\n     */\n    set sessionRotationPeriodMessages(arg0) {\n        wasm.__wbg_set_roomsettings_sessionRotationPeriodMessages(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? 0 : arg0);\n    }\n    /**\n     * Create a new `RoomSettings` with default values.\n     */\n    constructor() {\n        const ret = wasm.roomsettings_new();\n        this.__wbg_ptr = ret >>> 0;\n        RoomSettingsFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst SasFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_sas_free(ptr >>> 0, 1));\n/**\n * Short Authentication String (SAS) verification.\n */\nexport class Sas {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Sas.prototype);\n        obj.__wbg_ptr = ptr;\n        SasFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        SasFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_sas_free(ptr, 0);\n    }\n    /**\n     * Get our own user ID.\n     * @returns {UserId}\n     */\n    get userId() {\n        const ret = wasm.sas_userId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * Get our own device ID.\n     * @returns {DeviceId}\n     */\n    get deviceId() {\n        const ret = wasm.sas_deviceId(this.__wbg_ptr);\n        return DeviceId.__wrap(ret);\n    }\n    /**\n     * Get the user id of the other side.\n     * @returns {UserId}\n     */\n    get otherUserId() {\n        const ret = wasm.sas_otherUserId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * Get the device ID of the other side.\n     * @returns {DeviceId}\n     */\n    get otherDeviceId() {\n        const ret = wasm.sas_otherDeviceId(this.__wbg_ptr);\n        return DeviceId.__wrap(ret);\n    }\n    /**\n     * Get the unique ID that identifies this SAS verification flow,\n     * be either a to-device request ID or a room event ID.\n     * @returns {string}\n     */\n    get flowId() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.sas_flowId(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Get the room ID if the verification is happening inside a\n     * room.\n     * @returns {RoomId | undefined}\n     */\n    get roomId() {\n        const ret = wasm.sas_roomId(this.__wbg_ptr);\n        return ret === 0 ? undefined : RoomId.__wrap(ret);\n    }\n    /**\n     * Does this verification flow support displaying emoji for the\n     * short authentication string?\n     * @returns {boolean}\n     */\n    supportsEmoji() {\n        const ret = wasm.sas_supportsEmoji(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Did this verification flow start from a verification request?\n     * @returns {boolean}\n     */\n    startedFromRequest() {\n        const ret = wasm.sas_startedFromRequest(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is this a verification that is verifying one of our own\n     * devices?\n     * @returns {boolean}\n     */\n    isSelfVerification() {\n        const ret = wasm.sas_isSelfVerification(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Have we confirmed that the short auth string matches?\n     * @returns {boolean}\n     */\n    haveWeConfirmed() {\n        const ret = wasm.sas_haveWeConfirmed(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Has the verification been accepted by both parties?\n     * @returns {boolean}\n     */\n    hasBeenAccepted() {\n        const ret = wasm.sas_hasBeenAccepted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Get info about the cancellation if the verification flow has\n     * been cancelled.\n     * @returns {CancelInfo | undefined}\n     */\n    cancelInfo() {\n        const ret = wasm.sas_cancelInfo(this.__wbg_ptr);\n        return ret === 0 ? undefined : CancelInfo.__wrap(ret);\n    }\n    /**\n     * True if we initiated the verification flow (ie, we sent the\n     * `m.key.verification.request`).\n     * @returns {boolean}\n     */\n    weStarted() {\n        const ret = wasm.sas_weStarted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Accept the SAS verification.\n     *\n     * This does nothing (and returns `undefined`) if the verification was\n     * already accepted, otherwise it returns an `OutgoingRequest`\n     * that needs to be sent out.\n     * @returns {any}\n     */\n    accept() {\n        const ret = wasm.sas_accept(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Confirm the SAS verification.\n     *\n     * This confirms that the short auth strings match on both sides.\n     *\n     * Does nothing if we’re not in a state where we can confirm the\n     * short auth string.\n     *\n     * Returns a `Promise` for an array of `OutgoingRequest`s.\n     * @returns {Promise<any>}\n     */\n    confirm() {\n        const ret = wasm.sas_confirm(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Cancel the verification.\n     *\n     * Returns either an `OutgoingRequest` which should be sent out, or\n     * `undefined` if the verification is already cancelled.\n     * @returns {any}\n     */\n    cancel() {\n        const ret = wasm.sas_cancel(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Cancel the verification.\n     *\n     * This cancels the verification with given code (e.g. `m.user`).\n     *\n     * Returns either an `OutgoingRequest` which should be sent out, or\n     * `undefined` if the verification is already cancelled.\n     * @param {string} code\n     * @returns {any}\n     */\n    cancelWithCode(code) {\n        const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.sas_cancelWithCode(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Has the SAS verification flow timed out?\n     * @returns {boolean}\n     */\n    timedOut() {\n        const ret = wasm.sas_timedOut(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Are we in a state where we can show the short auth string?\n     * @returns {boolean}\n     */\n    canBePresented() {\n        const ret = wasm.sas_canBePresented(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is the SAS flow done?\n     * @returns {boolean}\n     */\n    isDone() {\n        const ret = wasm.sas_isDone(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is the SAS flow cancelled?\n     * @returns {boolean}\n     */\n    isCancelled() {\n        const ret = wasm.sas_isCancelled(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Get the emoji version of the short auth string.\n     *\n     * Returns `undefined` if we can't yet present the short auth string,\n     * otherwise an array of seven `Emoji` objects.\n     * @returns {Emoji[] | undefined}\n     */\n    emoji() {\n        const ret = wasm.sas_emoji(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n        }\n        return v1;\n    }\n    /**\n     * Get the index of the emoji representing the short auth string\n     *\n     * Returns `undefined` if we can’t yet present the short auth\n     * string, otherwise seven `u8` numbers in the range from 0 to 63\n     * inclusive which can be converted to an emoji using [the\n     * relevant specification\n     * entry](https://spec.matrix.org/unstable/client-server-api/#sas-method-emoji).\n     * @returns {Uint8Array | undefined}\n     */\n    emojiIndex() {\n        const ret = wasm.sas_emojiIndex(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n    /**\n     * Get the decimal version of the short auth string.\n     *\n     * Returns None if we can’t yet present the short auth string,\n     * otherwise a tuple containing three 4-digit integers that\n     * represent the short auth string.\n     * @returns {Uint16Array | undefined}\n     */\n    decimals() {\n        const ret = wasm.sas_decimals(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getArrayU16FromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 2, 2);\n        }\n        return v1;\n    }\n    /**\n     * Register a callback which will be called whenever there is an update to\n     * the request.\n     *\n     * The `callback` is called with no parameters.\n     * @param {Function} callback\n     */\n    registerChangesCallback(callback) {\n        wasm.sas_registerChangesCallback(this.__wbg_ptr, callback);\n    }\n}\n\nconst SecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_secretsbundle_free(ptr >>> 0, 1));\n/**\n * Struct containing the bundle of secrets to fully activate a new device for\n * end-to-end encryption.\n */\nexport class SecretsBundle {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(SecretsBundle.prototype);\n        obj.__wbg_ptr = ptr;\n        SecretsBundleFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        SecretsBundleFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_secretsbundle_free(ptr, 0);\n    }\n    /**\n     * The seed of the master key encoded as unpadded base64.\n     * @returns {string}\n     */\n    get masterKey() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.secretsbundle_masterKey(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The seed of the self signing key encoded as unpadded base64.\n     * @returns {string}\n     */\n    get selfSigningKey() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.secretsbundle_selfSigningKey(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The seed of the user signing key encoded as unpadded base64.\n     * @returns {string}\n     */\n    get userSigningKey() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.secretsbundle_userSigningKey(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The bundle of the backup decryption key and backup version if any.\n     * @returns {BackupSecretsBundle | undefined}\n     */\n    get backupBundle() {\n        const ret = wasm.secretsbundle_backupBundle(this.__wbg_ptr);\n        return ret === 0 ? undefined : BackupSecretsBundle.__wrap(ret);\n    }\n    /**\n     * Serialize the [`SecretsBundle`] to a JSON object.\n     * @returns {any}\n     */\n    to_json() {\n        const ret = wasm.secretsbundle_to_json(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Deserialize the [`SecretsBundle`] from a JSON object.\n     * @param {any} json\n     * @returns {SecretsBundle}\n     */\n    static from_json(json) {\n        const ret = wasm.secretsbundle_from_json(json);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return SecretsBundle.__wrap(ret[0]);\n    }\n}\n\nconst ServerNameFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_servername_free(ptr >>> 0, 1));\n/**\n * A Matrix-spec compliant [server name].\n *\n * It consists of a host and an optional port (separated by a colon if\n * present).\n *\n * [server name]: https://spec.matrix.org/v1.2/appendices/#server-name\n */\nexport class ServerName {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(ServerName.prototype);\n        obj.__wbg_ptr = ptr;\n        ServerNameFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        ServerNameFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_servername_free(ptr, 0);\n    }\n    /**\n     * Parse/validate and create a new `ServerName`.\n     * @param {string} name\n     */\n    constructor(name) {\n        const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.servername_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        ServerNameFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Returns the host of the server name.\n     *\n     * That is: Return the part of the server before `:<port>` or the\n     * full server name if there is no port.\n     * @returns {string}\n     */\n    get host() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.servername_host(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Returns the port of the server name if any.\n     * @returns {number | undefined}\n     */\n    get port() {\n        const ret = wasm.servername_port(this.__wbg_ptr);\n        return ret === 0xFFFFFF ? undefined : ret;\n    }\n    /**\n     * Returns true if and only if the server name is an IPv4 or IPv6\n     * address.\n     * @returns {boolean}\n     */\n    isIpLiteral() {\n        const ret = wasm.servername_isIpLiteral(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst ShieldStateFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_shieldstate_free(ptr >>> 0, 1));\n/**\n * Take a look at [`matrix_sdk_common::deserialized_responses::ShieldState`]\n * for more info.\n */\nexport class ShieldState {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(ShieldState.prototype);\n        obj.__wbg_ptr = ptr;\n        ShieldStateFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        ShieldStateFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_shieldstate_free(ptr, 0);\n    }\n    /**\n     * The shield color\n     * @returns {ShieldColor}\n     */\n    get color() {\n        const ret = wasm.__wbg_get_shieldstate_color(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The shield color\n     * @param {ShieldColor} arg0\n     */\n    set color(arg0) {\n        wasm.__wbg_set_shieldstate_color(this.__wbg_ptr, arg0);\n    }\n    /**\n     * A machine-readable representation of the authenticity for a\n     * `ShieldState`.\n     * @returns {ShieldStateCode | undefined}\n     */\n    get code() {\n        const ret = wasm.__wbg_get_shieldstate_code(this.__wbg_ptr);\n        return ret === 7 ? undefined : ret;\n    }\n    /**\n     * A machine-readable representation of the authenticity for a\n     * `ShieldState`.\n     * @param {ShieldStateCode | null} [arg0]\n     */\n    set code(arg0) {\n        wasm.__wbg_set_shieldstate_code(this.__wbg_ptr, isLikeNone(arg0) ? 7 : arg0);\n    }\n    /**\n     * Error message that can be displayed as a tooltip\n     * @returns {string | undefined}\n     */\n    get message() {\n        const ret = wasm.shieldstate_message(this.__wbg_ptr);\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n        }\n        return v1;\n    }\n}\n\nconst SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_signature_free(ptr >>> 0, 1));\n/**\n * Represents a potentially decoded signature (but not a validated\n * one).\n */\nexport class Signature {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Signature.prototype);\n        obj.__wbg_ptr = ptr;\n        SignatureFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        SignatureFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_signature_free(ptr, 0);\n    }\n    /**\n     * Get the Ed25519 signature, if this is one.\n     * @returns {Ed25519Signature | undefined}\n     */\n    get ed25519() {\n        const ret = wasm.signature_ed25519(this.__wbg_ptr);\n        return ret === 0 ? undefined : Ed25519Signature.__wrap(ret);\n    }\n    /**\n     * Convert the signature to a base64 encoded string.\n     * @returns {string}\n     */\n    toBase64() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.signature_toBase64(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst SignatureUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_signatureuploadrequest_free(ptr >>> 0, 1));\n/**\n * Data for a request to the `/keys/signatures/upload` API endpoint\n * ([specification]).\n *\n * Publishes cross-signing signatures for the user.\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#post_matrixclientv3keyssignaturesupload\n */\nexport class SignatureUploadRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(SignatureUploadRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        SignatureUploadRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        SignatureUploadRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_signatureuploadrequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * Some signature upload will have to an `id` field, some won't.\n     * They have one when they are created automatically during an interactive\n     * verification, otherwise they don't.\n     * @returns {string | undefined}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_signatureuploadrequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the payload of the request\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_signatureuploadrequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `SignatureUploadRequest`.\n     * @param {string} id\n     * @param {string} signed_keys\n     */\n    constructor(id, signed_keys) {\n        const ret = wasm.signatureuploadrequest_new(id, signed_keys);\n        this.__wbg_ptr = ret >>> 0;\n        SignatureUploadRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.signatureuploadrequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst SignatureVerificationFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_signatureverification_free(ptr >>> 0, 1));\n/**\n * The result of a signature verification of a signed JSON object.\n */\nexport class SignatureVerification {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(SignatureVerification.prototype);\n        obj.__wbg_ptr = ptr;\n        SignatureVerificationFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        SignatureVerificationFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_signatureverification_free(ptr, 0);\n    }\n    /**\n     * Give the backup signature state from the current device.\n     * See SignatureState for values\n     * @returns {SignatureState}\n     */\n    get deviceState() {\n        const ret = wasm.signatureverification_deviceState(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Give the backup signature state from the current user identity.\n     * See SignatureState for values\n     * @returns {SignatureState}\n     */\n    get userState() {\n        const ret = wasm.signatureverification_userState(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Is the result considered to be trusted?\n     *\n     * This tells us if the result has a valid signature from any of the\n     * following:\n     *\n     * * Our own device\n     * * Our own user identity, provided the identity is trusted as well\n     * * Any of our own devices, provided the device is trusted as well\n     * @returns {boolean}\n     */\n    trusted() {\n        const ret = wasm.signatureverification_trusted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst SignaturesFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_signatures_free(ptr >>> 0, 1));\n/**\n * A collection of `Signature`.\n */\nexport class Signatures {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Signatures.prototype);\n        obj.__wbg_ptr = ptr;\n        SignaturesFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        SignaturesFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_signatures_free(ptr, 0);\n    }\n    /**\n     * Creates a new, empty, signatures collection.\n     */\n    constructor() {\n        const ret = wasm.signatures_new();\n        this.__wbg_ptr = ret >>> 0;\n        SignaturesFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Add the given signature from the given signer and the given key ID to\n     * the collection.\n     * @param {UserId} signer\n     * @param {DeviceKeyId} key_id\n     * @param {Ed25519Signature} signature\n     * @returns {MaybeSignature | undefined}\n     */\n    addSignature(signer, key_id, signature) {\n        _assertClass(signer, UserId);\n        _assertClass(key_id, DeviceKeyId);\n        _assertClass(signature, Ed25519Signature);\n        const ret = wasm.signatures_addSignature(this.__wbg_ptr, signer.__wbg_ptr, key_id.__wbg_ptr, signature.__wbg_ptr);\n        return ret === 0 ? undefined : MaybeSignature.__wrap(ret);\n    }\n    /**\n     * Try to find an Ed25519 signature from the given signer with\n     * the given key ID.\n     * @param {UserId} signer\n     * @param {DeviceKeyId} key_id\n     * @returns {Ed25519Signature | undefined}\n     */\n    getSignature(signer, key_id) {\n        _assertClass(signer, UserId);\n        _assertClass(key_id, DeviceKeyId);\n        const ret = wasm.signatures_getSignature(this.__wbg_ptr, signer.__wbg_ptr, key_id.__wbg_ptr);\n        return ret === 0 ? undefined : Ed25519Signature.__wrap(ret);\n    }\n    /**\n     * Get the map of signatures that belong to the given user.\n     * @param {UserId} signer\n     * @returns {Map<any, any> | undefined}\n     */\n    get(signer) {\n        _assertClass(signer, UserId);\n        const ret = wasm.signatures_get(this.__wbg_ptr, signer.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Remove all the signatures we currently hold.\n     */\n    clear() {\n        wasm.signatures_clear(this.__wbg_ptr);\n    }\n    /**\n     * Do we hold any signatures or is our collection completely\n     * empty.\n     * @returns {boolean}\n     */\n    isEmpty() {\n        const ret = wasm.signatures_isEmpty(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * How many signatures do we currently hold.\n     * @returns {number}\n     */\n    get count() {\n        const ret = wasm.signatures_count(this.__wbg_ptr);\n        return ret >>> 0;\n    }\n    /**\n     * Get the json with all signatures\n     * @returns {string}\n     */\n    asJSON() {\n        const ret = wasm.signatures_asJSON(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n}\n\nconst StoreHandleFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_storehandle_free(ptr >>> 0, 1));\n/**\n * A struct containing an open connection to a CryptoStore.\n *\n * Opening the CryptoStore can take some time, due to the PBKDF calculation\n * involved, so if multiple operations are being done on the same store, it is\n * more efficient to open it once.\n */\nexport class StoreHandle {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(StoreHandle.prototype);\n        obj.__wbg_ptr = ptr;\n        StoreHandleFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        StoreHandleFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_storehandle_free(ptr, 0);\n    }\n    /**\n     * Open a crypto store.\n     *\n     * The created store will be based on IndexedDB if a `store_name` is\n     * provided; otherwise it will be based on a memory store and once the\n     * objects is dropped, the keys will be lost.\n     *\n     * # Arguments\n     *\n     * * `store_name` - The name that should be used to open the IndexedDB\n     *   based database. If this isn't provided, a memory-only store will be\n     *   used. *Note* the memory-only store will lose your E2EE keys when the\n     *   `StoreHandle` gets dropped.\n     *\n     * * `store_passphrase` - The passphrase that should be used to encrypt the\n     *   store, for IndexedDB-based stores\n     *\n     * * `logger` - An optional logger instance to use for writing log messages\n     *   during the open operation. An instance of `JsLogger`.\n     * @param {string | null} [store_name]\n     * @param {string | null} [store_passphrase]\n     * @param {any | null} [logger]\n     * @returns {Promise<StoreHandle>}\n     */\n    static open(store_name, store_passphrase, logger) {\n        var ptr0 = isLikeNone(store_name) ? 0 : passStringToWasm0(store_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len0 = WASM_VECTOR_LEN;\n        var ptr1 = isLikeNone(store_passphrase) ? 0 : passStringToWasm0(store_passphrase, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        var len1 = WASM_VECTOR_LEN;\n        const ret = wasm.storehandle_open(ptr0, len0, ptr1, len1, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        return ret;\n    }\n    /**\n     * Open a crypto store based on IndexedDB, using the given key for\n     * encryption.\n     *\n     * # Arguments\n     *\n     * * `store_name` - The name that should be used to open the IndexedDB\n     *   based database.\n     *\n     * * `store_key` - The key that should be used to encrypt the store, for\n     *   IndexedDB-based stores. Must be a 32-byte array.\n     *\n     * * `logger` - An optional logger instance to use for writing log messages\n     *   during the open operation. An instance of `JsLogger`.\n     * @param {string} store_name\n     * @param {Uint8Array} store_key\n     * @param {any | null} [logger]\n     * @returns {Promise<StoreHandle>}\n     */\n    static openWithKey(store_name, store_key, logger) {\n        const ptr0 = passStringToWasm0(store_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ptr1 = passArray8ToWasm0(store_key, wasm.__wbindgen_malloc);\n        const len1 = WASM_VECTOR_LEN;\n        const ret = wasm.storehandle_openWithKey(ptr0, len0, ptr1, len1, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n        return ret;\n    }\n}\n\nconst StoredRoomKeyBundleDataFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_storedroomkeybundledata_free(ptr >>> 0, 1));\n/**\n * Information on a stored room key bundle data event.\n */\nexport class StoredRoomKeyBundleData {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(StoredRoomKeyBundleData.prototype);\n        obj.__wbg_ptr = ptr;\n        StoredRoomKeyBundleDataFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        StoredRoomKeyBundleDataFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_storedroomkeybundledata_free(ptr, 0);\n    }\n    /**\n     * The user that sent us this data.\n     * @returns {UserId}\n     */\n    get senderUser() {\n        const ret = wasm.storedroomkeybundledata_senderUser(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The room that these keys are for.\n     * @returns {RoomId}\n     */\n    get roomId() {\n        const ret = wasm.storedroomkeybundledata_roomId(this.__wbg_ptr);\n        return RoomId.__wrap(ret);\n    }\n    /**\n     * The location of the bundle.\n     * @returns {string}\n     */\n    get url() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.storedroomkeybundledata_url(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The JSON-encoded encryption info for the key bundle.\n     *\n     * @deprecated Should not be used within applications.\n     * @returns {string}\n     */\n    get encryptionInfo() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.storedroomkeybundledata_encryptionInfo(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n}\n\nconst ToDeviceEncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_todeviceencryptioninfo_free(ptr >>> 0, 1));\n/**\n * Struct containing information on how a to-device message was decrypted.\n */\nexport class ToDeviceEncryptionInfo {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(ToDeviceEncryptionInfo.prototype);\n        obj.__wbg_ptr = ptr;\n        ToDeviceEncryptionInfoFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        ToDeviceEncryptionInfoFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_todeviceencryptioninfo_free(ptr, 0);\n    }\n    /**\n     * The base64-encoded public Curve25519 key of the device that encrypted\n     * the message.\n     * @returns {string}\n     */\n    get senderCurve25519Key() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.__wbg_get_todeviceencryptioninfo_senderCurve25519Key(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * The base64-encoded public Curve25519 key of the device that encrypted\n     * the message.\n     * @param {string} arg0\n     */\n    set senderCurve25519Key(arg0) {\n        const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        wasm.__wbg_set_backupsecretsbundle_key(this.__wbg_ptr, ptr0, len0);\n    }\n    /**\n     * The user ID of the sender of the event.\n     *\n     * Note this is untrusted data unless {@link isSenderVerified} is true.\n     * @returns {UserId}\n     */\n    get sender() {\n        const ret = wasm.__wbg_get_todeviceencryptioninfo_sender(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The user ID of the sender of the event.\n     *\n     * Note this is untrusted data unless {@link isSenderVerified} is true.\n     * @param {UserId} arg0\n     */\n    set sender(arg0) {\n        _assertClass(arg0, UserId);\n        var ptr0 = arg0.__destroy_into_raw();\n        wasm.__wbg_set_todeviceencryptioninfo_sender(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * The device ID of the device that sent us the to-device message.\n     *\n     * Could be `undefined` in the case where the to-device message sender\n     * checks are delayed. There is no delay for to-device messages other\n     * than `m.room_key`, so this will always be truthy for other\n     * message types (the decryption would fail if the sender device keys\n     * cannot be found).\n     *\n     * Note this is untrusted data unless {@link isSenderVerified} is true.\n     * @returns {DeviceId | undefined}\n     */\n    get senderDevice() {\n        const ret = wasm.__wbg_get_todeviceencryptioninfo_senderDevice(this.__wbg_ptr);\n        return ret === 0 ? undefined : DeviceId.__wrap(ret);\n    }\n    /**\n     * The device ID of the device that sent us the to-device message.\n     *\n     * Could be `undefined` in the case where the to-device message sender\n     * checks are delayed. There is no delay for to-device messages other\n     * than `m.room_key`, so this will always be truthy for other\n     * message types (the decryption would fail if the sender device keys\n     * cannot be found).\n     *\n     * Note this is untrusted data unless {@link isSenderVerified} is true.\n     * @param {DeviceId | null} [arg0]\n     */\n    set senderDevice(arg0) {\n        let ptr0 = 0;\n        if (!isLikeNone(arg0)) {\n            _assertClass(arg0, DeviceId);\n            ptr0 = arg0.__destroy_into_raw();\n        }\n        wasm.__wbg_set_todeviceencryptioninfo_senderDevice(this.__wbg_ptr, ptr0);\n    }\n    /**\n     * Returns whether the sender device is in a verified state.\n     * This reflects the state at the time of decryption.\n     * @returns {boolean}\n     */\n    isSenderVerified() {\n        const ret = wasm.todeviceencryptioninfo_isSenderVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n}\n\nconst ToDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_todevicerequest_free(ptr >>> 0, 1));\n/**\n * Data for a request to the `/sendToDevice` API endpoint\n * ([specification]).\n *\n * Send an event to a single device or to a group of devices.\n *\n * [specification]: https://spec.matrix.org/unstable/client-server-api/#put_matrixclientv3sendtodeviceeventtypetxnid\n */\nexport class ToDeviceRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(ToDeviceRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        ToDeviceRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        ToDeviceRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_todevicerequest_free(ptr, 0);\n    }\n    /**\n     * The request ID.\n     * For to-device request this would be the same value as `txn_id`. It is\n     * exposed also as `id` so that the js bindings are consistent with the\n     * other request types by using this field to mark as sent.\n     * @returns {string}\n     */\n    get id() {\n        const ret = wasm.__wbg_get_todevicerequest_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A string representing the type of event being sent to each devices.\n     * @returns {string}\n     */\n    get event_type() {\n        const ret = wasm.__wbg_get_todevicerequest_event_type(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A string representing a request identifier unique to the access token\n     * used to send the request.\n     * @returns {string}\n     */\n    get txn_id() {\n        const ret = wasm.__wbg_get_todevicerequest_txn_id(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `messages`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_todevicerequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `ToDeviceRequest`.\n     * @param {string} id\n     * @param {string} event_type\n     * @param {string} txn_id\n     * @param {string} body\n     */\n    constructor(id, event_type, txn_id, body) {\n        const ret = wasm.todevicerequest_new(id, event_type, txn_id, body);\n        this.__wbg_ptr = ret >>> 0;\n        ToDeviceRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Get its request type.\n     * @returns {RequestType}\n     */\n    get type() {\n        const ret = wasm.todevicerequest_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst ToDeviceUnableToDecryptInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_todeviceunabletodecryptinfo_free(ptr >>> 0, 1));\n/**\n * Metadata about a to-device event that could not be decrypted.\n */\nexport class ToDeviceUnableToDecryptInfo {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(ToDeviceUnableToDecryptInfo.prototype);\n        obj.__wbg_ptr = ptr;\n        ToDeviceUnableToDecryptInfoFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        ToDeviceUnableToDecryptInfoFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_todeviceunabletodecryptinfo_free(ptr, 0);\n    }\n    /**\n     * Reason code for the decryption failure\n     * @returns {ToDeviceUnableToDecryptReason}\n     */\n    get reason() {\n        const ret = wasm.__wbg_get_todeviceunabletodecryptinfo_reason(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Reason code for the decryption failure\n     * @param {ToDeviceUnableToDecryptReason} arg0\n     */\n    set reason(arg0) {\n        wasm.__wbg_set_todeviceunabletodecryptinfo_reason(this.__wbg_ptr, arg0);\n    }\n}\n\nconst TracingFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_tracing_free(ptr >>> 0, 1));\n/**\n * Type to install and to manipulate the tracing layer.\n */\nexport class Tracing {\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        TracingFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_tracing_free(ptr, 0);\n    }\n    /**\n     * Check whether the `tracing` feature has been enabled.\n     *\n     * @deprecated: `tracing` is now always enabled.\n     * @returns {boolean}\n     */\n    static isAvailable() {\n        const ret = wasm.tracing_isAvailable();\n        return ret !== 0;\n    }\n    /**\n     * Install the tracing layer.\n     * @param {LoggerLevel} min_level\n     */\n    constructor(min_level) {\n        const ret = wasm.tracing_new(min_level);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        TracingFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Re-define the minimum logger level.\n     * @param {LoggerLevel} min_level\n     */\n    set minLevel(min_level) {\n        const ret = wasm.tracing_set_minLevel(this.__wbg_ptr, min_level);\n        if (ret[1]) {\n            throw takeFromExternrefTable0(ret[0]);\n        }\n    }\n    /**\n     * Turn the logger on, i.e. it emits logs again if it was turned\n     * off.\n     */\n    turnOn() {\n        const ret = wasm.tracing_turnOn(this.__wbg_ptr);\n        if (ret[1]) {\n            throw takeFromExternrefTable0(ret[0]);\n        }\n    }\n    /**\n     * Turn the logger off, i.e. it no longer emits logs.\n     */\n    turnOff() {\n        const ret = wasm.tracing_turnOff(this.__wbg_ptr);\n        if (ret[1]) {\n            throw takeFromExternrefTable0(ret[0]);\n        }\n    }\n}\n\nconst UTDToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_utdtodeviceevent_free(ptr >>> 0, 1));\n/**\n * Represents an encrypted to-device event that could not be decrypted.\n */\nexport class UTDToDeviceEvent {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(UTDToDeviceEvent.prototype);\n        obj.__wbg_ptr = ptr;\n        UTDToDeviceEventFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        UTDToDeviceEventFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_utdtodeviceevent_free(ptr, 0);\n    }\n    /**\n     * The original message (of type `m.room.encrypted`) that failed to be\n     * decrypted, encoded as JSON.\n     * @returns {string}\n     */\n    get rawEvent() {\n        const ret = wasm.__wbg_get_utdtodeviceevent_rawEvent(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Information on the reason we failed to decrypt\n     * @returns {ToDeviceUnableToDecryptInfo}\n     */\n    get utdInfo() {\n        const ret = wasm.__wbg_get_utdtodeviceevent_utdInfo(this.__wbg_ptr);\n        return ToDeviceUnableToDecryptInfo.__wrap(ret);\n    }\n    /**\n     * The type of processed to-device event. Always {@link\n     * ProcessedToDeviceEventType.UnableToDecrypt} for this type.\n     * @returns {ProcessedToDeviceEventType}\n     */\n    get type() {\n        const ret = wasm.utdtodeviceevent_type(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst UploadSigningKeysRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_uploadsigningkeysrequest_free(ptr >>> 0, 1));\n/**\n * Other Requests *\n * Request that will publish a cross signing identity.\n *\n * This uploads the public cross signing key triplet.\n */\nexport class UploadSigningKeysRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(UploadSigningKeysRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        UploadSigningKeysRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        UploadSigningKeysRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_uploadsigningkeysrequest_free(ptr, 0);\n    }\n    /**\n     * A JSON-encoded object containing the rest of the payload: `master_key`,\n     * `self_signing_key`, `user_signing_key`.\n     *\n     * It represents the body of the HTTP request.\n     * @returns {string}\n     */\n    get body() {\n        const ret = wasm.__wbg_get_uploadsigningkeysrequest_body(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Create a new `UploadSigningKeysRequest`.\n     * @param {string} body\n     */\n    constructor(body) {\n        const ret = wasm.uploadsigningkeysrequest_new(body);\n        this.__wbg_ptr = ret >>> 0;\n        UploadSigningKeysRequestFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n}\n\nconst UserDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_userdevices_free(ptr >>> 0, 1));\n/**\n * A read only view over all devices belonging to a user.\n */\nexport class UserDevices {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(UserDevices.prototype);\n        obj.__wbg_ptr = ptr;\n        UserDevicesFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        UserDevicesFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_userdevices_free(ptr, 0);\n    }\n    /**\n     * Get the specific device with the given device ID.\n     * @param {DeviceId} device_id\n     * @returns {Device | undefined}\n     */\n    get(device_id) {\n        _assertClass(device_id, DeviceId);\n        const ret = wasm.userdevices_get(this.__wbg_ptr, device_id.__wbg_ptr);\n        return ret === 0 ? undefined : Device.__wrap(ret);\n    }\n    /**\n     * Returns true if there is at least one devices of this user\n     * that is considered to be verified, false otherwise.\n     *\n     * This won't consider your own device as verified, as your own\n     * device is always implicitly verified.\n     * @returns {boolean}\n     */\n    isAnyVerified() {\n        const ret = wasm.userdevices_isAnyVerified(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Array over all the device IDs of the user devices.\n     * @returns {Array<any>}\n     */\n    keys() {\n        const ret = wasm.userdevices_keys(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Iterator over all the devices of the user devices.\n     * @returns {Array<any>}\n     */\n    devices() {\n        const ret = wasm.userdevices_devices(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst UserIdFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_userid_free(ptr >>> 0, 1));\n/**\n * A Matrix [user ID].\n *\n * [user ID]: https://spec.matrix.org/v1.2/appendices/#user-identifiers\n */\nexport class UserId {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(UserId.prototype);\n        obj.__wbg_ptr = ptr;\n        UserIdFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    static __unwrap(jsValue) {\n        if (!(jsValue instanceof UserId)) {\n            return 0;\n        }\n        return jsValue.__destroy_into_raw();\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        UserIdFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_userid_free(ptr, 0);\n    }\n    /**\n     * Parse/validate and create a new `UserId`.\n     * @param {string} id\n     */\n    constructor(id) {\n        const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.userid_new(ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        this.__wbg_ptr = ret[0] >>> 0;\n        UserIdFinalization.register(this, this.__wbg_ptr, this);\n        return this;\n    }\n    /**\n     * Returns the user's localpart.\n     * @returns {string}\n     */\n    get localpart() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.userid_localpart(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Returns the server name of the user ID.\n     * @returns {ServerName}\n     */\n    get serverName() {\n        const ret = wasm.userid_serverName(this.__wbg_ptr);\n        return ServerName.__wrap(ret);\n    }\n    /**\n     * Whether this user ID is a historical one.\n     *\n     * A historical user ID is one that doesn't conform to the latest\n     * specification of the user ID grammar but is still accepted\n     * because it was previously allowed.\n     * @returns {boolean}\n     */\n    isHistorical() {\n        const ret = wasm.userid_isHistorical(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Return the user ID as a string.\n     * @returns {string}\n     */\n    toString() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.userid_toString(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Create a clone of this `UserId`.\n     *\n     * This can be useful when passing a `UserId` instance to methods such as\n     * {@link OlmMachine.updateTrackedUsers} which destroy the instance.\n     * @returns {UserId}\n     */\n    clone() {\n        const ret = wasm.userid_clone(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n}\n\nconst VerificationRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_verificationrequest_free(ptr >>> 0, 1));\n/**\n * An object controlling key verification requests.\n *\n * Interactive verification flows usually start with a verification\n * request, this object lets you send and reply to such a\n * verification request.\n *\n * After the initial handshake the verification flow transitions into\n * one of the verification methods.\n */\nexport class VerificationRequest {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(VerificationRequest.prototype);\n        obj.__wbg_ptr = ptr;\n        VerificationRequestFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        VerificationRequestFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_verificationrequest_free(ptr, 0);\n    }\n    /**\n     * Create an event content that can be sent as a room event to\n     * request verification from the other side. This should be used\n     * only for verifications of other users and it should be sent to\n     * a room we consider to be a DM with the other user.\n     * @param {UserId} own_user_id\n     * @param {DeviceId} own_device_id\n     * @param {UserId} other_user_id\n     * @param {any[] | null} [methods]\n     * @returns {string}\n     */\n    static request(own_user_id, own_device_id, other_user_id, methods) {\n        let deferred3_0;\n        let deferred3_1;\n        try {\n            _assertClass(own_user_id, UserId);\n            _assertClass(own_device_id, DeviceId);\n            _assertClass(other_user_id, UserId);\n            var ptr0 = isLikeNone(methods) ? 0 : passArrayJsValueToWasm0(methods, wasm.__wbindgen_malloc);\n            var len0 = WASM_VECTOR_LEN;\n            const ret = wasm.verificationrequest_request(own_user_id.__wbg_ptr, own_device_id.__wbg_ptr, other_user_id.__wbg_ptr, ptr0, len0);\n            var ptr2 = ret[0];\n            var len2 = ret[1];\n            if (ret[3]) {\n                ptr2 = 0; len2 = 0;\n                throw takeFromExternrefTable0(ret[2]);\n            }\n            deferred3_0 = ptr2;\n            deferred3_1 = len2;\n            return getStringFromWasm0(ptr2, len2);\n        } finally {\n            wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);\n        }\n    }\n    /**\n     * Our own user id.\n     * @returns {UserId}\n     */\n    get ownUserId() {\n        const ret = wasm.verificationrequest_ownUserId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The ID of the other user that is participating in this\n     * verification request.\n     * @returns {UserId}\n     */\n    get otherUserId() {\n        const ret = wasm.verificationrequest_otherUserId(this.__wbg_ptr);\n        return UserId.__wrap(ret);\n    }\n    /**\n     * The ID of the other device that is participating in this\n     * verification.\n     * @returns {DeviceId | undefined}\n     */\n    get otherDeviceId() {\n        const ret = wasm.verificationrequest_otherDeviceId(this.__wbg_ptr);\n        return ret === 0 ? undefined : DeviceId.__wrap(ret);\n    }\n    /**\n     * Get the room ID if the verification is happening inside a\n     * room.\n     * @returns {RoomId | undefined}\n     */\n    get roomId() {\n        const ret = wasm.verificationrequest_roomId(this.__wbg_ptr);\n        return ret === 0 ? undefined : RoomId.__wrap(ret);\n    }\n    /**\n     * Get info about the cancellation if the verification request\n     * has been cancelled.\n     * @returns {CancelInfo | undefined}\n     */\n    get cancelInfo() {\n        const ret = wasm.verificationrequest_cancelInfo(this.__wbg_ptr);\n        return ret === 0 ? undefined : CancelInfo.__wrap(ret);\n    }\n    /**\n     * Has the verification request been answered by another device?\n     * @returns {boolean}\n     */\n    isPassive() {\n        const ret = wasm.verificationrequest_isPassive(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Is the verification request ready to start a verification flow?\n     * @returns {boolean}\n     */\n    isReady() {\n        const ret = wasm.verificationrequest_isReady(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Has the verification flow timed out?\n     * @returns {boolean}\n     */\n    timedOut() {\n        const ret = wasm.verificationrequest_timedOut(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * The number of milliseconds remaining before this verification flow times\n     * out.\n     *\n     * Returns zero if the time has already passed.\n     * @returns {number}\n     */\n    timeRemainingMillis() {\n        const ret = wasm.verificationrequest_timeRemainingMillis(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Get the supported verification methods of the other side.\n     *\n     * Will be present only if the other side requested the\n     * verification or if we’re in the ready state.\n     *\n     * # Returns\n     *\n     * `undefined` if we do not yet know the supported methods; otherwise, an\n     * array of `VerificationMethod`s.\n     * @returns {any[] | undefined}\n     */\n    get theirSupportedMethods() {\n        const ret = wasm.verificationrequest_theirSupportedMethods(this.__wbg_ptr);\n        if (ret[3]) {\n            throw takeFromExternrefTable0(ret[2]);\n        }\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n        }\n        return v1;\n    }\n    /**\n     * Get our own supported verification methods that we advertised.\n     *\n     * Will be present only we requested the verification or if we’re\n     * in the ready state.\n     * @returns {any[] | undefined}\n     */\n    get ourSupportedMethods() {\n        const ret = wasm.verificationrequest_ourSupportedMethods(this.__wbg_ptr);\n        if (ret[3]) {\n            throw takeFromExternrefTable0(ret[2]);\n        }\n        let v1;\n        if (ret[0] !== 0) {\n            v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n            wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n        }\n        return v1;\n    }\n    /**\n     * Get the unique ID of this verification request.\n     * @returns {string}\n     */\n    get flowId() {\n        let deferred1_0;\n        let deferred1_1;\n        try {\n            const ret = wasm.verificationrequest_flowId(this.__wbg_ptr);\n            deferred1_0 = ret[0];\n            deferred1_1 = ret[1];\n            return getStringFromWasm0(ret[0], ret[1]);\n        } finally {\n            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n        }\n    }\n    /**\n     * Is this a verification that is verifying one of our own\n     * devices?\n     * @returns {boolean}\n     */\n    isSelfVerification() {\n        const ret = wasm.verificationrequest_isSelfVerification(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Did we initiate the verification request?\n     * @returns {boolean}\n     */\n    weStarted() {\n        const ret = wasm.verificationrequest_weStarted(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Has the verification flow that was started with this request\n     * finished?\n     * @returns {boolean}\n     */\n    isDone() {\n        const ret = wasm.verificationrequest_isDone(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Get the current phase of this request.\n     *\n     * Returns a `VerificationRequestPhase`.\n     * @returns {VerificationRequestPhase}\n     */\n    phase() {\n        const ret = wasm.verificationrequest_phase(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * If this request has transitioned into a concrete verification\n     * flow (and not yet been completed or cancelled), returns a `Verification`\n     * object.\n     *\n     * Returns: a `Sas`, a `Qr`, or `undefined`.\n     * @returns {any}\n     */\n    getVerification() {\n        const ret = wasm.verificationrequest_getVerification(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Register a callback which will be called whenever there is an update to\n     * the request.\n     *\n     * The `callback` is called with no parameters.\n     * @param {Function} callback\n     */\n    registerChangesCallback(callback) {\n        wasm.verificationrequest_registerChangesCallback(this.__wbg_ptr, callback);\n    }\n    /**\n     * Has the verification flow that was started with this request\n     * been cancelled?\n     * @returns {boolean}\n     */\n    isCancelled() {\n        const ret = wasm.verificationrequest_isCancelled(this.__wbg_ptr);\n        return ret !== 0;\n    }\n    /**\n     * Accept the verification request signaling that our client\n     * supports the given verification methods.\n     *\n     * `methods` represents the methods that we should advertise as\n     * supported by us.\n     *\n     * It returns either a `ToDeviceRequest`, a `RoomMessageRequest`\n     * or `undefined`.\n     * @param {any[]} methods\n     * @returns {any}\n     */\n    acceptWithMethods(methods) {\n        const ptr0 = passArrayJsValueToWasm0(methods, wasm.__wbindgen_malloc);\n        const len0 = WASM_VECTOR_LEN;\n        const ret = wasm.verificationrequest_acceptWithMethods(this.__wbg_ptr, ptr0, len0);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Accept the verification request.\n     *\n     * This method will accept the request and signal that it\n     * supports the `m.sas.v1`, the `m.qr_code.show.v1`, and\n     * `m.reciprocate.v1` method.\n     *\n     * `m.qr_code.show.v1` will only be signaled if the `qrcode`\n     * feature is enabled. This feature is disabled by default. If\n     * it's enabled and QR code scanning should be supported or QR\n     * code showing shouldn't be supported the `accept_with_methods`\n     * method should be used instead.\n     *\n     * It returns either a `ToDeviceRequest`, a `RoomMessageRequest`\n     * or `undefined`.\n     * @returns {any}\n     */\n    accept() {\n        const ret = wasm.verificationrequest_accept(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Cancel the verification request.\n     *\n     * It returns either a `ToDeviceRequest`, a `RoomMessageRequest`\n     * or `undefined`.\n     * @returns {any}\n     */\n    cancel() {\n        const ret = wasm.verificationrequest_cancel(this.__wbg_ptr);\n        if (ret[2]) {\n            throw takeFromExternrefTable0(ret[1]);\n        }\n        return takeFromExternrefTable0(ret[0]);\n    }\n    /**\n     * Transition from this verification request into a SAS verification flow.\n     *\n     * Returns `Promise<[Sas, RoomMessageRequest|ToDeviceRequest] | undefined>`\n     * @returns {Promise<any>}\n     */\n    startSas() {\n        const ret = wasm.verificationrequest_startSas(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Generate a QR code that can be used by another client to start\n     * a QR code based verification.\n     *\n     * Returns a `Qr` or `undefined`.\n     * @returns {Promise<any>}\n     */\n    generateQrCode() {\n        const ret = wasm.verificationrequest_generateQrCode(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * Start a QR code verification by providing a scanned QR code\n     * for this verification flow.\n     * @param {QrCodeScan} data\n     * @returns {Promise<any>}\n     */\n    scanQrCode(data) {\n        _assertClass(data, QrCodeScan);\n        const ret = wasm.verificationrequest_scanQrCode(this.__wbg_ptr, data.__wbg_ptr);\n        return ret;\n    }\n}\n\nconst VersionsFinalization = (typeof FinalizationRegistry === 'undefined')\n    ? { register: () => {}, unregister: () => {} }\n    : new FinalizationRegistry(ptr => wasm.__wbg_versions_free(ptr >>> 0, 1));\n/**\n * Object containing the versions of the Rust libraries we are using.\n */\nexport class Versions {\n\n    static __wrap(ptr) {\n        ptr = ptr >>> 0;\n        const obj = Object.create(Versions.prototype);\n        obj.__wbg_ptr = ptr;\n        VersionsFinalization.register(obj, obj.__wbg_ptr, obj);\n        return obj;\n    }\n\n    __destroy_into_raw() {\n        const ptr = this.__wbg_ptr;\n        this.__wbg_ptr = 0;\n        VersionsFinalization.unregister(this);\n        return ptr;\n    }\n\n    free() {\n        const ptr = this.__destroy_into_raw();\n        wasm.__wbg_versions_free(ptr, 0);\n    }\n    /**\n     * The version of the vodozemac crate.\n     * @returns {string}\n     */\n    get vodozemac() {\n        const ret = wasm.__wbg_get_versions_vodozemac(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The version of the matrix-sdk-crypto crate.\n     * @returns {string}\n     */\n    get matrix_sdk_crypto() {\n        const ret = wasm.__wbg_get_versions_matrix_sdk_crypto(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The Git commit hash of the crate's source tree at build time.\n     * @returns {string}\n     */\n    get git_sha() {\n        const ret = wasm.__wbg_get_versions_git_sha(this.__wbg_ptr);\n        return ret;\n    }\n    /**\n     * The build-time output of the `git describe` command of the source tree\n     * of crate.\n     * @returns {string}\n     */\n    get git_description() {\n        const ret = wasm.__wbg_get_versions_git_description(this.__wbg_ptr);\n        return ret;\n    }\n}\n\nexport function __wbg_Error_0497d5bdba9362e5(arg0, arg1) {\n    const ret = Error(getStringFromWasm0(arg0, arg1));\n    return ret;\n};\n\nexport function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {\n    const ret = String(arg1);\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbg_Window_b0044ac7db258535(arg0) {\n    const ret = arg0.Window;\n    return ret;\n};\n\nexport function __wbg_WorkerGlobalScope_b74cefefc62a37da(arg0) {\n    const ret = arg0.WorkerGlobalScope;\n    return ret;\n};\n\nexport function __wbg_add_64c6e51ab0ed12dd() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.add(arg1, arg2);\n    return ret;\n}, arguments) };\n\nexport function __wbg_add_dd833f9f523abe36(arg0, arg1) {\n    const ret = arg0.add(arg1);\n    return ret;\n};\n\nexport function __wbg_at_5b2884630cb66ea6(arg0, arg1) {\n    const ret = arg0.at(arg1);\n    return ret;\n};\n\nexport function __wbg_backupkeys_new(arg0) {\n    const ret = BackupKeys.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_bound_0274374bea7f6bca() { return handleError(function (arg0, arg1) {\n    const ret = IDBKeyRange.bound(arg0, arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_bound_eb572b424befade3() { return handleError(function (arg0, arg1, arg2, arg3) {\n    const ret = IDBKeyRange.bound(arg0, arg1, arg2 !== 0, arg3 !== 0);\n    return ret;\n}, arguments) };\n\nexport function __wbg_buffer_a1a27a0dfa70165d(arg0) {\n    const ret = arg0.buffer;\n    return ret;\n};\n\nexport function __wbg_call_1b920c3ac0afee4b() { return handleError(function (arg0, arg1, arg2, arg3) {\n    const ret = arg0.call(arg1, arg2, arg3);\n    return ret;\n}, arguments) };\n\nexport function __wbg_call_36f1bbf64b4cf7c7() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n    const ret = arg0.call(arg1, arg2, arg3, arg4);\n    return ret;\n}, arguments) };\n\nexport function __wbg_call_f2db6205e5c51dc8() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.call(arg1, arg2);\n    return ret;\n}, arguments) };\n\nexport function __wbg_call_fbe8be8bf6436ce5() { return handleError(function (arg0, arg1) {\n    const ret = arg0.call(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_clearTimeout_5a54f8841c30079a(arg0) {\n    const ret = clearTimeout(arg0);\n    return ret;\n};\n\nexport function __wbg_clear_e6ec1cc113e1555e() { return handleError(function (arg0) {\n    const ret = arg0.clear();\n    return ret;\n}, arguments) };\n\nexport function __wbg_close_2079e209ea5709b5(arg0) {\n    arg0.close();\n};\n\nexport function __wbg_code_5e459ca721f994f5(arg0) {\n    const ret = arg0.code;\n    return ret;\n};\n\nexport function __wbg_continue_7d9cdafc888cb902() { return handleError(function (arg0) {\n    arg0.continue();\n}, arguments) };\n\nexport function __wbg_count_2941fdbb8154c02d() { return handleError(function (arg0) {\n    const ret = arg0.count();\n    return ret;\n}, arguments) };\n\nexport function __wbg_count_5ceb291ba9a02b4b() { return handleError(function (arg0) {\n    const ret = arg0.count();\n    return ret;\n}, arguments) };\n\nexport function __wbg_createIndex_32ba53785b2ef24e() { return handleError(function (arg0, arg1, arg2, arg3) {\n    const ret = arg0.createIndex(getStringFromWasm0(arg1, arg2), arg3);\n    return ret;\n}, arguments) };\n\nexport function __wbg_createIndex_a343510ba567e58c() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n    const ret = arg0.createIndex(getStringFromWasm0(arg1, arg2), arg3, arg4);\n    return ret;\n}, arguments) };\n\nexport function __wbg_createObjectStore_b1f08961900155dd() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));\n    return ret;\n}, arguments) };\n\nexport function __wbg_crosssigningbootstraprequests_new(arg0) {\n    const ret = CrossSigningBootstrapRequests.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_crosssigningkeyexport_new(arg0) {\n    const ret = CrossSigningKeyExport.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_crosssigningstatus_new(arg0) {\n    const ret = CrossSigningStatus.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_crypto_574e78ad8b13b65f(arg0) {\n    const ret = arg0.crypto;\n    return ret;\n};\n\nexport function __wbg_debug_58d16ea352cfbca1(arg0) {\n    console.debug(arg0);\n};\n\nexport function __wbg_debug_ada37632f0e8cdde(arg0, arg1) {\n    arg0.debug(arg1);\n};\n\nexport function __wbg_decryptedroomevent_new(arg0) {\n    const ret = DecryptedRoomEvent.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_decryptedtodeviceevent_new(arg0) {\n    const ret = DecryptedToDeviceEvent.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_dehydrateddevice_new(arg0) {\n    const ret = DehydratedDevice.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_dehydrateddevicekey_new(arg0) {\n    const ret = DehydratedDeviceKey.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_deleteObjectStore_7b427b19378475fd() { return handleError(function (arg0, arg1, arg2) {\n    arg0.deleteObjectStore(getStringFromWasm0(arg1, arg2));\n}, arguments) };\n\nexport function __wbg_delete_1af2aac87b36c0f1() { return handleError(function (arg0) {\n    const ret = arg0.delete();\n    return ret;\n}, arguments) };\n\nexport function __wbg_delete_71b7921c73aa9378() { return handleError(function (arg0, arg1) {\n    const ret = arg0.delete(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_device_new(arg0) {\n    const ret = Device.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_deviceid_new(arg0) {\n    const ret = DeviceId.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_devicekey_new(arg0) {\n    const ret = DeviceKey.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_devicekeyid_new(arg0) {\n    const ret = DeviceKeyId.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_done_4d01f352bade43b7(arg0) {\n    const ret = arg0.done;\n    return ret;\n};\n\nexport function __wbg_emoji_new(arg0) {\n    const ret = Emoji.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_encryptedattachment_new(arg0) {\n    const ret = EncryptedAttachment.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_encryptioninfo_new(arg0) {\n    const ret = EncryptionInfo.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_entries_41651c850143b957(arg0) {\n    const ret = Object.entries(arg0);\n    return ret;\n};\n\nexport function __wbg_entries_c951fa14164704e7(arg0) {\n    const ret = arg0.entries();\n    return ret;\n};\n\nexport function __wbg_error_24afdcd463ac8bd9(arg0, arg1) {\n    arg0.error(arg1);\n};\n\nexport function __wbg_error_4e978abc9692c0c5() { return handleError(function (arg0) {\n    const ret = arg0.error;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_error_51ecdd39ec054205(arg0) {\n    console.error(arg0);\n};\n\nexport function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {\n    let deferred0_0;\n    let deferred0_1;\n    try {\n        deferred0_0 = arg0;\n        deferred0_1 = arg1;\n        console.error(getStringFromWasm0(arg0, arg1));\n    } finally {\n        wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);\n    }\n};\n\nexport function __wbg_from_12ff8e47307bd4c7(arg0) {\n    const ret = Array.from(arg0);\n    return ret;\n};\n\nexport function __wbg_getAllKeys_fce3f6ef8201c450() { return handleError(function (arg0) {\n    const ret = arg0.getAllKeys();\n    return ret;\n}, arguments) };\n\nexport function __wbg_getAll_22a744d3b40f0fb5() { return handleError(function (arg0) {\n    const ret = arg0.getAll();\n    return ret;\n}, arguments) };\n\nexport function __wbg_getAll_654e689108532352() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.getAll(arg1, arg2 >>> 0);\n    return ret;\n}, arguments) };\n\nexport function __wbg_getAll_864be044b219e256() { return handleError(function (arg0, arg1) {\n    const ret = arg0.getAll(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_getRandomValues_38a1ff1ea09f6cc7() { return handleError(function (arg0, arg1) {\n    globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n}, arguments) };\n\nexport function __wbg_getRandomValues_b8f5dbd5f3995a9e() { return handleError(function (arg0, arg1) {\n    arg0.getRandomValues(arg1);\n}, arguments) };\n\nexport function __wbg_getTime_2afe67905d873e92(arg0) {\n    const ret = arg0.getTime();\n    return ret;\n};\n\nexport function __wbg_get_92470be87867c2e5() { return handleError(function (arg0, arg1) {\n    const ret = Reflect.get(arg0, arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_get_a131a44bd1eb6979(arg0, arg1) {\n    const ret = arg0[arg1 >>> 0];\n    return ret;\n};\n\nexport function __wbg_get_a4719581b0d717ad() { return handleError(function (arg0, arg1) {\n    const ret = arg0.get(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_get_d37904b955701f99() { return handleError(function (arg0, arg1) {\n    const ret = arg0.get(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {\n    const ret = arg0[arg1];\n    return ret;\n};\n\nexport function __wbg_global_b6f5c73312f62313(arg0) {\n    const ret = arg0.global;\n    return ret;\n};\n\nexport function __wbg_inboundgroupsession_new(arg0) {\n    const ret = InboundGroupSession.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_index_405783ca8da5f008() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.index(getStringFromWasm0(arg1, arg2));\n    return ret;\n}, arguments) };\n\nexport function __wbg_indexedDB_317016dcb8a872d6() { return handleError(function (arg0) {\n    const ret = arg0.indexedDB;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_indexedDB_601ec26c63e333de() { return handleError(function (arg0) {\n    const ret = arg0.indexedDB;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_indexedDB_63b82e158eb67cbd() { return handleError(function (arg0) {\n    const ret = arg0.indexedDB;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_info_e56933705c348038(arg0) {\n    console.info(arg0);\n};\n\nexport function __wbg_info_f3589034369581f6(arg0, arg1) {\n    arg0.info(arg1);\n};\n\nexport function __wbg_instanceof_ArrayBuffer_a8b6f580b363f2bc(arg0) {\n    let result;\n    try {\n        result = arg0 instanceof ArrayBuffer;\n    } catch (_) {\n        result = false;\n    }\n    const ret = result;\n    return ret;\n};\n\nexport function __wbg_instanceof_Map_80cc65041c96417a(arg0) {\n    let result;\n    try {\n        result = arg0 instanceof Map;\n    } catch (_) {\n        result = false;\n    }\n    const ret = result;\n    return ret;\n};\n\nexport function __wbg_instanceof_Promise_66f94afc64d9039f(arg0) {\n    let result;\n    try {\n        result = arg0 instanceof Promise;\n    } catch (_) {\n        result = false;\n    }\n    const ret = result;\n    return ret;\n};\n\nexport function __wbg_instanceof_Uint8Array_ca460677bc155827(arg0) {\n    let result;\n    try {\n        result = arg0 instanceof Uint8Array;\n    } catch (_) {\n        result = false;\n    }\n    const ret = result;\n    return ret;\n};\n\nexport function __wbg_invalidtodeviceevent_new(arg0) {\n    const ret = InvalidToDeviceEvent.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_isArray_2a07fd175d45c496(arg0) {\n    const ret = Array.isArray(arg0);\n    return ret;\n};\n\nexport function __wbg_isArray_5f090bed72bd4f89(arg0) {\n    const ret = Array.isArray(arg0);\n    return ret;\n};\n\nexport function __wbg_isSafeInteger_90d7c4674047d684(arg0) {\n    const ret = Number.isSafeInteger(arg0);\n    return ret;\n};\n\nexport function __wbg_item_15285ca2d766f142(arg0, arg1, arg2) {\n    const ret = arg1.item(arg2 >>> 0);\n    var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    var len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbg_iterator_4068add5b2aef7a6() {\n    const ret = Symbol.iterator;\n    return ret;\n};\n\nexport function __wbg_key_a17a68df9ec1b180() { return handleError(function (arg0) {\n    const ret = arg0.key;\n    return ret;\n}, arguments) };\n\nexport function __wbg_keysbackuprequest_new(arg0) {\n    const ret = KeysBackupRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_keysclaimrequest_new(arg0) {\n    const ret = KeysClaimRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_keysqueryrequest_new(arg0) {\n    const ret = KeysQueryRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_keysuploadrequest_new(arg0) {\n    const ret = KeysUploadRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_length_471141fa24df24b2(arg0) {\n    const ret = arg0.length;\n    return ret;\n};\n\nexport function __wbg_length_ab6d22b5ead75c72(arg0) {\n    const ret = arg0.length;\n    return ret;\n};\n\nexport function __wbg_length_f00ec12454a5d9fd(arg0) {\n    const ret = arg0.length;\n    return ret;\n};\n\nexport function __wbg_lowerBound_13c8e875a3fb9f7d() { return handleError(function (arg0, arg1) {\n    const ret = IDBKeyRange.lowerBound(arg0, arg1 !== 0);\n    return ret;\n}, arguments) };\n\nexport function __wbg_maybesignature_new(arg0) {\n    const ret = MaybeSignature.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_megolmdecryptionerror_new(arg0) {\n    const ret = MegolmDecryptionError.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_message_2d95ea5aff0d63b9(arg0, arg1) {\n    const ret = arg1.message;\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbg_msCrypto_a61aeb35a24c1329(arg0) {\n    const ret = arg0.msCrypto;\n    return ret;\n};\n\nexport function __wbg_name_2acff1e83d9735f9(arg0, arg1) {\n    const ret = arg1.name;\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbg_new_07b483f72211fd66() {\n    const ret = new Object();\n    return ret;\n};\n\nexport function __wbg_new_58353953ad2097cc() {\n    const ret = new Array();\n    return ret;\n};\n\nexport function __wbg_new_8a6f238a6ece86ea() {\n    const ret = new Error();\n    return ret;\n};\n\nexport function __wbg_new_a2957aa5684de228(arg0) {\n    const ret = new Date(arg0);\n    return ret;\n};\n\nexport function __wbg_new_a979b4b45bd55c7f() {\n    const ret = new Map();\n    return ret;\n};\n\nexport function __wbg_new_b3a08d2910ee5170(arg0) {\n    const ret = new Uint8ClampedArray(arg0);\n    return ret;\n};\n\nexport function __wbg_new_db7d9b0ee94df522(arg0) {\n    const ret = new Set(arg0);\n    return ret;\n};\n\nexport function __wbg_new_e30c39c06edaabf2(arg0, arg1) {\n    try {\n        var state0 = {a: arg0, b: arg1};\n        var cb0 = (arg0, arg1) => {\n            const a = state0.a;\n            state0.a = 0;\n            try {\n                return __wbg_adapter_836(a, state0.b, arg0, arg1);\n            } finally {\n                state0.a = a;\n            }\n        };\n        const ret = new Promise(cb0);\n        return ret;\n    } finally {\n        state0.a = state0.b = 0;\n    }\n};\n\nexport function __wbg_new_e52b3efaaa774f96(arg0) {\n    const ret = new Uint8Array(arg0);\n    return ret;\n};\n\nexport function __wbg_newnoargs_ff528e72d35de39a(arg0, arg1) {\n    const ret = new Function(getStringFromWasm0(arg0, arg1));\n    return ret;\n};\n\nexport function __wbg_newwithbyteoffsetandlength_06e8c938173769b5(arg0, arg1, arg2) {\n    const ret = new Uint8ClampedArray(arg0, arg1 >>> 0, arg2 >>> 0);\n    return ret;\n};\n\nexport function __wbg_newwithbyteoffsetandlength_3b01ecda099177e8(arg0, arg1, arg2) {\n    const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);\n    return ret;\n};\n\nexport function __wbg_newwithlength_08f872dc1e3ada2e(arg0) {\n    const ret = new Uint8Array(arg0 >>> 0);\n    return ret;\n};\n\nexport function __wbg_newwithlength_8a0d31010560ce9a(arg0) {\n    const ret = new Uint8ClampedArray(arg0 >>> 0);\n    return ret;\n};\n\nexport function __wbg_newwithmessage_54042111509ba20c() { return handleError(function (arg0, arg1) {\n    const ret = new DOMException(getStringFromWasm0(arg0, arg1));\n    return ret;\n}, arguments) };\n\nexport function __wbg_next_8bb824d217961b5d(arg0) {\n    const ret = arg0.next;\n    return ret;\n};\n\nexport function __wbg_next_e2da48d8fff7439a() { return handleError(function (arg0) {\n    const ret = arg0.next();\n    return ret;\n}, arguments) };\n\nexport function __wbg_node_905d3e251edff8a2(arg0) {\n    const ret = arg0.node;\n    return ret;\n};\n\nexport function __wbg_now_2c95c9de01293173(arg0) {\n    const ret = arg0.now();\n    return ret;\n};\n\nexport function __wbg_now_eb0821f3bd9f6529() {\n    const ret = Date.now();\n    return ret;\n};\n\nexport function __wbg_objectStoreNames_e82275eb2d403a92(arg0) {\n    const ret = arg0.objectStoreNames;\n    return ret;\n};\n\nexport function __wbg_objectStore_b463d32c86d6b543() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));\n    return ret;\n}, arguments) };\n\nexport function __wbg_oldVersion_af5af638a028177c(arg0) {\n    const ret = arg0.oldVersion;\n    return ret;\n};\n\nexport function __wbg_olmmachine_new(arg0) {\n    const ret = OlmMachine.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_openCursor_7c13a2cd32c6258b() { return handleError(function (arg0) {\n    const ret = arg0.openCursor();\n    return ret;\n}, arguments) };\n\nexport function __wbg_openCursor_a53133c898e0829c() { return handleError(function (arg0, arg1) {\n    const ret = arg0.openCursor(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_openCursor_dbd279400634ae67() { return handleError(function (arg0) {\n    const ret = arg0.openCursor();\n    return ret;\n}, arguments) };\n\nexport function __wbg_open_0f04f50fa4d98f67() { return handleError(function (arg0, arg1, arg2, arg3) {\n    const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);\n    return ret;\n}, arguments) };\n\nexport function __wbg_open_b70fb421d97aad40() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.open(getStringFromWasm0(arg1, arg2));\n    return ret;\n}, arguments) };\n\nexport function __wbg_otheruseridentity_new(arg0) {\n    const ret = OtherUserIdentity.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_ownuseridentity_new(arg0) {\n    const ret = OwnUserIdentity.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_parse_c7ba327fb6231e7f() { return handleError(function (arg0, arg1) {\n    const ret = JSON.parse(getStringFromWasm0(arg0, arg1));\n    return ret;\n}, arguments) };\n\nexport function __wbg_performance_7a3ffd0b17f663ad(arg0) {\n    const ret = arg0.performance;\n    return ret;\n};\n\nexport function __wbg_pickledinboundgroupsession_unwrap(arg0) {\n    const ret = PickledInboundGroupSession.__unwrap(arg0);\n    return ret;\n};\n\nexport function __wbg_pickledsession_unwrap(arg0) {\n    const ret = PickledSession.__unwrap(arg0);\n    return ret;\n};\n\nexport function __wbg_plaintexttodeviceevent_new(arg0) {\n    const ret = PlainTextToDeviceEvent.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_process_dc0fbacc7c1c06f7(arg0) {\n    const ret = arg0.process;\n    return ret;\n};\n\nexport function __wbg_push_73fd7b5550ebf707(arg0, arg1) {\n    const ret = arg0.push(arg1);\n    return ret;\n};\n\nexport function __wbg_put_7f0b4dcc666f09e3() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.put(arg1, arg2);\n    return ret;\n}, arguments) };\n\nexport function __wbg_putdehydrateddevicerequest_new(arg0) {\n    const ret = PutDehydratedDeviceRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_qr_new(arg0) {\n    const ret = Qr.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_queueMicrotask_46c1df247678729f(arg0) {\n    queueMicrotask(arg0);\n};\n\nexport function __wbg_queueMicrotask_8acf3ccb75ed8d11(arg0) {\n    const ret = arg0.queueMicrotask;\n    return ret;\n};\n\nexport function __wbg_randomFillSync_ac0988aba3254290() { return handleError(function (arg0, arg1) {\n    arg0.randomFillSync(arg1);\n}, arguments) };\n\nexport function __wbg_readyState_249e5707a38b7a7a(arg0) {\n    const ret = arg0.readyState;\n    return (__wbindgen_enum_IdbRequestReadyState.indexOf(ret) + 1 || 3) - 1;\n};\n\nexport function __wbg_rehydrateddevice_new(arg0) {\n    const ret = RehydratedDevice.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_require_60cc747a6bc5215a() { return handleError(function () {\n    const ret = module.require;\n    return ret;\n}, arguments) };\n\nexport function __wbg_resolve_0dac8c580ffd4678(arg0) {\n    const ret = Promise.resolve(arg0);\n    return ret;\n};\n\nexport function __wbg_result_a0f1bf2fe64a516c() { return handleError(function (arg0) {\n    const ret = arg0.result;\n    return ret;\n}, arguments) };\n\nexport function __wbg_roomid_unwrap(arg0) {\n    const ret = RoomId.__unwrap(arg0);\n    return ret;\n};\n\nexport function __wbg_roomkeycounts_new(arg0) {\n    const ret = RoomKeyCounts.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_roomkeyimportresult_new(arg0) {\n    const ret = RoomKeyImportResult.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_roomkeyinfo_new(arg0) {\n    const ret = RoomKeyInfo.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_roomkeywithheldinfo_new(arg0) {\n    const ret = RoomKeyWithheldInfo.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_roommessagerequest_new(arg0) {\n    const ret = RoomMessageRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_roomsettings_new(arg0) {\n    const ret = RoomSettings.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_sas_new(arg0) {\n    const ret = Sas.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_secretsbundle_new(arg0) {\n    const ret = SecretsBundle.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_setTimeout_db2dbaeefb6f39c7() { return handleError(function (arg0, arg1) {\n    const ret = setTimeout(arg0, arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {\n    arg0[arg1] = arg2;\n};\n\nexport function __wbg_set_7422acbe992d64ab(arg0, arg1, arg2) {\n    arg0[arg1 >>> 0] = arg2;\n};\n\nexport function __wbg_set_d6bdfd275fb8a4ce(arg0, arg1, arg2) {\n    const ret = arg0.set(arg1, arg2);\n    return ret;\n};\n\nexport function __wbg_set_fd40eacc85c5ab66(arg0, arg1, arg2) {\n    arg0.set(arg1, arg2 >>> 0);\n};\n\nexport function __wbg_set_fe4e79d1ed3b0e9b(arg0, arg1, arg2) {\n    arg0.set(arg1, arg2 >>> 0);\n};\n\nexport function __wbg_setonabort_479ebb5884fcb171(arg0, arg1) {\n    arg0.onabort = arg1;\n};\n\nexport function __wbg_setonblocked_046331b614d6f8e3(arg0, arg1) {\n    arg0.onblocked = arg1;\n};\n\nexport function __wbg_setoncomplete_27bdbca012e45c05(arg0, arg1) {\n    arg0.oncomplete = arg1;\n};\n\nexport function __wbg_setonerror_537b68f474e27d4e(arg0, arg1) {\n    arg0.onerror = arg1;\n};\n\nexport function __wbg_setonerror_ce5c4d34aed931bb(arg0, arg1) {\n    arg0.onerror = arg1;\n};\n\nexport function __wbg_setonsuccess_0b2b45bd8cc13b95(arg0, arg1) {\n    arg0.onsuccess = arg1;\n};\n\nexport function __wbg_setonupgradeneeded_be2e0ae927917f82(arg0, arg1) {\n    arg0.onupgradeneeded = arg1;\n};\n\nexport function __wbg_setonversionchange_407ebf1ad930c84c(arg0, arg1) {\n    arg0.onversionchange = arg1;\n};\n\nexport function __wbg_setunique_727cefd7e14cf677(arg0, arg1) {\n    arg0.unique = arg1 !== 0;\n};\n\nexport function __wbg_signatures_new(arg0) {\n    const ret = Signatures.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_signatureuploadrequest_new(arg0) {\n    const ret = SignatureUploadRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_signatureverification_new(arg0) {\n    const ret = SignatureVerification.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {\n    const ret = arg1.stack;\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbg_static_accessor_GLOBAL_487c52c58d65314d() {\n    const ret = typeof global === 'undefined' ? null : global;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291() {\n    const ret = typeof globalThis === 'undefined' ? null : globalThis;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_static_accessor_SELF_78c9e3071b912620() {\n    const ret = typeof self === 'undefined' ? null : self;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_static_accessor_WINDOW_a093d21393777366() {\n    const ret = typeof window === 'undefined' ? null : window;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_storedroomkeybundledata_new(arg0) {\n    const ret = StoredRoomKeyBundleData.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_storehandle_new(arg0) {\n    const ret = StoreHandle.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_stringify_c242842b97f054cc() { return handleError(function (arg0) {\n    const ret = JSON.stringify(arg0);\n    return ret;\n}, arguments) };\n\nexport function __wbg_subarray_dd4ade7d53bd8e26(arg0, arg1, arg2) {\n    const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n    return ret;\n};\n\nexport function __wbg_target_15f1da583855ac4e(arg0) {\n    const ret = arg0.target;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_then_82ab9fb4080f1707(arg0, arg1, arg2) {\n    const ret = arg0.then(arg1, arg2);\n    return ret;\n};\n\nexport function __wbg_then_db882932c0c714c6(arg0, arg1) {\n    const ret = arg0.then(arg1);\n    return ret;\n};\n\nexport function __wbg_todevicerequest_new(arg0) {\n    const ret = ToDeviceRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_transaction_34c41b46ca391af6(arg0) {\n    const ret = arg0.transaction;\n    return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_transaction_36c8b28ed4349a9a() { return handleError(function (arg0, arg1, arg2, arg3) {\n    const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);\n    return ret;\n}, arguments) };\n\nexport function __wbg_transaction_399fc15f5bba1880() { return handleError(function (arg0, arg1, arg2) {\n    const ret = arg0.transaction(arg1, __wbindgen_enum_IdbTransactionMode[arg2]);\n    return ret;\n}, arguments) };\n\nexport function __wbg_update_297181dae0cc0af4() { return handleError(function (arg0, arg1) {\n    const ret = arg0.update(arg1);\n    return ret;\n}, arguments) };\n\nexport function __wbg_userdevices_new(arg0) {\n    const ret = UserDevices.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_userid_new(arg0) {\n    const ret = UserId.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_userid_unwrap(arg0) {\n    const ret = UserId.__unwrap(arg0);\n    return ret;\n};\n\nexport function __wbg_utdtodeviceevent_new(arg0) {\n    const ret = UTDToDeviceEvent.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_value_17b896954e14f896(arg0) {\n    const ret = arg0.value;\n    return ret;\n};\n\nexport function __wbg_value_648dc44894c8dc95() { return handleError(function (arg0) {\n    const ret = arg0.value;\n    return ret;\n}, arguments) };\n\nexport function __wbg_values_81045499c3c8e670(arg0) {\n    const ret = arg0.values();\n    return ret;\n};\n\nexport function __wbg_verificationrequest_new(arg0) {\n    const ret = VerificationRequest.__wrap(arg0);\n    return ret;\n};\n\nexport function __wbg_version_2c3ed4a311fdabdf(arg0) {\n    const ret = arg0.version;\n    return ret;\n};\n\nexport function __wbg_versions_c01dfd4722a88165(arg0) {\n    const ret = arg0.versions;\n    return ret;\n};\n\nexport function __wbg_warn_9b968a0475b49f6b(arg0, arg1) {\n    arg0.warn(arg1);\n};\n\nexport function __wbg_warn_d89f6637da554c8d(arg0) {\n    console.warn(arg0);\n};\n\nexport function __wbindgen_array_new() {\n    const ret = [];\n    return ret;\n};\n\nexport function __wbindgen_array_push(arg0, arg1) {\n    arg0.push(arg1);\n};\n\nexport function __wbindgen_as_number(arg0) {\n    const ret = +arg0;\n    return ret;\n};\n\nexport function __wbindgen_bigint_from_i64(arg0) {\n    const ret = arg0;\n    return ret;\n};\n\nexport function __wbindgen_bigint_from_u64(arg0) {\n    const ret = BigInt.asUintN(64, arg0);\n    return ret;\n};\n\nexport function __wbindgen_bigint_get_as_i64(arg0, arg1) {\n    const v = arg1;\n    const ret = typeof(v) === 'bigint' ? v : undefined;\n    getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n};\n\nexport function __wbindgen_boolean_get(arg0) {\n    const v = arg0;\n    const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;\n    return ret;\n};\n\nexport function __wbindgen_cb_drop(arg0) {\n    const obj = arg0.original;\n    if (obj.cnt-- == 1) {\n        obj.a = 0;\n        return true;\n    }\n    const ret = false;\n    return ret;\n};\n\nexport function __wbindgen_closure_wrapper1160(arg0, arg1, arg2) {\n    const ret = makeMutClosure(arg0, arg1, 40, __wbg_adapter_58);\n    return ret;\n};\n\nexport function __wbindgen_closure_wrapper2391(arg0, arg1, arg2) {\n    const ret = makeMutClosure(arg0, arg1, 432, __wbg_adapter_61);\n    return ret;\n};\n\nexport function __wbindgen_closure_wrapper5618(arg0, arg1, arg2) {\n    const ret = makeMutClosure(arg0, arg1, 432, __wbg_adapter_64);\n    return ret;\n};\n\nexport function __wbindgen_closure_wrapper7116(arg0, arg1, arg2) {\n    const ret = makeClosure(arg0, arg1, 437, __wbg_adapter_67);\n    return ret;\n};\n\nexport function __wbindgen_closure_wrapper7121(arg0, arg1, arg2) {\n    const ret = makeClosure(arg0, arg1, 437, __wbg_adapter_70);\n    return ret;\n};\n\nexport function __wbindgen_debug_string(arg0, arg1) {\n    const ret = debugString(arg1);\n    const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    const len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbindgen_in(arg0, arg1) {\n    const ret = arg0 in arg1;\n    return ret;\n};\n\nexport function __wbindgen_init_externref_table() {\n    const table = wasm.__wbindgen_export_4;\n    const offset = table.grow(4);\n    table.set(0, undefined);\n    table.set(offset + 0, undefined);\n    table.set(offset + 1, null);\n    table.set(offset + 2, true);\n    table.set(offset + 3, false);\n    ;\n};\n\nexport function __wbindgen_is_bigint(arg0) {\n    const ret = typeof(arg0) === 'bigint';\n    return ret;\n};\n\nexport function __wbindgen_is_function(arg0) {\n    const ret = typeof(arg0) === 'function';\n    return ret;\n};\n\nexport function __wbindgen_is_null(arg0) {\n    const ret = arg0 === null;\n    return ret;\n};\n\nexport function __wbindgen_is_object(arg0) {\n    const val = arg0;\n    const ret = typeof(val) === 'object' && val !== null;\n    return ret;\n};\n\nexport function __wbindgen_is_string(arg0) {\n    const ret = typeof(arg0) === 'string';\n    return ret;\n};\n\nexport function __wbindgen_is_undefined(arg0) {\n    const ret = arg0 === undefined;\n    return ret;\n};\n\nexport function __wbindgen_jsval_eq(arg0, arg1) {\n    const ret = arg0 === arg1;\n    return ret;\n};\n\nexport function __wbindgen_jsval_loose_eq(arg0, arg1) {\n    const ret = arg0 == arg1;\n    return ret;\n};\n\nexport function __wbindgen_memory() {\n    const ret = wasm.memory;\n    return ret;\n};\n\nexport function __wbindgen_number_get(arg0, arg1) {\n    const obj = arg1;\n    const ret = typeof(obj) === 'number' ? obj : undefined;\n    getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n};\n\nexport function __wbindgen_number_new(arg0) {\n    const ret = arg0;\n    return ret;\n};\n\nexport function __wbindgen_string_get(arg0, arg1) {\n    const obj = arg1;\n    const ret = typeof(obj) === 'string' ? obj : undefined;\n    var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n    var len1 = WASM_VECTOR_LEN;\n    getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n    getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n};\n\nexport function __wbindgen_string_new(arg0, arg1) {\n    const ret = getStringFromWasm0(arg0, arg1);\n    return ret;\n};\n\nexport function __wbindgen_throw(arg0, arg1) {\n    throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\nexport function __wbindgen_try_into_number(arg0) {\n    let result;\n    try { result = +arg0 } catch (e) { result = e }\n    const ret = result;\n    return ret;\n};\n\n","// Copyright 2024 The Matrix.org Foundation C.I.C.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @ts-check\n\n/**\n * This is the entrypoint on non-node ESM environments.\n * `asyncLoad` will load the WASM module using a `fetch` call.\n */\n\nimport * as bindings from \"./pkg/matrix_sdk_crypto_wasm_bg.js\";\n\nconst defaultURL = new URL(\"./pkg/matrix_sdk_crypto_wasm_bg.wasm\", import.meta.url);\n\n// Although we could simply instantiate the WASM at import time with a top-level `await`,\n// we avoid that, to make it easier for callers to delay loading the WASM (and instead\n// wait until `initAsync` is called). (Also, Safari 14 doesn't support top-level `await`.)\n//\n// However, having done so, there is no way to synchronously load the WASM if the user ends\n// up using the bindings before calling `initAsync` (unlike under Node.js), so we just throw\n// an error.\nbindings.__wbg_set_wasm(\n    new Proxy(\n        {},\n        {\n            get() {\n                throw new Error(\n                    \"@matrix-org/matrix-sdk-crypto-wasm was used before it was initialized. Call `initAsync` first.\",\n                );\n            },\n        },\n    ),\n);\n\n/**\n * Stores a promise of the `loadModuleAsync` call\n * @type {Promise<void> | null}\n */\nlet modPromise = null;\n\n/**\n * Loads and instantiates the WASM module asynchronously\n *\n * @param {URL | string} url - The URL to fetch the WebAssembly module from\n * @returns {Promise<void>}\n */\nasync function loadModuleAsync(url) {\n    const { instance } = await WebAssembly.instantiateStreaming(fetch(url), {\n        // @ts-expect-error: The bindings don't exactly match the 'ExportValue' type\n        \"./matrix_sdk_crypto_wasm_bg.js\": bindings,\n    });\n\n    bindings.__wbg_set_wasm(instance.exports);\n    // @ts-expect-error: Typescript doesn't know what the module exports are\n    instance.exports.__wbindgen_start();\n}\n\n/**\n * Load the WebAssembly module in the background, if it has not already been loaded.\n *\n * Returns a promise which will resolve once the other methods are ready.\n *\n * @param {URL | string} [url] - The URL to fetch the WebAssembly module from. If not provided, a default URL will be used.\n * @returns {Promise<void>}\n */\nexport async function initAsync(url = defaultURL) {\n    if (!modPromise) modPromise = loadModuleAsync(url);\n    await modPromise;\n}\n\n// Re-export everything from the generated javascript wrappers\nexport * from \"./pkg/matrix_sdk_crypto_wasm_bg.js\";\n","/* Copyright 2015 Mark Haines\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *  You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use strict';\n\nvar escaped = /[\\\\\\\"\\x00-\\x1F]/g;\nvar escapes = {};\nfor (var i = 0; i < 0x20; ++i) {\n    escapes[String.fromCharCode(i)] = (\n        '\\\\U' + ('0000' + i.toString(16)).slice(-4).toUpperCase()\n    );\n}\nescapes['\\b'] = '\\\\b';\nescapes['\\t'] = '\\\\t';\nescapes['\\n'] = '\\\\n';\nescapes['\\f'] = '\\\\f';\nescapes['\\r'] = '\\\\r';\nescapes['\\\"'] = '\\\\\\\"';\nescapes['\\\\'] = '\\\\\\\\';\n\nfunction escapeString(value) {\n    escaped.lastIndex = 0;\n    return value.replace(escaped, function(c) { return escapes[c]; });\n}\n\nfunction stringify(value) {\n    switch (typeof value) {\n        case 'string':\n            return '\"' + escapeString(value) + '\"';\n        case 'number':\n            return isFinite(value) ? value : 'null';\n        case 'boolean':\n            return value;\n        case 'object':\n            if (value === null) {\n                return 'null';\n            }\n            if (Array.isArray(value)) {\n                return stringifyArray(value);\n            }\n            return stringifyObject(value);\n        default:\n            throw new Error('Cannot stringify: ' + typeof value);\n    }\n}\n\nfunction stringifyArray(array) {\n    var sep = '[';\n    var result = '';\n    for (var i = 0; i < array.length; ++i) {\n        result += sep;\n        sep = ',';\n        result += stringify(array[i]);\n    }\n    if (sep != ',') {\n        return '[]';\n    } else {\n        return result + ']';\n    }\n}\n\nfunction stringifyObject(object) {\n    var sep = '{';\n    var result = '';\n    var keys = Object.keys(object);\n    keys.sort();\n    for (var i = 0; i < keys.length; ++i) {\n        var key = keys[i];\n        result += sep + '\"' + escapeString(key) + '\":';\n        sep = ',';\n        result += stringify(object[key]);\n    }\n    if (sep != ',') {\n        return '{}';\n    } else {\n        return result + '}';\n    }\n}\n\n/** */\nmodule.exports = {stringify: stringify};\n","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { CollectStrategy, EncryptionAlgorithm, EncryptionSettings, HistoryVisibility as RustHistoryVisibility, RoomId, UserId } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { EventType } from \"../@types/event.js\";\nimport { LogSpan } from \"../logger.js\";\nimport { HistoryVisibility } from \"../@types/partials.js\";\nimport { logDuration } from \"../utils.js\";\nimport { KnownMembership } from \"../@types/membership.js\";\nimport { DeviceIsolationModeKind } from \"../crypto-api/index.js\";\n\n/**\n * RoomEncryptor: responsible for encrypting messages to a given room\n *\n * @internal\n */\nexport class RoomEncryptor {\n  /**\n   * @param prefixedLogger - A logger to use for log messages.\n   * @param olmMachine - The rust-sdk's OlmMachine\n   * @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests\n   * @param outgoingRequestManager - The OutgoingRequestManager, which manages the queue of outgoing requests.\n   * @param room - The room we want to encrypt for\n   * @param encryptionSettings - body of the m.room.encryption event currently in force in this room\n   */\n  constructor(prefixedLogger, olmMachine, keyClaimManager, outgoingRequestManager, room, encryptionSettings) {\n    this.prefixedLogger = prefixedLogger;\n    this.olmMachine = olmMachine;\n    this.keyClaimManager = keyClaimManager;\n    this.outgoingRequestManager = outgoingRequestManager;\n    this.room = room;\n    this.encryptionSettings = encryptionSettings;\n    /** whether the room members have been loaded and tracked for the first time */\n    _defineProperty(this, \"lazyLoadedMembersResolved\", false);\n    /**\n     * Ensures that there is only one encryption operation at a time for that room.\n     *\n     * An encryption operation is either a {@link prepareForEncryption} or an {@link encryptEvent} call.\n     */\n    _defineProperty(this, \"currentEncryptionPromise\", Promise.resolve());\n    // start tracking devices for any users already known to be in this room.\n    // Do not load members here, would defeat lazy loading.\n    var members = room.getJoinedMembers();\n\n    // At this point just mark the known members as tracked, it might not be the full list of members\n    // because of lazy loading. This is fine, because we will get a member list update when sending a message for\n    // the first time, see `RoomEncryptor#ensureEncryptionSession`\n    this.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId))).catch(e => this.prefixedLogger.error(\"Error initializing tracked users\", e));\n  }\n\n  /**\n   * Handle a new `m.room.encryption` event in this room\n   *\n   * @param config - The content of the encryption event\n   */\n  onCryptoEvent(config) {\n    if (JSON.stringify(this.encryptionSettings) != JSON.stringify(config)) {\n      // This should currently be unreachable, since the Rust SDK will reject any attempts to change config.\n      throw new Error(\"Cannot reconfigure an active RoomEncryptor\");\n    }\n  }\n\n  /**\n   * Handle a new `m.room.member` event in this room\n   *\n   * @param member - new membership state\n   */\n  onRoomMembership(member) {\n    if (member.membership == KnownMembership.Join || member.membership == KnownMembership.Invite && this.room.shouldEncryptForInvitedMembers()) {\n      // make sure we are tracking the deviceList for this user\n      this.olmMachine.updateTrackedUsers([new UserId(member.userId)]).catch(e => {\n        this.prefixedLogger.error(\"Unable to update tracked users\", e);\n      });\n    }\n\n    // TODO: handle leaves (including our own)\n  }\n\n  /**\n   * Prepare to encrypt events in this room.\n   *\n   * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n   * in the room.\n   * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n   * will not send encrypted messages to unverified devices.\n   * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n   * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n   */\n  prepareForEncryption(globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      // We consider a prepareForEncryption as an encryption promise as it will potentially share keys\n      // even if it doesn't send an event.\n      // Usually this is called when the user starts typing, so we want to make sure we have keys ready when the\n      // message is finally sent.\n      // If `encryptEvent` is invoked before `prepareForEncryption` has completed, the `encryptEvent` call will wait for\n      // `prepareForEncryption` to complete before executing.\n      // The part where `encryptEvent` shares the room key will then usually be a no-op as it was already performed by `prepareForEncryption`.\n      yield _this.encryptEvent(null, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n    })();\n  }\n\n  /**\n   * Encrypt an event for this room, or prepare for encryption.\n   *\n   * This will ensure that we have a megolm session for this room, share it with the devices in the room, and\n   * then, if an event is provided, encrypt it using the session.\n   *\n   * @param event - Event to be encrypted, or null if only preparing for encryption (in which case we will pre-share the room key).\n   * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n   * will not send encrypted messages to unverified devices.\n   * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n   * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n   */\n  encryptEvent(event, globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n    var _event$getTxnId,\n      _this2 = this;\n    var logger = new LogSpan(this.prefixedLogger, event ? (_event$getTxnId = event.getTxnId()) !== null && _event$getTxnId !== void 0 ? _event$getTxnId : \"\" : \"prepareForEncryption\");\n    // Ensure order of encryption to avoid message ordering issues, as the scheduler only ensures\n    // events order after they have been encrypted.\n    var prom = this.currentEncryptionPromise.catch(() => {\n      // Any errors in the previous call will have been reported already, so there is nothing to do here.\n      // we just throw away the error and start anew.\n    }).then(/*#__PURE__*/_asyncToGenerator(function* () {\n      yield logDuration(logger, \"ensureEncryptionSession\", /*#__PURE__*/_asyncToGenerator(function* () {\n        yield _this2.ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n      }));\n      if (event) {\n        yield logDuration(logger, \"encryptEventInner\", /*#__PURE__*/_asyncToGenerator(function* () {\n          yield _this2.encryptEventInner(logger, event);\n        }));\n      }\n    }));\n    this.currentEncryptionPromise = prom;\n    return prom;\n  }\n\n  /**\n   * Prepare to encrypt events in this room.\n   *\n   * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n   * in the room.\n   *\n   * @param logger - a place to write diagnostics to\n   * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n   * will not send encrypted messages to unverified devices.\n   * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n   * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n   */\n  ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      if (_this3.encryptionSettings.algorithm !== \"m.megolm.v1.aes-sha2\") {\n        throw new Error(\"Cannot encrypt in \".concat(_this3.room.roomId, \" for unsupported algorithm '\").concat(_this3.encryptionSettings.algorithm, \"'\"));\n      }\n      logger.debug(\"Starting encryption\");\n      var members = yield _this3.room.getEncryptionTargetMembers();\n\n      // If this is the first time we are sending a message to the room, we may not yet have seen all the members\n      // (so the Crypto SDK might not have a device list for them). So, if this is the first time we are encrypting\n      // for this room, give the SDK the full list of members, to be on the safe side.\n      //\n      // This could end up being racy (if two calls to ensureEncryptionSession happen at the same time), but that's\n      // not a particular problem, since `OlmMachine.updateTrackedUsers` just adds any users that weren't already tracked.\n      if (!_this3.lazyLoadedMembersResolved) {\n        yield logDuration(logger, \"loadMembersIfNeeded: updateTrackedUsers\", /*#__PURE__*/_asyncToGenerator(function* () {\n          yield _this3.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId)));\n        }));\n        logger.debug(\"Updated tracked users\");\n        _this3.lazyLoadedMembersResolved = true;\n\n        // Query keys in case we don't have them for newly tracked members.\n        // It's important after loading members for the first time, as likely most of them won't be\n        // known yet and will be unable to decrypt messages despite being in the room for long.\n        // This must be done before ensuring sessions. If not the devices of these users are not\n        // known yet and will not get the room key.\n        // We don't have API to only get the keys queries related to this member list, so we just\n        // process the pending requests from the olmMachine. (usually these are processed\n        // at the end of the sync, but we can't wait for that).\n        // XXX future improvement process only KeysQueryRequests for the users that have never been queried.\n        logger.debug(\"Processing outgoing requests\");\n        yield logDuration(logger, \"doProcessOutgoingRequests\", /*#__PURE__*/_asyncToGenerator(function* () {\n          yield _this3.outgoingRequestManager.doProcessOutgoingRequests();\n        }));\n      } else {\n        // If members are already loaded it's less critical to await on key queries.\n        // We might still want to trigger a processOutgoingRequests here.\n        // The call to `ensureSessionsForUsers` below will wait a bit on in-flight key queries we are\n        // interested in. If a sync handling happens in the meantime, and some new members are added to the room\n        // or have new devices it would give us a chance to query them before sending.\n        // It's less critical due to the racy nature of this process.\n        logger.debug(\"Processing outgoing requests in background\");\n        _this3.outgoingRequestManager.doProcessOutgoingRequests();\n      }\n      logger.debug(\"Encrypting for users (shouldEncryptForInvitedMembers: \".concat(_this3.room.shouldEncryptForInvitedMembers(), \"):\"), members.map(u => \"\".concat(u.userId, \" (\").concat(u.membership, \")\")));\n      var userList = members.map(u => new UserId(u.userId));\n      yield logDuration(logger, \"ensureSessionsForUsers\", /*#__PURE__*/_asyncToGenerator(function* () {\n        yield _this3.keyClaimManager.ensureSessionsForUsers(logger, userList);\n      }));\n      var rustEncryptionSettings = new EncryptionSettings();\n      rustEncryptionSettings.historyVisibility = toRustHistoryVisibility(_this3.room.getHistoryVisibility());\n\n      // We only support megolm\n      rustEncryptionSettings.algorithm = EncryptionAlgorithm.MegolmV1AesSha2;\n\n      // We need to convert the rotation period from milliseconds to microseconds\n      // See https://spec.matrix.org/v1.8/client-server-api/#mroomencryption and\n      // https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/classes/EncryptionSettings.html#rotationPeriod\n      if (typeof _this3.encryptionSettings.rotation_period_ms === \"number\") {\n        rustEncryptionSettings.rotationPeriod = BigInt(_this3.encryptionSettings.rotation_period_ms * 1000);\n      }\n      if (typeof _this3.encryptionSettings.rotation_period_msgs === \"number\") {\n        rustEncryptionSettings.rotationPeriodMessages = BigInt(_this3.encryptionSettings.rotation_period_msgs);\n      }\n      switch (deviceIsolationMode.kind) {\n        case DeviceIsolationModeKind.AllDevicesIsolationMode:\n          {\n            var _this3$room$getBlackl;\n            // When this.room.getBlacklistUnverifiedDevices() === null, the global settings should be used\n            // See Room#getBlacklistUnverifiedDevices\n            var onlyAllowTrustedDevices = (_this3$room$getBlackl = _this3.room.getBlacklistUnverifiedDevices()) !== null && _this3$room$getBlackl !== void 0 ? _this3$room$getBlackl : globalBlacklistUnverifiedDevices;\n            rustEncryptionSettings.sharingStrategy = CollectStrategy.deviceBasedStrategy(onlyAllowTrustedDevices, deviceIsolationMode.errorOnVerifiedUserProblems);\n          }\n          break;\n        case DeviceIsolationModeKind.OnlySignedDevicesIsolationMode:\n          rustEncryptionSettings.sharingStrategy = CollectStrategy.identityBasedStrategy();\n          break;\n      }\n      yield logDuration(logger, \"shareRoomKey\", /*#__PURE__*/_asyncToGenerator(function* () {\n        var shareMessages = yield _this3.olmMachine.shareRoomKey(new RoomId(_this3.room.roomId),\n        // safe to pass without cloning, as it's not reused here (before or after)\n        userList, rustEncryptionSettings);\n        if (shareMessages) {\n          for (var m of shareMessages) {\n            yield _this3.outgoingRequestManager.outgoingRequestProcessor.makeOutgoingRequest(m);\n          }\n        }\n      }));\n    })();\n  }\n\n  /**\n   * Discard any existing group session for this room\n   */\n  forceDiscardSession() {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      var r = yield _this4.olmMachine.invalidateGroupSession(new RoomId(_this4.room.roomId));\n      if (r) {\n        _this4.prefixedLogger.info(\"Discarded existing group session\");\n      }\n    })();\n  }\n  encryptEventInner(logger, event) {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      logger.debug(\"Encrypting actual message content\");\n      var room = new RoomId(_this5.room.roomId);\n      var type = event.getType();\n      var content = JSON.stringify(event.getContent());\n      var encryptedContent;\n      if (event.isState()) {\n        encryptedContent = yield _this5.olmMachine.encryptStateEvent(room, type,\n        // Safety: we've already checked above that this is a state event, so the state key must exist.\n        event.getStateKey(), content);\n      } else {\n        encryptedContent = yield _this5.olmMachine.encryptRoomEvent(room, type, content);\n      }\n      event.makeEncrypted(EventType.RoomMessageEncrypted, JSON.parse(encryptedContent), _this5.olmMachine.identityKeys.curve25519.toBase64(), _this5.olmMachine.identityKeys.ed25519.toBase64());\n      logger.debug(\"Encrypted event successfully\");\n    })();\n  }\n}\n\n/**\n * Convert a HistoryVisibility to a RustHistoryVisibility\n * @param visibility - HistoryVisibility enum\n * @returns a RustHistoryVisibility enum\n */\nexport function toRustHistoryVisibility(visibility) {\n  switch (visibility) {\n    case HistoryVisibility.Invited:\n      return RustHistoryVisibility.Invited;\n    case HistoryVisibility.Joined:\n      return RustHistoryVisibility.Joined;\n    case HistoryVisibility.Shared:\n      return RustHistoryVisibility.Shared;\n    case HistoryVisibility.WorldReadable:\n      return RustHistoryVisibility.WorldReadable;\n  }\n}\n//# sourceMappingURL=RoomEncryptor.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { encodeUri } from \"../utils.js\";\nimport { Method } from \"../http-api/index.js\";\nimport { decodeBase64 } from \"../base64.js\";\nimport { CryptoEvent } from \"../crypto-api/index.js\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.js\";\n\n/**\n * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device`.\n */\n\n/**\n * The response body of `POST /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/events`.\n */\n\n/**\n * The unstable URL prefix for dehydrated device endpoints\n */\nexport var UnstablePrefix = \"/_matrix/client/unstable/org.matrix.msc3814.v1\";\n/**\n * The name used for the dehydration key in Secret Storage\n */\nvar SECRET_STORAGE_NAME = \"org.matrix.msc3814\";\n\n/**\n * The interval between creating dehydrated devices. (one week)\n */\nvar DEHYDRATION_INTERVAL = 7 * 24 * 60 * 60 * 1000;\n\n/**\n * Manages dehydrated devices\n *\n * We have one of these per `RustCrypto`.  It's responsible for\n *\n * * determining server support for dehydrated devices\n * * creating new dehydrated devices when requested, including periodically\n *   replacing the dehydrated device with a new one\n * * rehydrating a device when requested, and when present\n *\n * @internal\n */\nexport class DehydratedDeviceManager extends TypedEventEmitter {\n  constructor(logger, olmMachine, http, outgoingRequestProcessor, secretStorage) {\n    super();\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.http = http;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    this.secretStorage = secretStorage;\n    /** the ID of the interval for periodically replacing the dehydrated device */\n    _defineProperty(this, \"intervalId\", void 0);\n  }\n  cacheKey(key) {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      yield _this.olmMachine.dehydratedDevices().saveDehydratedDeviceKey(key);\n      _this.emit(CryptoEvent.DehydrationKeyCached);\n    })();\n  }\n\n  /**\n   * Return whether the server supports dehydrated devices.\n   */\n  isSupported() {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      // call the endpoint to get a dehydrated device.  If it returns an\n      // M_UNRECOGNIZED error, then dehydration is unsupported.  If it returns\n      // a successful response, or an M_NOT_FOUND, then dehydration is supported.\n      // Any other exceptions are passed through.\n      try {\n        yield _this2.http.authedRequest(Method.Get, \"/dehydrated_device\", undefined, undefined, {\n          prefix: UnstablePrefix\n        });\n      } catch (error) {\n        var err = error;\n        if (err.errcode === \"M_UNRECOGNIZED\") {\n          return false;\n        } else if (err.errcode === \"M_NOT_FOUND\") {\n          return true;\n        }\n        throw error;\n      }\n      return true;\n    })();\n  }\n\n  /**\n   * Start using device dehydration.\n   *\n   * - Rehydrates a dehydrated device, if one is available and `opts.rehydrate`\n   *   is `true`.\n   * - Creates a new dehydration key, if necessary, and stores it in Secret\n   *   Storage.\n   *   - If `opts.createNewKey` is set to true, always creates a new key.\n   *   - If a dehydration key is not available, creates a new one.\n   * - Creates a new dehydrated device, and schedules periodically creating\n   *   new dehydrated devices.\n   *\n   * @param opts - options for device dehydration. For backwards compatibility\n   *     with old code, a boolean can be given here, which will be treated as\n   *     the `createNewKey` option. However, this is deprecated.\n   */\n  start() {\n    var _arguments = arguments,\n      _this3 = this;\n    return _asyncToGenerator(function* () {\n      var opts = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};\n      if (typeof opts === \"boolean\") {\n        opts = {\n          createNewKey: opts\n        };\n      }\n      if (opts.onlyIfKeyCached && !(yield _this3.olmMachine.dehydratedDevices().getDehydratedDeviceKey())) {\n        return;\n      }\n      _this3.stop();\n      if (opts.rehydrate !== false) {\n        try {\n          yield _this3.rehydrateDeviceIfAvailable();\n        } catch (e) {\n          // If rehydration fails, there isn't much we can do about it.  Log\n          // the error, and create a new device.\n          _this3.logger.info(\"dehydration: Error rehydrating device:\", e);\n          _this3.emit(CryptoEvent.RehydrationError, e.message);\n        }\n      }\n      if (opts.createNewKey) {\n        yield _this3.resetKey();\n      }\n      yield _this3.scheduleDeviceDehydration();\n    })();\n  }\n\n  /**\n   * Return whether the dehydration key is stored in Secret Storage.\n   */\n  isKeyStored() {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      return Boolean(yield _this4.secretStorage.isStored(SECRET_STORAGE_NAME));\n    })();\n  }\n\n  /**\n   * Reset the dehydration key.\n   *\n   * Creates a new key and stores it in secret storage.\n   *\n   * @returns The newly-generated key.\n   */\n  resetKey() {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      var key = RustSdkCryptoJs.DehydratedDeviceKey.createRandomKey();\n      yield _this5.secretStorage.store(SECRET_STORAGE_NAME, key.toBase64());\n      // Also cache it in the rust SDK's crypto store.\n      yield _this5.cacheKey(key);\n      return key;\n    })();\n  }\n\n  /**\n   * Get and cache the encryption key from secret storage.\n   *\n   * If `create` is `true`, creates a new key if no existing key is present.\n   *\n   * @returns the key, if available, or `null` if no key is available\n   */\n  getKey(create) {\n    var _this6 = this;\n    return _asyncToGenerator(function* () {\n      var cachedKey = yield _this6.olmMachine.dehydratedDevices().getDehydratedDeviceKey();\n      if (cachedKey) return cachedKey;\n      var keyB64 = yield _this6.secretStorage.get(SECRET_STORAGE_NAME);\n      if (keyB64 === undefined) {\n        if (!create) {\n          return null;\n        }\n        return yield _this6.resetKey();\n      }\n\n      // We successfully found the key in secret storage: decode it, and cache it in\n      // the rust SDK's crypto store.\n      var bytes = decodeBase64(keyB64);\n      try {\n        var key = RustSdkCryptoJs.DehydratedDeviceKey.createKeyFromArray(bytes);\n        yield _this6.cacheKey(key);\n        return key;\n      } finally {\n        bytes.fill(0);\n      }\n    })();\n  }\n\n  /**\n   * Rehydrate the dehydrated device stored on the server.\n   *\n   * Checks if there is a dehydrated device on the server.  If so, rehydrates\n   * the device and processes the to-device events.\n   *\n   * Returns whether or not a dehydrated device was found.\n   */\n  rehydrateDeviceIfAvailable() {\n    var _this7 = this;\n    return _asyncToGenerator(function* () {\n      var key = yield _this7.getKey(false);\n      if (!key) {\n        return false;\n      }\n      var dehydratedDeviceResp;\n      try {\n        dehydratedDeviceResp = yield _this7.http.authedRequest(Method.Get, \"/dehydrated_device\", undefined, undefined, {\n          prefix: UnstablePrefix\n        });\n      } catch (error) {\n        var err = error;\n        // We ignore M_NOT_FOUND (there is no dehydrated device, so nothing\n        // us to do) and M_UNRECOGNIZED (the server does not understand the\n        // endpoint).  We pass through any other errors.\n        if (err.errcode === \"M_NOT_FOUND\" || err.errcode === \"M_UNRECOGNIZED\") {\n          _this7.logger.info(\"dehydration: No dehydrated device\");\n          return false;\n        }\n        throw err;\n      }\n      _this7.logger.info(\"dehydration: dehydrated device found\");\n      _this7.emit(CryptoEvent.RehydrationStarted);\n      var rehydratedDevice = yield _this7.olmMachine.dehydratedDevices().rehydrate(key, new RustSdkCryptoJs.DeviceId(dehydratedDeviceResp.device_id), JSON.stringify(dehydratedDeviceResp.device_data));\n      _this7.logger.info(\"dehydration: device rehydrated\");\n      var nextBatch = undefined;\n      var toDeviceCount = 0;\n      var roomKeyCount = 0;\n      var path = encodeUri(\"/dehydrated_device/$device_id/events\", {\n        $device_id: dehydratedDeviceResp.device_id\n      });\n      // eslint-disable-next-line no-constant-condition\n      while (true) {\n        var eventResp = yield _this7.http.authedRequest(Method.Post, path, undefined, nextBatch ? {\n          next_batch: nextBatch\n        } : {}, {\n          prefix: UnstablePrefix\n        });\n        if (eventResp.events.length === 0) {\n          break;\n        }\n        toDeviceCount += eventResp.events.length;\n        nextBatch = eventResp.next_batch;\n        var roomKeyInfos = yield rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));\n        roomKeyCount += roomKeyInfos.length;\n        _this7.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);\n      }\n      _this7.logger.info(\"dehydration: received \".concat(roomKeyCount, \" room keys from \").concat(toDeviceCount, \" to-device events\"));\n      _this7.emit(CryptoEvent.RehydrationCompleted);\n      return true;\n    })();\n  }\n\n  /**\n   * Creates and uploads a new dehydrated device.\n   *\n   * Creates and stores a new key in secret storage if none is available.\n   */\n  createAndUploadDehydratedDevice() {\n    var _this8 = this;\n    return _asyncToGenerator(function* () {\n      var key = yield _this8.getKey(true);\n      var dehydratedDevice = yield _this8.olmMachine.dehydratedDevices().create();\n      _this8.emit(CryptoEvent.DehydratedDeviceCreated);\n      var request = yield dehydratedDevice.keysForUpload(\"Dehydrated device\", key);\n      yield _this8.outgoingRequestProcessor.makeOutgoingRequest(request);\n      _this8.emit(CryptoEvent.DehydratedDeviceUploaded);\n      _this8.logger.info(\"dehydration: uploaded device\");\n    })();\n  }\n\n  /**\n   * Schedule periodic creation of dehydrated devices.\n   */\n  scheduleDeviceDehydration() {\n    var _this9 = this;\n    return _asyncToGenerator(function* () {\n      // cancel any previously-scheduled tasks\n      _this9.stop();\n      yield _this9.createAndUploadDehydratedDevice();\n      _this9.intervalId = setInterval(() => {\n        _this9.createAndUploadDehydratedDevice().catch(error => {\n          _this9.emit(CryptoEvent.DehydratedDeviceRotationError, error.message);\n          _this9.logger.error(\"Error creating dehydrated device:\", error);\n        });\n      }, DEHYDRATION_INTERVAL);\n    })();\n  }\n\n  /**\n   * Stop the dehydrated device manager.\n   *\n   * Cancels any scheduled dehydration tasks.\n   */\n  stop() {\n    if (this.intervalId) {\n      clearInterval(this.intervalId);\n      this.intervalId = undefined;\n    }\n  }\n\n  /**\n   * Delete the current dehydrated device and stop the dehydrated device manager.\n   */\n  delete() {\n    var _this0 = this;\n    return _asyncToGenerator(function* () {\n      _this0.stop();\n      try {\n        yield _this0.http.authedRequest(Method.Delete, \"/dehydrated_device\", undefined, {}, {\n          prefix: UnstablePrefix\n        });\n      } catch (error) {\n        var err = error;\n        // If dehydrated devices aren't supported, or no dehydrated device\n        // is found, we don't consider it an error, because we we'll end up\n        // with no dehydrated device.\n        if (err.errcode === \"M_UNRECOGNIZED\") {\n          return;\n        } else if (err.errcode === \"M_NOT_FOUND\") {\n          return;\n        }\n        throw error;\n      }\n    })();\n  }\n}\n\n/**\n * The events fired by the DehydratedDeviceManager\n * @internal\n */\n\n/**\n * A map of the {@link DehydratedDeviceEvents} fired by the {@link DehydratedDeviceManager} and their payloads.\n * @internal\n */\n//# sourceMappingURL=DehydratedDeviceManager.js.map","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { KeysBackupRequest, KeysClaimRequest, KeysQueryRequest, KeysUploadRequest, PutDehydratedDeviceRequest, RoomMessageRequest, SignatureUploadRequest, ToDeviceRequest, UploadSigningKeysRequest } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { calculateRetryBackoff, Method } from \"../http-api/index.js\";\nimport { logDuration, sleep } from \"../utils.js\";\nimport { ToDeviceMessageId } from \"../@types/event.js\";\nimport { UnstablePrefix as DehydrationUnstablePrefix } from \"./DehydratedDeviceManager.js\";\n\n/**\n * OutgoingRequestManager: turns `OutgoingRequest`s from the rust sdk into HTTP requests\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`), not that it does anything terribly complicated.\n * It's responsible for:\n *\n *   * holding the reference to the `MatrixHttpApi`\n *   * turning `OutgoingRequest`s from the rust backend into HTTP requests, and sending them\n *   * sending the results of such requests back to the rust backend.\n *\n * @internal\n */\nexport class OutgoingRequestProcessor {\n  constructor(logger, olmMachine, http) {\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.http = http;\n  }\n  makeOutgoingRequest(msg, uiaCallback) {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      var resp;\n\n      /* refer https://docs.rs/matrix-sdk-crypto/0.6.0/matrix_sdk_crypto/requests/enum.OutgoingRequests.html\n       * for the complete list of request types\n       */\n      if (msg instanceof KeysUploadRequest) {\n        resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/upload\", {}, msg.body);\n      } else if (msg instanceof KeysQueryRequest) {\n        resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/query\", {}, msg.body);\n      } else if (msg instanceof KeysClaimRequest) {\n        resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/claim\", {}, msg.body);\n      } else if (msg instanceof SignatureUploadRequest) {\n        resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/signatures/upload\", {}, msg.body);\n      } else if (msg instanceof KeysBackupRequest) {\n        resp = yield _this.requestWithRetry(Method.Put, \"/_matrix/client/v3/room_keys/keys\", {\n          version: msg.version\n        }, msg.body);\n      } else if (msg instanceof ToDeviceRequest) {\n        resp = yield _this.sendToDeviceRequest(msg);\n      } else if (msg instanceof RoomMessageRequest) {\n        var path = \"/_matrix/client/v3/rooms/\".concat(encodeURIComponent(msg.room_id), \"/send/\") + \"\".concat(encodeURIComponent(msg.event_type), \"/\").concat(encodeURIComponent(msg.txn_id));\n        resp = yield _this.requestWithRetry(Method.Put, path, {}, msg.body);\n      } else if (msg instanceof UploadSigningKeysRequest) {\n        yield _this.makeRequestWithUIA(Method.Post, \"/_matrix/client/v3/keys/device_signing/upload\", {}, msg.body, uiaCallback);\n        // SigningKeysUploadRequest does not implement OutgoingRequest and does not need to be marked as sent.\n        return;\n      } else if (msg instanceof PutDehydratedDeviceRequest) {\n        var _path = DehydrationUnstablePrefix + \"/dehydrated_device\";\n        yield _this.rawJsonRequest(Method.Put, _path, {}, msg.body);\n        // PutDehydratedDeviceRequest does not implement OutgoingRequest and does not need to be marked as sent.\n        return;\n      } else {\n        _this.logger.warn(\"Unsupported outgoing message\", Object.getPrototypeOf(msg));\n        resp = \"\";\n      }\n      if (msg.id) {\n        try {\n          yield logDuration(_this.logger, \"Mark Request as sent \".concat(msg.type), /*#__PURE__*/_asyncToGenerator(function* () {\n            yield _this.olmMachine.markRequestAsSent(msg.id, msg.type, resp);\n          }));\n        } catch (e) {\n          // Ignore errors which are caused by the olmMachine having been freed. The exact error message depends\n          // on whether we are using a release or develop build of rust-sdk-crypto-wasm.\n          if (e instanceof Error && (e.message === \"Attempt to use a moved value\" || e.message === \"null pointer passed to rust\")) {\n            _this.logger.debug(\"Ignoring error '\".concat(e.message, \"': client is likely shutting down\"));\n          } else {\n            throw e;\n          }\n        }\n      } else {\n        _this.logger.trace(\"Outgoing request type:\".concat(msg.type, \" does not have an ID\"));\n      }\n    })();\n  }\n\n  /**\n   * Send the HTTP request for a `ToDeviceRequest`\n   *\n   * @param request - request to send\n   * @returns JSON-serialized body of the response, if successful\n   */\n  sendToDeviceRequest(request) {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      // a bit of extra logging, to help trace to-device messages through the system\n      var parsedBody = JSON.parse(request.body);\n      var messageList = [];\n      for (var [userId, perUserMessages] of Object.entries(parsedBody.messages)) {\n        for (var [deviceId, message] of Object.entries(perUserMessages)) {\n          messageList.push(\"\".concat(userId, \"/\").concat(deviceId, \" (msgid \").concat(message[ToDeviceMessageId], \")\"));\n        }\n      }\n      _this2.logger.info(\"Sending batch of to-device messages. type=\".concat(request.event_type, \" txnid=\").concat(request.txn_id), messageList);\n      var path = \"/_matrix/client/v3/sendToDevice/\".concat(encodeURIComponent(request.event_type), \"/\") + encodeURIComponent(request.txn_id);\n      return yield _this2.requestWithRetry(Method.Put, path, {}, request.body);\n    })();\n  }\n  makeRequestWithUIA(method, path, queryParams, body, uiaCallback) {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      if (!uiaCallback) {\n        return yield _this3.requestWithRetry(method, path, queryParams, body);\n      }\n      var parsedBody = JSON.parse(body);\n      var makeRequest = /*#__PURE__*/function () {\n        var _ref2 = _asyncToGenerator(function* (auth) {\n          var newBody = _objectSpread({}, parsedBody);\n          if (auth !== null) {\n            newBody.auth = auth;\n          }\n          var resp = yield _this3.requestWithRetry(method, path, queryParams, JSON.stringify(newBody));\n          return JSON.parse(resp);\n        });\n        return function makeRequest(_x) {\n          return _ref2.apply(this, arguments);\n        };\n      }();\n      var resp = yield uiaCallback(makeRequest);\n      return JSON.stringify(resp);\n    })();\n  }\n  requestWithRetry(method, path, queryParams, body) {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      var currentRetryCount = 0;\n\n      // eslint-disable-next-line no-constant-condition\n      while (true) {\n        try {\n          return yield _this4.rawJsonRequest(method, path, queryParams, body);\n        } catch (e) {\n          currentRetryCount++;\n          var backoff = calculateRetryBackoff(e, currentRetryCount, true);\n          if (backoff < 0) {\n            // Max number of retries reached, or error is not retryable. rethrow the error\n            throw e;\n          }\n          // wait for the specified time and then retry the request\n          yield sleep(backoff);\n        }\n      }\n    })();\n  }\n  rawJsonRequest(method, path, queryParams, body) {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      var opts = {\n        // inhibit the JSON stringification and parsing within HttpApi.\n        json: false,\n        // nevertheless, we are sending, and accept, JSON.\n        headers: {\n          \"Content-Type\": \"application/json\",\n          \"Accept\": \"application/json\"\n        },\n        // we use the full prefix\n        prefix: \"\",\n        // We set a timeout of 60 seconds to guard against requests getting stuck forever and wedging the\n        // request loop (cf https://github.com/element-hq/element-web/issues/29534).\n        //\n        // (XXX: should we do this in the whole of the js-sdk?)\n        localTimeoutMs: 60000\n      };\n      return yield _this5.http.authedRequest(method, path, queryParams, body, opts);\n    })();\n  }\n}\n//# sourceMappingURL=OutgoingRequestProcessor.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * KeyClaimManager: linearises calls to OlmMachine.getMissingSessions to avoid races\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`).\n *\n * @internal\n */\nexport class KeyClaimManager {\n  constructor(olmMachine, outgoingRequestProcessor) {\n    this.olmMachine = olmMachine;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    _defineProperty(this, \"currentClaimPromise\", void 0);\n    _defineProperty(this, \"stopped\", false);\n    this.currentClaimPromise = Promise.resolve();\n  }\n\n  /**\n   * Tell the KeyClaimManager to immediately stop processing requests.\n   *\n   * Any further calls, and any still in the queue, will fail with an error.\n   */\n  stop() {\n    this.stopped = true;\n  }\n\n  /**\n   * Given a list of users, attempt to ensure that we have Olm Sessions active with each of their devices\n   *\n   * If we don't have an active olm session, we will claim a one-time key and start one.\n   * @param logger - logger to use\n   * @param userList - list of userIDs to claim\n   */\n  ensureSessionsForUsers(logger, userList) {\n    // The Rust-SDK requires that we only have one getMissingSessions process in flight at once. This little dance\n    // ensures that, by only having one call to ensureSessionsForUsersInner active at once (and making them\n    // queue up in order).\n    var prom = this.currentClaimPromise.catch(() => {\n      // any errors in the previous claim will have been reported already, so there is nothing to do here.\n      // we just throw away the error and start anew.\n    }).then(() => this.ensureSessionsForUsersInner(logger, userList));\n    this.currentClaimPromise = prom;\n    return prom;\n  }\n  ensureSessionsForUsersInner(logger, userList) {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      // bail out quickly if we've been stopped.\n      if (_this.stopped) {\n        throw new Error(\"Cannot ensure Olm sessions: shutting down\");\n      }\n      logger.info(\"Checking for missing Olm sessions\");\n      // By passing the userId array to rust we transfer ownership of the items to rust, causing\n      // them to be invalidated on the JS side as soon as the method is called.\n      // As we haven't created the `userList` let's clone the users, to not break the caller from re-using it.\n      var claimRequest = yield _this.olmMachine.getMissingSessions(userList.map(u => u.clone()));\n      if (claimRequest) {\n        logger.info(\"Making /keys/claim request\");\n        yield _this.outgoingRequestProcessor.makeOutgoingRequest(claimRequest);\n      }\n      logger.info(\"Olm sessions prepared\");\n    })();\n  }\n}\n//# sourceMappingURL=KeyClaimManager.js.map","/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { Device, DeviceVerification } from \"../models/device.js\";\n/**\n * Convert a {@link RustSdkCryptoJs.Device} to a {@link Device}\n * @param device - Rust Sdk device\n * @param userId - owner of the device\n *\n * @internal\n */\nexport function rustDeviceToJsDevice(device, userId) {\n  // Copy rust device keys to Device.keys\n  var keys = new Map();\n  for (var [keyId, key] of device.keys.entries()) {\n    keys.set(keyId.toString(), key.toBase64());\n  }\n\n  // Compute verified from device state\n  var verified = DeviceVerification.Unverified;\n  if (device.isBlacklisted()) {\n    verified = DeviceVerification.Blocked;\n  } else if (device.isVerified()) {\n    verified = DeviceVerification.Verified;\n  }\n\n  // Convert rust signatures to Device.signatures\n  var signatures = new Map();\n  var mayBeSignatureMap = device.signatures.get(userId);\n  if (mayBeSignatureMap) {\n    var convertedSignatures = new Map();\n    // Convert maybeSignatures map to a Map<string, string>\n    for (var [_key, value] of mayBeSignatureMap.entries()) {\n      if (value.isValid() && value.signature) {\n        convertedSignatures.set(_key, value.signature.toBase64());\n      }\n    }\n    signatures.set(userId.toString(), convertedSignatures);\n  }\n\n  // Convert rust algorithms to algorithms\n  var rustAlgorithms = device.algorithms;\n  // Use set to ensure that algorithms are not duplicated\n  var algorithms = new Set();\n  rustAlgorithms.forEach(algorithm => {\n    switch (algorithm) {\n      case RustSdkCryptoJs.EncryptionAlgorithm.MegolmV1AesSha2:\n        algorithms.add(\"m.megolm.v1.aes-sha2\");\n        break;\n      case RustSdkCryptoJs.EncryptionAlgorithm.OlmV1Curve25519AesSha2:\n      default:\n        algorithms.add(\"m.olm.v1.curve25519-aes-sha2\");\n        break;\n    }\n  });\n  return new Device({\n    deviceId: device.deviceId.toString(),\n    userId: userId.toString(),\n    keys,\n    algorithms: Array.from(algorithms),\n    verified,\n    signatures,\n    displayName: device.displayName,\n    dehydrated: device.isDehydrated\n  });\n}\n\n/**\n * Convert {@link DeviceKeys}  from `/keys/query` request to a `Map<string, Device>`\n * @param deviceKeys - Device keys object to convert\n *\n * @internal\n */\nexport function deviceKeysToDeviceMap(deviceKeys) {\n  return new Map(Object.entries(deviceKeys).map(_ref => {\n    var [deviceId, device] = _ref;\n    return [deviceId, downloadDeviceToJsDevice(device)];\n  }));\n}\n\n// Device from `/keys/query` request\n\n/**\n * Convert `/keys/query` {@link QueryDevice} device to {@link Device}\n * @param device - Device from `/keys/query` request\n *\n * @internal\n */\nexport function downloadDeviceToJsDevice(device) {\n  var _device$unsigned;\n  var keys = new Map(Object.entries(device.keys));\n  var displayName = (_device$unsigned = device.unsigned) === null || _device$unsigned === void 0 ? void 0 : _device$unsigned.device_display_name;\n  var signatures = new Map();\n  if (device.signatures) {\n    for (var userId in device.signatures) {\n      signatures.set(userId, new Map(Object.entries(device.signatures[userId])));\n    }\n  }\n  return new Device({\n    deviceId: device.device_id,\n    userId: device.user_id,\n    keys,\n    algorithms: device.algorithms,\n    verified: DeviceVerification.Unverified,\n    signatures,\n    displayName\n  });\n}\n//# sourceMappingURL=device-converter.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/** Manages the cross-signing keys for our own user.\n *\n * @internal\n */\nexport class CrossSigningIdentity {\n  constructor(logger, olmMachine, outgoingRequestProcessor, secretStorage) {\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    this.secretStorage = secretStorage;\n  }\n\n  /**\n   * Initialise our cross-signing keys by creating new keys if they do not exist, and uploading to the server\n   */\n  bootstrapCrossSigning(opts) {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      if (opts.setupNewCrossSigning) {\n        yield _this.resetCrossSigning(opts.authUploadDeviceSigningKeys);\n        return;\n      }\n      var olmDeviceStatus = yield _this.olmMachine.crossSigningStatus();\n\n      // Try to fetch cross signing keys from the secret storage\n      var masterKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.master\");\n      var selfSigningKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.self_signing\");\n      var userSigningKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.user_signing\");\n      var privateKeysInSecretStorage = Boolean(masterKeyFromSecretStorage && selfSigningKeyFromSecretStorage && userSigningKeyFromSecretStorage);\n      var olmDeviceHasKeys = olmDeviceStatus.hasMaster && olmDeviceStatus.hasUserSigning && olmDeviceStatus.hasSelfSigning;\n\n      // Log all relevant state for easier parsing of debug logs.\n      _this.logger.debug(\"bootstrapCrossSigning: starting\", {\n        setupNewCrossSigning: opts.setupNewCrossSigning,\n        olmDeviceHasMaster: olmDeviceStatus.hasMaster,\n        olmDeviceHasUserSigning: olmDeviceStatus.hasUserSigning,\n        olmDeviceHasSelfSigning: olmDeviceStatus.hasSelfSigning,\n        privateKeysInSecretStorage\n      });\n      if (olmDeviceHasKeys) {\n        if (!(yield _this.secretStorage.hasKey())) {\n          _this.logger.warn(\"bootstrapCrossSigning: Olm device has private keys, but secret storage is not yet set up; doing nothing for now.\");\n          // the keys should get uploaded to 4S once that is set up.\n        } else if (!privateKeysInSecretStorage) {\n          // the device has the keys but they are not in 4S, so update it\n          _this.logger.debug(\"bootstrapCrossSigning: Olm device has private keys: exporting to secret storage\");\n          yield _this.exportCrossSigningKeysToStorage();\n        } else {\n          _this.logger.debug(\"bootstrapCrossSigning: Olm device has private keys and they are saved in secret storage; doing nothing\");\n        }\n      } /* (!olmDeviceHasKeys) */else {\n        if (privateKeysInSecretStorage) {\n          // they are in 4S, so import from there\n          _this.logger.debug(\"bootstrapCrossSigning: Cross-signing private keys not found locally, but they are available \" + \"in secret storage, reading storage and caching locally\");\n          var status = yield _this.olmMachine.importCrossSigningKeys(masterKeyFromSecretStorage, selfSigningKeyFromSecretStorage, userSigningKeyFromSecretStorage);\n\n          // Check that `importCrossSigningKeys` worked correctly (for example, it will fail silently if the\n          // public keys are not available).\n          if (!status.hasMaster || !status.hasSelfSigning || !status.hasUserSigning) {\n            throw new Error(\"importCrossSigningKeys failed to import the keys\");\n          }\n\n          // Get the current device\n          var device = yield _this.olmMachine.getDevice(_this.olmMachine.userId, _this.olmMachine.deviceId);\n          try {\n            // Sign the device with our cross-signing key and upload the signature\n            var request = yield device.verify();\n            yield _this.outgoingRequestProcessor.makeOutgoingRequest(request);\n          } finally {\n            device.free();\n          }\n        } else {\n          _this.logger.debug(\"bootstrapCrossSigning: Cross-signing private keys not found locally or in secret storage, creating new keys\");\n          yield _this.resetCrossSigning(opts.authUploadDeviceSigningKeys);\n        }\n      }\n\n      // TODO: we might previously have bootstrapped cross-signing but not completed uploading the keys to the\n      //   server -- in which case we should call OlmDevice.bootstrap_cross_signing. How do we know?\n      _this.logger.debug(\"bootstrapCrossSigning: complete\");\n    })();\n  }\n\n  /** Reset our cross-signing keys\n   *\n   * This method will:\n   *   * Tell the OlmMachine to create new keys\n   *   * Upload the new public keys and the device signature to the server\n   *   * Upload the private keys to SSSS, if it is set up\n   */\n  resetCrossSigning(authUploadDeviceSigningKeys) {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      // XXX: We must find a way to make this atomic, currently if the user does not remember his account password\n      // or 4S passphrase/key the process will fail in a bad state, with keys rotated but not uploaded or saved in 4S.\n      var outgoingRequests = yield _this2.olmMachine.bootstrapCrossSigning(true);\n\n      // If 4S is configured we need to update it.\n      if (!(yield _this2.secretStorage.hasKey())) {\n        _this2.logger.warn(\"resetCrossSigning: Secret storage is not yet set up; not exporting keys to secret storage yet.\");\n        // the keys should get uploaded to 4S once that is set up.\n      } else {\n        // Update 4S before uploading cross-signing keys, to stay consistent with legacy that asks\n        // 4S passphrase before asking for account password.\n        // Ultimately should be made atomic and resistant to forgotten password/passphrase.\n        _this2.logger.debug(\"resetCrossSigning: exporting private keys to secret storage\");\n        yield _this2.exportCrossSigningKeysToStorage();\n      }\n      _this2.logger.debug(\"resetCrossSigning: publishing public keys to server\");\n      for (var req of [outgoingRequests.uploadKeysRequest, outgoingRequests.uploadSigningKeysRequest, outgoingRequests.uploadSignaturesRequest]) {\n        if (req) {\n          yield _this2.outgoingRequestProcessor.makeOutgoingRequest(req, authUploadDeviceSigningKeys);\n        }\n      }\n    })();\n  }\n\n  /**\n   * Extract the cross-signing keys from the olm machine and save them to secret storage, if it is configured\n   *\n   * (If secret storage is *not* configured, we assume that the export will happen when it is set up)\n   */\n  exportCrossSigningKeysToStorage() {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      var exported = yield _this3.olmMachine.exportCrossSigningKeys();\n      /* istanbul ignore else (this function is only called when we know the olm machine has keys) */\n      if (exported !== null && exported !== void 0 && exported.masterKey) {\n        yield _this3.secretStorage.store(\"m.cross_signing.master\", exported.masterKey);\n      } else {\n        _this3.logger.error(\"Cannot export MSK to secret storage, private key unknown\");\n      }\n      if (exported !== null && exported !== void 0 && exported.self_signing_key) {\n        yield _this3.secretStorage.store(\"m.cross_signing.self_signing\", exported.self_signing_key);\n      } else {\n        _this3.logger.error(\"Cannot export SSK to secret storage, private key unknown\");\n      }\n      if (exported !== null && exported !== void 0 && exported.userSigningKey) {\n        yield _this3.secretStorage.store(\"m.cross_signing.user_signing\", exported.userSigningKey);\n      } else {\n        _this3.logger.error(\"Cannot export USK to secret storage, private key unknown\");\n      }\n    })();\n  }\n}\n//# sourceMappingURL=CrossSigningIdentity.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Check that the private cross signing keys (master, self signing, user signing) are stored in the secret storage and encrypted with the default secret storage key.\n *\n * @param secretStorage - The secret store using account data\n * @returns True if the cross-signing keys are all stored and encrypted with the same secret storage key.\n *\n * @internal\n */\nexport function secretStorageContainsCrossSigningKeys(_x) {\n  return _secretStorageContainsCrossSigningKeys.apply(this, arguments);\n}\n\n/**\n *\n * Check that the secret storage can access the given secrets using the default key.\n *\n * @param secretStorage - The secret store using account data\n * @param secretNames - The secret names to check\n * @returns True if all the given secrets are accessible and encrypted with the given key.\n *\n * @internal\n */\nfunction _secretStorageContainsCrossSigningKeys() {\n  _secretStorageContainsCrossSigningKeys = _asyncToGenerator(function* (secretStorage) {\n    return secretStorageCanAccessSecrets(secretStorage, [\"m.cross_signing.master\", \"m.cross_signing.user_signing\", \"m.cross_signing.self_signing\"]);\n  });\n  return _secretStorageContainsCrossSigningKeys.apply(this, arguments);\n}\nexport function secretStorageCanAccessSecrets(_x2, _x3) {\n  return _secretStorageCanAccessSecrets.apply(this, arguments);\n}\nfunction _secretStorageCanAccessSecrets() {\n  _secretStorageCanAccessSecrets = _asyncToGenerator(function* (secretStorage, secretNames) {\n    var defaultKeyId = yield secretStorage.getDefaultKeyId();\n    if (!defaultKeyId) return false;\n    for (var secretName of secretNames) {\n      // check which keys this particular secret is encrypted with\n      var record = (yield secretStorage.isStored(secretName)) || {};\n      // if it's not encrypted with the right key, there is no point continuing\n      if (!(defaultKeyId in record)) return false;\n    }\n    return true;\n  });\n  return _secretStorageCanAccessSecrets.apply(this, arguments);\n}\n//# sourceMappingURL=secret-storage.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { QrState } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { VerificationPhase, VerificationRequestEvent, VerifierEvent } from \"../crypto-api/verification.js\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.js\";\nimport { TypedReEmitter } from \"../ReEmitter.js\";\nimport { EventType, MsgType } from \"../@types/event.js\";\nimport { VerificationMethod } from \"../types.js\";\n/**\n * An incoming, or outgoing, request to verify a user or a device via cross-signing.\n *\n * @internal\n */\nexport class RustVerificationRequest extends TypedEventEmitter {\n  /**\n   * Construct a new RustVerificationRequest to wrap the rust-level `VerificationRequest`.\n   *\n   * @param logger - A logger instance which will be used to log events.\n   * @param olmMachine - The `OlmMachine` from the underlying rust crypto sdk.\n   * @param inner - VerificationRequest from the Rust SDK.\n   * @param outgoingRequestProcessor - `OutgoingRequestProcessor` to use for making outgoing HTTP requests.\n   * @param supportedVerificationMethods - Verification methods to use when `accept()` is called.\n   */\n  constructor(logger, olmMachine, inner, outgoingRequestProcessor, supportedVerificationMethods) {\n    super();\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.inner = inner;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    this.supportedVerificationMethods = supportedVerificationMethods;\n    /** a reëmitter which relays VerificationRequestEvent.Changed events emitted by the verifier */\n    _defineProperty(this, \"reEmitter\", void 0);\n    /** Are we in the process of sending an `m.key.verification.ready` event? */\n    _defineProperty(this, \"_accepting\", false);\n    /** Are we in the process of sending an `m.key.verification.cancellation` event? */\n    _defineProperty(this, \"_cancelling\", false);\n    _defineProperty(this, \"_verifier\", void 0);\n    this.reEmitter = new TypedReEmitter(this);\n\n    // Obviously, the Rust object maintains a reference to the callback function. If the callback function maintains\n    // a reference to the Rust object, then we have a reference cycle which means that `RustVerificationRequest`\n    // will never be garbage-collected, and hence the underlying rust object will never be freed.\n    //\n    // To avoid this reference cycle, use a weak reference in the callback function. If the `RustVerificationRequest`\n    // gets garbage-collected, then there is nothing to update!\n    var weakThis = new WeakRef(this);\n    inner.registerChangesCallback(/*#__PURE__*/_asyncToGenerator(function* () {\n      var _weakThis$deref;\n      return (_weakThis$deref = weakThis.deref()) === null || _weakThis$deref === void 0 ? void 0 : _weakThis$deref.onChange();\n    }));\n  }\n\n  /**\n   * Hook which is called when the underlying rust class notifies us that there has been a change.\n   */\n  onChange() {\n    var verification = this.inner.getVerification();\n\n    // Set the _verifier object (wrapping the rust `Verification` as a js-sdk Verifier) if:\n    // - we now have a `Verification` where we lacked one before\n    // - we have transitioned from QR to SAS\n    // - we are verifying with SAS, but we need to replace our verifier with a new one because both parties\n    //   tried to start verification at the same time, and we lost the tie breaking\n    if (verification instanceof RustSdkCryptoJs.Sas) {\n      if (this._verifier === undefined || this._verifier instanceof RustQrCodeVerifier) {\n        this.setVerifier(new RustSASVerifier(verification, this, this.outgoingRequestProcessor));\n      } else if (this._verifier instanceof RustSASVerifier) {\n        this._verifier.replaceInner(verification);\n      }\n    } else if (verification instanceof RustSdkCryptoJs.Qr && this._verifier === undefined) {\n      this.setVerifier(new RustQrCodeVerifier(verification, this.outgoingRequestProcessor));\n    }\n    this.emit(VerificationRequestEvent.Change);\n  }\n  setVerifier(verifier) {\n    // if we already have a verifier, unsubscribe from its events\n    if (this._verifier) {\n      this.reEmitter.stopReEmitting(this._verifier, [VerificationRequestEvent.Change]);\n    }\n    this._verifier = verifier;\n    this.reEmitter.reEmit(this._verifier, [VerificationRequestEvent.Change]);\n  }\n\n  /**\n   * Unique ID for this verification request.\n   *\n   * An ID isn't assigned until the first message is sent, so this may be `undefined` in the early phases.\n   */\n  get transactionId() {\n    return this.inner.flowId;\n  }\n\n  /**\n   * For an in-room verification, the ID of the room.\n   *\n   * For to-device verifications, `undefined`.\n   */\n  get roomId() {\n    var _this$inner$roomId;\n    return (_this$inner$roomId = this.inner.roomId) === null || _this$inner$roomId === void 0 ? void 0 : _this$inner$roomId.toString();\n  }\n\n  /**\n   * True if this request was initiated by the local client.\n   *\n   * For in-room verifications, the initiator is who sent the `m.key.verification.request` event.\n   * For to-device verifications, the initiator is who sent the `m.key.verification.start` event.\n   */\n  get initiatedByMe() {\n    return this.inner.weStarted();\n  }\n\n  /** The user id of the other party in this request */\n  get otherUserId() {\n    return this.inner.otherUserId.toString();\n  }\n\n  /** For verifications via to-device messages: the ID of the other device. Otherwise, undefined. */\n  get otherDeviceId() {\n    var _this$inner$otherDevi;\n    return (_this$inner$otherDevi = this.inner.otherDeviceId) === null || _this$inner$otherDevi === void 0 ? void 0 : _this$inner$otherDevi.toString();\n  }\n\n  /** Get the other device involved in the verification, if it is known */\n  getOtherDevice() {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      var otherDeviceId = _this.inner.otherDeviceId;\n      if (!otherDeviceId) {\n        return undefined;\n      }\n      return yield _this.olmMachine.getDevice(_this.inner.otherUserId, otherDeviceId, 5);\n    })();\n  }\n\n  /** True if the other party in this request is one of this user's own devices. */\n  get isSelfVerification() {\n    return this.inner.isSelfVerification();\n  }\n\n  /** current phase of the request. */\n  get phase() {\n    var phase = this.inner.phase();\n    switch (phase) {\n      case RustSdkCryptoJs.VerificationRequestPhase.Created:\n      case RustSdkCryptoJs.VerificationRequestPhase.Requested:\n        return VerificationPhase.Requested;\n      case RustSdkCryptoJs.VerificationRequestPhase.Ready:\n        // if we're still sending the `m.key.verification.ready`, that counts as \"Requested\" in the js-sdk's\n        // parlance.\n        return this._accepting ? VerificationPhase.Requested : VerificationPhase.Ready;\n      case RustSdkCryptoJs.VerificationRequestPhase.Transitioned:\n        if (!this._verifier) {\n          // this shouldn't happen, because the onChange handler should have created a _verifier.\n          throw new Error(\"VerificationRequest: inner phase == Transitioned but no verifier!\");\n        }\n        return this._verifier.verificationPhase;\n      case RustSdkCryptoJs.VerificationRequestPhase.Done:\n        return VerificationPhase.Done;\n      case RustSdkCryptoJs.VerificationRequestPhase.Cancelled:\n        return VerificationPhase.Cancelled;\n    }\n    throw new Error(\"Unknown verification phase \".concat(phase));\n  }\n\n  /** True if the request has sent its initial event and needs more events to complete\n   * (ie it is in phase `Requested`, `Ready` or `Started`).\n   */\n  get pending() {\n    if (this.inner.isPassive()) return false;\n    var phase = this.phase;\n    return phase !== VerificationPhase.Done && phase !== VerificationPhase.Cancelled;\n  }\n\n  /**\n   * True if we have started the process of sending an `m.key.verification.ready` (but have not necessarily received\n   * the remote echo which causes a transition to {@link VerificationPhase.Ready}.\n   */\n  get accepting() {\n    return this._accepting;\n  }\n\n  /**\n   * True if we have started the process of sending an `m.key.verification.cancel` (but have not necessarily received\n   * the remote echo which causes a transition to {@link VerificationPhase.Cancelled}).\n   */\n  get declining() {\n    return this._cancelling;\n  }\n\n  /**\n   * The remaining number of ms before the request will be automatically cancelled.\n   *\n   * `null` indicates that there is no timeout\n   */\n  get timeout() {\n    return this.inner.timeRemainingMillis();\n  }\n\n  /** once the phase is Started (and !initiatedByMe) or Ready: common methods supported by both sides */\n  get methods() {\n    throw new Error(\"not implemented\");\n  }\n\n  /** the method picked in the .start event */\n  get chosenMethod() {\n    if (this.phase !== VerificationPhase.Started) return null;\n    var verification = this.inner.getVerification();\n    if (verification instanceof RustSdkCryptoJs.Sas) {\n      return VerificationMethod.Sas;\n    } else if (verification instanceof RustSdkCryptoJs.Qr) {\n      return VerificationMethod.Reciprocate;\n    } else {\n      return null;\n    }\n  }\n\n  /**\n   * Checks whether the other party supports a given verification method.\n   * This is useful when setting up the QR code UI, as it is somewhat asymmetrical:\n   * if the other party supports SCAN_QR, we should show a QR code in the UI, and vice versa.\n   * For methods that need to be supported by both ends, use the `methods` property.\n   *\n   * @param method - the method to check\n   * @returns true if the other party said they supported the method\n   */\n  otherPartySupportsMethod(method) {\n    var theirMethods = this.inner.theirSupportedMethods;\n    if (theirMethods === undefined) {\n      // no message from the other side yet\n      return false;\n    }\n    var requiredMethod = verificationMethodsByIdentifier[method];\n    return theirMethods.some(m => m === requiredMethod);\n  }\n\n  /**\n   * Accepts the request, sending a .ready event to the other party\n   *\n   * @returns Promise which resolves when the event has been sent.\n   */\n  accept() {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      if (_this2.inner.phase() !== RustSdkCryptoJs.VerificationRequestPhase.Requested || _this2._accepting) {\n        throw new Error(\"Cannot accept a verification request in phase \".concat(_this2.phase));\n      }\n      _this2._accepting = true;\n      try {\n        var req = _this2.inner.acceptWithMethods(_this2.supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n        if (req) {\n          yield _this2.outgoingRequestProcessor.makeOutgoingRequest(req);\n        }\n      } finally {\n        _this2._accepting = false;\n      }\n\n      // phase may have changed, so emit a 'change' event\n      _this2.emit(VerificationRequestEvent.Change);\n    })();\n  }\n\n  /**\n   * Cancels the request, sending a cancellation to the other party\n   *\n   * @param params - Details for the cancellation, including `reason` (defaults to \"User declined\"), and `code`\n   *    (defaults to `m.user`).\n   *\n   * @returns Promise which resolves when the event has been sent.\n   */\n  cancel(params) {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      if (_this3._cancelling) {\n        // already cancelling; do nothing\n        return;\n      }\n      _this3.logger.info(\"Cancelling verification request with params:\", params);\n      _this3._cancelling = true;\n      try {\n        var req = _this3.inner.cancel();\n        if (req) {\n          yield _this3.outgoingRequestProcessor.makeOutgoingRequest(req);\n        }\n      } finally {\n        _this3._cancelling = false;\n      }\n    })();\n  }\n\n  /**\n   * Create a {@link Verifier} to do this verification via a particular method.\n   *\n   * If a verifier has already been created for this request, returns that verifier.\n   *\n   * This does *not* send the `m.key.verification.start` event - to do so, call {@link Verifier#verifier} on the\n   * returned verifier.\n   *\n   * If no previous events have been sent, pass in `targetDevice` to set who to direct this request to.\n   *\n   * @param method - the name of the verification method to use.\n   * @param targetDevice - details of where to send the request to.\n   *\n   * @returns The verifier which will do the actual verification.\n   */\n  beginKeyVerification(method, targetDevice) {\n    throw new Error(\"not implemented\");\n  }\n\n  /**\n   * Send an `m.key.verification.start` event to start verification via a particular method.\n   *\n   * Implementation of {@link Crypto.VerificationRequest#startVerification}.\n   *\n   * @param method - the name of the verification method to use.\n   */\n  startVerification(method) {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      if (method !== VerificationMethod.Sas) {\n        throw new Error(\"Unsupported verification method \".concat(method));\n      }\n\n      // make sure that we have a list of the other user's devices (workaround https://github.com/matrix-org/matrix-rust-sdk/issues/2896)\n      if (!(yield _this4.getOtherDevice())) {\n        throw new Error(\"startVerification(): other device is unknown\");\n      }\n      var res = yield _this4.inner.startSas();\n      if (res) {\n        var [, req] = res;\n        yield _this4.outgoingRequestProcessor.makeOutgoingRequest(req);\n      }\n\n      // this should have triggered the onChange callback, and we should now have a verifier\n      if (!_this4._verifier) {\n        throw new Error(\"Still no verifier after startSas() call\");\n      }\n      return _this4._verifier;\n    })();\n  }\n\n  /**\n   * Start a QR code verification by providing a scanned QR code for this verification flow.\n   *\n   * Implementation of {@link Crypto.VerificationRequest#scanQRCode}.\n   *\n   * @param qrCodeData - the decoded QR code.\n   * @returns A verifier; call `.verify()` on it to wait for the other side to complete the verification flow.\n   */\n  scanQRCode(uint8Array) {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      var scan = RustSdkCryptoJs.QrCodeScan.fromBytes(uint8Array);\n      var verifier = yield _this5.inner.scanQrCode(scan);\n\n      // this should have triggered the onChange callback, and we should now have a verifier\n      if (!_this5._verifier) {\n        throw new Error(\"Still no verifier after scanQrCode() call\");\n      }\n\n      // we can immediately trigger the reciprocate request\n      var req = verifier.reciprocate();\n      if (req) {\n        yield _this5.outgoingRequestProcessor.makeOutgoingRequest(req);\n      }\n      return _this5._verifier;\n    })();\n  }\n\n  /**\n   * The verifier which is doing the actual verification, once the method has been established.\n   * Only defined when the `phase` is Started.\n   */\n  get verifier() {\n    // It's possible for us to have a Verifier before a method has been chosen (in particular,\n    // if we are showing a QR code which the other device has not yet scanned. At that point, we could\n    // still switch to SAS).\n    //\n    // In that case, we should not return it to the application yet, since the application will not expect the\n    // Verifier to be replaced during the lifetime of the VerificationRequest.\n    return this.phase === VerificationPhase.Started ? this._verifier : undefined;\n  }\n\n  /**\n   * Stub implementation of {@link Crypto.VerificationRequest#getQRCodeBytes}.\n   */\n  getQRCodeBytes() {\n    throw new Error(\"getQRCodeBytes() unsupported in Rust Crypto; use generateQRCode() instead.\");\n  }\n\n  /**\n   * Generate the data for a QR code allowing the other device to verify this one, if it supports it.\n   *\n   * Implementation of {@link Crypto.VerificationRequest#generateQRCode}.\n   */\n  generateQRCode() {\n    var _this6 = this;\n    return _asyncToGenerator(function* () {\n      // make sure that we have a list of the other user's devices (workaround https://github.com/matrix-org/matrix-rust-sdk/issues/2896)\n      if (!(yield _this6.getOtherDevice())) {\n        throw new Error(\"generateQRCode(): other device is unknown\");\n      }\n      var innerVerifier = yield _this6.inner.generateQrCode();\n      // If we are unable to generate a QRCode, we return undefined\n      if (!innerVerifier) return;\n      return innerVerifier.toBytes();\n    })();\n  }\n\n  /**\n   * If this request has been cancelled, the cancellation code (e.g `m.user`) which is responsible for cancelling\n   * this verification.\n   */\n  get cancellationCode() {\n    var _this$inner$cancelInf, _this$inner$cancelInf2;\n    return (_this$inner$cancelInf = (_this$inner$cancelInf2 = this.inner.cancelInfo) === null || _this$inner$cancelInf2 === void 0 ? void 0 : _this$inner$cancelInf2.cancelCode()) !== null && _this$inner$cancelInf !== void 0 ? _this$inner$cancelInf : null;\n  }\n\n  /**\n   * The id of the user that cancelled the request.\n   *\n   * Only defined when phase is Cancelled\n   */\n  get cancellingUserId() {\n    var cancelInfo = this.inner.cancelInfo;\n    if (!cancelInfo) {\n      return undefined;\n    } else if (cancelInfo.cancelledbyUs()) {\n      return this.olmMachine.userId.toString();\n    } else {\n      return this.inner.otherUserId.toString();\n    }\n  }\n}\n\n/** Common base class for `Verifier` implementations which wrap rust classes.\n *\n * The generic parameter `InnerType` is the type of the rust Verification class which we wrap.\n *\n * @internal\n */\nclass BaseRustVerifer extends TypedEventEmitter {\n  constructor(inner, outgoingRequestProcessor) {\n    super();\n    this.inner = inner;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    /** A deferred which completes when the verification completes (or rejects when it is cancelled/fails) */\n    _defineProperty(this, \"completionDeferred\", void 0);\n    this.completionDeferred = Promise.withResolvers();\n\n    // As with RustVerificationRequest, we need to avoid a reference cycle.\n    // See the comments in RustVerificationRequest.\n    var weakThis = new WeakRef(this);\n    inner.registerChangesCallback(/*#__PURE__*/_asyncToGenerator(function* () {\n      var _weakThis$deref2;\n      return (_weakThis$deref2 = weakThis.deref()) === null || _weakThis$deref2 === void 0 ? void 0 : _weakThis$deref2.onChange();\n    }));\n\n    // stop the runtime complaining if nobody catches a failure\n    this.completionDeferred.promise.catch(() => null);\n  }\n\n  /**\n   * Hook which is called when the underlying rust class notifies us that there has been a change.\n   *\n   * Can be overridden by subclasses to see if we can notify the application about an update. The overriding method\n   * must call `super.onChange()`.\n   */\n  onChange() {\n    if (this.inner.isDone()) {\n      this.completionDeferred.resolve(undefined);\n    } else if (this.inner.isCancelled()) {\n      var cancelInfo = this.inner.cancelInfo();\n      this.completionDeferred.reject(new Error(\"Verification cancelled by \".concat(cancelInfo.cancelledbyUs() ? \"us\" : \"them\", \" with code \").concat(cancelInfo.cancelCode(), \": \").concat(cancelInfo.reason())));\n    }\n    this.emit(VerificationRequestEvent.Change);\n  }\n\n  /**\n   * Returns true if the verification has been cancelled, either by us or the other side.\n   */\n  get hasBeenCancelled() {\n    return this.inner.isCancelled();\n  }\n\n  /**\n   * The ID of the other user in the verification process.\n   */\n  get userId() {\n    return this.inner.otherUserId.toString();\n  }\n\n  /**\n   * Cancel a verification.\n   *\n   * We will send an `m.key.verification.cancel` if the verification is still in flight. The verification promise\n   * will reject, and a {@link Crypto.VerifierEvent#Cancel} will be emitted.\n   *\n   * @param e - the reason for the cancellation.\n   */\n  cancel(e) {\n    // TODO: something with `e`\n    var req = this.inner.cancel();\n    if (req) {\n      this.outgoingRequestProcessor.makeOutgoingRequest(req);\n    }\n  }\n\n  /**\n   * Get the details for an SAS verification, if one is in progress\n   *\n   * Returns `null`, unless this verifier is for a SAS-based verification and we are waiting for the user to confirm\n   * the SAS matches.\n   */\n  getShowSasCallbacks() {\n    return null;\n  }\n\n  /**\n   * Get the details for reciprocating QR code verification, if one is in progress\n   *\n   * Returns `null`, unless this verifier is for reciprocating a QR-code-based verification (ie, the other user has\n   * already scanned our QR code), and we are waiting for the user to confirm.\n   */\n  getReciprocateQrCodeCallbacks() {\n    return null;\n  }\n}\n\n/** A Verifier instance which is used to show and/or scan a QR code. */\nexport class RustQrCodeVerifier extends BaseRustVerifer {\n  constructor(inner, outgoingRequestProcessor) {\n    super(inner, outgoingRequestProcessor);\n    _defineProperty(this, \"callbacks\", null);\n  }\n  onChange() {\n    // if the other side has scanned our QR code and sent us a \"reciprocate\" message, it is now time for the\n    // application to prompt the user to confirm their side.\n    if (this.callbacks === null && this.inner.hasBeenScanned()) {\n      this.callbacks = {\n        confirm: () => {\n          this.confirmScanning();\n        },\n        cancel: () => this.cancel()\n      };\n    }\n    super.onChange();\n  }\n\n  /**\n   * Start the key verification, if it has not already been started.\n   *\n   * @returns Promise which resolves when the verification has completed, or rejects if the verification is cancelled\n   *    or times out.\n   */\n  verify() {\n    var _this7 = this;\n    return _asyncToGenerator(function* () {\n      // Some applications (hello, matrix-react-sdk) may not check if there is a `ShowQrCodeCallbacks` and instead\n      // register a `ShowReciprocateQr` listener which they expect to be called once `.verify` is called.\n      if (_this7.callbacks !== null) {\n        _this7.emit(VerifierEvent.ShowReciprocateQr, _this7.callbacks);\n      }\n      // Nothing to do here but wait.\n      yield _this7.completionDeferred.promise;\n    })();\n  }\n\n  /**\n   * Calculate an appropriate VerificationPhase for a VerificationRequest where this is the verifier.\n   *\n   * This is abnormally complicated because a rust-side QR Code verifier can span several verification phases.\n   */\n  get verificationPhase() {\n    switch (this.inner.state()) {\n      case QrState.Created:\n        // we have created a QR for display; neither side has yet sent an `m.key.verification.start`.\n        return VerificationPhase.Ready;\n      case QrState.Scanned:\n        // other side has scanned our QR and sent an `m.key.verification.start` with `m.reciprocate.v1`\n        return VerificationPhase.Started;\n      case QrState.Confirmed:\n        // we have confirmed the other side's scan and sent an `m.key.verification.done`.\n        //\n        // However, the verification is not yet \"Done\", because we have to wait until we have received the\n        // `m.key.verification.done` from the other side (in particular, we don't mark the device/identity as\n        // verified until that happens). If we return \"Done\" too soon, we risk the user cancelling the flow.\n        return VerificationPhase.Started;\n      case QrState.Reciprocated:\n        // although the rust SDK doesn't immediately send the `m.key.verification.start` on transition into this\n        // state, `RustVerificationRequest.scanQrCode` immediately calls `reciprocate()` and does so, so in practice\n        // we can treat the two the same.\n        return VerificationPhase.Started;\n      case QrState.Done:\n        return VerificationPhase.Done;\n      case QrState.Cancelled:\n        return VerificationPhase.Cancelled;\n      default:\n        throw new Error(\"Unknown qr code state \".concat(this.inner.state()));\n    }\n  }\n\n  /**\n   * Get the details for reciprocating QR code verification, if one is in progress\n   *\n   * Returns `null`, unless this verifier is for reciprocating a QR-code-based verification (ie, the other user has\n   * already scanned our QR code), and we are waiting for the user to confirm.\n   */\n  getReciprocateQrCodeCallbacks() {\n    return this.callbacks;\n  }\n  confirmScanning() {\n    var _this8 = this;\n    return _asyncToGenerator(function* () {\n      var req = _this8.inner.confirmScanning();\n      if (req) {\n        yield _this8.outgoingRequestProcessor.makeOutgoingRequest(req);\n      }\n    })();\n  }\n}\n\n/** A Verifier instance which is used if we are exchanging emojis */\nexport class RustSASVerifier extends BaseRustVerifer {\n  constructor(inner, _verificationRequest, outgoingRequestProcessor) {\n    super(inner, outgoingRequestProcessor);\n    _defineProperty(this, \"callbacks\", null);\n  }\n\n  /**\n   * Start the key verification, if it has not already been started.\n   *\n   * This means sending a `m.key.verification.start` if we are the first responder, or a `m.key.verification.accept`\n   * if the other side has already sent a start event.\n   *\n   * @returns Promise which resolves when the verification has completed, or rejects if the verification is cancelled\n   *    or times out.\n   */\n  verify() {\n    var _this9 = this;\n    return _asyncToGenerator(function* () {\n      yield _this9.sendAccept();\n      yield _this9.completionDeferred.promise;\n    })();\n  }\n\n  /**\n   * Send the accept or start event, if it hasn't already been sent\n   */\n  sendAccept() {\n    var _this0 = this;\n    return _asyncToGenerator(function* () {\n      var req = _this0.inner.accept();\n      if (req) {\n        yield _this0.outgoingRequestProcessor.makeOutgoingRequest(req);\n      }\n    })();\n  }\n\n  /** if we can now show the callbacks, do so */\n  onChange() {\n    var _this1 = this;\n    super.onChange();\n    if (this.callbacks === null) {\n      var emoji = this.inner.emoji();\n      var decimal = this.inner.decimals();\n      if (emoji === undefined && decimal === undefined) {\n        return;\n      }\n      var sas = {};\n      if (emoji) {\n        sas.emoji = emoji.map(e => [e.symbol, e.description]);\n      }\n      if (decimal) {\n        sas.decimal = [decimal[0], decimal[1], decimal[2]];\n      }\n      this.callbacks = {\n        sas,\n        confirm: function () {\n          var _confirm = _asyncToGenerator(function* () {\n            var requests = yield _this1.inner.confirm();\n            for (var m of requests) {\n              yield _this1.outgoingRequestProcessor.makeOutgoingRequest(m);\n            }\n          });\n          function confirm() {\n            return _confirm.apply(this, arguments);\n          }\n          return confirm;\n        }(),\n        mismatch: () => {\n          var request = this.inner.cancelWithCode(\"m.mismatched_sas\");\n          if (request) {\n            this.outgoingRequestProcessor.makeOutgoingRequest(request);\n          }\n        },\n        cancel: () => {\n          var request = this.inner.cancelWithCode(\"m.user\");\n          if (request) {\n            this.outgoingRequestProcessor.makeOutgoingRequest(request);\n          }\n        }\n      };\n      this.emit(VerifierEvent.ShowSas, this.callbacks);\n    }\n  }\n\n  /**\n   * Calculate an appropriate VerificationPhase for a VerificationRequest where this is the verifier.\n   */\n  get verificationPhase() {\n    return VerificationPhase.Started;\n  }\n\n  /**\n   * Get the details for an SAS verification, if one is in progress\n   *\n   * Returns `null`, unless this verifier is for a SAS-based verification and we are waiting for the user to confirm\n   * the SAS matches.\n   */\n  getShowSasCallbacks() {\n    return this.callbacks;\n  }\n\n  /**\n   * Replace the inner Rust verifier with a different one.\n   *\n   * @param inner - the new Rust verifier\n   * @internal\n   */\n  replaceInner(inner) {\n    if (this.inner != inner) {\n      this.inner = inner;\n\n      // As with RustVerificationRequest, we need to avoid a reference cycle.\n      // See the comments in RustVerificationRequest.\n      var weakThis = new WeakRef(this);\n      inner.registerChangesCallback(/*#__PURE__*/_asyncToGenerator(function* () {\n        var _weakThis$deref3;\n        return (_weakThis$deref3 = weakThis.deref()) === null || _weakThis$deref3 === void 0 ? void 0 : _weakThis$deref3.onChange();\n      }));\n\n      // replaceInner will only get called if we started the verification at the same time as the other side, and we lost\n      // the tie breaker.  So we need to re-accept their verification.\n      this.sendAccept();\n      this.onChange();\n    }\n  }\n}\n\n/** For each specced verification method, the rust-side `VerificationMethod` corresponding to it */\nvar verificationMethodsByIdentifier = {\n  [VerificationMethod.Sas]: RustSdkCryptoJs.VerificationMethod.SasV1,\n  [VerificationMethod.ScanQrCode]: RustSdkCryptoJs.VerificationMethod.QrCodeScanV1,\n  [VerificationMethod.ShowQrCode]: RustSdkCryptoJs.VerificationMethod.QrCodeShowV1,\n  [VerificationMethod.Reciprocate]: RustSdkCryptoJs.VerificationMethod.ReciprocateV1\n};\n\n/**\n * Convert a specced verification method identifier into a rust-side `VerificationMethod`.\n *\n * @param method - specced method identifier, for example `m.sas.v1`.\n * @returns Rust-side `VerificationMethod` corresponding to `method`.\n * @throws An error if the method is unknown.\n *\n * @internal\n */\nexport function verificationMethodIdentifierToMethod(method) {\n  var meth = verificationMethodsByIdentifier[method];\n  if (meth === undefined) {\n    throw new Error(\"Unknown verification method \".concat(method));\n  }\n  return meth;\n}\n\n/**\n * Return true if the event's type matches that of an in-room verification event\n *\n * @param event - MatrixEvent\n * @returns\n *\n * @internal\n */\nexport function isVerificationEvent(event) {\n  switch (event.getType()) {\n    case EventType.KeyVerificationCancel:\n    case EventType.KeyVerificationDone:\n    case EventType.KeyVerificationMac:\n    case EventType.KeyVerificationStart:\n    case EventType.KeyVerificationKey:\n    case EventType.KeyVerificationReady:\n    case EventType.KeyVerificationAccept:\n      return true;\n    case EventType.RoomMessage:\n      return event.getContent().msgtype === MsgType.KeyVerificationRequest;\n    default:\n      return false;\n  }\n}\n//# sourceMappingURL=verification.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { ClientPrefix, MatrixError, Method } from \"../http-api/index.js\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.js\";\nimport { encodeUri, logDuration } from \"../utils.js\";\nimport { sleep } from \"../utils.js\";\nimport { CryptoEvent, ImportRoomKeyStage } from \"../crypto-api/index.js\";\n\n/** Authentification of the backup info, depends on algorithm */\n\n/**\n * Holds information of a created keybackup.\n * Useful to get the generated private key material and save it securely somewhere.\n */\n\n/**\n * @internal\n */\nexport class RustBackupManager extends TypedEventEmitter {\n  constructor(logger, olmMachine, http, outgoingRequestProcessor) {\n    super();\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.http = http;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    /** Have we checked if there is a backup on the server which we can use */\n    _defineProperty(this, \"checkedForBackup\", false);\n    /**\n     * The latest backup version on the server, when we last checked.\n     *\n     * If there was no backup on the server, `null`. If our attempt to check resulted in an error, `undefined`.\n     *\n     * Note that the backup was not necessarily verified.\n     */\n    _defineProperty(this, \"serverBackupInfo\", undefined);\n    _defineProperty(this, \"activeBackupVersion\", null);\n    _defineProperty(this, \"stopped\", false);\n    /** whether {@link backupKeysLoop} is currently running */\n    _defineProperty(this, \"backupKeysLoopRunning\", false);\n    _defineProperty(this, \"keyBackupCheckInProgress\", null);\n  }\n\n  /**\n   * Tells the RustBackupManager to stop.\n   * The RustBackupManager is scheduling background uploads of keys to the backup, this\n   * call allows to cancel the process when the client is stoppped.\n   */\n  stop() {\n    this.stopped = true;\n  }\n\n  /**\n   * Get the backup version we are currently backing up to, if any\n   */\n  getActiveBackupVersion() {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      if (!(yield _this.olmMachine.isBackupEnabled())) return null;\n      return _this.activeBackupVersion;\n    })();\n  }\n\n  /**\n   * Return the details of the latest backup on the server, when we last checked.\n   *\n   * This normally returns a cached value, but if we haven't yet made a request to the server, it will fire one off.\n   * It will always return the details of the active backup if key backup is enabled.\n   *\n   * If there was no backup on the server, `null`. If our attempt to check resulted in an error, `undefined`.\n   */\n  getServerBackupInfo() {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      // Do a validity check if we haven't already done one. The check is likely to fail if we don't yet have the\n      // backup keys -- but as a side-effect, it will populate `serverBackupInfo`.\n      yield _this2.checkKeyBackupAndEnable(false);\n      return _this2.serverBackupInfo;\n    })();\n  }\n\n  /**\n   * Determine if a key backup can be trusted.\n   *\n   * @param info - key backup info dict from {@link CryptoApi.getKeyBackupInfo}.\n   */\n  isKeyBackupTrusted(info) {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      var signatureVerification = yield _this3.olmMachine.verifyBackup(info);\n      var backupKeys = yield _this3.olmMachine.getBackupKeys();\n      var decryptionKey = backupKeys === null || backupKeys === void 0 ? void 0 : backupKeys.decryptionKey;\n      var backupMatchesSavedPrivateKey = !!decryptionKey && _this3.backupInfoMatchesBackupDecryptionKey(info, decryptionKey);\n      return {\n        matchesDecryptionKey: backupMatchesSavedPrivateKey,\n        trusted: signatureVerification.trusted()\n      };\n    })();\n  }\n\n  /**\n   * Re-check the key backup and enable/disable it as appropriate.\n   *\n   * @param force - whether we should force a re-check even if one has already happened.\n   */\n  checkKeyBackupAndEnable(force) {\n    if (!force && this.checkedForBackup) {\n      return Promise.resolve(null);\n    }\n\n    // make sure there is only one check going on at a time\n    if (!this.keyBackupCheckInProgress) {\n      this.keyBackupCheckInProgress = this.doCheckKeyBackup().finally(() => {\n        this.keyBackupCheckInProgress = null;\n      });\n    }\n    return this.keyBackupCheckInProgress;\n  }\n\n  /**\n   * Handles a backup secret received event and store it if it matches the current backup version.\n   *\n   * @param secret - The secret as received from a `m.secret.send` event for secret `m.megolm_backup.v1`.\n   * @returns true if the secret is valid and has been stored, false otherwise.\n   */\n  handleBackupSecretReceived(secret) {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      var _latestBackupInfo;\n      // Currently we only receive the decryption key without any key backup version. It is important to\n      // check that the secret is valid for the current version before storing it.\n      // We force a check to ensure to have the latest version.\n      var latestBackupInfo;\n      try {\n        latestBackupInfo = yield _this4.requestKeyBackupVersion();\n      } catch (e) {\n        _this4.logger.warn(\"handleBackupSecretReceived: Error checking for latest key backup\", e);\n        return false;\n      }\n      if (!((_latestBackupInfo = latestBackupInfo) !== null && _latestBackupInfo !== void 0 && _latestBackupInfo.version)) {\n        // There is no server-side key backup.\n        // This decryption key is useless to us.\n        _this4.logger.warn(\"handleBackupSecretReceived: Received a backup decryption key, but there is no trusted server-side key backup\");\n        return false;\n      }\n      try {\n        var backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(secret);\n        var privateKeyMatches = _this4.backupInfoMatchesBackupDecryptionKey(latestBackupInfo, backupDecryptionKey);\n        if (!privateKeyMatches) {\n          _this4.logger.warn(\"handleBackupSecretReceived: Private decryption key does not match the public key of the current remote backup.\");\n          // just ignore the secret\n          return false;\n        }\n        _this4.logger.info(\"handleBackupSecretReceived: A valid backup decryption key has been received and stored in cache.\");\n        yield _this4.saveBackupDecryptionKey(backupDecryptionKey, latestBackupInfo.version);\n        return true;\n      } catch (e) {\n        _this4.logger.warn(\"handleBackupSecretReceived: Invalid backup decryption key\", e);\n      }\n      return false;\n    })();\n  }\n  saveBackupDecryptionKey(backupDecryptionKey, version) {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      yield _this5.olmMachine.saveBackupDecryptionKey(backupDecryptionKey, version);\n      // Emit an event that we have a new backup decryption key, so that the sdk can start\n      // importing keys from backup if needed.\n      _this5.emit(CryptoEvent.KeyBackupDecryptionKeyCached, version);\n    })();\n  }\n\n  /**\n   * Import a list of room keys previously exported by exportRoomKeys\n   *\n   * @param keys - a list of session export objects\n   * @param opts - options object\n   * @returns a promise which resolves once the keys have been imported\n   */\n  importRoomKeys(keys, opts) {\n    var _this6 = this;\n    return _asyncToGenerator(function* () {\n      yield _this6.importRoomKeysAsJson(JSON.stringify(keys), opts);\n    })();\n  }\n\n  /**\n   * Import a list of room keys previously exported by exportRoomKeysAsJson\n   *\n   * @param jsonKeys - a JSON string encoding a list of session export objects,\n   *    each of which is an IMegolmSessionData\n   * @param opts - options object\n   * @returns a promise which resolves once the keys have been imported\n   */\n  importRoomKeysAsJson(jsonKeys, opts) {\n    var _this7 = this;\n    return _asyncToGenerator(function* () {\n      yield _this7.olmMachine.importExportedRoomKeys(jsonKeys, (progress, total) => {\n        var _opts$progressCallbac;\n        var importOpt = {\n          total: Number(total),\n          successes: Number(progress),\n          stage: ImportRoomKeyStage.LoadKeys,\n          failures: 0\n        };\n        opts === null || opts === void 0 || (_opts$progressCallbac = opts.progressCallback) === null || _opts$progressCallbac === void 0 || _opts$progressCallbac.call(opts, importOpt);\n      });\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoBackend#importBackedUpRoomKeys}.\n   */\n  importBackedUpRoomKeys(keys, backupVersion, opts) {\n    var _this8 = this;\n    return _asyncToGenerator(function* () {\n      var keysByRoom = new Map();\n      for (var key of keys) {\n        var roomId = new RustSdkCryptoJs.RoomId(key.room_id);\n        if (!keysByRoom.has(roomId)) {\n          keysByRoom.set(roomId, new Map());\n        }\n        keysByRoom.get(roomId).set(key.session_id, key);\n      }\n      yield _this8.olmMachine.importBackedUpRoomKeys(keysByRoom, (progress, total, failures) => {\n        var _opts$progressCallbac2;\n        var importOpt = {\n          total: Number(total),\n          successes: Number(progress),\n          stage: ImportRoomKeyStage.LoadKeys,\n          failures: Number(failures)\n        };\n        opts === null || opts === void 0 || (_opts$progressCallbac2 = opts.progressCallback) === null || _opts$progressCallbac2 === void 0 || _opts$progressCallbac2.call(opts, importOpt);\n      }, backupVersion);\n    })();\n  }\n  /** Helper for `checkKeyBackup` */\n  doCheckKeyBackup() {\n    var _this9 = this;\n    return _asyncToGenerator(function* () {\n      _this9.logger.debug(\"Checking key backup status...\");\n      var backupInfo;\n      try {\n        backupInfo = yield _this9.requestKeyBackupVersion();\n      } catch (e) {\n        _this9.logger.warn(\"Error checking for active key backup\", e);\n        _this9.serverBackupInfo = undefined;\n        return null;\n      }\n      _this9.checkedForBackup = true;\n      if (backupInfo && !backupInfo.version) {\n        _this9.logger.warn(\"active backup lacks a useful 'version'; ignoring it\");\n        backupInfo = undefined;\n      }\n      _this9.serverBackupInfo = backupInfo;\n      var activeVersion = yield _this9.getActiveBackupVersion();\n      if (!backupInfo) {\n        if (activeVersion !== null) {\n          _this9.logger.debug(\"No key backup present on server: disabling key backup\");\n          yield _this9.disableKeyBackup();\n        } else {\n          _this9.logger.debug(\"No key backup present on server: not enabling key backup\");\n        }\n        return null;\n      }\n      var trustInfo = yield _this9.isKeyBackupTrusted(backupInfo);\n\n      // Per the spec, we should enable key upload if either (a) the backup is signed by a trusted key, or\n      // (b) the public key matches the private decryption key that we have received from 4S.\n      if (!trustInfo.matchesDecryptionKey && !trustInfo.trusted) {\n        if (activeVersion !== null) {\n          _this9.logger.debug(\"Key backup present on server but not trusted: disabling key backup\");\n          yield _this9.disableKeyBackup();\n        } else {\n          _this9.logger.debug(\"Key backup present on server but not trusted: not enabling key backup\");\n        }\n      } else {\n        if (activeVersion === null) {\n          _this9.logger.debug(\"Found usable key backup v\".concat(backupInfo.version, \": enabling key backups\"));\n          yield _this9.enableKeyBackup(backupInfo);\n        } else if (activeVersion !== backupInfo.version) {\n          _this9.logger.debug(\"On backup version \".concat(activeVersion, \" but found version \").concat(backupInfo.version, \": switching.\"));\n          // This will remove any pending backup request, remove the backup key and reset the backup state of each room key we have.\n          yield _this9.disableKeyBackup();\n          // Enabling will now trigger re-upload of all the keys\n          yield _this9.enableKeyBackup(backupInfo);\n        } else {\n          _this9.logger.debug(\"Backup version \".concat(backupInfo.version, \" still current\"));\n        }\n      }\n      return {\n        backupInfo,\n        trustInfo\n      };\n    })();\n  }\n  enableKeyBackup(backupInfo) {\n    var _this0 = this;\n    return _asyncToGenerator(function* () {\n      // we know for certain it must be a Curve25519 key, because we have verified it and only Curve25519\n      // keys can be verified.\n      //\n      // we also checked it has a valid `version`.\n      yield _this0.olmMachine.enableBackupV1(backupInfo.auth_data.public_key, backupInfo.version);\n      _this0.activeBackupVersion = backupInfo.version;\n      _this0.emit(CryptoEvent.KeyBackupStatus, true);\n      _this0.backupKeysLoop();\n    })();\n  }\n\n  /**\n   * Restart the backup key loop if there is an active trusted backup.\n   * Doesn't try to check the backup server side. To be called when a new\n   * megolm key is known locally.\n   */\n  maybeUploadKey() {\n    var _this1 = this;\n    return _asyncToGenerator(function* () {\n      if (_this1.activeBackupVersion != null) {\n        _this1.backupKeysLoop();\n      }\n    })();\n  }\n  disableKeyBackup() {\n    var _this10 = this;\n    return _asyncToGenerator(function* () {\n      yield _this10.olmMachine.disableBackup();\n      _this10.activeBackupVersion = null;\n      _this10.emit(CryptoEvent.KeyBackupStatus, false);\n    })();\n  }\n  backupKeysLoop() {\n    var _arguments = arguments,\n      _this11 = this;\n    return _asyncToGenerator(function* () {\n      var maxDelay = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : 10000;\n      if (_this11.backupKeysLoopRunning) {\n        _this11.logger.debug(\"Backup loop already running\");\n        return;\n      }\n      _this11.backupKeysLoopRunning = true;\n      _this11.logger.debug(\"Backup: Starting keys upload loop for backup version:\".concat(_this11.activeBackupVersion, \".\"));\n\n      // wait between 0 and `maxDelay` seconds, to avoid backup\n      // requests from different clients hitting the server all at\n      // the same time when a new key is sent\n      var delay = Math.random() * maxDelay;\n      yield sleep(delay);\n      try {\n        // number of consecutive network failures for exponential backoff\n        var numFailures = 0;\n        // The number of keys left to back up. (Populated lazily: see more comments below.)\n        var remainingToUploadCount = null;\n        // To avoid computing the key when only a few keys were added (after a sync for example),\n        // we compute the count only when at least two iterations are needed.\n        var isFirstIteration = true;\n        while (!_this11.stopped) {\n          // Get a batch of room keys to upload\n          var request = undefined;\n          try {\n            request = yield logDuration(_this11.logger, \"BackupRoomKeys: Get keys to backup from rust crypto-sdk\", /*#__PURE__*/_asyncToGenerator(function* () {\n              return yield _this11.olmMachine.backupRoomKeys();\n            }));\n          } catch (err) {\n            _this11.logger.error(\"Backup: Failed to get keys to backup from rust crypto-sdk\", err);\n          }\n          if (!request || _this11.stopped || !_this11.activeBackupVersion) {\n            _this11.logger.debug(\"Backup: Ending loop for version \".concat(_this11.activeBackupVersion, \".\"));\n            if (!request) {\n              // nothing more to upload\n              _this11.emit(CryptoEvent.KeyBackupSessionsRemaining, 0);\n            }\n            return;\n          }\n          try {\n            yield _this11.outgoingRequestProcessor.makeOutgoingRequest(request);\n            numFailures = 0;\n            if (_this11.stopped) break;\n\n            // Key count performance (`olmMachine.roomKeyCounts()`) can be pretty bad on some configurations.\n            // In particular, we detected on some M1 macs that when the object store reaches a threshold, the count\n            // performance stops growing in O(n) and suddenly becomes very slow (40s, 60s or more).\n            // For reference, the performance drop occurs around 300-400k keys on the platforms where this issue is observed.\n            // Even on other configurations, the count can take several seconds.\n            // This will block other operations on the database, like sending messages.\n            //\n            // This is a workaround to avoid calling `olmMachine.roomKeyCounts()` too often, and only when necessary.\n            // We don't call it on the first loop because there could be only a few keys to upload, and we don't want to wait for the count.\n            if (!isFirstIteration && remainingToUploadCount === null) {\n              try {\n                var keyCount = yield _this11.olmMachine.roomKeyCounts();\n                remainingToUploadCount = keyCount.total - keyCount.backedUp;\n              } catch (err) {\n                _this11.logger.error(\"Backup: Failed to get key counts from rust crypto-sdk\", err);\n              }\n            }\n            if (remainingToUploadCount !== null) {\n              _this11.emit(CryptoEvent.KeyBackupSessionsRemaining, remainingToUploadCount);\n              var keysCountInBatch = _this11.keysCountInBatch(request);\n              // `OlmMachine.roomKeyCounts` is called only once for the current backupKeysLoop. But new\n              // keys could be added during the current loop (after a sync for example).\n              // So the count can get out of sync with the real number of remaining keys to upload.\n              // Depending on the number of new keys imported and the time to complete the loop,\n              // this could result in multiple events being emitted with a remaining key count of 0.\n              remainingToUploadCount = Math.max(remainingToUploadCount - keysCountInBatch, 0);\n            }\n          } catch (err) {\n            numFailures++;\n            _this11.logger.error(\"Backup: Error processing backup request for rust crypto-sdk\", err);\n            if (err instanceof MatrixError) {\n              var errCode = err.data.errcode;\n              if (errCode == \"M_NOT_FOUND\" || errCode == \"M_WRONG_ROOM_KEYS_VERSION\") {\n                _this11.logger.debug(\"Backup: Failed to upload keys to current vesion: \".concat(errCode, \".\"));\n                try {\n                  yield _this11.disableKeyBackup();\n                } catch (error) {\n                  _this11.logger.error(\"Backup: An error occurred while disabling key backup:\", error);\n                }\n                _this11.emit(CryptoEvent.KeyBackupFailed, err.data.errcode);\n                // There was an active backup and we are out of sync with the server\n                // force a check server side\n                _this11.backupKeysLoopRunning = false;\n                _this11.checkKeyBackupAndEnable(true);\n                return;\n              } else if (err.isRateLimitError()) {\n                // wait for that and then continue?\n                try {\n                  var waitTime = err.getRetryAfterMs();\n                  if (waitTime && waitTime > 0) {\n                    yield sleep(waitTime);\n                    continue;\n                  }\n                } catch (error) {\n                  _this11.logger.warn(\"Backup: An error occurred while retrieving a rate-limit retry delay\", error);\n                } // else go to the normal backoff\n              }\n            }\n\n            // Some other errors (mx, network, or CORS or invalid urls?) anyhow backoff\n            // exponential backoff if we have failures\n            yield sleep(1000 * Math.pow(2, Math.min(numFailures - 1, 4)));\n          }\n          isFirstIteration = false;\n        }\n      } finally {\n        _this11.backupKeysLoopRunning = false;\n      }\n    })();\n  }\n\n  /**\n   * Utility method to count the number of keys in a backup request, in order to update the remaining keys count.\n   * This should be the chunk size of the backup request for all requests but the last, but we don't have access to it\n   * (it's static in the Rust SDK).\n   * @param batch - The backup request to count the keys from.\n   *\n   * @returns The number of keys in the backup request.\n   */\n  keysCountInBatch(batch) {\n    var parsedBody = JSON.parse(batch.body);\n    return countKeysInBackup(parsedBody);\n  }\n\n  /**\n   * Get information about a key backup from the server\n   * - If version is provided, get information about that backup version.\n   * - If no version is provided, get information about the latest backup.\n   *\n   * @param version - The version of the backup to get information about.\n   * @returns Information object from API or null if there is no active backup.\n   */\n  requestKeyBackupVersion(version) {\n    var _this12 = this;\n    return _asyncToGenerator(function* () {\n      return yield requestKeyBackupVersion(_this12.http, version);\n    })();\n  }\n\n  /**\n   * Creates a new key backup by generating a new random private key.\n   *\n   * If there is an existing backup server side it will be deleted and replaced\n   * by the new one.\n   *\n   * @param signObject - Method that should sign the backup with existing device and\n   * existing identity.\n   * @returns a KeyBackupCreationInfo - All information related to the backup.\n   */\n  setupKeyBackup(signObject) {\n    var _this13 = this;\n    return _asyncToGenerator(function* () {\n      // Clean up any existing backup\n      yield _this13.deleteAllKeyBackupVersions();\n      var randomKey = RustSdkCryptoJs.BackupDecryptionKey.createRandomKey();\n      var pubKey = randomKey.megolmV1PublicKey;\n      var authData = {\n        public_key: pubKey.publicKeyBase64\n      };\n      yield signObject(authData);\n      var res = yield _this13.http.authedRequest(Method.Post, \"/room_keys/version\", undefined, {\n        algorithm: pubKey.algorithm,\n        auth_data: authData\n      }, {\n        prefix: ClientPrefix.V3\n      });\n      yield _this13.saveBackupDecryptionKey(randomKey, res.version);\n      return {\n        version: res.version,\n        algorithm: pubKey.algorithm,\n        authData: authData,\n        decryptionKey: randomKey\n      };\n    })();\n  }\n\n  /**\n   * Deletes all key backups.\n   *\n   * Will call the API to delete active backup until there is no more present.\n   */\n  deleteAllKeyBackupVersions() {\n    var _this14 = this;\n    return _asyncToGenerator(function* () {\n      var _yield$_this14$reques, _yield$_this14$reques2;\n      // there could be several backup versions. Delete all to be safe.\n      var current = (_yield$_this14$reques = (_yield$_this14$reques2 = yield _this14.requestKeyBackupVersion()) === null || _yield$_this14$reques2 === void 0 ? void 0 : _yield$_this14$reques2.version) !== null && _yield$_this14$reques !== void 0 ? _yield$_this14$reques : null;\n      while (current != null) {\n        var _yield$_this14$reques3, _yield$_this14$reques4;\n        yield _this14.deleteKeyBackupVersion(current);\n        current = (_yield$_this14$reques3 = (_yield$_this14$reques4 = yield _this14.requestKeyBackupVersion()) === null || _yield$_this14$reques4 === void 0 ? void 0 : _yield$_this14$reques4.version) !== null && _yield$_this14$reques3 !== void 0 ? _yield$_this14$reques3 : null;\n      }\n\n      // XXX: Should this also update Secret Storage and delete any existing keys?\n    })();\n  }\n\n  /**\n   * Deletes the given key backup.\n   *\n   * @param version - The backup version to delete.\n   */\n  deleteKeyBackupVersion(version) {\n    var _this15 = this;\n    return _asyncToGenerator(function* () {\n      _this15.logger.debug(\"deleteKeyBackupVersion v:\".concat(version));\n      var path = encodeUri(\"/room_keys/version/$version\", {\n        $version: version\n      });\n      yield _this15.http.authedRequest(Method.Delete, path, undefined, undefined, {\n        prefix: ClientPrefix.V3\n      });\n      // If the backup we are deleting is the active one, we need to disable the key backup and to have the local properties reset\n      if (_this15.activeBackupVersion === version) {\n        _this15.serverBackupInfo = null;\n        yield _this15.disableKeyBackup();\n      }\n    })();\n  }\n\n  /**\n   * Creates a new backup decryptor for the given private key.\n   * @param decryptionKey - The private key to use for decryption.\n   */\n  createBackupDecryptor(decryptionKey) {\n    return new RustBackupDecryptor(this.logger, decryptionKey);\n  }\n\n  /**\n   * Restore a key backup.\n   *\n   * @param backupVersion - The version of the backup to restore.\n   * @param backupDecryptor - The backup decryptor to use to decrypt the keys.\n   * @param opts - Options for the restore.\n   * @returns The total number of keys and the total imported.\n   */\n  restoreKeyBackup(backupVersion, backupDecryptor, opts) {\n    var _this16 = this;\n    return _asyncToGenerator(function* () {\n      var keyBackup = yield _this16.downloadKeyBackup(backupVersion);\n      return _this16.importKeyBackup(keyBackup, backupVersion, backupDecryptor, opts);\n    })();\n  }\n\n  /**\n   * Call `/room_keys/keys` to download the key backup (room keys) for the given backup version.\n   * https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3room_keyskeys\n   *\n   * @param backupVersion\n   * @returns The key backup response.\n   */\n  downloadKeyBackup(backupVersion) {\n    return this.http.authedRequest(Method.Get, \"/room_keys/keys\", {\n      version: backupVersion\n    }, undefined, {\n      prefix: ClientPrefix.V3\n    });\n  }\n\n  /**\n   * Import the room keys from a `/room_keys/keys` call.\n   * Calls `opts.progressCallback` with the progress of the import.\n   *\n   * @param keyBackup - The response from the server containing the keys to import.\n   * @param backupVersion - The version of the backup info.\n   * @param backupDecryptor - The backup decryptor to use to decrypt the keys.\n   * @param opts - Options for the import.\n   *\n   * @returns The total number of keys and the total imported.\n   *\n   * @private\n   */\n  importKeyBackup(keyBackup, backupVersion, backupDecryptor, opts) {\n    var _this17 = this;\n    return _asyncToGenerator(function* () {\n      var _opts$progressCallbac3;\n      // We have a full backup here, it can get quite big, so we need to decrypt and import it in chunks.\n\n      var CHUNK_SIZE = 200;\n      // Get the total count as a first pass\n      var totalKeyCount = countKeysInBackup(keyBackup);\n      var totalImported = 0;\n      var totalFailures = 0;\n      opts === null || opts === void 0 || (_opts$progressCallbac3 = opts.progressCallback) === null || _opts$progressCallbac3 === void 0 || _opts$progressCallbac3.call(opts, {\n        total: totalKeyCount,\n        successes: totalImported,\n        stage: ImportRoomKeyStage.LoadKeys,\n        failures: totalFailures\n      });\n\n      /**\n       * This method is called when we have enough chunks to decrypt.\n       * It will decrypt the chunks and try to import the room keys.\n       * @param roomChunks\n       */\n      var handleChunkCallback = /*#__PURE__*/function () {\n        var _ref2 = _asyncToGenerator(function* (roomChunks) {\n          var _opts$progressCallbac4;\n          var currentChunk = [];\n          var _loop = function* _loop(roomId) {\n            // Decrypt the sessions for the given room\n            var decryptedSessions = yield backupDecryptor.decryptSessions(roomChunks.get(roomId));\n            // Add the decrypted sessions to the current chunk\n            decryptedSessions.forEach(session => {\n              // We set the room_id for each session\n              session.room_id = roomId;\n              currentChunk.push(session);\n            });\n          };\n          for (var roomId of roomChunks.keys()) {\n            yield* _loop(roomId);\n          }\n\n          // We have a chunk of decrypted keys: import them\n          try {\n            yield _this17.importBackedUpRoomKeys(currentChunk, backupVersion);\n            totalImported += currentChunk.length;\n          } catch (e) {\n            totalFailures += currentChunk.length;\n            // We failed to import some keys, but we should still try to import the rest?\n            // Log the error and continue\n            _this17.logger.error(\"Error importing keys from backup\", e);\n          }\n          opts === null || opts === void 0 || (_opts$progressCallbac4 = opts.progressCallback) === null || _opts$progressCallbac4 === void 0 || _opts$progressCallbac4.call(opts, {\n            total: totalKeyCount,\n            successes: totalImported,\n            stage: ImportRoomKeyStage.LoadKeys,\n            failures: totalFailures\n          });\n        });\n        return function handleChunkCallback(_x) {\n          return _ref2.apply(this, arguments);\n        };\n      }();\n      var groupChunkCount = 0;\n      var chunkGroupByRoom = new Map();\n\n      // Iterate over the rooms and sessions to group them in chunks\n      // And we call the handleChunkCallback when we have enough chunks to decrypt\n      for (var [roomId, roomData] of Object.entries(keyBackup.rooms)) {\n        // If there are no sessions for the room, skip it\n        if (!roomData.sessions) continue;\n\n        // Initialize a new chunk group for the current room\n        chunkGroupByRoom.set(roomId, {});\n        for (var [sessionId, session] of Object.entries(roomData.sessions)) {\n          // We set previously the chunk group for the current room, so we can safely get it\n          var sessionsForRoom = chunkGroupByRoom.get(roomId);\n          sessionsForRoom[sessionId] = session;\n          groupChunkCount += 1;\n          // If we have enough chunks to decrypt, call the block callback\n          if (groupChunkCount >= CHUNK_SIZE) {\n            // We have enough chunks to decrypt\n            yield handleChunkCallback(chunkGroupByRoom);\n            // Reset the chunk group\n            chunkGroupByRoom = new Map();\n            // There might be remaining keys for that room, so add back an entry for the current room.\n            chunkGroupByRoom.set(roomId, {});\n            groupChunkCount = 0;\n          }\n        }\n      }\n\n      // Handle remaining chunk if needed\n      if (groupChunkCount > 0) {\n        yield handleChunkCallback(chunkGroupByRoom);\n      }\n      return {\n        total: totalKeyCount,\n        imported: totalImported\n      };\n    })();\n  }\n\n  /**\n   * Checks if the provided backup info matches the given private key.\n   *\n   * @param info - The backup info to check.\n   * @param backupDecryptionKey - The `BackupDecryptionKey` private key to check against.\n   * @returns `true` if the private key can decrypt the backup, `false` otherwise.\n   */\n  backupInfoMatchesBackupDecryptionKey(info, backupDecryptionKey) {\n    var _info$auth_data;\n    if (info.algorithm !== \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n      this.logger.warn(\"backupMatchesPrivateKey: Unsupported backup algorithm\", info.algorithm);\n      return false;\n    }\n    return ((_info$auth_data = info.auth_data) === null || _info$auth_data === void 0 ? void 0 : _info$auth_data.public_key) === backupDecryptionKey.megolmV1PublicKey.publicKeyBase64;\n  }\n}\n/**\n * Implementation of {@link BackupDecryptor} for the rust crypto backend.\n */\nexport class RustBackupDecryptor {\n  constructor(logger, decryptionKey) {\n    this.logger = logger;\n    _defineProperty(this, \"decryptionKey\", void 0);\n    _defineProperty(this, \"sourceTrusted\", void 0);\n    this.decryptionKey = decryptionKey;\n    this.sourceTrusted = false;\n  }\n\n  /**\n   * Implements {@link BackupDecryptor#decryptSessions}\n   */\n  decryptSessions(ciphertexts) {\n    var _this18 = this;\n    return _asyncToGenerator(function* () {\n      var keys = [];\n      for (var [sessionId, sessionData] of Object.entries(ciphertexts)) {\n        try {\n          var decrypted = JSON.parse(_this18.decryptionKey.decryptV1(sessionData.session_data.ephemeral, sessionData.session_data.mac, sessionData.session_data.ciphertext));\n          decrypted.session_id = sessionId;\n          keys.push(decrypted);\n        } catch (e) {\n          _this18.logger.debug(\"Failed to decrypt megolm session from backup\", e, sessionData);\n        }\n      }\n      return keys;\n    })();\n  }\n\n  /**\n   * Implements {@link BackupDecryptor#free}\n   */\n  free() {\n    this.decryptionKey.free();\n  }\n}\n\n/**\n * Fetch a key backup info from the server.\n *\n * If `version` is provided, calls `GET /room_keys/version/$version` and gets the backup info for that version.\n * See https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3room_keysversionversion.\n *\n * If not, calls `GET /room_keys/version` and gets the latest backup info.\n * See https://spec.matrix.org/v1.12/client-server-api/#get_matrixclientv3room_keysversion\n *\n * @param http\n * @param version - the specific version of the backup info to fetch\n * @returns The key backup info or null if there is no backup.\n */\nexport function requestKeyBackupVersion(_x2, _x3) {\n  return _requestKeyBackupVersion.apply(this, arguments);\n}\n\n/**\n * Checks if the provided decryption key matches the public key of the key backup info.\n *\n * @param decryptionKey - The decryption key to check.\n * @param keyBackupInfo - The key backup info to check against.\n * @returns `true` if the decryption key matches the key backup info, `false` otherwise.\n */\nfunction _requestKeyBackupVersion() {\n  _requestKeyBackupVersion = _asyncToGenerator(function* (http, version) {\n    try {\n      var path = version ? encodeUri(\"/room_keys/version/$version\", {\n        $version: version\n      }) : \"/room_keys/version\";\n      return yield http.authedRequest(Method.Get, path, undefined, undefined, {\n        prefix: ClientPrefix.V3\n      });\n    } catch (e) {\n      if (e.errcode === \"M_NOT_FOUND\") {\n        return null;\n      } else {\n        throw e;\n      }\n    }\n  });\n  return _requestKeyBackupVersion.apply(this, arguments);\n}\nexport function decryptionKeyMatchesKeyBackupInfo(decryptionKey, keyBackupInfo) {\n  var authData = keyBackupInfo.auth_data;\n  return authData.public_key === decryptionKey.megolmV1PublicKey.publicKeyBase64;\n}\n\n/**\n * Counts the total number of keys present in a key backup.\n * @param keyBackup - The key backup to count the keys from.\n * @returns The total number of keys in the backup.\n */\nfunction countKeysInBackup(keyBackup) {\n  var count = 0;\n  for (var {\n    sessions\n  } of Object.values(keyBackup.rooms)) {\n    count += Object.keys(sessions).length;\n  }\n  return count;\n}\n\n/**\n * Response from GET `/room_keys/keys` endpoint.\n * See https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3room_keyskeys\n */\n//# sourceMappingURL=backup.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { logDuration } from \"../utils.js\";\n\n/**\n * OutgoingRequestsManager: responsible for processing outgoing requests from the OlmMachine.\n * Ensure that only one loop is going on at once, and that the requests are processed in order.\n */\nexport class OutgoingRequestsManager {\n  constructor(logger, olmMachine, outgoingRequestProcessor) {\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.outgoingRequestProcessor = outgoingRequestProcessor;\n    /** whether {@link stop} has been called */\n    _defineProperty(this, \"stopped\", false);\n    /** whether {@link outgoingRequestLoop} is currently running */\n    _defineProperty(this, \"outgoingRequestLoopRunning\", false);\n    /**\n     * If there are additional calls to doProcessOutgoingRequests() while there is a current call running\n     * we need to remember in order to call `doProcessOutgoingRequests` again (as there could be new requests).\n     *\n     * If this is defined, it is an indication that we need to do another iteration; in this case the deferred\n     * will resolve once that next iteration completes. If it is undefined, there have been no new calls\n     * to `doProcessOutgoingRequests` since the current iteration started.\n     */\n    _defineProperty(this, \"nextLoopDeferred\", void 0);\n  }\n\n  /**\n   * Shut down as soon as possible the current loop of outgoing requests processing.\n   */\n  stop() {\n    this.stopped = true;\n  }\n\n  /**\n   * Process the OutgoingRequests from the OlmMachine.\n   *\n   * This should be called at the end of each sync, to process any OlmMachine OutgoingRequests created by the rust sdk.\n   * In some cases if OutgoingRequests need to be sent immediately, this can be called directly.\n   *\n   * Calls to doProcessOutgoingRequests() are processed synchronously, one after the other, in order.\n   * If doProcessOutgoingRequests() is called while another call is still being processed, it will be queued.\n   * Multiple calls to doProcessOutgoingRequests() when a call is already processing will be batched together.\n   */\n  doProcessOutgoingRequests() {\n    // Flag that we need at least one more iteration of the loop.\n    //\n    // It is important that we do this even if the loop is currently running. There is potential for a race whereby\n    // a request is added to the queue *after* `OlmMachine.outgoingRequests` checks the queue, but *before* it\n    // returns. In such a case, the item could sit there unnoticed for some time.\n    //\n    // In order to circumvent the race, we set a flag which tells the loop to go round once again even if the\n    // queue appears to be empty.\n    if (!this.nextLoopDeferred) {\n      this.nextLoopDeferred = Promise.withResolvers();\n    }\n\n    // ... and wait for it to complete.\n    var result = this.nextLoopDeferred.promise;\n\n    // set the loop going if it is not already.\n    if (!this.outgoingRequestLoopRunning) {\n      this.outgoingRequestLoop().catch(e => {\n        // this should not happen; outgoingRequestLoop should return any errors via `nextLoopDeferred`.\n        /* istanbul ignore next */\n        this.logger.error(\"Uncaught error in outgoing request loop\", e);\n      });\n    }\n    return result;\n  }\n  outgoingRequestLoop() {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      /* istanbul ignore if */\n      if (_this.outgoingRequestLoopRunning) {\n        throw new Error(\"Cannot run two outgoing request loops\");\n      }\n      _this.outgoingRequestLoopRunning = true;\n      try {\n        while (!_this.stopped && _this.nextLoopDeferred) {\n          var loopTickResolvers = _this.nextLoopDeferred;\n\n          // reset `nextLoopDeferred` so that any future calls to `doProcessOutgoingRequests` are queued\n          // for another additional iteration.\n          _this.nextLoopDeferred = undefined;\n\n          // make the requests and feed the results back to the `nextLoopDeferred`\n          yield _this.processOutgoingRequests().then(loopTickResolvers.resolve, loopTickResolvers.reject);\n        }\n      } finally {\n        _this.outgoingRequestLoopRunning = false;\n      }\n      if (_this.nextLoopDeferred) {\n        // the loop was stopped, but there was a call to `doProcessOutgoingRequests`. Make sure that\n        // we reject the promise in case anything is waiting for it.\n        _this.nextLoopDeferred.reject(new Error(\"OutgoingRequestsManager was stopped\"));\n      }\n    })();\n  }\n\n  /**\n   * Make a single request to `olmMachine.outgoingRequests` and do the corresponding requests.\n   */\n  processOutgoingRequests() {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      if (_this2.stopped) return;\n      var outgoingRequests = yield _this2.olmMachine.outgoingRequests();\n      var _loop = function* _loop(request) {\n          if (_this2.stopped) return {\n            v: void 0\n          };\n          try {\n            yield logDuration(_this2.logger, \"Make outgoing request \".concat(request.type), /*#__PURE__*/_asyncToGenerator(function* () {\n              yield _this2.outgoingRequestProcessor.makeOutgoingRequest(request);\n            }));\n          } catch (e) {\n            // as part of the loop we silently ignore errors, but log them.\n            // The rust sdk will retry the request later as it won't have been marked as sent.\n            _this2.logger.error(\"Failed to process outgoing request \".concat(request.type, \": \").concat(e));\n          }\n        },\n        _ret;\n      for (var request of outgoingRequests) {\n        _ret = yield* _loop(request);\n        if (_ret) return _ret.v;\n      }\n    })();\n  }\n}\n//# sourceMappingURL=OutgoingRequestsManager.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 - 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { CryptoEvent } from \"../crypto-api/index.js\";\nimport { ClientPrefix, MatrixError, Method } from \"../http-api/index.js\";\nimport { encodeUri, sleep } from \"../utils.js\";\n// The minimum time to wait between two retries in case of errors. To avoid hammering the server.\nvar KEY_BACKUP_BACKOFF = 5000; // ms\n\n/**\n * Enumerates the different kind of errors that can occurs when downloading and importing a key from backup.\n */\nvar KeyDownloadErrorCode = /*#__PURE__*/function (KeyDownloadErrorCode) {\n  /** The requested key is not in the backup. */\n  KeyDownloadErrorCode[\"MISSING_DECRYPTION_KEY\"] = \"MISSING_DECRYPTION_KEY\";\n  /** A network error occurred while trying to download the key from backup. */\n  KeyDownloadErrorCode[\"NETWORK_ERROR\"] = \"NETWORK_ERROR\";\n  /** The loop has been stopped. */\n  KeyDownloadErrorCode[\"STOPPED\"] = \"STOPPED\";\n  return KeyDownloadErrorCode;\n}(KeyDownloadErrorCode || {});\nclass KeyDownloadError extends Error {\n  constructor(code) {\n    super(\"Failed to get key from backup: \".concat(code));\n    this.code = code;\n    this.name = \"KeyDownloadError\";\n  }\n}\nclass KeyDownloadRateLimitError extends Error {\n  constructor(retryMillis) {\n    super(\"Failed to get key from backup: rate limited\");\n    this.retryMillis = retryMillis;\n    this.name = \"KeyDownloadRateLimitError\";\n  }\n}\n\n/** Details of a megolm session whose key we are trying to fetch. */\n\n/** Holds the current backup decryptor and version that should be used.\n *\n * This is intended to be used as an immutable object (a new instance should be created if the configuration changes),\n * and some of the logic relies on that, so the properties are marked as `readonly`.\n */\n\n/**\n * Used when an 'unable to decrypt' error occurs. It attempts to download the key from the backup.\n *\n * The current backup API lacks pagination, which can lead to lengthy key retrieval times for large histories (several 10s of minutes).\n * To mitigate this, keys are downloaded on demand as decryption errors occurs.\n * While this approach may result in numerous requests, it improves user experience by reducing wait times for message decryption.\n *\n * The PerSessionKeyBackupDownloader is resistant to backup configuration changes: it will automatically resume querying when\n * the backup is configured correctly.\n */\nexport class PerSessionKeyBackupDownloader {\n  /**\n   * Creates a new instance of PerSessionKeyBackupDownloader.\n   *\n   * @param backupManager - The backup manager to use.\n   * @param olmMachine - The olm machine to use.\n   * @param http - The http instance to use.\n   * @param logger - The logger to use.\n   */\n  constructor(logger, olmMachine, http, backupManager) {\n    this.olmMachine = olmMachine;\n    this.http = http;\n    this.backupManager = backupManager;\n    _defineProperty(this, \"stopped\", false);\n    /**\n     * The version and decryption key to use with current backup if all set up correctly.\n     *\n     * Will not be set unless `hasConfigurationProblem` is `false`.\n     */\n    _defineProperty(this, \"configuration\", null);\n    /** We remember when a session was requested and not found in backup to avoid query again too soon.\n     * Map of session_id to timestamp */\n    _defineProperty(this, \"sessionLastCheckAttemptedTime\", new Map());\n    /** The logger to use */\n    _defineProperty(this, \"logger\", void 0);\n    /** Whether the download loop is running. */\n    _defineProperty(this, \"downloadLoopRunning\", false);\n    /** The list of requests that are queued. */\n    _defineProperty(this, \"queuedRequests\", []);\n    /** Remembers if we have a configuration problem. */\n    _defineProperty(this, \"hasConfigurationProblem\", false);\n    /** The current server backup version check promise. To avoid doing a server call if one is in flight. */\n    _defineProperty(this, \"currentBackupVersionCheck\", null);\n    /**\n     * Called when the backup status changes (CryptoEvents)\n     * This will trigger a check of the backup configuration.\n     */\n    _defineProperty(this, \"onBackupStatusChanged\", () => {\n      // we want to force check configuration, so we clear the current one.\n      this.hasConfigurationProblem = false;\n      this.configuration = null;\n      this.getOrCreateBackupConfiguration().then(configuration => {\n        if (configuration) {\n          // restart the download loop if it was stopped\n          this.downloadKeysLoop();\n        }\n      });\n    });\n    this.logger = logger.getChild(\"[PerSessionKeyBackupDownloader]\");\n    backupManager.on(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n    backupManager.on(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n    backupManager.on(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n  }\n\n  /**\n   * Check if key download is successfully configured and active.\n   *\n   * @return `true` if key download is correctly configured and active; otherwise `false`.\n   */\n  isKeyBackupDownloadConfigured() {\n    return this.configuration !== null;\n  }\n\n  /**\n   * Return the details of the latest backup on the server, when we last checked.\n   *\n   * This is just a convenience method to expose {@link RustBackupManager.getServerBackupInfo}.\n   */\n  getServerBackupInfo() {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      return yield _this.backupManager.getServerBackupInfo();\n    })();\n  }\n\n  /**\n   * Called when a MissingRoomKey or UnknownMessageIndex decryption error is encountered.\n   *\n   * This will try to download the key from the backup if there is a trusted active backup.\n   * In case of success the key will be imported and the onRoomKeysUpdated callback will be called\n   * internally by the rust-sdk and decryption will be retried.\n   *\n   * @param roomId - The room ID of the room where the error occurred.\n   * @param megolmSessionId - The megolm session ID that is missing.\n   */\n  onDecryptionKeyMissingError(roomId, megolmSessionId) {\n    // Several messages encrypted with the same session may be decrypted at the same time,\n    // so we need to be resistant and not query several time the same session.\n    if (this.isAlreadyInQueue(roomId, megolmSessionId)) {\n      // There is already a request queued for this session, no need to queue another one.\n      this.logger.trace(\"Not checking key backup for session \".concat(megolmSessionId, \" as it is already queued\"));\n      return;\n    }\n    if (this.wasRequestedRecently(megolmSessionId)) {\n      // We already tried to download this session recently and it was not in backup, no need to try again.\n      this.logger.trace(\"Not checking key backup for session \".concat(megolmSessionId, \" as it was already requested recently\"));\n      return;\n    }\n\n    // We always add the request to the queue, even if we have a configuration problem (can't access backup).\n    // This is to make sure that if the configuration problem is resolved, we will try to download the key.\n    // This will happen after an initial sync, at this point the backup will not yet be trusted and the decryption\n    // key will not be available, but it will be just after the verification.\n    // We don't need to persist it because currently on refresh the sdk will retry to decrypt the messages in error.\n    this.queuedRequests.push({\n      roomId,\n      megolmSessionId\n    });\n\n    // Start the download loop if it's not already running.\n    this.downloadKeysLoop();\n  }\n  stop() {\n    this.stopped = true;\n    this.backupManager.off(CryptoEvent.KeyBackupStatus, this.onBackupStatusChanged);\n    this.backupManager.off(CryptoEvent.KeyBackupFailed, this.onBackupStatusChanged);\n    this.backupManager.off(CryptoEvent.KeyBackupDecryptionKeyCached, this.onBackupStatusChanged);\n  }\n  /** Returns true if the megolm session is already queued for download. */\n  isAlreadyInQueue(roomId, megolmSessionId) {\n    return this.queuedRequests.some(info => {\n      return info.roomId == roomId && info.megolmSessionId == megolmSessionId;\n    });\n  }\n\n  /**\n   * Marks the session as not found in backup, to avoid retrying to soon for a key not in backup\n   *\n   * @param megolmSessionId - The megolm session ID that is missing.\n   */\n  markAsNotFoundInBackup(megolmSessionId) {\n    var now = Date.now();\n    this.sessionLastCheckAttemptedTime.set(megolmSessionId, now);\n    // if too big make some cleaning to keep under control\n    if (this.sessionLastCheckAttemptedTime.size > 100) {\n      this.sessionLastCheckAttemptedTime = new Map(Array.from(this.sessionLastCheckAttemptedTime).filter((sid, ts) => {\n        return Math.max(now - ts, 0) < KEY_BACKUP_BACKOFF;\n      }));\n    }\n  }\n\n  /** Returns true if the session was requested recently. */\n  wasRequestedRecently(megolmSessionId) {\n    var lastCheck = this.sessionLastCheckAttemptedTime.get(megolmSessionId);\n    if (!lastCheck) return false;\n    return Math.max(Date.now() - lastCheck, 0) < KEY_BACKUP_BACKOFF;\n  }\n  getBackupDecryptionKey() {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      try {\n        return yield _this2.olmMachine.getBackupKeys();\n      } catch (_unused) {\n        return null;\n      }\n    })();\n  }\n\n  /**\n   * Requests a key from the server side backup.\n   *\n   * @param version - The backup version to use.\n   * @param roomId - The room ID of the room where the error occurred.\n   * @param sessionId - The megolm session ID that is missing.\n   */\n  requestRoomKeyFromBackup(version, roomId, sessionId) {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      var path = encodeUri(\"/room_keys/keys/$roomId/$sessionId\", {\n        $roomId: roomId,\n        $sessionId: sessionId\n      });\n      return yield _this3.http.authedRequest(Method.Get, path, {\n        version\n      }, undefined, {\n        prefix: ClientPrefix.V3\n      });\n    })();\n  }\n  downloadKeysLoop() {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      if (_this4.downloadLoopRunning) return;\n\n      // If we have a configuration problem, we don't want to try to download.\n      // If any configuration change is detected, we will retry and restart the loop.\n      if (_this4.hasConfigurationProblem) return;\n      _this4.downloadLoopRunning = true;\n      try {\n        while (_this4.queuedRequests.length > 0) {\n          // we just peek the first one without removing it, so if a new request for same key comes in while we're\n          // processing this one, it won't queue another request.\n          var request = _this4.queuedRequests[0];\n          try {\n            // The backup could have changed between the time we queued the request and now, so we need to check\n            var configuration = yield _this4.getOrCreateBackupConfiguration();\n            if (!configuration) {\n              // Backup is not configured correctly, so stop the loop.\n              _this4.downloadLoopRunning = false;\n              return;\n            }\n            var result = yield _this4.queryKeyBackup(request.roomId, request.megolmSessionId, configuration);\n            if (_this4.stopped) {\n              return;\n            }\n            // We got the encrypted key from backup, let's try to decrypt and import it.\n            try {\n              yield _this4.decryptAndImport(request, result, configuration);\n            } catch (e) {\n              _this4.logger.error(\"Error while decrypting and importing key backup for session \".concat(request.megolmSessionId), e);\n            }\n            // now remove the request from the queue as we've processed it.\n            _this4.queuedRequests.shift();\n          } catch (err) {\n            if (err instanceof KeyDownloadError) {\n              switch (err.code) {\n                case KeyDownloadErrorCode.MISSING_DECRYPTION_KEY:\n                  _this4.markAsNotFoundInBackup(request.megolmSessionId);\n                  // continue for next one\n                  _this4.queuedRequests.shift();\n                  break;\n                case KeyDownloadErrorCode.NETWORK_ERROR:\n                  // We don't want to hammer if there is a problem, so wait a bit.\n                  yield sleep(KEY_BACKUP_BACKOFF);\n                  break;\n                case KeyDownloadErrorCode.STOPPED:\n                  // If the downloader was stopped, we don't want to retry.\n                  _this4.downloadLoopRunning = false;\n                  return;\n              }\n            } else if (err instanceof KeyDownloadRateLimitError) {\n              // we want to retry after the backoff time\n              yield sleep(err.retryMillis);\n            }\n          }\n        }\n      } finally {\n        // all pending request have been processed, we can stop the loop.\n        _this4.downloadLoopRunning = false;\n      }\n    })();\n  }\n\n  /**\n   * Query the backup for a key.\n   *\n   * @param targetRoomId - ID of the room that the session is used in.\n   * @param targetSessionId - ID of the session for which to check backup.\n   * @param configuration - The backup configuration to use.\n   */\n  queryKeyBackup(targetRoomId, targetSessionId, configuration) {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      _this5.logger.debug(\"Checking key backup for session \".concat(targetSessionId));\n      if (_this5.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n      try {\n        var res = yield _this5.requestRoomKeyFromBackup(configuration.backupVersion, targetRoomId, targetSessionId);\n        _this5.logger.debug(\"Got key from backup for sessionId:\".concat(targetSessionId));\n        return res;\n      } catch (e) {\n        if (_this5.stopped) throw new KeyDownloadError(KeyDownloadErrorCode.STOPPED);\n        _this5.logger.info(\"No luck requesting key backup for session \".concat(targetSessionId, \": \").concat(e));\n        if (e instanceof MatrixError) {\n          var errCode = e.data.errcode;\n          if (errCode == \"M_NOT_FOUND\") {\n            // Unfortunately the spec doesn't give us a way to differentiate between a missing key and a wrong version.\n            // Synapse will return:\n            //     - \"error\": \"Unknown backup version\" if the version is wrong.\n            //     - \"error\": \"No room_keys found\" if the key is missing.\n            // It's useful to know if the key is missing or if the version is wrong.\n            // As it's not spec'ed, we fall back on considering the key is not in backup.\n            // Notice that this request will be lost if instead the backup got out of sync (updated from other session).\n            throw new KeyDownloadError(KeyDownloadErrorCode.MISSING_DECRYPTION_KEY);\n          }\n          if (e.isRateLimitError()) {\n            var waitTime;\n            try {\n              var _e$getRetryAfterMs;\n              waitTime = (_e$getRetryAfterMs = e.getRetryAfterMs()) !== null && _e$getRetryAfterMs !== void 0 ? _e$getRetryAfterMs : undefined;\n            } catch (error) {\n              _this5.logger.warn(\"Error while retrieving a rate-limit retry delay\", error);\n            }\n            if (waitTime && waitTime > 0) {\n              _this5.logger.info(\"Rate limited by server, waiting \".concat(waitTime, \"ms\"));\n            }\n            throw new KeyDownloadRateLimitError(waitTime !== null && waitTime !== void 0 ? waitTime : KEY_BACKUP_BACKOFF);\n          }\n        }\n        throw new KeyDownloadError(KeyDownloadErrorCode.NETWORK_ERROR);\n      }\n    })();\n  }\n  decryptAndImport(sessionInfo, data, configuration) {\n    var _this6 = this;\n    return _asyncToGenerator(function* () {\n      var sessionsToImport = {\n        [sessionInfo.megolmSessionId]: data\n      };\n      var keys = yield configuration.decryptor.decryptSessions(sessionsToImport);\n      for (var k of keys) {\n        k.room_id = sessionInfo.roomId;\n      }\n      yield _this6.backupManager.importBackedUpRoomKeys(keys, configuration.backupVersion);\n    })();\n  }\n\n  /**\n   * Gets the current backup configuration or create one if it doesn't exist.\n   *\n   * When a valid configuration is found it is cached and returned for subsequent calls.\n   * Otherwise, if a check is forced or a check has not yet been done, a new check is done.\n   *\n   * @returns The backup configuration to use or null if there is a configuration problem.\n   */\n  getOrCreateBackupConfiguration() {\n    var _this7 = this;\n    return _asyncToGenerator(function* () {\n      if (_this7.configuration) {\n        return _this7.configuration;\n      }\n\n      // We already tried to check the configuration and it failed.\n      // We don't want to try again immediately, we will retry if a configuration change is detected.\n      if (_this7.hasConfigurationProblem) {\n        return null;\n      }\n\n      // This method can be called rapidly by several emitted CryptoEvent, so we need to make sure that we don't\n      // query the server several times.\n      if (_this7.currentBackupVersionCheck != null) {\n        _this7.logger.debug(\"Already checking server version, use current promise\");\n        return yield _this7.currentBackupVersionCheck;\n      }\n      _this7.currentBackupVersionCheck = _this7.internalCheckFromServer();\n      try {\n        return yield _this7.currentBackupVersionCheck;\n      } finally {\n        _this7.currentBackupVersionCheck = null;\n      }\n    })();\n  }\n  internalCheckFromServer() {\n    var _this8 = this;\n    return _asyncToGenerator(function* () {\n      var _currentServerVersion, _currentServerVersion2, _currentServerVersion4;\n      var currentServerVersion = null;\n      try {\n        currentServerVersion = yield _this8.backupManager.getServerBackupInfo();\n      } catch (e) {\n        _this8.logger.debug(\"Backup: error while checking server version: \".concat(e));\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      _this8.logger.debug(\"Got current backup version from server: \".concat((_currentServerVersion = currentServerVersion) === null || _currentServerVersion === void 0 ? void 0 : _currentServerVersion.version));\n      if (((_currentServerVersion2 = currentServerVersion) === null || _currentServerVersion2 === void 0 ? void 0 : _currentServerVersion2.algorithm) != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n        var _currentServerVersion3;\n        _this8.logger.info(\"Unsupported algorithm \".concat((_currentServerVersion3 = currentServerVersion) === null || _currentServerVersion3 === void 0 ? void 0 : _currentServerVersion3.algorithm));\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      if (!((_currentServerVersion4 = currentServerVersion) !== null && _currentServerVersion4 !== void 0 && _currentServerVersion4.version)) {\n        _this8.logger.info(\"No current key backup\");\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      var activeVersion = yield _this8.backupManager.getActiveBackupVersion();\n      if (activeVersion == null || currentServerVersion.version != activeVersion) {\n        // Either the current backup version on server side is not trusted, or it is out of sync with the active version on the client side.\n        _this8.logger.info(\"The current backup version on the server (\".concat(currentServerVersion.version, \") is not trusted. Version we are currently backing up to: \").concat(activeVersion));\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      var backupKeys = yield _this8.getBackupDecryptionKey();\n      if (!(backupKeys !== null && backupKeys !== void 0 && backupKeys.decryptionKey)) {\n        _this8.logger.debug(\"Not checking key backup for session (no decryption key)\");\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      if (activeVersion != backupKeys.backupVersion) {\n        _this8.logger.debug(\"Version for which we have a decryption key (\".concat(backupKeys.backupVersion, \") doesn't match the version we are backing up to (\").concat(activeVersion, \")\"));\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      var authData = currentServerVersion.auth_data;\n      if (authData.public_key != backupKeys.decryptionKey.megolmV1PublicKey.publicKeyBase64) {\n        _this8.logger.debug(\"Key backup on server does not match our decryption key\");\n        _this8.hasConfigurationProblem = true;\n        return null;\n      }\n      var backupDecryptor = _this8.backupManager.createBackupDecryptor(backupKeys.decryptionKey);\n      _this8.hasConfigurationProblem = false;\n      _this8.configuration = {\n        decryptor: backupDecryptor,\n        backupVersion: activeVersion\n      };\n      return _this8.configuration;\n    })();\n  }\n}\n//# sourceMappingURL=PerSessionKeyBackupDownloader.js.map","/*\n * Copyright 2024 The Matrix.org Foundation C.I.C.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { deriveRecoveryKeyFromPassphrase } from \"../crypto-api/index.js\";\n\n/* eslint-disable camelcase */\n\n/**\n * Derive a backup key from a passphrase using the salt and iterations from the auth data.\n * @param authData - The auth data containing the salt and iterations\n * @param passphrase - The passphrase to derive the key from\n * @deprecated Deriving a backup key from a passphrase is not part of the matrix spec. Instead, a random key is generated and stored/shared via 4S.\n */\nexport function keyFromAuthData(authData, passphrase) {\n  if (!authData.private_key_salt || !authData.private_key_iterations) {\n    throw new Error(\"Salt and/or iterations not found: \" + \"this backup cannot be restored with a passphrase\");\n  }\n  return deriveRecoveryKeyFromPassphrase(passphrase, authData.private_key_salt, authData.private_key_iterations, authData.private_key_bits);\n}\n//# sourceMappingURL=key-passphrase.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/*\nCopyright 2022-2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport anotherjson from \"another-json\";\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { KnownMembership } from \"../@types/membership.js\";\nimport { MatrixEventEvent } from \"../models/event.js\";\nimport { DecryptionError } from \"../common-crypto/CryptoBackend.js\";\nimport { LogSpan } from \"../logger.js\";\nimport { Method } from \"../http-api/index.js\";\nimport { RoomEncryptor } from \"./RoomEncryptor.js\";\nimport { OutgoingRequestProcessor } from \"./OutgoingRequestProcessor.js\";\nimport { KeyClaimManager } from \"./KeyClaimManager.js\";\nimport { MapWithDefault } from \"../utils.js\";\nimport { AllDevicesIsolationMode, CrossSigningKey, CryptoEvent, DecryptionFailureCode, deriveRecoveryKeyFromPassphrase, DeviceIsolationModeKind, DeviceVerificationStatus, encodeRecoveryKey, EventShieldColour, EventShieldReason, ImportRoomKeyStage, UserVerificationStatus } from \"../crypto-api/index.js\";\nimport { deviceKeysToDeviceMap, rustDeviceToJsDevice } from \"./device-converter.js\";\nimport { SECRET_STORAGE_ALGORITHM_V1_AES } from \"../secret-storage.js\";\nimport { CrossSigningIdentity } from \"./CrossSigningIdentity.js\";\nimport { secretStorageCanAccessSecrets, secretStorageContainsCrossSigningKeys } from \"./secret-storage.js\";\nimport { isVerificationEvent, RustVerificationRequest, verificationMethodIdentifierToMethod } from \"./verification.js\";\nimport { EventType, MsgType } from \"../@types/event.js\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.js\";\nimport { decryptionKeyMatchesKeyBackupInfo, RustBackupManager } from \"./backup.js\";\nimport { TypedReEmitter } from \"../ReEmitter.js\";\nimport { secureRandomString } from \"../randomstring.js\";\nimport { ClientStoppedError } from \"../errors.js\";\nimport { decodeBase64, encodeBase64 } from \"../base64.js\";\nimport { OutgoingRequestsManager } from \"./OutgoingRequestsManager.js\";\nimport { PerSessionKeyBackupDownloader } from \"./PerSessionKeyBackupDownloader.js\";\nimport { DehydratedDeviceManager } from \"./DehydratedDeviceManager.js\";\nimport { VerificationMethod } from \"../types.js\";\nimport { keyFromAuthData } from \"../common-crypto/key-passphrase.js\";\nimport { getHttpUriForMxc } from \"../content-repo.js\";\nvar ALL_VERIFICATION_METHODS = [VerificationMethod.Sas, VerificationMethod.ScanQrCode, VerificationMethod.ShowQrCode, VerificationMethod.Reciprocate];\n/**\n * An implementation of {@link CryptoBackend} using the Rust matrix-sdk-crypto.\n *\n * @internal\n */\nexport class RustCrypto extends TypedEventEmitter {\n  constructor(logger, /** The `OlmMachine` from the underlying rust crypto sdk. */\n  olmMachine,\n  /**\n   * Low-level HTTP interface: used to make outgoing requests required by the rust SDK.\n   *\n   * We expect it to set the access token, etc.\n   */\n  http, /** The local user's User ID. */\n  userId, /** The local user's Device ID. */\n  _deviceId, /** Interface to server-side secret storage */\n  secretStorage, /** Crypto callbacks provided by the application */\n  cryptoCallbacks) {\n    var enableEncryptedStateEvents = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;\n    super();\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.http = http;\n    this.userId = userId;\n    this.secretStorage = secretStorage;\n    this.cryptoCallbacks = cryptoCallbacks;\n    this.enableEncryptedStateEvents = enableEncryptedStateEvents;\n    /**\n     * The number of iterations to use when deriving a recovery key from a passphrase.\n     */\n    _defineProperty(this, \"RECOVERY_KEY_DERIVATION_ITERATIONS\", 500000);\n    _defineProperty(this, \"_trustCrossSignedDevices\", true);\n    _defineProperty(this, \"deviceIsolationMode\", new AllDevicesIsolationMode(false));\n    /** whether {@link stop} has been called */\n    _defineProperty(this, \"stopped\", false);\n    /** mapping of roomId → encryptor class */\n    _defineProperty(this, \"roomEncryptors\", {});\n    _defineProperty(this, \"eventDecryptor\", void 0);\n    _defineProperty(this, \"keyClaimManager\", void 0);\n    _defineProperty(this, \"outgoingRequestProcessor\", void 0);\n    _defineProperty(this, \"crossSigningIdentity\", void 0);\n    _defineProperty(this, \"backupManager\", void 0);\n    _defineProperty(this, \"outgoingRequestsManager\", void 0);\n    _defineProperty(this, \"perSessionBackupDownloader\", void 0);\n    _defineProperty(this, \"dehydratedDeviceManager\", void 0);\n    _defineProperty(this, \"reemitter\", new TypedReEmitter(this));\n    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n    //\n    // CryptoApi implementation\n    //\n    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n    _defineProperty(this, \"globalBlacklistUnverifiedDevices\", false);\n    /**\n     * The verification methods we offer to the other side during an interactive verification.\n     */\n    _defineProperty(this, \"_supportedVerificationMethods\", ALL_VERIFICATION_METHODS);\n    this.outgoingRequestProcessor = new OutgoingRequestProcessor(logger, olmMachine, http);\n    this.outgoingRequestsManager = new OutgoingRequestsManager(this.logger, olmMachine, this.outgoingRequestProcessor);\n    this.keyClaimManager = new KeyClaimManager(olmMachine, this.outgoingRequestProcessor);\n    this.backupManager = new RustBackupManager(logger, olmMachine, http, this.outgoingRequestProcessor);\n    this.perSessionBackupDownloader = new PerSessionKeyBackupDownloader(this.logger, this.olmMachine, this.http, this.backupManager);\n    this.dehydratedDeviceManager = new DehydratedDeviceManager(this.logger, olmMachine, http, this.outgoingRequestProcessor, secretStorage);\n    this.eventDecryptor = new EventDecryptor(this.logger, olmMachine, this.perSessionBackupDownloader);\n\n    // re-emit the events emitted by managers\n    this.reemitter.reEmit(this.backupManager, [CryptoEvent.KeyBackupStatus, CryptoEvent.KeyBackupSessionsRemaining, CryptoEvent.KeyBackupFailed, CryptoEvent.KeyBackupDecryptionKeyCached]);\n    this.reemitter.reEmit(this.dehydratedDeviceManager, [CryptoEvent.DehydratedDeviceCreated, CryptoEvent.DehydratedDeviceUploaded, CryptoEvent.RehydrationStarted, CryptoEvent.RehydrationProgress, CryptoEvent.RehydrationCompleted, CryptoEvent.RehydrationError, CryptoEvent.DehydrationKeyCached, CryptoEvent.DehydratedDeviceRotationError]);\n    this.crossSigningIdentity = new CrossSigningIdentity(logger, olmMachine, this.outgoingRequestProcessor, secretStorage);\n\n    // Check and start in background the key backup connection\n    this.checkKeyBackupAndEnable();\n  }\n\n  /**\n   * Return the OlmMachine only if {@link RustCrypto#stop} has not been called.\n   *\n   * This allows us to better handle race conditions where the client is stopped before or during a crypto API call.\n   *\n   * @throws ClientStoppedError if {@link RustCrypto#stop} has been called.\n   */\n  getOlmMachineOrThrow() {\n    if (this.stopped) {\n      throw new ClientStoppedError();\n    }\n    return this.olmMachine;\n  }\n\n  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n  //\n  // CryptoBackend implementation\n  //\n  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n  set globalErrorOnUnknownDevices(_v) {\n    // Not implemented for rust crypto.\n  }\n  get globalErrorOnUnknownDevices() {\n    // Not implemented for rust crypto.\n    return false;\n  }\n  stop() {\n    // stop() may be called multiple times, but attempting to close() the OlmMachine twice\n    // will cause an error.\n    if (this.stopped) {\n      return;\n    }\n    this.stopped = true;\n    this.keyClaimManager.stop();\n    this.backupManager.stop();\n    this.outgoingRequestsManager.stop();\n    this.perSessionBackupDownloader.stop();\n    this.dehydratedDeviceManager.stop();\n\n    // make sure we close() the OlmMachine; doing so means that all the Rust objects will be\n    // cleaned up; in particular, the indexeddb connections will be closed, which means they\n    // can then be deleted.\n    this.olmMachine.close();\n  }\n  encryptEvent(event, _room) {\n    var _this = this;\n    return _asyncToGenerator(function* () {\n      var roomId = event.getRoomId();\n      var encryptor = _this.roomEncryptors[roomId];\n      if (!encryptor) {\n        throw new Error(\"Cannot encrypt event in unconfigured room \".concat(roomId));\n      }\n      yield encryptor.encryptEvent(event, _this.globalBlacklistUnverifiedDevices, _this.deviceIsolationMode);\n    })();\n  }\n  decryptEvent(event) {\n    var _this2 = this;\n    return _asyncToGenerator(function* () {\n      var roomId = event.getRoomId();\n      if (!roomId) {\n        // presumably, a to-device message. These are normally decrypted in preprocessToDeviceMessages\n        // so the fact it has come back here suggests that decryption failed.\n        //\n        // once we drop support for the libolm crypto implementation, we can stop passing to-device messages\n        // through decryptEvent and hence get rid of this case.\n        throw new Error(\"to-device event was not decrypted in preprocessToDeviceMessages\");\n      }\n      return yield _this2.eventDecryptor.attemptEventDecryption(event, _this2.deviceIsolationMode);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoBackend#getBackupDecryptor}.\n   */\n  getBackupDecryptor(backupInfo, privKey) {\n    var _this3 = this;\n    return _asyncToGenerator(function* () {\n      if (!(privKey instanceof Uint8Array)) {\n        throw new Error(\"getBackupDecryptor: expects Uint8Array\");\n      }\n      if (backupInfo.algorithm != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n        throw new Error(\"getBackupDecryptor: Unsupported algorithm \".concat(backupInfo.algorithm));\n      }\n      var backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(encodeBase64(privKey));\n      if (!decryptionKeyMatchesKeyBackupInfo(backupDecryptionKey, backupInfo)) {\n        throw new Error(\"getBackupDecryptor: key backup on server does not match the decryption key\");\n      }\n      return _this3.backupManager.createBackupDecryptor(backupDecryptionKey);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoBackend#importBackedUpRoomKeys}.\n   */\n  importBackedUpRoomKeys(keys, backupVersion, opts) {\n    var _this4 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this4.backupManager.importBackedUpRoomKeys(keys, backupVersion, opts);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoBackend.maybeAcceptKeyBundle}.\n   */\n  maybeAcceptKeyBundle(roomId, inviter) {\n    var _this5 = this;\n    return _asyncToGenerator(function* () {\n      // TODO: retry this if it gets interrupted or it fails. (https://github.com/matrix-org/matrix-rust-sdk/issues/5112)\n      // TODO: do this in the background.\n      // TODO: handle the bundle message arriving after the invite (https://github.com/element-hq/element-web/issues/30740)\n\n      var logger = new LogSpan(_this5.logger, \"maybeAcceptKeyBundle(\".concat(roomId, \", \").concat(inviter, \")\"));\n\n      // Make sure we have an up-to-date idea of the inviter's cross-signing keys, so that we can check if the\n      // device that sent us the bundle data was correctly cross-signed.\n      //\n      // TODO: it would be nice to skip this step if we have an up-to-date copy of the inviter's cross-signing keys,\n      //   but we don't have an easy way to check that. Possibly the rust side could trigger a key request and then\n      //   block until it happens.\n      logger.info(\"Checking inviter cross-signing keys\");\n      var request = _this5.olmMachine.queryKeysForUsers([new RustSdkCryptoJs.UserId(inviter)]);\n      yield _this5.outgoingRequestProcessor.makeOutgoingRequest(request);\n      var bundleData = yield _this5.olmMachine.getReceivedRoomKeyBundleData(new RustSdkCryptoJs.RoomId(roomId), new RustSdkCryptoJs.UserId(inviter));\n      if (!bundleData) {\n        logger.info(\"No key bundle found for user\");\n        return;\n      }\n      logger.info(\"Fetching key bundle \".concat(bundleData.url));\n      var url = getHttpUriForMxc(_this5.http.opts.baseUrl, bundleData.url, undefined, undefined, undefined, /* allowDirectLinks */false, /* allowRedirects */true, /* useAuthentication */true);\n      var encryptedBundle;\n      try {\n        var bundleUrl = new URL(url);\n        encryptedBundle = yield _this5.http.authedRequest(Method.Get, bundleUrl.pathname + bundleUrl.search, {}, undefined, {\n          rawResponseBody: true,\n          prefix: \"\"\n        });\n      } catch (err) {\n        logger.warn(\"Error downloading encrypted bundle from \".concat(url, \":\"), err);\n        throw err;\n      }\n      logger.info(\"Received blob of length \".concat(encryptedBundle.size));\n      try {\n        yield _this5.olmMachine.receiveRoomKeyBundle(bundleData, new Uint8Array(yield encryptedBundle.arrayBuffer()));\n      } catch (err) {\n        logger.warn(\"Error receiving encrypted bundle:\", err);\n        throw err;\n      }\n    })();\n  }\n  /**\n   * Implementation of {@link CryptoApi#getVersion}.\n   */\n  getVersion() {\n    var versions = RustSdkCryptoJs.getVersions();\n    return \"Rust SDK \".concat(versions.matrix_sdk_crypto, \" (\").concat(versions.git_sha, \"), Vodozemac \").concat(versions.vodozemac);\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#setDeviceIsolationMode}.\n   */\n  setDeviceIsolationMode(isolationMode) {\n    this.deviceIsolationMode = isolationMode;\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#isEncryptionEnabledInRoom}.\n   */\n  isEncryptionEnabledInRoom(roomId) {\n    var _this6 = this;\n    return _asyncToGenerator(function* () {\n      var roomSettings = yield _this6.olmMachine.getRoomSettings(new RustSdkCryptoJs.RoomId(roomId));\n      return Boolean(roomSettings === null || roomSettings === void 0 ? void 0 : roomSettings.algorithm);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#isStateEncryptionEnabledInRoom}.\n   */\n  isStateEncryptionEnabledInRoom(roomId) {\n    var _this7 = this;\n    return _asyncToGenerator(function* () {\n      var roomSettings = yield _this7.olmMachine.getRoomSettings(new RustSdkCryptoJs.RoomId(roomId));\n      return Boolean(roomSettings === null || roomSettings === void 0 ? void 0 : roomSettings.encryptStateEvents);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getOwnDeviceKeys}.\n   */\n  getOwnDeviceKeys() {\n    var _this8 = this;\n    return _asyncToGenerator(function* () {\n      var keys = _this8.olmMachine.identityKeys;\n      return {\n        ed25519: keys.ed25519.toBase64(),\n        curve25519: keys.curve25519.toBase64()\n      };\n    })();\n  }\n  prepareToEncrypt(room) {\n    var encryptor = this.roomEncryptors[room.roomId];\n    if (encryptor) {\n      encryptor.prepareForEncryption(this.globalBlacklistUnverifiedDevices, this.deviceIsolationMode);\n    }\n  }\n  forceDiscardSession(roomId) {\n    var _this$roomEncryptors$;\n    return (_this$roomEncryptors$ = this.roomEncryptors[roomId]) === null || _this$roomEncryptors$ === void 0 ? void 0 : _this$roomEncryptors$.forceDiscardSession();\n  }\n  exportRoomKeys() {\n    var _this9 = this;\n    return _asyncToGenerator(function* () {\n      var raw = yield _this9.olmMachine.exportRoomKeys(() => true);\n      return JSON.parse(raw);\n    })();\n  }\n  exportRoomKeysAsJson() {\n    var _this0 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this0.olmMachine.exportRoomKeys(() => true);\n    })();\n  }\n  importRoomKeys(keys, opts) {\n    var _this1 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this1.backupManager.importRoomKeys(keys, opts);\n    })();\n  }\n  importRoomKeysAsJson(keys, opts) {\n    var _this10 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this10.backupManager.importRoomKeysAsJson(keys, opts);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi.userHasCrossSigningKeys}.\n   */\n  userHasCrossSigningKeys() {\n    var _arguments = arguments,\n      _this11 = this;\n    return _asyncToGenerator(function* () {\n      var userId = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : _this11.userId;\n      var downloadUncached = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : false;\n      // TODO: could probably do with a more efficient way of doing this than returning the whole set and searching\n      var rustTrackedUsers = yield _this11.olmMachine.trackedUsers();\n      var rustTrackedUser;\n      for (var u of rustTrackedUsers) {\n        if (userId === u.toString()) {\n          rustTrackedUser = u;\n          break;\n        }\n      }\n      if (rustTrackedUser !== undefined) {\n        if (userId === _this11.userId) {\n          /* make sure we have an *up-to-date* idea of the user's cross-signing keys. This is important, because if we\n           * return \"false\" here, we will end up generating new cross-signing keys and replacing the existing ones.\n           */\n          var request = _this11.olmMachine.queryKeysForUsers(\n          // clone as rust layer will take ownership and it's reused later\n          [rustTrackedUser.clone()]);\n          yield _this11.outgoingRequestProcessor.makeOutgoingRequest(request);\n        }\n        var userIdentity = yield _this11.olmMachine.getIdentity(rustTrackedUser);\n        userIdentity === null || userIdentity === void 0 || userIdentity.free();\n        return userIdentity !== undefined;\n      } else if (downloadUncached) {\n        var _keyResult$master_key;\n        // Download the cross signing keys and check if the master key is available\n        var keyResult = yield _this11.downloadDeviceList(new Set([userId]));\n        var keys = (_keyResult$master_key = keyResult.master_keys) === null || _keyResult$master_key === void 0 ? void 0 : _keyResult$master_key[userId];\n\n        // No master key\n        if (!keys) return false;\n\n        // `keys` is an object with { [`ed25519:${pubKey}`]: pubKey }\n        // We assume only a single key, and we want the bare form without type\n        // prefix, so we select the values.\n        return Boolean(Object.values(keys.keys)[0]);\n      } else {\n        return false;\n      }\n    })();\n  }\n\n  /**\n   * Get the device information for the given list of users.\n   *\n   * @param userIds - The users to fetch.\n   * @param downloadUncached - If true, download the device list for users whose device list we are not\n   *    currently tracking. Defaults to false, in which case such users will not appear at all in the result map.\n   *\n   * @returns A map `{@link DeviceMap}`.\n   */\n  getUserDeviceInfo(userIds) {\n    var _arguments2 = arguments,\n      _this12 = this;\n    return _asyncToGenerator(function* () {\n      var downloadUncached = _arguments2.length > 1 && _arguments2[1] !== undefined ? _arguments2[1] : false;\n      var deviceMapByUserId = new Map();\n      var rustTrackedUsers = yield _this12.getOlmMachineOrThrow().trackedUsers();\n\n      // Convert RustSdkCryptoJs.UserId to a `Set<string>`\n      var trackedUsers = new Set();\n      rustTrackedUsers.forEach(rustUserId => trackedUsers.add(rustUserId.toString()));\n\n      // Keep untracked user to download their keys after\n      var untrackedUsers = new Set();\n      for (var _userId of userIds) {\n        // if this is a tracked user, we can just fetch the device list from the rust-sdk\n        // (NB: this is probably ok even if we race with a leave event such that we stop tracking the user's\n        // devices: the rust-sdk will return the last-known device list, which will be good enough.)\n        if (trackedUsers.has(_userId)) {\n          deviceMapByUserId.set(_userId, yield _this12.getUserDevices(_userId));\n        } else {\n          untrackedUsers.add(_userId);\n        }\n      }\n\n      // for any users whose device lists we are not tracking, fall back to downloading the device list\n      // over HTTP.\n      if (downloadUncached && untrackedUsers.size >= 1) {\n        var queryResult = yield _this12.downloadDeviceList(untrackedUsers);\n        Object.entries(queryResult.device_keys).forEach(_ref => {\n          var [userId, deviceKeys] = _ref;\n          return deviceMapByUserId.set(userId, deviceKeysToDeviceMap(deviceKeys));\n        });\n      }\n      return deviceMapByUserId;\n    })();\n  }\n\n  /**\n   * Get the device list for the given user from the olm machine\n   * @param userId - Rust SDK UserId\n   */\n  getUserDevices(userId) {\n    var _this13 = this;\n    return _asyncToGenerator(function* () {\n      var rustUserId = new RustSdkCryptoJs.UserId(userId);\n\n      // For reasons I don't really understand, the Javascript FinalizationRegistry doesn't seem to run the\n      // registered callbacks when `userDevices` goes out of scope, nor when the individual devices in the array\n      // returned by `userDevices.devices` do so.\n      //\n      // This is particularly problematic, because each of those structures holds a reference to the\n      // VerificationMachine, which in turn holds a reference to the IndexeddbCryptoStore. Hence, we end up leaking\n      // open connections to the crypto store, which means the store can't be deleted on logout.\n      //\n      // To fix this, we explicitly call `.free` on each of the objects, which tells the rust code to drop the\n      // allocated memory and decrement the refcounts for the crypto store.\n\n      // Wait for up to a second for any in-flight device list requests to complete.\n      // The reason for this isn't so much to avoid races (some level of raciness is\n      // inevitable for this method) but to make testing easier.\n      var userDevices = yield _this13.olmMachine.getUserDevices(rustUserId, 1);\n      try {\n        var deviceArray = userDevices.devices();\n        try {\n          return new Map(deviceArray.map(device => [device.deviceId.toString(), rustDeviceToJsDevice(device, rustUserId)]));\n        } finally {\n          deviceArray.forEach(d => d.free());\n        }\n      } finally {\n        userDevices.free();\n      }\n    })();\n  }\n\n  /**\n   * Download the given user keys by calling `/keys/query` request\n   * @param untrackedUsers - download keys of these users\n   */\n  downloadDeviceList(untrackedUsers) {\n    var _this14 = this;\n    return _asyncToGenerator(function* () {\n      var queryBody = {\n        device_keys: {}\n      };\n      untrackedUsers.forEach(user => queryBody.device_keys[user] = []);\n      return yield _this14.http.authedRequest(Method.Post, \"/_matrix/client/v3/keys/query\", undefined, queryBody, {\n        prefix: \"\"\n      });\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getTrustCrossSignedDevices}.\n   */\n  getTrustCrossSignedDevices() {\n    return this._trustCrossSignedDevices;\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#setTrustCrossSignedDevices}.\n   */\n  setTrustCrossSignedDevices(val) {\n    this._trustCrossSignedDevices = val;\n    // TODO: legacy crypto goes through the list of known devices and emits DeviceVerificationChanged\n    //  events. Maybe we need to do the same?\n  }\n\n  /**\n   * Mark the given device as locally verified.\n   *\n   * Implementation of {@link CryptoApi#setDeviceVerified}.\n   */\n  setDeviceVerified(userId, deviceId) {\n    var _arguments3 = arguments,\n      _this15 = this;\n    return _asyncToGenerator(function* () {\n      var verified = _arguments3.length > 2 && _arguments3[2] !== undefined ? _arguments3[2] : true;\n      var device = yield _this15.olmMachine.getDevice(new RustSdkCryptoJs.UserId(userId), new RustSdkCryptoJs.DeviceId(deviceId));\n      if (!device) {\n        throw new Error(\"Unknown device \".concat(userId, \"|\").concat(deviceId));\n      }\n      try {\n        yield device.setLocalTrust(verified ? RustSdkCryptoJs.LocalTrust.Verified : RustSdkCryptoJs.LocalTrust.Unset);\n      } finally {\n        device.free();\n      }\n    })();\n  }\n\n  /**\n   * Blindly cross-sign one of our other devices.\n   *\n   * Implementation of {@link CryptoApi#crossSignDevice}.\n   */\n  crossSignDevice(deviceId) {\n    var _this16 = this;\n    return _asyncToGenerator(function* () {\n      var device = yield _this16.olmMachine.getDevice(new RustSdkCryptoJs.UserId(_this16.userId), new RustSdkCryptoJs.DeviceId(deviceId));\n      if (!device) {\n        throw new Error(\"Unknown device \".concat(deviceId));\n      }\n      try {\n        var outgoingRequest = yield device.verify();\n        yield _this16.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n      } finally {\n        device.free();\n      }\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getDeviceVerificationStatus}.\n   */\n  getDeviceVerificationStatus(userId, deviceId) {\n    var _this17 = this;\n    return _asyncToGenerator(function* () {\n      var device = yield _this17.olmMachine.getDevice(new RustSdkCryptoJs.UserId(userId), new RustSdkCryptoJs.DeviceId(deviceId));\n      if (!device) return null;\n      try {\n        return new DeviceVerificationStatus({\n          signedByOwner: device.isCrossSignedByOwner(),\n          crossSigningVerified: device.isCrossSigningTrusted(),\n          localVerified: device.isLocallyTrusted(),\n          trustCrossSignedDevices: _this17._trustCrossSignedDevices\n        });\n      } finally {\n        device.free();\n      }\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getUserVerificationStatus}.\n   */\n  getUserVerificationStatus(userId) {\n    var _this18 = this;\n    return _asyncToGenerator(function* () {\n      var userIdentity = yield _this18.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(userId));\n      if (userIdentity === undefined) {\n        return new UserVerificationStatus(false, false, false);\n      }\n      var verified = userIdentity.isVerified();\n      var wasVerified = userIdentity.wasPreviouslyVerified();\n      var needsUserApproval = userIdentity instanceof RustSdkCryptoJs.OtherUserIdentity ? userIdentity.identityNeedsUserApproval() : false;\n      userIdentity.free();\n      return new UserVerificationStatus(verified, wasVerified, false, needsUserApproval);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#pinCurrentUserIdentity}.\n   */\n  pinCurrentUserIdentity(userId) {\n    var _this19 = this;\n    return _asyncToGenerator(function* () {\n      var userIdentity = yield _this19.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(userId));\n      if (userIdentity === undefined) {\n        throw new Error(\"Cannot pin identity of unknown user\");\n      }\n      if (userIdentity instanceof RustSdkCryptoJs.OwnUserIdentity) {\n        throw new Error(\"Cannot pin identity of own user\");\n      }\n      yield userIdentity.pinCurrentMasterKey();\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#withdrawVerificationRequirement}.\n   */\n  withdrawVerificationRequirement(userId) {\n    var _this20 = this;\n    return _asyncToGenerator(function* () {\n      var userIdentity = yield _this20.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(userId));\n      if (userIdentity === undefined) {\n        throw new Error(\"Cannot withdraw verification of unknown user\");\n      }\n      yield userIdentity.withdrawVerification();\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#isCrossSigningReady}\n   */\n  isCrossSigningReady() {\n    var _this21 = this;\n    return _asyncToGenerator(function* () {\n      var {\n        privateKeysInSecretStorage,\n        privateKeysCachedLocally\n      } = yield _this21.getCrossSigningStatus();\n      var hasKeysInCache = Boolean(privateKeysCachedLocally.masterKey) && Boolean(privateKeysCachedLocally.selfSigningKey) && Boolean(privateKeysCachedLocally.userSigningKey);\n      var identity = yield _this21.getOwnIdentity();\n\n      // Cross-signing is ready if the public identity is trusted, and the private keys\n      // are either cached, or accessible via secret-storage.\n      return !!(identity !== null && identity !== void 0 && identity.isVerified()) && (hasKeysInCache || privateKeysInSecretStorage);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getCrossSigningKeyId}\n   */\n  getCrossSigningKeyId() {\n    var _arguments4 = arguments,\n      _this22 = this;\n    return _asyncToGenerator(function* () {\n      var type = _arguments4.length > 0 && _arguments4[0] !== undefined ? _arguments4[0] : CrossSigningKey.Master;\n      var userIdentity = yield _this22.olmMachine.getIdentity(new RustSdkCryptoJs.UserId(_this22.userId));\n      if (!userIdentity) {\n        // The public keys are not available on this device\n        return null;\n      }\n      try {\n        var crossSigningStatus = yield _this22.olmMachine.crossSigningStatus();\n        var privateKeysOnDevice = crossSigningStatus.hasMaster && crossSigningStatus.hasUserSigning && crossSigningStatus.hasSelfSigning;\n        if (!privateKeysOnDevice) {\n          // The private keys are not available on this device\n          return null;\n        }\n        if (!userIdentity.isVerified()) {\n          // We have both public and private keys, but they don't match!\n          return null;\n        }\n        var key;\n        switch (type) {\n          case CrossSigningKey.Master:\n            key = userIdentity.masterKey;\n            break;\n          case CrossSigningKey.SelfSigning:\n            key = userIdentity.selfSigningKey;\n            break;\n          case CrossSigningKey.UserSigning:\n            key = userIdentity.userSigningKey;\n            break;\n          default:\n            // Unknown type\n            return null;\n        }\n        var parsedKey = JSON.parse(key);\n        // `keys` is an object with { [`ed25519:${pubKey}`]: pubKey }\n        // We assume only a single key, and we want the bare form without type\n        // prefix, so we select the values.\n        return Object.values(parsedKey.keys)[0];\n      } finally {\n        userIdentity.free();\n      }\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#bootstrapCrossSigning}\n   */\n  bootstrapCrossSigning(opts) {\n    var _this23 = this;\n    return _asyncToGenerator(function* () {\n      yield _this23.crossSigningIdentity.bootstrapCrossSigning(opts);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#isSecretStorageReady}\n   */\n  isSecretStorageReady() {\n    var _this24 = this;\n    return _asyncToGenerator(function* () {\n      // make sure that the cross-signing keys are stored\n      var secretsToCheck = [\"m.cross_signing.master\", \"m.cross_signing.user_signing\", \"m.cross_signing.self_signing\"];\n\n      // if key backup is active, we also need to check that the backup decryption key is stored\n      var keyBackupEnabled = (yield _this24.backupManager.getActiveBackupVersion()) != null;\n      if (keyBackupEnabled) {\n        secretsToCheck.push(\"m.megolm_backup.v1\");\n      }\n      return secretStorageCanAccessSecrets(_this24.secretStorage, secretsToCheck);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#bootstrapSecretStorage}\n   */\n  bootstrapSecretStorage() {\n    var _arguments5 = arguments,\n      _this25 = this;\n    return _asyncToGenerator(function* () {\n      var {\n        createSecretStorageKey,\n        setupNewSecretStorage,\n        setupNewKeyBackup\n      } = _arguments5.length > 0 && _arguments5[0] !== undefined ? _arguments5[0] : {};\n      // If an AES Key is already stored in the secret storage and setupNewSecretStorage is not set\n      // we don't want to create a new key\n      var isNewSecretStorageKeyNeeded = setupNewSecretStorage || !(yield _this25.secretStorageHasAESKey());\n      if (isNewSecretStorageKeyNeeded) {\n        if (!createSecretStorageKey) {\n          throw new Error(\"unable to create a new secret storage key, createSecretStorageKey is not set\");\n        }\n\n        // Create a new storage key and add it to secret storage\n        _this25.logger.info(\"bootstrapSecretStorage: creating new secret storage key\");\n        var recoveryKey = yield createSecretStorageKey();\n        if (!recoveryKey) {\n          throw new Error(\"createSecretStorageKey() callback did not return a secret storage key\");\n        }\n        yield _this25.addSecretStorageKeyToSecretStorage(recoveryKey);\n      }\n      var crossSigningPrivateKeys = yield _this25.olmMachine.exportCrossSigningKeys();\n      var hasPrivateKeys = crossSigningPrivateKeys && crossSigningPrivateKeys.masterKey !== undefined && crossSigningPrivateKeys.self_signing_key !== undefined && crossSigningPrivateKeys.userSigningKey !== undefined;\n\n      // If we have cross-signing private keys cached, store them in secret\n      // storage if they are not there already.\n      if (hasPrivateKeys && (isNewSecretStorageKeyNeeded || !(yield secretStorageContainsCrossSigningKeys(_this25.secretStorage)))) {\n        _this25.logger.info(\"bootstrapSecretStorage: cross-signing keys not yet exported; doing so now.\");\n        yield _this25.secretStorage.store(\"m.cross_signing.master\", crossSigningPrivateKeys.masterKey);\n        yield _this25.secretStorage.store(\"m.cross_signing.user_signing\", crossSigningPrivateKeys.userSigningKey);\n        yield _this25.secretStorage.store(\"m.cross_signing.self_signing\", crossSigningPrivateKeys.self_signing_key);\n      }\n\n      // likewise with the key backup key: if we have one, store it in secret storage (if it's not already there)\n      // also don't bother storing it if we're about to set up a new backup\n      if (!setupNewKeyBackup) {\n        yield _this25.saveBackupKeyToStorage();\n      } else {\n        yield _this25.resetKeyBackup();\n      }\n    })();\n  }\n\n  /**\n   * If we have a backup key for the current, trusted backup in cache,\n   * save it to secret storage.\n   */\n  saveBackupKeyToStorage() {\n    var _this26 = this;\n    return _asyncToGenerator(function* () {\n      var keyBackupInfo = yield _this26.backupManager.getServerBackupInfo();\n      if (!keyBackupInfo || !keyBackupInfo.version) {\n        _this26.logger.info(\"Not saving backup key to secret storage: no backup info\");\n        return;\n      }\n      var backupKeys = yield _this26.olmMachine.getBackupKeys();\n      if (!backupKeys.decryptionKey) {\n        _this26.logger.info(\"Not saving backup key to secret storage: no backup key\");\n        return;\n      }\n      if (!decryptionKeyMatchesKeyBackupInfo(backupKeys.decryptionKey, keyBackupInfo)) {\n        _this26.logger.info(\"Not saving backup key to secret storage: decryption key does not match backup info\");\n        return;\n      }\n      var backupKeyBase64 = backupKeys.decryptionKey.toBase64();\n      yield _this26.secretStorage.store(\"m.megolm_backup.v1\", backupKeyBase64);\n    })();\n  }\n\n  /**\n   * Add the secretStorage key to the secret storage\n   * - The secret storage key must have the `keyInfo` field filled\n   * - The secret storage key is set as the default key of the secret storage\n   * - Call `cryptoCallbacks.cacheSecretStorageKey` when done\n   *\n   * @param secretStorageKey - The secret storage key to add in the secret storage.\n   */\n  addSecretStorageKeyToSecretStorage(secretStorageKey) {\n    var _this27 = this;\n    return _asyncToGenerator(function* () {\n      var _secretStorageKey$key, _secretStorageKey$key2, _this27$cryptoCallbac, _this27$cryptoCallbac2;\n      var secretStorageKeyObject = yield _this27.secretStorage.addKey(SECRET_STORAGE_ALGORITHM_V1_AES, {\n        passphrase: (_secretStorageKey$key = secretStorageKey.keyInfo) === null || _secretStorageKey$key === void 0 ? void 0 : _secretStorageKey$key.passphrase,\n        name: (_secretStorageKey$key2 = secretStorageKey.keyInfo) === null || _secretStorageKey$key2 === void 0 ? void 0 : _secretStorageKey$key2.name,\n        key: secretStorageKey.privateKey\n      });\n      yield _this27.secretStorage.setDefaultKeyId(secretStorageKeyObject.keyId);\n      (_this27$cryptoCallbac = (_this27$cryptoCallbac2 = _this27.cryptoCallbacks).cacheSecretStorageKey) === null || _this27$cryptoCallbac === void 0 || _this27$cryptoCallbac.call(_this27$cryptoCallbac2, secretStorageKeyObject.keyId, secretStorageKeyObject.keyInfo, secretStorageKey.privateKey);\n    })();\n  }\n\n  /**\n   * Check if a secret storage AES Key is already added in secret storage\n   *\n   * @returns True if an AES key is in the secret storage\n   */\n  secretStorageHasAESKey() {\n    var _this28 = this;\n    return _asyncToGenerator(function* () {\n      // See if we already have an AES secret-storage key.\n      var secretStorageKeyTuple = yield _this28.secretStorage.getKey();\n      if (!secretStorageKeyTuple) return false;\n      var [, keyInfo] = secretStorageKeyTuple;\n\n      // Check if the key is an AES key\n      return keyInfo.algorithm === SECRET_STORAGE_ALGORITHM_V1_AES;\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getCrossSigningStatus}\n   */\n  getCrossSigningStatus() {\n    var _this29 = this;\n    return _asyncToGenerator(function* () {\n      var userIdentity = yield _this29.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(_this29.userId));\n      var publicKeysOnDevice = Boolean(userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.masterKey) && Boolean(userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.selfSigningKey) && Boolean(userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.userSigningKey);\n      userIdentity === null || userIdentity === void 0 || userIdentity.free();\n      var privateKeysInSecretStorage = yield secretStorageContainsCrossSigningKeys(_this29.secretStorage);\n      var crossSigningStatus = yield _this29.getOlmMachineOrThrow().crossSigningStatus();\n      return {\n        publicKeysOnDevice,\n        privateKeysInSecretStorage,\n        privateKeysCachedLocally: {\n          masterKey: Boolean(crossSigningStatus === null || crossSigningStatus === void 0 ? void 0 : crossSigningStatus.hasMaster),\n          userSigningKey: Boolean(crossSigningStatus === null || crossSigningStatus === void 0 ? void 0 : crossSigningStatus.hasUserSigning),\n          selfSigningKey: Boolean(crossSigningStatus === null || crossSigningStatus === void 0 ? void 0 : crossSigningStatus.hasSelfSigning)\n        }\n      };\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#createRecoveryKeyFromPassphrase}\n   */\n  createRecoveryKeyFromPassphrase(password) {\n    var _this30 = this;\n    return _asyncToGenerator(function* () {\n      if (password) {\n        // Generate the key from the passphrase\n        // first we generate a random salt\n        var salt = secureRandomString(32);\n        // then we derive the key from the passphrase\n        var recoveryKey = yield deriveRecoveryKeyFromPassphrase(password, salt, _this30.RECOVERY_KEY_DERIVATION_ITERATIONS);\n        return {\n          keyInfo: {\n            passphrase: {\n              algorithm: \"m.pbkdf2\",\n              iterations: _this30.RECOVERY_KEY_DERIVATION_ITERATIONS,\n              salt\n            }\n          },\n          privateKey: recoveryKey,\n          encodedPrivateKey: encodeRecoveryKey(recoveryKey)\n        };\n      } else {\n        // Using the navigator crypto API to generate the private key\n        var key = new Uint8Array(32);\n        globalThis.crypto.getRandomValues(key);\n        return {\n          privateKey: key,\n          encodedPrivateKey: encodeRecoveryKey(key)\n        };\n      }\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getEncryptionInfoForEvent}.\n   */\n  getEncryptionInfoForEvent(event) {\n    var _this31 = this;\n    return _asyncToGenerator(function* () {\n      return _this31.eventDecryptor.getEncryptionInfoForEvent(event);\n    })();\n  }\n\n  /**\n   * Returns to-device verification requests that are already in progress for the given user id.\n   *\n   * Implementation of {@link CryptoApi#getVerificationRequestsToDeviceInProgress}\n   *\n   * @param userId - the ID of the user to query\n   *\n   * @returns the VerificationRequests that are in progress\n   */\n  getVerificationRequestsToDeviceInProgress(userId) {\n    var requests = this.olmMachine.getVerificationRequests(new RustSdkCryptoJs.UserId(userId));\n    return requests.filter(request => request.roomId === undefined && !request.isCancelled()).map(request => this.makeVerificationRequest(request));\n  }\n\n  /**\n   * Finds a DM verification request that is already in progress for the given room id\n   *\n   * Implementation of {@link CryptoApi#findVerificationRequestDMInProgress}\n   *\n   * @param roomId - the room to use for verification\n   * @param userId - search the verification request for the given user\n   *\n   * @returns the VerificationRequest that is in progress, if any\n   *\n   */\n  findVerificationRequestDMInProgress(roomId, userId) {\n    if (!userId) throw new Error(\"missing userId\");\n    var requests = this.olmMachine.getVerificationRequests(new RustSdkCryptoJs.UserId(userId));\n\n    // Search for the verification request for the given room id\n    var request = requests.find(request => {\n      var _request$roomId;\n      return ((_request$roomId = request.roomId) === null || _request$roomId === void 0 ? void 0 : _request$roomId.toString()) === roomId && !request.isCancelled();\n    });\n    if (request) {\n      return this.makeVerificationRequest(request);\n    }\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#requestVerificationDM}\n   */\n  requestVerificationDM(userId, roomId) {\n    var _this32 = this;\n    return _asyncToGenerator(function* () {\n      var userIdentity = yield _this32.olmMachine.getIdentity(new RustSdkCryptoJs.UserId(userId));\n      if (!userIdentity) throw new Error(\"unknown userId \".concat(userId));\n      try {\n        // Transform the verification methods into rust objects\n        var methods = _this32._supportedVerificationMethods.map(method => verificationMethodIdentifierToMethod(method));\n        // Get the request content to send to the DM room\n        var verCont = yield userIdentity.verificationRequestContent(methods);\n\n        // TODO: due to https://github.com/matrix-org/matrix-rust-sdk/issues/5643, we need to fix up the verification request content to include `msgtype`.\n        var verContObj = JSON.parse(verCont);\n        verContObj[\"msgtype\"] = \"m.key.verification.request\";\n        var verificationEventContent = JSON.stringify(verContObj);\n\n        // Send the request content to send to the DM room\n        var eventId = yield _this32.sendVerificationRequestContent(roomId, verificationEventContent);\n\n        // Get a verification request\n        var request = yield userIdentity.requestVerification(new RustSdkCryptoJs.RoomId(roomId), new RustSdkCryptoJs.EventId(eventId), methods);\n        return _this32.makeVerificationRequest(request);\n      } finally {\n        userIdentity.free();\n      }\n    })();\n  }\n\n  /**\n   * Send the verification content to a room\n   * See https://spec.matrix.org/v1.7/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid\n   *\n   * Prefer to use {@link OutgoingRequestProcessor.makeOutgoingRequest} when dealing with {@link RustSdkCryptoJs.RoomMessageRequest}\n   *\n   * @param roomId - the targeted room\n   * @param verificationEventContent - the request body.\n   *\n   * @returns the event id\n   */\n  sendVerificationRequestContent(roomId, verificationEventContent) {\n    var _this33 = this;\n    return _asyncToGenerator(function* () {\n      var txId = secureRandomString(32);\n      // Send the verification request content to the DM room\n      var {\n        event_id: eventId\n      } = yield _this33.http.authedRequest(Method.Put, \"/_matrix/client/v3/rooms/\".concat(encodeURIComponent(roomId), \"/send/m.room.message/\").concat(encodeURIComponent(txId)), undefined, verificationEventContent, {\n        prefix: \"\"\n      });\n      return eventId;\n    })();\n  }\n  /**\n   * Set the verification methods we offer to the other side during an interactive verification.\n   *\n   * If `undefined`, we will offer all the methods supported by the Rust SDK.\n   */\n  setSupportedVerificationMethods(methods) {\n    // by default, the Rust SDK does not offer `m.qr_code.scan.v1`, but we do want to offer that.\n    this._supportedVerificationMethods = methods !== null && methods !== void 0 ? methods : ALL_VERIFICATION_METHODS;\n  }\n\n  /**\n   * Send a verification request to our other devices.\n   *\n   * If a verification is already in flight, returns it. Otherwise, initiates a new one.\n   *\n   * Implementation of {@link CryptoApi#requestOwnUserVerification}.\n   *\n   * @returns a VerificationRequest when the request has been sent to the other party.\n   */\n  requestOwnUserVerification() {\n    var _this34 = this;\n    return _asyncToGenerator(function* () {\n      var userIdentity = yield _this34.olmMachine.getIdentity(new RustSdkCryptoJs.UserId(_this34.userId));\n      if (userIdentity === undefined) {\n        throw new Error(\"cannot request verification for this device when there is no existing cross-signing key\");\n      }\n      try {\n        var [request, outgoingRequest] = yield userIdentity.requestVerification(_this34._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n        yield _this34.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n        return _this34.makeVerificationRequest(request);\n      } finally {\n        userIdentity.free();\n      }\n    })();\n  }\n\n  /**\n   * Request an interactive verification with the given device.\n   *\n   * If a verification is already in flight, returns it. Otherwise, initiates a new one.\n   *\n   * Implementation of {@link CryptoApi#requestDeviceVerification}.\n   *\n   * @param userId - ID of the owner of the device to verify\n   * @param deviceId - ID of the device to verify\n   *\n   * @returns a VerificationRequest when the request has been sent to the other party.\n   */\n  requestDeviceVerification(userId, deviceId) {\n    var _this35 = this;\n    return _asyncToGenerator(function* () {\n      var device = yield _this35.olmMachine.getDevice(new RustSdkCryptoJs.UserId(userId), new RustSdkCryptoJs.DeviceId(deviceId));\n      if (!device) {\n        throw new Error(\"Not a known device\");\n      }\n      try {\n        var [request, outgoingRequest] = device.requestVerification(_this35._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n        yield _this35.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n        return _this35.makeVerificationRequest(request);\n      } finally {\n        device.free();\n      }\n    })();\n  }\n\n  /**\n   * Fetch the backup decryption key we have saved in our store.\n   *\n   * Implementation of {@link CryptoApi#getSessionBackupPrivateKey}.\n   *\n   * @returns the key, if any, or null\n   */\n  getSessionBackupPrivateKey() {\n    var _this36 = this;\n    return _asyncToGenerator(function* () {\n      var backupKeys = yield _this36.olmMachine.getBackupKeys();\n      if (!backupKeys.decryptionKey) return null;\n      return decodeBase64(backupKeys.decryptionKey.toBase64());\n    })();\n  }\n\n  /**\n   * Store the backup decryption key.\n   *\n   * Implementation of {@link CryptoApi#storeSessionBackupPrivateKey}.\n   *\n   * @param key - the backup decryption key\n   * @param version - the backup version for this key.\n   */\n  storeSessionBackupPrivateKey(key, version) {\n    var _this37 = this;\n    return _asyncToGenerator(function* () {\n      var base64Key = encodeBase64(key);\n      if (!version) {\n        throw new Error(\"storeSessionBackupPrivateKey: version is required\");\n      }\n      yield _this37.backupManager.saveBackupDecryptionKey(RustSdkCryptoJs.BackupDecryptionKey.fromBase64(base64Key), version);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#loadSessionBackupPrivateKeyFromSecretStorage}.\n   */\n  loadSessionBackupPrivateKeyFromSecretStorage() {\n    var _this38 = this;\n    return _asyncToGenerator(function* () {\n      var backupKey = yield _this38.secretStorage.get(\"m.megolm_backup.v1\");\n      if (!backupKey) {\n        throw new Error(\"loadSessionBackupPrivateKeyFromSecretStorage: missing decryption key in secret storage\");\n      }\n      var keyBackupInfo = yield _this38.backupManager.getServerBackupInfo();\n      if (!keyBackupInfo || !keyBackupInfo.version) {\n        throw new Error(\"loadSessionBackupPrivateKeyFromSecretStorage: unable to get backup version\");\n      }\n      var backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(backupKey);\n      if (!decryptionKeyMatchesKeyBackupInfo(backupDecryptionKey, keyBackupInfo)) {\n        throw new Error(\"loadSessionBackupPrivateKeyFromSecretStorage: decryption key does not match backup info\");\n      }\n      yield _this38.backupManager.saveBackupDecryptionKey(backupDecryptionKey, keyBackupInfo.version);\n    })();\n  }\n\n  /**\n   * Get the current status of key backup.\n   *\n   * Implementation of {@link CryptoApi#getActiveSessionBackupVersion}.\n   */\n  getActiveSessionBackupVersion() {\n    var _this39 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this39.backupManager.getActiveBackupVersion();\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#getKeyBackupInfo}.\n   */\n  getKeyBackupInfo() {\n    var _this40 = this;\n    return _asyncToGenerator(function* () {\n      return (yield _this40.backupManager.getServerBackupInfo()) || null;\n    })();\n  }\n\n  /**\n   * Determine if a key backup can be trusted.\n   *\n   * Implementation of {@link CryptoApi#isKeyBackupTrusted}.\n   */\n  isKeyBackupTrusted(info) {\n    var _this41 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this41.backupManager.isKeyBackupTrusted(info);\n    })();\n  }\n\n  /**\n   * Force a re-check of the key backup and enable/disable it as appropriate.\n   *\n   * Implementation of {@link CryptoApi#checkKeyBackupAndEnable}.\n   */\n  checkKeyBackupAndEnable() {\n    var _this42 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this42.backupManager.checkKeyBackupAndEnable(true);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#deleteKeyBackupVersion}.\n   */\n  deleteKeyBackupVersion(version) {\n    var _this43 = this;\n    return _asyncToGenerator(function* () {\n      yield _this43.backupManager.deleteKeyBackupVersion(version);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#resetKeyBackup}.\n   */\n  resetKeyBackup() {\n    var _this44 = this;\n    return _asyncToGenerator(function* () {\n      var backupInfo = yield _this44.backupManager.setupKeyBackup(o => _this44.signObject(o));\n\n      // we want to store the private key in 4S\n      // need to check if 4S is set up?\n      if (yield _this44.secretStorageHasAESKey()) {\n        yield _this44.secretStorage.store(\"m.megolm_backup.v1\", backupInfo.decryptionKey.toBase64());\n      }\n\n      // we can check and start async\n      _this44.checkKeyBackupAndEnable();\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#disableKeyStorage}.\n   */\n  disableKeyStorage() {\n    var _this45 = this;\n    return _asyncToGenerator(function* () {\n      // Get the key backup version we're using\n      var info = yield _this45.getKeyBackupInfo();\n      if (info !== null && info !== void 0 && info.version) {\n        yield _this45.deleteKeyBackupVersion(info.version);\n      } else {\n        _this45.logger.error(\"Can't delete key backup version: no version available\");\n      }\n\n      // also turn off 4S, since this is also storing keys on the server.\n      yield _this45.deleteSecretStorage();\n      yield _this45.dehydratedDeviceManager.delete();\n    })();\n  }\n\n  /**\n   * Signs the given object with the current device and current identity (if available).\n   * As defined in {@link https://spec.matrix.org/v1.8/appendices/#signing-json | Signing JSON}.\n   *\n   * Helper for {@link RustCrypto#resetKeyBackup}.\n   *\n   * @param obj - The object to sign\n   */\n  signObject(obj) {\n    var _this46 = this;\n    return _asyncToGenerator(function* () {\n      var sigs = new Map(Object.entries(obj.signatures || {}));\n      var unsigned = obj.unsigned;\n      delete obj.signatures;\n      delete obj.unsigned;\n      var userSignatures = sigs.get(_this46.userId) || {};\n      var canonalizedJson = anotherjson.stringify(obj);\n      var signatures = yield _this46.olmMachine.sign(canonalizedJson);\n      var map = JSON.parse(signatures.asJSON());\n      sigs.set(_this46.userId, _objectSpread(_objectSpread({}, userSignatures), map[_this46.userId]));\n      if (unsigned !== undefined) obj.unsigned = unsigned;\n      obj.signatures = Object.fromEntries(sigs.entries());\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#restoreKeyBackupWithPassphrase}.\n   */\n  restoreKeyBackupWithPassphrase(passphrase, opts) {\n    var _this47 = this;\n    return _asyncToGenerator(function* () {\n      var backupInfo = yield _this47.backupManager.getServerBackupInfo();\n      if (!(backupInfo !== null && backupInfo !== void 0 && backupInfo.version)) {\n        throw new Error(\"No backup info available\");\n      }\n      var privateKey = yield keyFromAuthData(backupInfo.auth_data, passphrase);\n\n      // Cache the key\n      yield _this47.storeSessionBackupPrivateKey(privateKey, backupInfo.version);\n      return _this47.restoreKeyBackup(opts);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#restoreKeyBackup}.\n   */\n  restoreKeyBackup(opts) {\n    var _this48 = this;\n    return _asyncToGenerator(function* () {\n      // Get the decryption key from the crypto store\n      var backupKeys = yield _this48.olmMachine.getBackupKeys();\n      var {\n        decryptionKey,\n        backupVersion\n      } = backupKeys;\n      if (!decryptionKey || !backupVersion) throw new Error(\"No decryption key found in crypto store\");\n      var decodedDecryptionKey = decodeBase64(decryptionKey.toBase64());\n      var backupInfo = yield _this48.backupManager.requestKeyBackupVersion(backupVersion);\n      if (!backupInfo) throw new Error(\"Backup version to restore \".concat(backupVersion, \" not found on server\"));\n      var backupDecryptor = yield _this48.getBackupDecryptor(backupInfo, decodedDecryptionKey);\n      try {\n        var _opts$progressCallbac;\n        opts === null || opts === void 0 || (_opts$progressCallbac = opts.progressCallback) === null || _opts$progressCallbac === void 0 || _opts$progressCallbac.call(opts, {\n          stage: ImportRoomKeyStage.Fetch\n        });\n        return yield _this48.backupManager.restoreKeyBackup(backupVersion, backupDecryptor, opts);\n      } finally {\n        // Free to avoid to keep in memory the decryption key stored in it. To avoid to exposing it to an attacker.\n        backupDecryptor.free();\n      }\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#isDehydrationSupported}.\n   */\n  isDehydrationSupported() {\n    var _this49 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this49.dehydratedDeviceManager.isSupported();\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#startDehydration}.\n   */\n  startDehydration() {\n    var _arguments6 = arguments,\n      _this50 = this;\n    return _asyncToGenerator(function* () {\n      var opts = _arguments6.length > 0 && _arguments6[0] !== undefined ? _arguments6[0] : {};\n      if (!(yield _this50.isCrossSigningReady()) || !(yield _this50.isSecretStorageReady())) {\n        throw new Error(\"Device dehydration requires cross-signing and secret storage to be set up\");\n      }\n      return yield _this50.dehydratedDeviceManager.start(opts || {});\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#importSecretsBundle}.\n   */\n  importSecretsBundle(secrets) {\n    var _this51 = this;\n    return _asyncToGenerator(function* () {\n      var secretsBundle = RustSdkCryptoJs.SecretsBundle.from_json(secrets);\n      yield _this51.getOlmMachineOrThrow().importSecretsBundle(secretsBundle); // this method frees the SecretsBundle\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#exportSecretsBundle}.\n   */\n  exportSecretsBundle() {\n    var _this52 = this;\n    return _asyncToGenerator(function* () {\n      var secretsBundle = yield _this52.getOlmMachineOrThrow().exportSecretsBundle();\n      var secrets = secretsBundle.to_json();\n      secretsBundle.free();\n      return secrets;\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#encryptToDeviceMessages}.\n   */\n  encryptToDeviceMessages(eventType, devices, payload) {\n    var _this53 = this;\n    return _asyncToGenerator(function* () {\n      var logger = new LogSpan(_this53.logger, \"encryptToDeviceMessages\");\n      var uniqueUsers = new Set(devices.map(_ref2 => {\n        var {\n          userId\n        } = _ref2;\n        return userId;\n      }));\n\n      // This will ensure we have Olm sessions for all of the users' devices.\n      // However, we only care about some of the devices.\n      // So, perhaps we can optimise this later on.\n      yield _this53.keyClaimManager.ensureSessionsForUsers(logger, Array.from(uniqueUsers).map(userId => new RustSdkCryptoJs.UserId(userId)));\n      var batch = {\n        batch: [],\n        eventType: EventType.RoomMessageEncrypted\n      };\n      yield Promise.all(devices.map(/*#__PURE__*/function () {\n        var _ref4 = _asyncToGenerator(function* (_ref3) {\n          var {\n            userId,\n            deviceId\n          } = _ref3;\n          var device = yield _this53.olmMachine.getDevice(new RustSdkCryptoJs.UserId(userId), new RustSdkCryptoJs.DeviceId(deviceId));\n          if (device) {\n            var encryptedPayload = JSON.parse(yield device.encryptToDeviceEvent(eventType, payload));\n            batch.batch.push({\n              deviceId,\n              userId,\n              payload: encryptedPayload\n            });\n          } else {\n            _this53.logger.warn(\"encryptToDeviceMessages: unknown device \".concat(userId, \":\").concat(deviceId));\n          }\n        });\n        return function (_x) {\n          return _ref4.apply(this, arguments);\n        };\n      }()));\n      return batch;\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#resetEncryption}.\n   */\n  resetEncryption(authUploadDeviceSigningKeys) {\n    var _this54 = this;\n    return _asyncToGenerator(function* () {\n      _this54.logger.debug(\"resetEncryption: resetting encryption\");\n\n      // Delete the dehydrated device, since any existing one will be signed\n      // by the wrong cross-signing key\n      _this54.dehydratedDeviceManager.delete();\n\n      // Disable backup, and delete all the backups from the server\n      yield _this54.backupManager.deleteAllKeyBackupVersions();\n      yield _this54.deleteSecretStorage();\n\n      // Reset the cross-signing keys\n      yield _this54.crossSigningIdentity.bootstrapCrossSigning({\n        setupNewCrossSigning: true,\n        authUploadDeviceSigningKeys\n      });\n\n      // Create a new key backup\n      yield _this54.resetKeyBackup();\n      _this54.logger.debug(\"resetEncryption: ended\");\n    })();\n  }\n\n  /**\n   * Removes the secret storage key, default key pointer and all (known) secret storage data\n   * from the user's account data\n   */\n  deleteSecretStorage() {\n    var _this55 = this;\n    return _asyncToGenerator(function* () {\n      // Remove the stored secrets in the secret storage\n      yield _this55.secretStorage.store(\"m.cross_signing.master\", null);\n      yield _this55.secretStorage.store(\"m.cross_signing.self_signing\", null);\n      yield _this55.secretStorage.store(\"m.cross_signing.user_signing\", null);\n      yield _this55.secretStorage.store(\"m.megolm_backup.v1\", null);\n\n      // Remove the recovery key\n      var defaultKeyId = yield _this55.secretStorage.getDefaultKeyId();\n      if (defaultKeyId) yield _this55.secretStorage.store(\"m.secret_storage.key.\".concat(defaultKeyId), null);\n      // Disable the recovery key and the secret storage\n      yield _this55.secretStorage.setDefaultKeyId(null);\n    })();\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#shareRoomHistoryWithUser}.\n   */\n  shareRoomHistoryWithUser(roomId, userId) {\n    var _this56 = this;\n    return _asyncToGenerator(function* () {\n      var logger = new LogSpan(_this56.logger, \"shareRoomHistoryWithUser(\".concat(roomId, \", \").concat(userId, \")\"));\n\n      // 0. We can only share room history if our user has set up cross-signing.\n      var identity = yield _this56.getOwnIdentity();\n      if (!(identity !== null && identity !== void 0 && identity.isVerified())) {\n        logger.warn(\"Not sharing message history as the current device is not verified by our cross-signing identity\");\n        return;\n      }\n      logger.info(\"Sharing message history\");\n\n      // 1. Construct the key bundle\n      var bundle = yield _this56.getOlmMachineOrThrow().buildRoomKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n      if (!bundle) {\n        logger.info(\"No keys to share\");\n        return;\n      }\n\n      // 2. Upload the encrypted bundle to the server\n      var uploadResponse = yield _this56.http.uploadContent(bundle.encryptedData);\n      logger.info(\"Uploaded encrypted key blob: \".concat(JSON.stringify(uploadResponse)));\n\n      // 3. We may not share a room with the user, so get a fresh list of devices for the invited user.\n      var req = _this56.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(userId)]);\n      yield _this56.outgoingRequestProcessor.makeOutgoingRequest(req);\n\n      // 4. Establish Olm sessions with all of the recipient's devices.\n      yield _this56.keyClaimManager.ensureSessionsForUsers(logger, [new RustSdkCryptoJs.UserId(userId)]);\n\n      // 5. Send to-device messages to the recipient to share the keys.\n      var requests = yield _this56.getOlmMachineOrThrow().shareRoomKeyBundleData(new RustSdkCryptoJs.UserId(userId), new RustSdkCryptoJs.RoomId(roomId), uploadResponse.content_uri, bundle.mediaEncryptionInfo, RustSdkCryptoJs.CollectStrategy.identityBasedStrategy());\n      for (var _req of requests) {\n        yield _this56.outgoingRequestProcessor.makeOutgoingRequest(_req);\n      }\n    })();\n  }\n\n  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n  //\n  // SyncCryptoCallbacks implementation\n  //\n  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n  /**\n   * Apply sync changes to the olm machine\n   * @param events - the received to-device messages\n   * @param oneTimeKeysCounts - the received one time key counts\n   * @param unusedFallbackKeys - the received unused fallback keys\n   * @param devices - the received device list updates\n   * @returns A list of processed to-device messages.\n   */\n  receiveSyncChanges(_ref5) {\n    var _this57 = this;\n    return _asyncToGenerator(function* () {\n      var {\n        events,\n        oneTimeKeysCounts = new Map(),\n        unusedFallbackKeys,\n        devices = new RustSdkCryptoJs.DeviceLists()\n      } = _ref5;\n      return yield _this57.olmMachine.receiveSyncChanges(events ? JSON.stringify(events) : \"[]\", devices, oneTimeKeysCounts, unusedFallbackKeys);\n    })();\n  }\n\n  /** called by the sync loop to preprocess incoming to-device messages\n   *\n   * @param events - the received to-device messages\n   * @returns A list of preprocessed to-device messages.\n   */\n  preprocessToDeviceMessages(events) {\n    var _this58 = this;\n    return _asyncToGenerator(function* () {\n      // send the received to-device messages into receiveSyncChanges. We have no info on device-list changes,\n      // one-time-keys, or fallback keys, so just pass empty data.\n      var processed = yield _this58.receiveSyncChanges({\n        events\n      });\n      var received = [];\n      for (var message of processed) {\n        var parsedMessage = JSON.parse(message.rawEvent);\n\n        // look for interesting to-device messages\n        if (parsedMessage.type === EventType.KeyVerificationRequest) {\n          var sender = parsedMessage.sender;\n          var transactionId = parsedMessage.content.transaction_id;\n          if (transactionId && sender) {\n            _this58.onIncomingKeyVerificationRequest(sender, transactionId);\n          }\n        }\n        switch (message.type) {\n          case RustSdkCryptoJs.ProcessedToDeviceEventType.Decrypted:\n            {\n              var _encryptionInfo$sende;\n              var encryptionInfo = message.encryptionInfo;\n              received.push({\n                message: parsedMessage,\n                encryptionInfo: {\n                  sender: encryptionInfo.sender.toString(),\n                  senderDevice: (_encryptionInfo$sende = encryptionInfo.senderDevice) === null || _encryptionInfo$sende === void 0 ? void 0 : _encryptionInfo$sende.toString(),\n                  senderCurve25519KeyBase64: encryptionInfo.senderCurve25519Key,\n                  senderVerified: encryptionInfo.isSenderVerified()\n                }\n              });\n              break;\n            }\n          case RustSdkCryptoJs.ProcessedToDeviceEventType.PlainText:\n            {\n              received.push({\n                message: parsedMessage,\n                encryptionInfo: null\n              });\n              break;\n            }\n          case RustSdkCryptoJs.ProcessedToDeviceEventType.UnableToDecrypt:\n            // ignore messages we cannot decrypt\n            break;\n          case RustSdkCryptoJs.ProcessedToDeviceEventType.Invalid:\n            // ignore invalid messages\n            break;\n        }\n      }\n      return received;\n    })();\n  }\n\n  /** called by the sync loop to process one time key counts and unused fallback keys\n   *\n   * @param oneTimeKeysCounts - the received one time key counts\n   * @param unusedFallbackKeys - the received unused fallback keys\n   */\n  processKeyCounts(oneTimeKeysCounts, unusedFallbackKeys) {\n    var _this59 = this;\n    return _asyncToGenerator(function* () {\n      var mapOneTimeKeysCount = oneTimeKeysCounts && new Map(Object.entries(oneTimeKeysCounts));\n      var setUnusedFallbackKeys = unusedFallbackKeys && new Set(unusedFallbackKeys);\n      if (mapOneTimeKeysCount !== undefined || setUnusedFallbackKeys !== undefined) {\n        yield _this59.receiveSyncChanges({\n          oneTimeKeysCounts: mapOneTimeKeysCount,\n          unusedFallbackKeys: setUnusedFallbackKeys\n        });\n      }\n    })();\n  }\n\n  /** called by the sync loop to process the notification that device lists have\n   * been changed.\n   *\n   * @param deviceLists - device_lists field from /sync\n   */\n  processDeviceLists(deviceLists) {\n    var _this60 = this;\n    return _asyncToGenerator(function* () {\n      var _deviceLists$changed, _deviceLists$left;\n      var devices = new RustSdkCryptoJs.DeviceLists((_deviceLists$changed = deviceLists.changed) === null || _deviceLists$changed === void 0 ? void 0 : _deviceLists$changed.map(userId => new RustSdkCryptoJs.UserId(userId)), (_deviceLists$left = deviceLists.left) === null || _deviceLists$left === void 0 ? void 0 : _deviceLists$left.map(userId => new RustSdkCryptoJs.UserId(userId)));\n      yield _this60.receiveSyncChanges({\n        devices\n      });\n    })();\n  }\n\n  /** called by the sync loop on m.room.encryption events\n   *\n   * @param room - in which the event was received\n   * @param event - encryption event to be processed\n   */\n  onCryptoEvent(room, event) {\n    var _this61 = this;\n    return _asyncToGenerator(function* () {\n      var config = event.getContent();\n      var settings = new RustSdkCryptoJs.RoomSettings();\n      if (config.algorithm === \"m.megolm.v1.aes-sha2\") {\n        settings.algorithm = RustSdkCryptoJs.EncryptionAlgorithm.MegolmV1AesSha2;\n      } else {\n        // Among other situations, this happens if the crypto state event is redacted.\n        _this61.logger.warn(\"Room \".concat(room.roomId, \": ignoring crypto event with invalid algorithm \").concat(config.algorithm));\n        return;\n      }\n      if (config[\"io.element.msc3414.encrypt_state_events\"] && _this61.enableEncryptedStateEvents) {\n        _this61.logger.info(\"crypto Enabling state event encryption...\");\n        settings.encryptStateEvents = true;\n      }\n      try {\n        settings.sessionRotationPeriodMs = config.rotation_period_ms;\n        settings.sessionRotationPeriodMessages = config.rotation_period_msgs;\n        yield _this61.olmMachine.setRoomSettings(new RustSdkCryptoJs.RoomId(room.roomId), settings);\n      } catch (e) {\n        _this61.logger.warn(\"Room \".concat(room.roomId, \": ignoring crypto event which caused error: \").concat(e));\n        return;\n      }\n\n      // If we got this far, the SDK found the event acceptable.\n      // We need to either create or update the active RoomEncryptor.\n      var existingEncryptor = _this61.roomEncryptors[room.roomId];\n      if (existingEncryptor) {\n        existingEncryptor.onCryptoEvent(config);\n      } else {\n        _this61.roomEncryptors[room.roomId] = new RoomEncryptor(_this61.logger.getChild(\"[\".concat(room.roomId, \" encryption]\")), _this61.olmMachine, _this61.keyClaimManager, _this61.outgoingRequestsManager, room, config);\n      }\n    })();\n  }\n\n  /** called by the sync loop after processing each sync.\n   *\n   *\n   * @param syncState - information on the completed sync.\n   */\n  onSyncCompleted(syncState) {\n    // Processing the /sync may have produced new outgoing requests which need sending, so kick off the outgoing\n    // request loop, if it's not already running.\n    this.outgoingRequestsManager.doProcessOutgoingRequests().catch(e => {\n      this.logger.warn(\"onSyncCompleted: Error processing outgoing requests\", e);\n    });\n  }\n\n  /**\n   * Implementation of {@link CryptoApi#markAllTrackedUsersAsDirty}.\n   */\n  markAllTrackedUsersAsDirty() {\n    var _this62 = this;\n    return _asyncToGenerator(function* () {\n      yield _this62.olmMachine.markAllTrackedUsersAsDirty();\n    })();\n  }\n\n  /**\n   * Handle an incoming m.key.verification.request event, received either in-room or in a to-device message.\n   *\n   * @param sender - the sender of the event\n   * @param transactionId - the transaction ID for the verification. For to-device messages, this comes from the\n   *    content of the message; for in-room messages it is the event ID.\n   */\n  onIncomingKeyVerificationRequest(sender, transactionId) {\n    var request = this.olmMachine.getVerificationRequest(new RustSdkCryptoJs.UserId(sender), transactionId);\n    if (request) {\n      this.emit(CryptoEvent.VerificationRequestReceived, this.makeVerificationRequest(request));\n    } else {\n      // There are multiple reasons this can happen; probably the most likely is that the event is an\n      // in-room event which is too old.\n      this.logger.info(\"Ignoring just-received verification request \".concat(transactionId, \" which did not start a rust-side verification\"));\n    }\n  }\n\n  /** Utility function to wrap a rust `VerificationRequest` with our own {@link VerificationRequest}. */\n  makeVerificationRequest(request) {\n    return new RustVerificationRequest(this.logger, this.olmMachine, request, this.outgoingRequestProcessor, this._supportedVerificationMethods);\n  }\n\n  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n  //\n  // Other public functions\n  //\n  ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n  /** called by the MatrixClient on a room membership event\n   *\n   * @param event - The matrix event which caused this event to fire.\n   * @param member - The member whose RoomMember.membership changed.\n   * @param oldMembership - The previous membership state. Null if it's a new member.\n   */\n  onRoomMembership(event, member, oldMembership) {\n    var enc = this.roomEncryptors[event.getRoomId()];\n    if (!enc) {\n      // not encrypting in this room\n      return;\n    }\n    enc.onRoomMembership(member);\n  }\n\n  /** Callback for OlmMachine.registerRoomKeyUpdatedCallback\n   *\n   * Called by the rust-sdk whenever there is an update to (megolm) room keys. We\n   * check if we have any events waiting for the given keys, and schedule them for\n   * a decryption retry if so.\n   *\n   * @param keys - details of the updated keys\n   */\n  onRoomKeysUpdated(keys) {\n    var _this63 = this;\n    return _asyncToGenerator(function* () {\n      for (var key of keys) {\n        _this63.onRoomKeyUpdated(key);\n      }\n      _this63.backupManager.maybeUploadKey();\n    })();\n  }\n  onRoomKeyUpdated(key) {\n    var _this64 = this;\n    if (this.stopped) return;\n    this.logger.debug(\"Got update for session \".concat(key.sessionId, \" from sender \").concat(key.senderKey.toBase64(), \" in \").concat(key.roomId.toString()));\n    var pendingList = this.eventDecryptor.getEventsPendingRoomKey(key.roomId.toString(), key.sessionId);\n    if (pendingList.length === 0) return;\n    this.logger.debug(\"Retrying decryption on events:\", pendingList.map(e => \"\".concat(e.getId())));\n\n    // Have another go at decrypting events with this key.\n    //\n    // We don't want to end up blocking the callback from Rust, which could otherwise end up dropping updates,\n    // so we don't wait for the decryption to complete. In any case, there is no need to wait:\n    // MatrixEvent.attemptDecryption ensures that there is only one decryption attempt happening at once,\n    // and deduplicates repeated attempts for the same event.\n    var _loop = function _loop(ev) {\n      ev.attemptDecryption(_this64, {\n        isRetry: true\n      }).catch(_e => {\n        _this64.logger.info(\"Still unable to decrypt event \".concat(ev.getId(), \" after receiving key\"));\n      });\n    };\n    for (var ev of pendingList) {\n      _loop(ev);\n    }\n  }\n\n  /**\n   * Callback for `OlmMachine.registerRoomKeyWithheldCallback`.\n   *\n   * Called by the rust sdk whenever we are told that a key has been withheld. We see if we had any events that\n   * failed to decrypt for the given session, and update their status if so.\n   *\n   * @param withheld - Details of the withheld sessions.\n   */\n  onRoomKeysWithheld(withheld) {\n    var _this65 = this;\n    return _asyncToGenerator(function* () {\n      for (var session of withheld) {\n        _this65.logger.debug(\"Got withheld message for session \".concat(session.sessionId, \" in \").concat(session.roomId.toString()));\n        var pendingList = _this65.eventDecryptor.getEventsPendingRoomKey(session.roomId.toString(), session.sessionId);\n        if (pendingList.length === 0) return;\n\n        // The easiest way to update the status of the event is to have another go at decrypting it.\n        _this65.logger.debug(\"Retrying decryption on events:\", pendingList.map(e => \"\".concat(e.getId())));\n        for (var ev of pendingList) {\n          ev.attemptDecryption(_this65, {\n            isRetry: true\n          }).catch(_e => {\n            // It's somewhat expected that we still can't decrypt here.\n          });\n        }\n      }\n    })();\n  }\n\n  /**\n   * Callback for `OlmMachine.registerUserIdentityUpdatedCallback`\n   *\n   * Called by the rust-sdk whenever there is an update to any user's cross-signing status. We re-check their trust\n   * status and emit a `UserTrustStatusChanged` event, as well as a `KeysChanged` if it is our own identity that changed.\n   *\n   * @param userId - the user with the updated identity\n   */\n  onUserIdentityUpdated(userId) {\n    var _this66 = this;\n    return _asyncToGenerator(function* () {\n      var newVerification = yield _this66.getUserVerificationStatus(userId.toString());\n      _this66.emit(CryptoEvent.UserTrustStatusChanged, userId.toString(), newVerification);\n\n      // If our own user identity has changed, we may now trust the key backup where we did not before.\n      // So, re-check the key backup status and enable it if available.\n      if (userId.toString() === _this66.userId) {\n        _this66.emit(CryptoEvent.KeysChanged, {});\n        yield _this66.checkKeyBackupAndEnable();\n      }\n    })();\n  }\n\n  /**\n   * Callback for `OlmMachine.registerDevicesUpdatedCallback`\n   *\n   * Called when users' devices have updated. Emits `WillUpdateDevices` and `DevicesUpdated`. In the JavaScript\n   * crypto backend, these events are called at separate times, with `WillUpdateDevices` being emitted just before\n   * the devices are saved, and `DevicesUpdated` being emitted just after. But the OlmMachine only gives us\n   * one event, so we emit both events here.\n   *\n   * @param userIds - an array of user IDs of users whose devices have updated.\n   */\n  onDevicesUpdated(userIds) {\n    var _this67 = this;\n    return _asyncToGenerator(function* () {\n      _this67.emit(CryptoEvent.WillUpdateDevices, userIds, false);\n      _this67.emit(CryptoEvent.DevicesUpdated, userIds, false);\n    })();\n  }\n\n  /**\n   * Handles secret received from the rust secret inbox.\n   *\n   * The gossipped secrets are received using the `m.secret.send` event type\n   * and are guaranteed to have been received over a 1-to-1 Olm\n   * Session from a verified device.\n   *\n   * The only secret currently handled in this way is `m.megolm_backup.v1`.\n   *\n   * @param name - the secret name\n   * @param value - the secret value\n   */\n  handleSecretReceived(name, value) {\n    var _this68 = this;\n    return _asyncToGenerator(function* () {\n      _this68.logger.debug(\"onReceiveSecret: Received secret \".concat(name));\n      if (name === \"m.megolm_backup.v1\") {\n        return yield _this68.backupManager.handleBackupSecretReceived(value);\n        // XXX at this point we should probably try to download the backup and import the keys,\n        // or at least retry for the current decryption failures?\n        // Maybe add some signaling when a new secret is received, and let clients handle it?\n        // as it's where the restore from backup APIs are exposed.\n      }\n      return false;\n    })();\n  }\n\n  /**\n   * Called when a new secret is received in the rust secret inbox.\n   *\n   * Will poll the secret inbox and handle the secrets received.\n   *\n   * @param name - The name of the secret received.\n   */\n  checkSecrets(name) {\n    var _this69 = this;\n    return _asyncToGenerator(function* () {\n      var pendingValues = yield _this69.olmMachine.getSecretsFromInbox(name);\n      for (var value of pendingValues) {\n        if (yield _this69.handleSecretReceived(name, value)) {\n          // If we have a valid secret for that name there is no point of processing the other secrets values.\n          // It's probably the same secret shared by another device.\n          break;\n        }\n      }\n\n      // Important to call this after handling the secrets as good hygiene.\n      yield _this69.olmMachine.deleteSecretsFromInbox(name);\n    })();\n  }\n\n  /**\n   * Handle a live event received via /sync.\n   * See {@link ClientEventHandlerMap#event}\n   *\n   * @param event - live event\n   */\n  onLiveEventFromSync(event) {\n    var _this70 = this;\n    return _asyncToGenerator(function* () {\n      // Ignore state event or remote echo\n      // transaction_id is provided in case of remote echo {@link https://spec.matrix.org/v1.7/client-server-api/#local-echo}\n      if (event.isState() || !!event.getUnsigned().transaction_id) return;\n      var processEvent = /*#__PURE__*/function () {\n        var _ref6 = _asyncToGenerator(function* (evt) {\n          // Process only verification event\n          if (isVerificationEvent(event)) {\n            yield _this70.onKeyVerificationEvent(evt);\n          }\n        });\n        return function processEvent(_x2) {\n          return _ref6.apply(this, arguments);\n        };\n      }();\n\n      // If the event is encrypted of in failure, we wait for decryption\n      if (event.isDecryptionFailure() || event.isEncrypted()) {\n        // 5 mins\n        var TIMEOUT_DELAY = 5 * 60 * 1000;\n\n        // After 5mins, we are not expecting the event to be decrypted\n        var timeoutId = setTimeout(() => event.off(MatrixEventEvent.Decrypted, onDecrypted), TIMEOUT_DELAY);\n        var onDecrypted = (decryptedEvent, error) => {\n          if (error) return;\n          clearTimeout(timeoutId);\n          event.off(MatrixEventEvent.Decrypted, onDecrypted);\n          processEvent(decryptedEvent);\n        };\n        event.on(MatrixEventEvent.Decrypted, onDecrypted);\n      } else {\n        yield processEvent(event);\n      }\n    })();\n  }\n\n  /**\n   * Handle an in-room key verification event.\n   *\n   * @param event - a key validation request event.\n   */\n  onKeyVerificationEvent(event) {\n    var _this71 = this;\n    return _asyncToGenerator(function* () {\n      var roomId = event.getRoomId();\n      if (!roomId) {\n        throw new Error(\"missing roomId in the event\");\n      }\n      _this71.logger.debug(\"Incoming verification event \".concat(event.getId(), \" type \").concat(event.getType(), \" from \").concat(event.getSender()));\n      yield _this71.olmMachine.receiveVerificationEvent(JSON.stringify({\n        event_id: event.getId(),\n        type: event.getType(),\n        sender: event.getSender(),\n        state_key: event.getStateKey(),\n        content: event.getContent(),\n        origin_server_ts: event.getTs()\n      }), new RustSdkCryptoJs.RoomId(roomId));\n      if (event.getType() === EventType.RoomMessage && event.getContent().msgtype === MsgType.KeyVerificationRequest) {\n        _this71.onIncomingKeyVerificationRequest(event.getSender(), event.getId());\n      }\n\n      // that may have caused us to queue up outgoing requests, so make sure we send them.\n      _this71.outgoingRequestsManager.doProcessOutgoingRequests().catch(e => {\n        _this71.logger.warn(\"onKeyVerificationRequest: Error processing outgoing requests\", e);\n      });\n    })();\n  }\n\n  /**\n   * Returns the cross-signing user identity of the current user.\n   *\n   * Not part of the public crypto-api interface.\n   * Used during migration from legacy js-crypto to update local trust if needed.\n   */\n  getOwnIdentity() {\n    var _this72 = this;\n    return _asyncToGenerator(function* () {\n      return yield _this72.olmMachine.getIdentity(new RustSdkCryptoJs.UserId(_this72.userId));\n    })();\n  }\n}\nclass EventDecryptor {\n  constructor(logger, olmMachine, perSessionBackupDownloader) {\n    this.logger = logger;\n    this.olmMachine = olmMachine;\n    this.perSessionBackupDownloader = perSessionBackupDownloader;\n    /**\n     * Events which we couldn't decrypt due to unknown sessions / indexes.\n     *\n     * Map from roomId to sessionId to Set of MatrixEvents\n     */\n    _defineProperty(this, \"eventsPendingKey\", new MapWithDefault(() => new MapWithDefault(() => new Set())));\n  }\n  attemptEventDecryption(event, isolationMode) {\n    var _this73 = this;\n    return _asyncToGenerator(function* () {\n      // add the event to the pending list *before* attempting to decrypt.\n      // then, if the key turns up while decryption is in progress (and\n      // decryption fails), we will schedule a retry.\n      // (fixes https://github.com/vector-im/element-web/issues/5001)\n      _this73.addEventToPendingList(event);\n      var trustRequirement;\n      switch (isolationMode.kind) {\n        case DeviceIsolationModeKind.AllDevicesIsolationMode:\n          trustRequirement = RustSdkCryptoJs.TrustRequirement.Untrusted;\n          break;\n        case DeviceIsolationModeKind.OnlySignedDevicesIsolationMode:\n          trustRequirement = RustSdkCryptoJs.TrustRequirement.CrossSignedOrLegacy;\n          break;\n      }\n      try {\n        var res = yield _this73.olmMachine.decryptRoomEvent(stringifyEvent(event), new RustSdkCryptoJs.RoomId(event.getRoomId()), new RustSdkCryptoJs.DecryptionSettings(trustRequirement));\n\n        // Success. We can remove the event from the pending list, if\n        // that hasn't already happened.\n        _this73.removeEventFromPendingList(event);\n        return {\n          clearEvent: JSON.parse(res.event),\n          claimedEd25519Key: res.senderClaimedEd25519Key,\n          senderCurve25519Key: res.senderCurve25519Key,\n          forwardingCurve25519KeyChain: res.forwardingCurve25519KeyChain\n        };\n      } catch (err) {\n        if (err instanceof RustSdkCryptoJs.MegolmDecryptionError) {\n          _this73.onMegolmDecryptionError(event, err, yield _this73.perSessionBackupDownloader.getServerBackupInfo());\n        } else {\n          throw new DecryptionError(DecryptionFailureCode.UNKNOWN_ERROR, \"Unknown error\");\n        }\n      }\n    })();\n  }\n\n  /**\n   * Handle a `MegolmDecryptionError` returned by the rust SDK.\n   *\n   * Fires off a request to the `perSessionBackupDownloader`, if appropriate, and then throws a `DecryptionError`.\n   *\n   * @param event - The event which could not be decrypted.\n   * @param err - The error from the Rust SDK.\n   * @param serverBackupInfo - Details about the current backup from the server. `null` if there is no backup.\n   *     `undefined` if our attempt to check failed.\n   */\n  onMegolmDecryptionError(event, err, serverBackupInfo) {\n    var content = event.getWireContent();\n    var errorDetails = {\n      sender_key: content.sender_key,\n      session_id: content.session_id\n    };\n\n    // If the error looks like it might be recoverable from backup, queue up a request to try that.\n    if (err.code === RustSdkCryptoJs.DecryptionErrorCode.MissingRoomKey || err.code === RustSdkCryptoJs.DecryptionErrorCode.UnknownMessageIndex) {\n      this.perSessionBackupDownloader.onDecryptionKeyMissingError(event.getRoomId(), content.session_id);\n\n      // If the server is telling us our membership at the time the event\n      // was sent, and it isn't \"join\", we use a different error code.\n      var membership = event.getMembershipAtEvent();\n      if (membership && membership !== KnownMembership.Join && membership !== KnownMembership.Invite) {\n        throw new DecryptionError(DecryptionFailureCode.HISTORICAL_MESSAGE_USER_NOT_JOINED, \"This message was sent when we were not a member of the room.\", errorDetails);\n      }\n\n      // If the event was sent before this device was created, we use some different error codes.\n      if (event.getTs() <= this.olmMachine.deviceCreationTimeMs) {\n        if (serverBackupInfo === null) {\n          throw new DecryptionError(DecryptionFailureCode.HISTORICAL_MESSAGE_NO_KEY_BACKUP, \"This message was sent before this device logged in, and there is no key backup on the server.\", errorDetails);\n        } else if (!this.perSessionBackupDownloader.isKeyBackupDownloadConfigured()) {\n          throw new DecryptionError(DecryptionFailureCode.HISTORICAL_MESSAGE_BACKUP_UNCONFIGURED, \"This message was sent before this device logged in, and key backup is not working.\", errorDetails);\n        } else {\n          throw new DecryptionError(DecryptionFailureCode.HISTORICAL_MESSAGE_WORKING_BACKUP, \"This message was sent before this device logged in. Key backup is working, but we still do not (yet) have the key.\", errorDetails);\n        }\n      }\n    }\n\n    // If we got a withheld code, expose that.\n    if (err.maybe_withheld) {\n      // Unfortunately the Rust SDK API doesn't let us distinguish between different withheld cases, other than\n      // by string-matching.\n      var failureCode = err.maybe_withheld === \"The sender has disabled encrypting to unverified devices.\" ? DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE : DecryptionFailureCode.MEGOLM_KEY_WITHHELD;\n      throw new DecryptionError(failureCode, err.maybe_withheld, errorDetails);\n    }\n    switch (err.code) {\n      case RustSdkCryptoJs.DecryptionErrorCode.MissingRoomKey:\n        throw new DecryptionError(DecryptionFailureCode.MEGOLM_UNKNOWN_INBOUND_SESSION_ID, \"The sender's device has not sent us the keys for this message.\", errorDetails);\n      case RustSdkCryptoJs.DecryptionErrorCode.UnknownMessageIndex:\n        throw new DecryptionError(DecryptionFailureCode.OLM_UNKNOWN_MESSAGE_INDEX, \"The sender's device has not sent us the keys for this message at this index.\", errorDetails);\n      case RustSdkCryptoJs.DecryptionErrorCode.SenderIdentityVerificationViolation:\n        // We're refusing to decrypt due to not trusting the sender,\n        // rather than failing to decrypt due to lack of keys, so we\n        // don't need to keep it on the pending list.\n        this.removeEventFromPendingList(event);\n        throw new DecryptionError(DecryptionFailureCode.SENDER_IDENTITY_PREVIOUSLY_VERIFIED, \"The sender identity is unverified, but was previously verified.\");\n      case RustSdkCryptoJs.DecryptionErrorCode.UnknownSenderDevice:\n        // We're refusing to decrypt due to not trusting the sender,\n        // rather than failing to decrypt due to lack of keys, so we\n        // don't need to keep it on the pending list.\n        this.removeEventFromPendingList(event);\n        throw new DecryptionError(DecryptionFailureCode.UNKNOWN_SENDER_DEVICE, \"The sender device is not known.\");\n      case RustSdkCryptoJs.DecryptionErrorCode.UnsignedSenderDevice:\n        // We're refusing to decrypt due to not trusting the sender,\n        // rather than failing to decrypt due to lack of keys, so we\n        // don't need to keep it on the pending list.\n        this.removeEventFromPendingList(event);\n        throw new DecryptionError(DecryptionFailureCode.UNSIGNED_SENDER_DEVICE, \"The sender identity is not cross-signed.\");\n\n      // We don't map MismatchedIdentityKeys for now, as there is no equivalent in legacy.\n      // Just put it on the `UNKNOWN_ERROR` bucket.\n      default:\n        throw new DecryptionError(DecryptionFailureCode.UNKNOWN_ERROR, err.description, errorDetails);\n    }\n  }\n  getEncryptionInfoForEvent(event) {\n    var _this74 = this;\n    return _asyncToGenerator(function* () {\n      if (!event.getClearContent() || event.isDecryptionFailure()) {\n        // not successfully decrypted\n        return null;\n      }\n\n      // special-case outgoing events, which the rust crypto-sdk will barf on\n      if (event.status !== null) {\n        return {\n          shieldColour: EventShieldColour.NONE,\n          shieldReason: null\n        };\n      }\n      var encryptionInfo = yield _this74.olmMachine.getRoomEventEncryptionInfo(stringifyEvent(event), new RustSdkCryptoJs.RoomId(event.getRoomId()));\n      return rustEncryptionInfoToJsEncryptionInfo(_this74.logger, encryptionInfo);\n    })();\n  }\n\n  /**\n   * Look for events which are waiting for a given megolm session\n   *\n   * Returns a list of events which were encrypted by `session` and could not be decrypted\n   */\n  getEventsPendingRoomKey(roomId, sessionId) {\n    var roomPendingEvents = this.eventsPendingKey.get(roomId);\n    if (!roomPendingEvents) return [];\n    var sessionPendingEvents = roomPendingEvents.get(sessionId);\n    if (!sessionPendingEvents) return [];\n    return [...sessionPendingEvents];\n  }\n\n  /**\n   * Add an event to the list of those awaiting their session keys.\n   */\n  addEventToPendingList(event) {\n    var roomId = event.getRoomId();\n    // We shouldn't have events without a room id here.\n    if (!roomId) return;\n    var roomPendingEvents = this.eventsPendingKey.getOrCreate(roomId);\n    var sessionPendingEvents = roomPendingEvents.getOrCreate(event.getWireContent().session_id);\n    sessionPendingEvents.add(event);\n  }\n\n  /**\n   * Remove an event from the list of those awaiting their session keys.\n   */\n  removeEventFromPendingList(event) {\n    var roomId = event.getRoomId();\n    if (!roomId) return;\n    var roomPendingEvents = this.eventsPendingKey.getOrCreate(roomId);\n    if (!roomPendingEvents) return;\n    var sessionPendingEvents = roomPendingEvents.get(event.getWireContent().session_id);\n    if (!sessionPendingEvents) return;\n    sessionPendingEvents.delete(event);\n\n    // also clean up the higher-level maps if they are now empty\n    if (sessionPendingEvents.size === 0) {\n      roomPendingEvents.delete(event.getWireContent().session_id);\n      if (roomPendingEvents.size === 0) {\n        this.eventsPendingKey.delete(roomId);\n      }\n    }\n  }\n}\nfunction stringifyEvent(event) {\n  return JSON.stringify({\n    event_id: event.getId(),\n    type: event.getWireType(),\n    sender: event.getSender(),\n    state_key: event.getStateKey(),\n    content: event.getWireContent(),\n    origin_server_ts: event.getTs()\n  });\n}\nfunction rustEncryptionInfoToJsEncryptionInfo(logger, encryptionInfo) {\n  if (encryptionInfo === undefined) {\n    // not decrypted here\n    return null;\n  }\n\n  // TODO: use strict shield semantics.\n  var shieldState = encryptionInfo.shieldState(false);\n  var shieldColour;\n  switch (shieldState.color) {\n    case RustSdkCryptoJs.ShieldColor.Grey:\n      shieldColour = EventShieldColour.GREY;\n      break;\n    case RustSdkCryptoJs.ShieldColor.None:\n      shieldColour = EventShieldColour.NONE;\n      break;\n    default:\n      shieldColour = EventShieldColour.RED;\n  }\n  var shieldReason;\n  switch (shieldState.code) {\n    case undefined:\n    case null:\n      shieldReason = null;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.AuthenticityNotGuaranteed:\n      shieldReason = EventShieldReason.AUTHENTICITY_NOT_GUARANTEED;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.UnknownDevice:\n      shieldReason = EventShieldReason.UNKNOWN_DEVICE;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.UnsignedDevice:\n      shieldReason = EventShieldReason.UNSIGNED_DEVICE;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.UnverifiedIdentity:\n      shieldReason = EventShieldReason.UNVERIFIED_IDENTITY;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.SentInClear:\n      shieldReason = EventShieldReason.SENT_IN_CLEAR;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.VerificationViolation:\n      shieldReason = EventShieldReason.VERIFICATION_VIOLATION;\n      break;\n    case RustSdkCryptoJs.ShieldStateCode.MismatchedSender:\n      shieldReason = EventShieldReason.MISMATCHED_SENDER;\n      break;\n    default:\n      shieldReason = EventShieldReason.UNKNOWN;\n      break;\n  }\n  return {\n    shieldColour,\n    shieldReason\n  };\n}\n//# sourceMappingURL=rust-crypto.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023-2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { MigrationState } from \"../crypto/store/base.js\";\nimport { IndexedDBCryptoStore } from \"../crypto/store/indexeddb-crypto-store.js\";\nimport { requestKeyBackupVersion } from \"./backup.js\";\nimport { sleep } from \"../utils.js\";\nimport { encodeBase64 } from \"../base64.js\";\nimport decryptAESSecretStorageItem from \"../utils/decryptAESSecretStorageItem.js\";\n/**\n * Determine if any data needs migrating from the legacy store, and do so.\n *\n * This migrates the base account data, and olm and megolm sessions. It does *not* migrate the room list, which should\n * happen after an `OlmMachine` is created, via {@link migrateRoomSettingsFromLegacyCrypto}.\n *\n * @param args - Arguments object.\n */\nexport function migrateFromLegacyCrypto(_x) {\n  return _migrateFromLegacyCrypto.apply(this, arguments);\n}\nfunction _migrateFromLegacyCrypto() {\n  _migrateFromLegacyCrypto = _asyncToGenerator(function* (args) {\n    var _args$legacyMigration2;\n    var {\n      logger,\n      legacyStore\n    } = args;\n\n    // initialise the rust matrix-sdk-crypto-wasm, if it hasn't already been done\n    yield RustSdkCryptoJs.initAsync();\n    if (!(yield legacyStore.containsData())) {\n      // This store was never used. Nothing to migrate.\n      return;\n    }\n    yield legacyStore.startup();\n    var accountPickle = null;\n    yield legacyStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], txn => {\n      legacyStore.getAccount(txn, acctPickle => {\n        accountPickle = acctPickle;\n      });\n    });\n    if (!accountPickle) {\n      // This store is not properly set up. Nothing to migrate.\n      logger.debug(\"Legacy crypto store is not set up (no account found). Not migrating.\");\n      return;\n    }\n    var migrationState = yield legacyStore.getMigrationState();\n    if (migrationState >= MigrationState.MEGOLM_SESSIONS_MIGRATED) {\n      // All migration is done for now. The room list comes later, once we have an OlmMachine.\n      return;\n    }\n    var nOlmSessions = yield countOlmSessions(logger, legacyStore);\n    var nMegolmSessions = yield countMegolmSessions(logger, legacyStore);\n    var totalSteps = 1 + nOlmSessions + nMegolmSessions;\n    logger.info(\"Migrating data from legacy crypto store. \".concat(nOlmSessions, \" olm sessions and \").concat(nMegolmSessions, \" megolm sessions to migrate.\"));\n    var stepsDone = 0;\n    function onProgress(steps) {\n      var _args$legacyMigration;\n      stepsDone += steps;\n      (_args$legacyMigration = args.legacyMigrationProgressListener) === null || _args$legacyMigration === void 0 || _args$legacyMigration.call(args, stepsDone, totalSteps);\n    }\n    onProgress(0);\n    var pickleKey = new TextEncoder().encode(args.legacyPickleKey);\n    if (migrationState === MigrationState.NOT_STARTED) {\n      logger.info(\"Migrating data from legacy crypto store. Step 1: base data\");\n      yield migrateBaseData(args.http, args.userId, args.deviceId, legacyStore, pickleKey, args.storeHandle, logger);\n      migrationState = MigrationState.INITIAL_DATA_MIGRATED;\n      yield legacyStore.setMigrationState(migrationState);\n    }\n    onProgress(1);\n    if (migrationState === MigrationState.INITIAL_DATA_MIGRATED) {\n      logger.info(\"Migrating data from legacy crypto store. Step 2: olm sessions (\".concat(nOlmSessions, \" sessions to migrate).\"));\n      yield migrateOlmSessions(logger, legacyStore, pickleKey, args.storeHandle, onProgress);\n      migrationState = MigrationState.OLM_SESSIONS_MIGRATED;\n      yield legacyStore.setMigrationState(migrationState);\n    }\n    if (migrationState === MigrationState.OLM_SESSIONS_MIGRATED) {\n      logger.info(\"Migrating data from legacy crypto store. Step 3: megolm sessions (\".concat(nMegolmSessions, \" sessions to migrate).\"));\n      yield migrateMegolmSessions(logger, legacyStore, pickleKey, args.storeHandle, onProgress);\n      migrationState = MigrationState.MEGOLM_SESSIONS_MIGRATED;\n      yield legacyStore.setMigrationState(migrationState);\n    }\n\n    // Migration is done.\n    (_args$legacyMigration2 = args.legacyMigrationProgressListener) === null || _args$legacyMigration2 === void 0 || _args$legacyMigration2.call(args, -1, -1);\n    logger.info(\"Migration from legacy crypto store complete\");\n  });\n  return _migrateFromLegacyCrypto.apply(this, arguments);\n}\nfunction migrateBaseData(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {\n  return _migrateBaseData.apply(this, arguments);\n}\nfunction _migrateBaseData() {\n  _migrateBaseData = _asyncToGenerator(function* (http, userId, deviceId, legacyStore, pickleKey, storeHandle, logger) {\n    var migrationData = new RustSdkCryptoJs.BaseMigrationData();\n    migrationData.userId = new RustSdkCryptoJs.UserId(userId);\n    migrationData.deviceId = new RustSdkCryptoJs.DeviceId(deviceId);\n    yield legacyStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], txn => legacyStore.getAccount(txn, a => {\n      migrationData.pickledAccount = a !== null && a !== void 0 ? a : \"\";\n    }));\n    var recoveryKey = yield getAndDecryptCachedSecretKey(legacyStore, pickleKey, \"m.megolm_backup.v1\");\n\n    // If we have a backup recovery key, we need to try to figure out which backup version it is for.\n    // All we can really do is ask the server for the most recent version and check if the cached key we have matches.\n    // It is possible that the backup has changed since last time his session was opened.\n    if (recoveryKey) {\n      var backupCallDone = false;\n      var backupInfo = null;\n      while (!backupCallDone) {\n        try {\n          backupInfo = yield requestKeyBackupVersion(http);\n          backupCallDone = true;\n        } catch (e) {\n          logger.info(\"Failed to get backup version during migration, retrying in 2 seconds\", e);\n          // Retry until successful, use simple constant delay\n          yield sleep(2000);\n        }\n      }\n      if (backupInfo && backupInfo.algorithm == \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n        // check if the recovery key matches, as the active backup version may have changed since the key was cached\n        // and the migration started.\n        try {\n          var _backupInfo$auth_data;\n          var decryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(recoveryKey);\n          var publicKey = (_backupInfo$auth_data = backupInfo.auth_data) === null || _backupInfo$auth_data === void 0 ? void 0 : _backupInfo$auth_data.public_key;\n          var isValid = decryptionKey.megolmV1PublicKey.publicKeyBase64 == publicKey;\n          if (isValid) {\n            migrationData.backupVersion = backupInfo.version;\n            migrationData.backupRecoveryKey = recoveryKey;\n          } else {\n            logger.debug(\"The backup key to migrate does not match the active backup version\", \"Cached pub key: \".concat(decryptionKey.megolmV1PublicKey.publicKeyBase64), \"Active pub key: \".concat(publicKey));\n          }\n        } catch (e) {\n          logger.warn(\"Failed to check if the backup key to migrate matches the active backup version\", e);\n        }\n      }\n    }\n    migrationData.privateCrossSigningMasterKey = yield getAndDecryptCachedSecretKey(legacyStore, pickleKey, \"master\");\n    migrationData.privateCrossSigningSelfSigningKey = yield getAndDecryptCachedSecretKey(legacyStore, pickleKey, \"self_signing\");\n    migrationData.privateCrossSigningUserSigningKey = yield getAndDecryptCachedSecretKey(legacyStore, pickleKey, \"user_signing\");\n    yield RustSdkCryptoJs.Migration.migrateBaseData(migrationData, pickleKey, storeHandle, logger);\n  });\n  return _migrateBaseData.apply(this, arguments);\n}\nfunction countOlmSessions(_x9, _x0) {\n  return _countOlmSessions.apply(this, arguments);\n}\nfunction _countOlmSessions() {\n  _countOlmSessions = _asyncToGenerator(function* (logger, legacyStore) {\n    logger.debug(\"Counting olm sessions to be migrated\");\n    var nSessions;\n    yield legacyStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_SESSIONS], txn => legacyStore.countEndToEndSessions(txn, n => nSessions = n));\n    return nSessions;\n  });\n  return _countOlmSessions.apply(this, arguments);\n}\nfunction countMegolmSessions(_x1, _x10) {\n  return _countMegolmSessions.apply(this, arguments);\n}\nfunction _countMegolmSessions() {\n  _countMegolmSessions = _asyncToGenerator(function* (logger, legacyStore) {\n    logger.debug(\"Counting megolm sessions to be migrated\");\n    return yield legacyStore.countEndToEndInboundGroupSessions();\n  });\n  return _countMegolmSessions.apply(this, arguments);\n}\nfunction migrateOlmSessions(_x11, _x12, _x13, _x14, _x15) {\n  return _migrateOlmSessions.apply(this, arguments);\n}\nfunction _migrateOlmSessions() {\n  _migrateOlmSessions = _asyncToGenerator(function* (logger, legacyStore, pickleKey, storeHandle, onBatchDone) {\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      var batch = yield legacyStore.getEndToEndSessionsBatch();\n      if (batch === null) return;\n      logger.debug(\"Migrating batch of \".concat(batch.length, \" olm sessions\"));\n      var migrationData = [];\n      for (var session of batch) {\n        var pickledSession = new RustSdkCryptoJs.PickledSession();\n        pickledSession.senderKey = session.deviceKey;\n        pickledSession.pickle = session.session;\n        pickledSession.lastUseTime = pickledSession.creationTime = new Date(session.lastReceivedMessageTs);\n        migrationData.push(pickledSession);\n      }\n      yield RustSdkCryptoJs.Migration.migrateOlmSessions(migrationData, pickleKey, storeHandle, logger);\n      yield legacyStore.deleteEndToEndSessionsBatch(batch);\n      onBatchDone(batch.length);\n    }\n  });\n  return _migrateOlmSessions.apply(this, arguments);\n}\nfunction migrateMegolmSessions(_x16, _x17, _x18, _x19, _x20) {\n  return _migrateMegolmSessions.apply(this, arguments);\n}\n/**\n * Determine if any room settings need migrating from the legacy store, and do so.\n *\n * @param args - Arguments object.\n */\nfunction _migrateMegolmSessions() {\n  _migrateMegolmSessions = _asyncToGenerator(function* (logger, legacyStore, pickleKey, storeHandle, onBatchDone) {\n    // eslint-disable-next-line no-constant-condition\n    while (true) {\n      var batch = yield legacyStore.getEndToEndInboundGroupSessionsBatch();\n      if (batch === null) return;\n      logger.debug(\"Migrating batch of \".concat(batch.length, \" megolm sessions\"));\n      var migrationData = [];\n      for (var session of batch) {\n        var _sessionData$keysClai;\n        var sessionData = session.sessionData;\n        var pickledSession = new RustSdkCryptoJs.PickledInboundGroupSession();\n        pickledSession.pickle = sessionData.session;\n        pickledSession.roomId = new RustSdkCryptoJs.RoomId(sessionData.room_id);\n        pickledSession.senderKey = session.senderKey;\n        pickledSession.senderSigningKey = (_sessionData$keysClai = sessionData.keysClaimed) === null || _sessionData$keysClai === void 0 ? void 0 : _sessionData$keysClai[\"ed25519\"];\n        pickledSession.backedUp = !session.needsBackup;\n\n        // The Rust SDK `imported` flag is used to indicate the authenticity status of a Megolm\n        // session, which tells us whether we can reliably tell which Olm device is the owner\n        // (creator) of the session.\n        //\n        // If `imported` is true, then we have no cryptographic proof that the session is owned\n        // by the device with the identity key `senderKey`.\n        //\n        // Only Megolm sessions received directly from the owning device via an encrypted\n        // `m.room_key` to-device message should have `imported` flag set to false. Megolm\n        // sessions received by any other currently available means (i.e. from a\n        // `m.forwarded_room_key`, from v1 asymmetric server-side key backup, imported from a\n        // file, etc) should have the `imported` flag set to true.\n        //\n        // Messages encrypted with such Megolm sessions will have a grey shield in the UI\n        // (\"Authenticity of this message cannot be guaranteed\").\n        //\n        // However, we don't want to bluntly mark all sessions as `imported` during migration\n        // because users will suddenly start seeing all their historic messages decorated with a\n        // grey shield, which would be seen as a non-actionable regression.\n        //\n        // In the legacy crypto stack, the flag encoding similar information was called\n        // `InboundGroupSessionData.untrusted`. The value of this flag was set as follows:\n        //\n        // - For outbound Megolm sessions created by our own device, `untrusted` is `undefined`.\n        // - For Megolm sessions received via a `m.room_key` to-device message, `untrusted` is\n        //   `undefined`.\n        // - For Megolm sessions received via a `m.forwarded_room_key` to-device message,\n        //   `untrusted` is `true`.\n        // - For Megolm sessions imported from a (v1 asymmetric / \"legacy\") server-side key\n        //   backup, `untrusted` is `true`.\n        // - For Megolm sessions imported from a file, untrusted is `undefined`.\n        //\n        // The main difference between the legacy crypto stack and the Rust crypto stack is that\n        // the Rust stack considers sessions imported from a file as `imported` (not\n        // authenticated). This is because the Megolm session export file format does not\n        // encode this authenticity information.\n        //\n        // Given this migration is only a one-time thing, we make a concession to accept the\n        // loss of information in this case, to avoid degrading UX in a non-actionable way.\n        pickledSession.imported = sessionData.untrusted === true;\n        migrationData.push(pickledSession);\n      }\n      yield RustSdkCryptoJs.Migration.migrateMegolmSessions(migrationData, pickleKey, storeHandle, logger);\n      yield legacyStore.deleteEndToEndInboundGroupSessionsBatch(batch);\n      onBatchDone(batch.length);\n    }\n  });\n  return _migrateMegolmSessions.apply(this, arguments);\n}\nexport function migrateRoomSettingsFromLegacyCrypto(_x21) {\n  return _migrateRoomSettingsFromLegacyCrypto.apply(this, arguments);\n}\nfunction _migrateRoomSettingsFromLegacyCrypto() {\n  _migrateRoomSettingsFromLegacyCrypto = _asyncToGenerator(function* (_ref) {\n    var {\n      logger,\n      legacyStore,\n      olmMachine\n    } = _ref;\n    if (!(yield legacyStore.containsData())) {\n      // This store was never used. Nothing to migrate.\n      return;\n    }\n    var migrationState = yield legacyStore.getMigrationState();\n    if (migrationState >= MigrationState.ROOM_SETTINGS_MIGRATED) {\n      // We've already migrated the room settings.\n      return;\n    }\n    var rooms = {};\n    yield legacyStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ROOMS], txn => {\n      legacyStore.getEndToEndRooms(txn, result => {\n        rooms = result;\n      });\n    });\n    logger.debug(\"Migrating \".concat(Object.keys(rooms).length, \" sets of room settings\"));\n    for (var [roomId, legacySettings] of Object.entries(rooms)) {\n      try {\n        var rustSettings = new RustSdkCryptoJs.RoomSettings();\n        if (legacySettings.algorithm !== \"m.megolm.v1.aes-sha2\") {\n          logger.warn(\"Room \".concat(roomId, \": ignoring room with invalid algorithm \").concat(legacySettings.algorithm));\n          continue;\n        }\n        rustSettings.algorithm = RustSdkCryptoJs.EncryptionAlgorithm.MegolmV1AesSha2;\n        rustSettings.sessionRotationPeriodMs = legacySettings.rotation_period_ms;\n        rustSettings.sessionRotationPeriodMessages = legacySettings.rotation_period_msgs;\n        yield olmMachine.setRoomSettings(new RustSdkCryptoJs.RoomId(roomId), rustSettings);\n\n        // We don't attempt to clear out the settings from the old store, or record where we've gotten up to,\n        // which means that if the app gets restarted while we're in the middle of this migration, we'll start\n        // again from scratch. So be it. Given that legacy crypto loads the whole room list into memory on startup\n        // anyway, we know it can't be that big.\n      } catch (e) {\n        logger.warn(\"Room \".concat(roomId, \": ignoring settings \").concat(JSON.stringify(legacySettings), \" which caused error \").concat(e));\n      }\n    }\n    logger.debug(\"Completed room settings migration\");\n    yield legacyStore.setMigrationState(MigrationState.ROOM_SETTINGS_MIGRATED);\n  });\n  return _migrateRoomSettingsFromLegacyCrypto.apply(this, arguments);\n}\nfunction getAndDecryptCachedSecretKey(_x22, _x23, _x24) {\n  return _getAndDecryptCachedSecretKey.apply(this, arguments);\n}\n/**\n * Check if the user's published identity (ie, public cross-signing keys) was trusted by the legacy session,\n * and if so mark it as trusted in the Rust session if needed.\n *\n * By default, if the legacy session didn't have the private MSK, the migrated session will revert to unverified,\n * even if the user has verified the session in the past.\n *\n * This only occurs if the private MSK was not cached in the crypto store (USK and SSK private keys won't help\n * to establish trust: the trust is rooted in the MSK).\n *\n * Rust crypto will only consider the current session as trusted if we import the private MSK itself.\n *\n * We could prompt the user to verify the session again, but it's probably better to just mark the user identity\n * as locally verified if it was before.\n *\n * See https://github.com/element-hq/element-web/issues/27079\n *\n * @param args - Argument object.\n */\nfunction _getAndDecryptCachedSecretKey() {\n  _getAndDecryptCachedSecretKey = _asyncToGenerator(function* (legacyStore, legacyPickleKey, name) {\n    var key = yield new Promise(resolve => {\n      legacyStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], txn => {\n        legacyStore.getSecretStorePrivateKey(txn, resolve, name);\n      });\n    });\n    if (key && key.ciphertext && key.iv && key.mac) {\n      return yield decryptAESSecretStorageItem(key, legacyPickleKey, name);\n    } else if (key instanceof Uint8Array) {\n      // This is a legacy backward compatibility case where the key was stored in clear.\n      return encodeBase64(key);\n    } else {\n      return undefined;\n    }\n  });\n  return _getAndDecryptCachedSecretKey.apply(this, arguments);\n}\nexport function migrateLegacyLocalTrustIfNeeded(_x25) {\n  return _migrateLegacyLocalTrustIfNeeded.apply(this, arguments);\n}\n\n/**\n * Checks if the legacy store has a trusted public master key, and returns it if so.\n *\n * @param legacyStore - The legacy store to check.\n *\n * @returns `null` if there were no cross signing keys or if they were not trusted. The trusted public master key if it was.\n */\nfunction _migrateLegacyLocalTrustIfNeeded() {\n  _migrateLegacyLocalTrustIfNeeded = _asyncToGenerator(function* (args) {\n    var {\n      legacyCryptoStore,\n      rustCrypto,\n      logger\n    } = args;\n    // Get the public cross-signing identity from rust.\n    var rustOwnIdentity = yield rustCrypto.getOwnIdentity();\n    if (!rustOwnIdentity) {\n      // There are no cross-signing keys published server side, so nothing to do here.\n      return;\n    }\n    if (rustOwnIdentity.isVerified()) {\n      // The rust session already trusts the keys, so again, nothing to do.\n      return;\n    }\n    var legacyLocallyTrustedMSK = yield getLegacyTrustedPublicMasterKeyBase64(legacyCryptoStore);\n    if (!legacyLocallyTrustedMSK) {\n      // The user never verified their identity in the legacy session, so nothing to do.\n      return;\n    }\n    var mskInfo = JSON.parse(rustOwnIdentity.masterKey);\n    if (!mskInfo.keys || Object.keys(mskInfo.keys).length === 0) {\n      // This should not happen, but let's be safe\n      logger.error(\"Post Migration | Unexpected error: no master key in the rust session.\");\n      return;\n    }\n    var rustSeenMSK = Object.values(mskInfo.keys)[0];\n    if (rustSeenMSK && rustSeenMSK == legacyLocallyTrustedMSK) {\n      logger.info(\"Post Migration: Migrating legacy trusted MSK: \".concat(legacyLocallyTrustedMSK, \" to locally verified.\"));\n      // Let's mark the user identity as locally verified as part of the migration.\n      yield rustOwnIdentity.verify();\n      // As well as marking the MSK as trusted, `OlmMachine.verify` returns a\n      // `SignatureUploadRequest` which will publish a signature of the MSK using\n      // this device. In this case, we ignore the request: since the user hasn't\n      // actually re-verified the MSK, we don't publish a new signature. (`.verify`\n      // doesn't store the signature, and if we drop the request here it won't be\n      // retried.)\n      //\n      // Not publishing the signature is consistent with the behaviour of\n      // matrix-crypto-sdk when the private key is imported via\n      // `importCrossSigningKeys`, and when the identity is verified via interactive\n      // verification.\n      //\n      // [Aside: device signatures on the MSK are not considered by the rust-sdk to\n      // establish the trust of the user identity so in any case, what we actually do\n      // here is somewhat moot.]\n    }\n  });\n  return _migrateLegacyLocalTrustIfNeeded.apply(this, arguments);\n}\nfunction getLegacyTrustedPublicMasterKeyBase64(_x26) {\n  return _getLegacyTrustedPublicMasterKeyBase.apply(this, arguments);\n}\nfunction _getLegacyTrustedPublicMasterKeyBase() {\n  _getLegacyTrustedPublicMasterKeyBase = _asyncToGenerator(function* (legacyStore) {\n    var maybeTrustedKeys = null;\n    yield legacyStore.doTxn(\"readonly\", \"account\", txn => {\n      legacyStore.getCrossSigningKeys(txn, keys => {\n        // can be an empty object after resetting cross-signing keys, see storeTrustedSelfKeys\n        var msk = keys === null || keys === void 0 ? void 0 : keys.master;\n        if (msk && Object.keys(msk.keys).length != 0) {\n          // `msk.keys` is an object with { [`ed25519:${pubKey}`]: pubKey }\n          maybeTrustedKeys = Object.values(msk.keys)[0];\n        }\n      });\n    });\n    return maybeTrustedKeys;\n  });\n  return _getLegacyTrustedPublicMasterKeyBase.apply(this, arguments);\n}\n//# sourceMappingURL=libolm_migration.js.map","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/*\nCopyright 2022 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { StoreHandle } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { RustCrypto } from \"./rust-crypto.js\";\nimport { MigrationState } from \"../crypto/store/base.js\";\nimport { migrateFromLegacyCrypto, migrateLegacyLocalTrustIfNeeded, migrateRoomSettingsFromLegacyCrypto } from \"./libolm_migration.js\";\n/**\n * Create a new `RustCrypto` implementation\n *\n * @param args - Parameter object\n * @internal\n */\nexport function initRustCrypto(_x) {\n  return _initRustCrypto.apply(this, arguments);\n}\nfunction _initRustCrypto() {\n  _initRustCrypto = _asyncToGenerator(function* (args) {\n    var {\n      logger\n    } = args;\n\n    // initialise the rust matrix-sdk-crypto-wasm, if it hasn't already been done\n    logger.debug(\"Initialising Rust crypto-sdk WASM artifact\");\n    yield RustSdkCryptoJs.initAsync();\n    logger.debug(\"Opening Rust CryptoStore\");\n    var storeHandle;\n    if (args.storePrefix) {\n      if (args.storeKey) {\n        storeHandle = yield StoreHandle.openWithKey(args.storePrefix, args.storeKey, logger);\n      } else {\n        storeHandle = yield StoreHandle.open(args.storePrefix, args.storePassphrase, logger);\n      }\n    } else {\n      storeHandle = yield StoreHandle.open(null, null, logger);\n    }\n    if (args.legacyCryptoStore) {\n      // We have a legacy crypto store, which we may need to migrate from.\n      yield migrateFromLegacyCrypto(_objectSpread({\n        legacyStore: args.legacyCryptoStore,\n        storeHandle\n      }, args));\n    }\n    var rustCrypto = yield initOlmMachine(logger, args.http, args.userId, args.deviceId, args.secretStorage, args.cryptoCallbacks, storeHandle, args.legacyCryptoStore, args.enableEncryptedStateEvents);\n    storeHandle.free();\n    logger.debug(\"Completed rust crypto-sdk setup\");\n    return rustCrypto;\n  });\n  return _initRustCrypto.apply(this, arguments);\n}\nfunction initOlmMachine(_x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0) {\n  return _initOlmMachine.apply(this, arguments);\n}\nfunction _initOlmMachine() {\n  _initOlmMachine = _asyncToGenerator(function* (logger, http, userId, deviceId, secretStorage, cryptoCallbacks, storeHandle, legacyCryptoStore, enableEncryptedStateEvents) {\n    logger.debug(\"Init OlmMachine\");\n    var olmMachine = yield RustSdkCryptoJs.OlmMachine.initFromStore(new RustSdkCryptoJs.UserId(userId), new RustSdkCryptoJs.DeviceId(deviceId), storeHandle, logger);\n\n    // A final migration step, now that we have an OlmMachine.\n    if (legacyCryptoStore) {\n      yield migrateRoomSettingsFromLegacyCrypto({\n        logger,\n        legacyStore: legacyCryptoStore,\n        olmMachine\n      });\n    }\n\n    // Disable room key requests, per https://github.com/vector-im/element-web/issues/26524.\n    olmMachine.roomKeyRequestsEnabled = false;\n    var rustCrypto = new RustCrypto(logger, olmMachine, http, userId, deviceId, secretStorage, cryptoCallbacks, enableEncryptedStateEvents);\n    yield olmMachine.registerRoomKeyUpdatedCallback(sessions => rustCrypto.onRoomKeysUpdated(sessions));\n    yield olmMachine.registerRoomKeysWithheldCallback(withheld => rustCrypto.onRoomKeysWithheld(withheld));\n    yield olmMachine.registerUserIdentityUpdatedCallback(userId => rustCrypto.onUserIdentityUpdated(userId));\n    yield olmMachine.registerDevicesUpdatedCallback(userIds => rustCrypto.onDevicesUpdated(userIds));\n\n    // Check if there are any key backup secrets pending processing. There may be multiple secrets to process if several devices have gossiped them.\n    // The `registerReceiveSecretCallback` function will only be triggered for new secrets. If the client is restarted before processing them, the secrets will need to be manually handled.\n    rustCrypto.checkSecrets(\"m.megolm_backup.v1\");\n\n    // Register a callback to be notified when a new secret is received, as for now only the key backup secret is supported (the cross signing secrets are handled automatically by the OlmMachine)\n    yield olmMachine.registerReceiveSecretCallback((name, _value) =>\n    // Instead of directly checking the secret value, we poll the inbox to get all values for that secret type.\n    // Once we have all the values, we can safely clear the secret inbox.\n    rustCrypto.checkSecrets(name));\n\n    // Tell the OlmMachine to think about its outgoing requests before we hand control back to the application.\n    //\n    // This is primarily a fudge to get it to correctly populate the `users_for_key_query` list, so that future\n    // calls to getIdentity (etc) block until the key queries are performed.\n    //\n    // Note that we don't actually need to *make* any requests here; it is sufficient to tell the Rust side to think\n    // about them.\n    //\n    // XXX: find a less hacky way to do this.\n    yield olmMachine.outgoingRequests();\n    if (legacyCryptoStore && (yield legacyCryptoStore.containsData())) {\n      var migrationState = yield legacyCryptoStore.getMigrationState();\n      if (migrationState < MigrationState.INITIAL_OWN_KEY_QUERY_DONE) {\n        logger.debug(\"Performing initial key query after migration\");\n        // We need to do an initial keys query so that the rust stack can properly update trust of\n        // the user device and identity from the migrated private keys.\n        // If not done, there is a short period where the own device/identity trust will be undefined after migration.\n        var initialKeyQueryDone = false;\n        while (!initialKeyQueryDone) {\n          try {\n            yield rustCrypto.userHasCrossSigningKeys(userId);\n            initialKeyQueryDone = true;\n          } catch (e) {\n            // If the initial key query fails, we retry until it succeeds.\n            logger.error(\"Failed to check for cross-signing keys after migration, retrying\", e);\n          }\n        }\n\n        // If the private master cross-signing key was not cached in the legacy store, the rust session\n        // will not be able to establish the trust of the user identity.\n        // That means that after migration the session could revert to unverified.\n        // In order to avoid asking the users to re-verify their sessions, we need to migrate the legacy local trust\n        // (if the legacy session was already verified) to the new session.\n        yield migrateLegacyLocalTrustIfNeeded({\n          legacyCryptoStore,\n          rustCrypto,\n          logger\n        });\n        yield legacyCryptoStore.setMigrationState(MigrationState.INITIAL_OWN_KEY_QUERY_DONE);\n      }\n    }\n    return rustCrypto;\n  });\n  return _initOlmMachine.apply(this, arguments);\n}\n//# sourceMappingURL=index.js.map"],"names":["wasm","__wbg_set_wasm","val","cachedUint8ArrayMemory0","getUint8ArrayMemory0","lTextDecoder","cachedTextDecoder","MAX_SAFARI_DECODE_BYTES","numBytesDecoded","decodeText","ptr","len","getStringFromWasm0","WASM_VECTOR_LEN","lTextEncoder","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","addToExternrefTable0","obj","idx","handleError","f","args","e","isLikeNone","x","getArrayU8FromWasm0","CLOSURE_DTORS","state","makeMutClosure","arg0","arg1","dtor","real","makeClosure","debugString","type","description","name","length","debug","i","builtInMatches","className","passArray8ToWasm0","takeFromExternrefTable0","value","_assertClass","instance","klass","passArrayJsValueToWasm0","array","add","getArrayJsValueFromWasm0","result","cachedUint16ArrayMemory0","getUint16ArrayMemory0","getArrayU16FromWasm0","getVersions","Versions","start","__wbg_adapter_58","arg2","__wbg_adapter_61","__wbg_adapter_64","__wbg_adapter_67","__wbg_adapter_70","__wbg_adapter_836","arg3","DecryptionErrorCode","DeviceKeyAlgorithmName","DeviceKeyName","EncryptionAlgorithm","HistoryVisibility","LocalTrust","LoggerLevel","ProcessedToDeviceEventType","QrCodeMode","QrState","RequestType","ShieldColor","ShieldStateCode","SignatureState","ToDeviceUnableToDecryptReason","TrustRequirement","VerificationMethod","VerificationRequestPhase","__wbindgen_enum_IdbRequestReadyState","__wbindgen_enum_IdbTransactionMode","AttachmentFinalization","Attachment","ptr0","len0","EncryptedAttachment","attachment","v1","BackupDecryptionKeyFinalization","BackupDecryptionKey","key","MegolmV1BackupKey","ephemeral_key","mac","ciphertext","deferred5_0","deferred5_1","ptr1","len1","ptr2","len2","ptr4","len4","BackupKeysFinalization","BackupKeys","BackupSecretsBundleFinalization","BackupSecretsBundle","deferred1_0","deferred1_1","Base64EncodedPkMessageFinalization","Base64EncodedPkMessage","BaseMigrationDataFinalization","BaseMigrationData","UserId","DeviceId","CancelInfoFinalization","CancelInfo","CheckCodeFinalization","CheckCode","CollectStrategyFinalization","CollectStrategy","other","only_allow_trusted_devices","error_on_verified_user_problem","CrossSigningBootstrapRequestsFinalization","CrossSigningBootstrapRequests","UploadSigningKeysRequest","SignatureUploadRequest","CrossSigningKeyExportFinalization","CrossSigningKeyExport","CrossSigningStatusFinalization","CrossSigningStatus","Curve25519PublicKeyFinalization","Curve25519PublicKey","Curve25519SecretKeyFinalization","Curve25519SecretKey","string","slice","DecryptedRoomEventFinalization","DecryptedRoomEvent","strict","ShieldState","DecryptedToDeviceEventFinalization","DecryptedToDeviceEvent","ToDeviceEncryptionInfo","DecryptionSettingsFinalization","DecryptionSettings","sender_device_trust_requirement","DehydratedDeviceFinalization","DehydratedDevice","initial_device_display_name","dehydrated_device_key","DehydratedDeviceKey","DehydratedDeviceKeyFinalization","DehydratedDevicesFinalization","DehydratedDevices","device_id","device_data","DeviceFinalization","Device","methods","event_type","content","share_strategy","local_state","algorithm","DeviceKey","Ed25519PublicKey","Signatures","DeviceIdFinalization","id","DeviceKeyFinalization","DeviceKeyAlgorithmFinalization","DeviceKeyAlgorithm","DeviceKeyIdFinalization","DeviceKeyId","DeviceListsFinalization","DeviceLists","changed","left","EciesFinalization","Ecies","initial_message","InboundCreationResult","public_key","OutboundCreationResult","Ed25519PublicKeyFinalization","Ed25519SignatureFinalization","Ed25519Signature","signature","EmojiFinalization","Emoji","EncryptedAttachmentFinalization","encrypted_data","media_encryption_info","EncryptionInfoFinalization","EncryptionInfo","EncryptionSettingsFinalization","EncryptionSettings","EstablishedEciesFinalization","EstablishedEcies","message","deferred2_0","deferred2_1","deferred3_0","deferred3_1","EventIdFinalization","EventId","ServerName","IdentityKeysFinalization","IdentityKeys","InboundCreationResultFinalization","InboundGroupSessionFinalization","InboundGroupSession","RoomId","InvalidToDeviceEventFinalization","InvalidToDeviceEvent","KeysBackupRequestFinalization","KeysBackupRequest","body","version","KeysClaimRequestFinalization","KeysClaimRequest","KeysQueryRequestFinalization","KeysQueryRequest","KeysUploadRequestFinalization","KeysUploadRequest","MaybeSignatureFinalization","MaybeSignature","Signature","MegolmDecryptionErrorFinalization","MegolmDecryptionError","MegolmV1BackupKeyFinalization","MigrationFinalization","Migration","data","pickle_key","store_handle","logger","StoreHandle","sessions","OlmMachineFinalization","OlmMachine","user_id","store_name","store_passphrase","enabled","users","to_device_events","changed_devices","one_time_keys_counts","unused_fallback_keys","decryption_settings","request_id","request_type","response","room_id","state_key","event","bundle","SecretsBundle","master_key","self_signing_key","user_signing_key","reset","encryption_settings","timeout_secs","flow_id","VerificationRequest","predicate","exported_room_keys","progress_listener","backed_up_room_keys","backup_version","decryption_key","backup_info","public_key_base_64","passphrase","rounds","deferred4_0","deferred4_1","ptr3","len3","encrypted_exported_room_keys","callback","secret_name","room_settings","RoomSettings","user","room","url","sharing_strategy","inviter","bundle_data","encrypted_bundle","StoredRoomKeyBundleData","OtherUserIdentityFinalization","OtherUserIdentity","request_event_id","OutboundCreationResultFinalization","OwnUserIdentityFinalization","OwnUserIdentity","PickledInboundGroupSessionFinalization","PickledInboundGroupSession","jsValue","PickledSessionFinalization","PickledSession","PkDecryptionFinalization","PkDecryption","PkMessage","PkEncryptionFinalization","PkEncryption","PkMessageFinalization","PlainTextToDeviceEventFinalization","PlainTextToDeviceEvent","PutDehydratedDeviceRequestFinalization","PutDehydratedDeviceRequest","QrFinalization","Qr","QrCode","QrCodeFinalization","QrCodeDataFinalization","QrCodeData","rendezvous_url","server_name","bytes","QrCodeScanFinalization","QrCodeScan","buffer","RehydratedDeviceFinalization","RehydratedDevice","RoomIdFinalization","RoomKeyCountsFinalization","RoomKeyCounts","RoomKeyImportResultFinalization","RoomKeyImportResult","RoomKeyInfoFinalization","RoomKeyInfo","RoomKeyWithheldInfoFinalization","RoomKeyWithheldInfo","RoomMessageRequestFinalization","RoomMessageRequest","txn_id","RoomSettingsFinalization","SasFinalization","Sas","SecretsBundleFinalization","json","ServerNameFinalization","ShieldStateFinalization","SignatureFinalization","SignatureUploadRequestFinalization","signed_keys","SignatureVerificationFinalization","SignatureVerification","SignaturesFinalization","signer","key_id","StoreHandleFinalization","store_key","StoredRoomKeyBundleDataFinalization","ToDeviceEncryptionInfoFinalization","ToDeviceRequestFinalization","ToDeviceRequest","ToDeviceUnableToDecryptInfoFinalization","ToDeviceUnableToDecryptInfo","TracingFinalization","Tracing","min_level","UTDToDeviceEventFinalization","UTDToDeviceEvent","UploadSigningKeysRequestFinalization","UserDevicesFinalization","UserDevices","UserIdFinalization","VerificationRequestFinalization","own_user_id","own_device_id","other_user_id","VersionsFinalization","__wbg_Error_0497d5bdba9362e5","__wbg_String_8f0eb39a4a4c2f66","__wbg_Window_b0044ac7db258535","__wbg_WorkerGlobalScope_b74cefefc62a37da","__wbg_add_64c6e51ab0ed12dd","__wbg_add_dd833f9f523abe36","__wbg_at_5b2884630cb66ea6","__wbg_backupkeys_new","__wbg_bound_0274374bea7f6bca","__wbg_bound_eb572b424befade3","__wbg_buffer_a1a27a0dfa70165d","__wbg_call_1b920c3ac0afee4b","__wbg_call_36f1bbf64b4cf7c7","arg4","__wbg_call_f2db6205e5c51dc8","__wbg_call_fbe8be8bf6436ce5","__wbg_clearTimeout_5a54f8841c30079a","__wbg_clear_e6ec1cc113e1555e","__wbg_close_2079e209ea5709b5","__wbg_code_5e459ca721f994f5","__wbg_continue_7d9cdafc888cb902","__wbg_count_2941fdbb8154c02d","__wbg_count_5ceb291ba9a02b4b","__wbg_createIndex_32ba53785b2ef24e","__wbg_createIndex_a343510ba567e58c","__wbg_createObjectStore_b1f08961900155dd","__wbg_crosssigningbootstraprequests_new","__wbg_crosssigningkeyexport_new","__wbg_crosssigningstatus_new","__wbg_crypto_574e78ad8b13b65f","__wbg_debug_58d16ea352cfbca1","__wbg_debug_ada37632f0e8cdde","__wbg_decryptedroomevent_new","__wbg_decryptedtodeviceevent_new","__wbg_dehydrateddevice_new","__wbg_dehydrateddevicekey_new","__wbg_deleteObjectStore_7b427b19378475fd","__wbg_delete_1af2aac87b36c0f1","__wbg_delete_71b7921c73aa9378","__wbg_device_new","__wbg_deviceid_new","__wbg_devicekey_new","__wbg_devicekeyid_new","__wbg_done_4d01f352bade43b7","__wbg_emoji_new","__wbg_encryptedattachment_new","__wbg_encryptioninfo_new","__wbg_entries_41651c850143b957","__wbg_entries_c951fa14164704e7","__wbg_error_24afdcd463ac8bd9","__wbg_error_4e978abc9692c0c5","__wbg_error_51ecdd39ec054205","__wbg_error_7534b8e9a36f1ab4","deferred0_0","deferred0_1","__wbg_from_12ff8e47307bd4c7","__wbg_getAllKeys_fce3f6ef8201c450","__wbg_getAll_22a744d3b40f0fb5","__wbg_getAll_654e689108532352","__wbg_getAll_864be044b219e256","__wbg_getRandomValues_38a1ff1ea09f6cc7","__wbg_getRandomValues_b8f5dbd5f3995a9e","__wbg_getTime_2afe67905d873e92","__wbg_get_92470be87867c2e5","__wbg_get_a131a44bd1eb6979","__wbg_get_a4719581b0d717ad","__wbg_get_d37904b955701f99","__wbg_getwithrefkey_1dc361bd10053bfe","__wbg_global_b6f5c73312f62313","__wbg_inboundgroupsession_new","__wbg_index_405783ca8da5f008","__wbg_indexedDB_317016dcb8a872d6","__wbg_indexedDB_601ec26c63e333de","__wbg_indexedDB_63b82e158eb67cbd","__wbg_info_e56933705c348038","__wbg_info_f3589034369581f6","__wbg_instanceof_ArrayBuffer_a8b6f580b363f2bc","__wbg_instanceof_Map_80cc65041c96417a","__wbg_instanceof_Promise_66f94afc64d9039f","__wbg_instanceof_Uint8Array_ca460677bc155827","__wbg_invalidtodeviceevent_new","__wbg_isArray_2a07fd175d45c496","__wbg_isArray_5f090bed72bd4f89","__wbg_isSafeInteger_90d7c4674047d684","__wbg_item_15285ca2d766f142","__wbg_iterator_4068add5b2aef7a6","__wbg_key_a17a68df9ec1b180","__wbg_keysbackuprequest_new","__wbg_keysclaimrequest_new","__wbg_keysqueryrequest_new","__wbg_keysuploadrequest_new","__wbg_length_471141fa24df24b2","__wbg_length_ab6d22b5ead75c72","__wbg_length_f00ec12454a5d9fd","__wbg_lowerBound_13c8e875a3fb9f7d","__wbg_maybesignature_new","__wbg_megolmdecryptionerror_new","__wbg_message_2d95ea5aff0d63b9","__wbg_msCrypto_a61aeb35a24c1329","__wbg_name_2acff1e83d9735f9","__wbg_new_07b483f72211fd66","__wbg_new_58353953ad2097cc","__wbg_new_8a6f238a6ece86ea","__wbg_new_a2957aa5684de228","__wbg_new_a979b4b45bd55c7f","__wbg_new_b3a08d2910ee5170","__wbg_new_db7d9b0ee94df522","__wbg_new_e30c39c06edaabf2","state0","cb0","__wbg_new_e52b3efaaa774f96","__wbg_newnoargs_ff528e72d35de39a","__wbg_newwithbyteoffsetandlength_06e8c938173769b5","__wbg_newwithbyteoffsetandlength_3b01ecda099177e8","__wbg_newwithlength_08f872dc1e3ada2e","__wbg_newwithlength_8a0d31010560ce9a","__wbg_newwithmessage_54042111509ba20c","__wbg_next_8bb824d217961b5d","__wbg_next_e2da48d8fff7439a","__wbg_node_905d3e251edff8a2","__wbg_now_2c95c9de01293173","__wbg_now_eb0821f3bd9f6529","__wbg_objectStoreNames_e82275eb2d403a92","__wbg_objectStore_b463d32c86d6b543","__wbg_oldVersion_af5af638a028177c","__wbg_olmmachine_new","__wbg_openCursor_7c13a2cd32c6258b","__wbg_openCursor_a53133c898e0829c","__wbg_openCursor_dbd279400634ae67","__wbg_open_0f04f50fa4d98f67","__wbg_open_b70fb421d97aad40","__wbg_otheruseridentity_new","__wbg_ownuseridentity_new","__wbg_parse_c7ba327fb6231e7f","__wbg_performance_7a3ffd0b17f663ad","__wbg_pickledinboundgroupsession_unwrap","__wbg_pickledsession_unwrap","__wbg_plaintexttodeviceevent_new","__wbg_process_dc0fbacc7c1c06f7","__wbg_push_73fd7b5550ebf707","__wbg_put_7f0b4dcc666f09e3","__wbg_putdehydrateddevicerequest_new","__wbg_qr_new","__wbg_queueMicrotask_46c1df247678729f","__wbg_queueMicrotask_8acf3ccb75ed8d11","__wbg_randomFillSync_ac0988aba3254290","__wbg_readyState_249e5707a38b7a7a","__wbg_rehydrateddevice_new","__wbg_require_60cc747a6bc5215a","__wbg_resolve_0dac8c580ffd4678","__wbg_result_a0f1bf2fe64a516c","__wbg_roomid_unwrap","__wbg_roomkeycounts_new","__wbg_roomkeyimportresult_new","__wbg_roomkeyinfo_new","__wbg_roomkeywithheldinfo_new","__wbg_roommessagerequest_new","__wbg_roomsettings_new","__wbg_sas_new","__wbg_secretsbundle_new","__wbg_setTimeout_db2dbaeefb6f39c7","__wbg_set_3f1d0b984ed272ed","__wbg_set_7422acbe992d64ab","__wbg_set_d6bdfd275fb8a4ce","__wbg_set_fd40eacc85c5ab66","__wbg_set_fe4e79d1ed3b0e9b","__wbg_setonabort_479ebb5884fcb171","__wbg_setonblocked_046331b614d6f8e3","__wbg_setoncomplete_27bdbca012e45c05","__wbg_setonerror_537b68f474e27d4e","__wbg_setonerror_ce5c4d34aed931bb","__wbg_setonsuccess_0b2b45bd8cc13b95","__wbg_setonupgradeneeded_be2e0ae927917f82","__wbg_setonversionchange_407ebf1ad930c84c","__wbg_setunique_727cefd7e14cf677","__wbg_signatures_new","__wbg_signatureuploadrequest_new","__wbg_signatureverification_new","__wbg_stack_0ed75d68575b0f3c","__wbg_static_accessor_GLOBAL_487c52c58d65314d","__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291","__wbg_static_accessor_SELF_78c9e3071b912620","__wbg_static_accessor_WINDOW_a093d21393777366","__wbg_storedroomkeybundledata_new","__wbg_storehandle_new","__wbg_stringify_c242842b97f054cc","__wbg_subarray_dd4ade7d53bd8e26","__wbg_target_15f1da583855ac4e","__wbg_then_82ab9fb4080f1707","__wbg_then_db882932c0c714c6","__wbg_todevicerequest_new","__wbg_transaction_34c41b46ca391af6","__wbg_transaction_36c8b28ed4349a9a","__wbg_transaction_399fc15f5bba1880","__wbg_update_297181dae0cc0af4","__wbg_userdevices_new","__wbg_userid_new","__wbg_userid_unwrap","__wbg_utdtodeviceevent_new","__wbg_value_17b896954e14f896","__wbg_value_648dc44894c8dc95","__wbg_values_81045499c3c8e670","__wbg_verificationrequest_new","__wbg_version_2c3ed4a311fdabdf","__wbg_versions_c01dfd4722a88165","__wbg_warn_9b968a0475b49f6b","__wbg_warn_d89f6637da554c8d","__wbindgen_array_new","__wbindgen_array_push","__wbindgen_as_number","__wbindgen_bigint_from_i64","__wbindgen_bigint_from_u64","__wbindgen_bigint_get_as_i64","v","__wbindgen_boolean_get","__wbindgen_cb_drop","__wbindgen_closure_wrapper1160","__wbindgen_closure_wrapper2391","__wbindgen_closure_wrapper5618","__wbindgen_closure_wrapper7116","__wbindgen_closure_wrapper7121","__wbindgen_debug_string","__wbindgen_in","__wbindgen_init_externref_table","table","__wbindgen_is_bigint","__wbindgen_is_function","__wbindgen_is_null","__wbindgen_is_object","__wbindgen_is_string","__wbindgen_is_undefined","__wbindgen_jsval_eq","__wbindgen_jsval_loose_eq","__wbindgen_memory","__wbindgen_number_get","__wbindgen_number_new","__wbindgen_string_get","__wbindgen_string_new","__wbindgen_throw","__wbindgen_try_into_number","defaultURL","bindings.__wbg_set_wasm","modPromise","loadModuleAsync","bindings","initAsync","escaped","escapes","escapeString","stringify","stringifyArray","stringifyObject","sep","object","keys","anotherJson","RoomEncryptor","prefixedLogger","olmMachine","keyClaimManager","outgoingRequestManager","encryptionSettings","_defineProperty","members","u","RustSdkCryptoJs.UserId","config","member","KnownMembership","globalBlacklistUnverifiedDevices","deviceIsolationMode","_this","_asyncToGenerator","_event$getTxnId","_this2","LogSpan","prom","logDuration","_this3","userList","rustEncryptionSettings","toRustHistoryVisibility","DeviceIsolationModeKind","_this3$room$getBlackl","onlyAllowTrustedDevices","shareMessages","m","_this4","r","_this5","encryptedContent","EventType","visibility","RustHistoryVisibility","UnstablePrefix","SECRET_STORAGE_NAME","DEHYDRATION_INTERVAL","DehydratedDeviceManager","TypedEventEmitter","http","outgoingRequestProcessor","secretStorage","CryptoEvent","Method","error","err","_arguments","opts","RustSdkCryptoJs.DehydratedDeviceKey","create","_this6","cachedKey","keyB64","decodeBase64","_this7","dehydratedDeviceResp","rehydratedDevice","RustSdkCryptoJs.DeviceId","nextBatch","toDeviceCount","roomKeyCount","path","encodeUri","eventResp","roomKeyInfos","_this8","dehydratedDevice","request","_this9","_this0","ownKeys","o","_objectSpread","OutgoingRequestProcessor","msg","uiaCallback","resp","_path","DehydrationUnstablePrefix","parsedBody","messageList","userId","perUserMessages","deviceId","ToDeviceMessageId","method","queryParams","makeRequest","_ref2","auth","newBody","_x","currentRetryCount","backoff","calculateRetryBackoff","sleep","KeyClaimManager","claimRequest","rustDeviceToJsDevice","device","keyId","verified","DeviceVerification","signatures","mayBeSignatureMap","convertedSignatures","_key","rustAlgorithms","algorithms","RustSdkCryptoJs.EncryptionAlgorithm","deviceKeysToDeviceMap","deviceKeys","_ref","downloadDeviceToJsDevice","_device$unsigned","displayName","CrossSigningIdentity","olmDeviceStatus","masterKeyFromSecretStorage","selfSigningKeyFromSecretStorage","userSigningKeyFromSecretStorage","privateKeysInSecretStorage","olmDeviceHasKeys","status","authUploadDeviceSigningKeys","outgoingRequests","req","exported","secretStorageContainsCrossSigningKeys","_secretStorageContainsCrossSigningKeys","secretStorageCanAccessSecrets","_x2","_x3","_secretStorageCanAccessSecrets","secretNames","defaultKeyId","secretName","record","RustVerificationRequest","inner","supportedVerificationMethods","TypedReEmitter","weakThis","_weakThis$deref","verification","RustSdkCryptoJs.Sas","RustQrCodeVerifier","RustSASVerifier","RustSdkCryptoJs.Qr","VerificationRequestEvent","verifier","_this$inner$roomId","_this$inner$otherDevi","otherDeviceId","phase","RustSdkCryptoJs.VerificationRequestPhase","VerificationPhase","theirMethods","requiredMethod","verificationMethodsByIdentifier","verificationMethodIdentifierToMethod","params","targetDevice","res","uint8Array","scan","RustSdkCryptoJs.QrCodeScan","innerVerifier","_this$inner$cancelInf","_this$inner$cancelInf2","cancelInfo","BaseRustVerifer","_weakThis$deref2","VerifierEvent","_verificationRequest","_this1","emoji","decimal","sas","_confirm","requests","confirm","_weakThis$deref3","RustSdkCryptoJs.VerificationMethod","meth","isVerificationEvent","MsgType","RustBackupManager","info","signatureVerification","backupKeys","decryptionKey","backupMatchesSavedPrivateKey","force","secret","_latestBackupInfo","latestBackupInfo","backupDecryptionKey","RustSdkCryptoJs.BackupDecryptionKey","privateKeyMatches","jsonKeys","progress","total","_opts$progressCallbac","importOpt","ImportRoomKeyStage","backupVersion","keysByRoom","roomId","RustSdkCryptoJs.RoomId","failures","_opts$progressCallbac2","backupInfo","activeVersion","trustInfo","_this10","_this11","maxDelay","delay","numFailures","remainingToUploadCount","isFirstIteration","keyCount","keysCountInBatch","MatrixError","errCode","waitTime","batch","countKeysInBackup","_this12","requestKeyBackupVersion","signObject","_this13","randomKey","pubKey","authData","ClientPrefix","_this14","_yield$_this14$reques","_yield$_this14$reques2","current","_yield$_this14$reques3","_yield$_this14$reques4","_this15","RustBackupDecryptor","backupDecryptor","_this16","keyBackup","_this17","_opts$progressCallbac3","CHUNK_SIZE","totalKeyCount","totalImported","totalFailures","handleChunkCallback","roomChunks","_opts$progressCallbac4","currentChunk","_loop","decryptedSessions","session","groupChunkCount","chunkGroupByRoom","roomData","sessionId","sessionsForRoom","_info$auth_data","ciphertexts","_this18","sessionData","decrypted","_requestKeyBackupVersion","decryptionKeyMatchesKeyBackupInfo","keyBackupInfo","count","OutgoingRequestsManager","loopTickResolvers","_ret","KEY_BACKUP_BACKOFF","KeyDownloadErrorCode","KeyDownloadError","KeyDownloadRateLimitError","retryMillis","PerSessionKeyBackupDownloader","backupManager","configuration","megolmSessionId","now","sid","ts","lastCheck","targetRoomId","targetSessionId","_e$getRetryAfterMs","sessionInfo","sessionsToImport","k","_currentServerVersion","_currentServerVersion2","_currentServerVersion4","currentServerVersion","_currentServerVersion3","keyFromAuthData","deriveRecoveryKeyFromPassphrase","ALL_VERIFICATION_METHODS","RustCrypto","_deviceId","cryptoCallbacks","enableEncryptedStateEvents","AllDevicesIsolationMode","EventDecryptor","ClientStoppedError","_v","_room","encryptor","privKey","encodeBase64","bundleData","getHttpUriForMxc","encryptedBundle","bundleUrl","versions","RustSdkCryptoJs.getVersions","isolationMode","roomSettings","_this$roomEncryptors$","raw","downloadUncached","rustTrackedUsers","rustTrackedUser","userIdentity","_keyResult$master_key","keyResult","userIds","_arguments2","deviceMapByUserId","trackedUsers","rustUserId","untrackedUsers","_userId","queryResult","userDevices","deviceArray","d","queryBody","_arguments3","RustSdkCryptoJs.LocalTrust","outgoingRequest","DeviceVerificationStatus","UserVerificationStatus","wasVerified","needsUserApproval","RustSdkCryptoJs.OtherUserIdentity","_this19","RustSdkCryptoJs.OwnUserIdentity","_this20","_this21","privateKeysCachedLocally","hasKeysInCache","identity","_arguments4","_this22","CrossSigningKey","crossSigningStatus","privateKeysOnDevice","parsedKey","_this23","_this24","secretsToCheck","keyBackupEnabled","_arguments5","_this25","createSecretStorageKey","setupNewSecretStorage","setupNewKeyBackup","isNewSecretStorageKeyNeeded","recoveryKey","crossSigningPrivateKeys","hasPrivateKeys","_this26","backupKeyBase64","secretStorageKey","_this27","_secretStorageKey$key","_secretStorageKey$key2","_this27$cryptoCallbac","_this27$cryptoCallbac2","secretStorageKeyObject","SECRET_STORAGE_ALGORITHM_V1_AES","_this28","secretStorageKeyTuple","keyInfo","_this29","publicKeysOnDevice","password","_this30","salt","secureRandomString","encodeRecoveryKey","_this31","_request$roomId","_this32","verCont","verContObj","verificationEventContent","eventId","RustSdkCryptoJs.EventId","_this33","txId","_this34","_this35","_this36","_this37","base64Key","_this38","backupKey","_this39","_this40","_this41","_this42","_this43","_this44","_this45","_this46","sigs","unsigned","userSignatures","canonalizedJson","anotherjson","map","_this47","privateKey","_this48","decodedDecryptionKey","_this49","_arguments6","_this50","secrets","_this51","secretsBundle","RustSdkCryptoJs.SecretsBundle","_this52","eventType","devices","payload","_this53","uniqueUsers","_ref4","_ref3","encryptedPayload","_this54","_this55","_this56","uploadResponse","RustSdkCryptoJs.CollectStrategy","_req","_ref5","_this57","events","oneTimeKeysCounts","unusedFallbackKeys","RustSdkCryptoJs.DeviceLists","_this58","processed","received","parsedMessage","sender","transactionId","RustSdkCryptoJs.ProcessedToDeviceEventType","_encryptionInfo$sende","encryptionInfo","_this59","mapOneTimeKeysCount","setUnusedFallbackKeys","deviceLists","_this60","_deviceLists$changed","_deviceLists$left","_this61","settings","RustSdkCryptoJs.RoomSettings","existingEncryptor","syncState","_this62","oldMembership","enc","_this63","_this64","pendingList","ev","_e","withheld","_this65","_this66","newVerification","_this67","_this68","_this69","pendingValues","_this70","processEvent","_ref6","evt","TIMEOUT_DELAY","timeoutId","MatrixEventEvent","onDecrypted","decryptedEvent","_this71","_this72","perSessionBackupDownloader","MapWithDefault","_this73","trustRequirement","RustSdkCryptoJs.TrustRequirement","stringifyEvent","RustSdkCryptoJs.DecryptionSettings","RustSdkCryptoJs.MegolmDecryptionError","DecryptionError","DecryptionFailureCode","serverBackupInfo","errorDetails","RustSdkCryptoJs.DecryptionErrorCode","membership","failureCode","_this74","EventShieldColour","rustEncryptionInfoToJsEncryptionInfo","roomPendingEvents","sessionPendingEvents","shieldState","shieldColour","RustSdkCryptoJs.ShieldColor","shieldReason","RustSdkCryptoJs.ShieldStateCode","EventShieldReason","migrateFromLegacyCrypto","_migrateFromLegacyCrypto","_args$legacyMigration2","legacyStore","RustSdkCryptoJs.initAsync","accountPickle","IndexedDBCryptoStore","txn","acctPickle","migrationState","MigrationState","nOlmSessions","countOlmSessions","nMegolmSessions","countMegolmSessions","totalSteps","stepsDone","onProgress","steps","_args$legacyMigration","pickleKey","migrateBaseData","migrateOlmSessions","migrateMegolmSessions","_x4","_x5","_x6","_x7","_x8","_migrateBaseData","storeHandle","migrationData","RustSdkCryptoJs.BaseMigrationData","a","getAndDecryptCachedSecretKey","backupCallDone","_backupInfo$auth_data","publicKey","isValid","RustSdkCryptoJs.Migration","_x9","_x0","_countOlmSessions","nSessions","n","_x1","_x10","_countMegolmSessions","_x11","_x12","_x13","_x14","_x15","_migrateOlmSessions","onBatchDone","pickledSession","RustSdkCryptoJs.PickledSession","_x16","_x17","_x18","_x19","_x20","_migrateMegolmSessions","_sessionData$keysClai","RustSdkCryptoJs.PickledInboundGroupSession","migrateRoomSettingsFromLegacyCrypto","_x21","_migrateRoomSettingsFromLegacyCrypto","rooms","legacySettings","rustSettings","_x22","_x23","_x24","_getAndDecryptCachedSecretKey","legacyPickleKey","resolve","decryptAESSecretStorageItem","migrateLegacyLocalTrustIfNeeded","_x25","_migrateLegacyLocalTrustIfNeeded","legacyCryptoStore","rustCrypto","rustOwnIdentity","legacyLocallyTrustedMSK","getLegacyTrustedPublicMasterKeyBase64","mskInfo","rustSeenMSK","_x26","_getLegacyTrustedPublicMasterKeyBase","maybeTrustedKeys","msk","initRustCrypto","_initRustCrypto","initOlmMachine","_initOlmMachine","RustSdkCryptoJs.OlmMachine","_value","initialKeyQueryDone"],"mappings":"qZAAA,IAAIA,EACG,SAASC,GAAeC,EAAK,CAChCF,EAAOE,CACX,CAGA,IAAIC,GAA0B,KAE9B,SAASC,IAAuB,CAC5B,OAAID,KAA4B,MAAQA,GAAwB,aAAe,KAC3EA,GAA0B,IAAI,WAAWH,EAAK,OAAO,MAAM,GAExDG,EACX,CAEA,MAAME,GAAe,OAAO,YAAgB,OAAkB,OAAO,SAAS,MAAM,EAAE,YAAc,YAEpG,IAAIC,GAAoB,IAAID,GAAa,QAAS,CAAE,UAAW,GAAM,MAAO,GAAM,EAElFC,GAAkB,OAAM,EAExB,MAAMC,GAA0B,WAChC,IAAIC,GAAkB,EACtB,SAASC,GAAWC,EAAKC,EAAK,CAC1B,OAAAH,IAAmBG,EACfH,IAAmBD,KACnBD,GAAoB,IAAID,GAAa,QAAS,CAAE,UAAW,GAAM,MAAO,GAAM,EAC9EC,GAAkB,OAAM,EACxBE,GAAkBG,GAEfL,GAAkB,OAAOF,GAAoB,EAAG,SAASM,EAAKA,EAAMC,CAAG,CAAC,CACnF,CAEA,SAASC,EAAmBF,EAAKC,EAAK,CAClC,OAAAD,EAAMA,IAAQ,EACPD,GAAWC,EAAKC,CAAG,CAC9B,CAEA,IAAIE,EAAkB,EAEtB,MAAMC,GAAe,OAAO,YAAgB,OAAkB,OAAO,SAAS,MAAM,EAAE,YAAc,YAE9FC,GAAoB,IAAID,GAAa,OAAO,EAE5CE,GAAgB,OAAOD,GAAkB,YAAe,WACxD,SAAUE,EAAKC,EAAM,CACvB,OAAOH,GAAkB,WAAWE,EAAKC,CAAI,CACjD,EACM,SAAUD,EAAKC,EAAM,CACvB,MAAMC,EAAMJ,GAAkB,OAAOE,CAAG,EACxC,OAAAC,EAAK,IAAIC,CAAG,EACL,CACH,KAA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