@sableclient/sable-call-embedded 0.16.3-sable.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-AGPL-3.0 +661 -0
- package/LICENSE-COMMERCIAL +6 -0
- package/README.md +9 -0
- package/dist/assets/IndexedDBWorker-Dgn5IQFp.js +25 -0
- package/dist/assets/IndexedDBWorker-Dgn5IQFp.js.map +1 -0
- package/dist/assets/baduntss-Ca1ZuBEK.ogg +0 -0
- package/dist/assets/baduntss-DOe0oFuS.mp3 +0 -0
- package/dist/assets/call_declined-1jWRbd4p.mp3 +0 -0
- package/dist/assets/call_declined-C6gHsCGH.ogg +0 -0
- package/dist/assets/call_timeout-BCxXxRD8.mp3 +0 -0
- package/dist/assets/call_timeout-DPKAj6sz.ogg +0 -0
- package/dist/assets/cat-4r_NkDcK.ogg +0 -0
- package/dist/assets/cat-Dd8bv_2W.mp3 +0 -0
- package/dist/assets/clap-AxCMZLTd.ogg +0 -0
- package/dist/assets/clap-Dxm5qGyl.mp3 +0 -0
- package/dist/assets/crickets-CcwrRdbq.mp3 +0 -0
- package/dist/assets/crickets-DUJdcuUa.ogg +0 -0
- package/dist/assets/cs-app-Du_5mVg3.json +236 -0
- package/dist/assets/da-app-BBz-lePm.json +236 -0
- package/dist/assets/de-app-DjOuqT-j.json +237 -0
- package/dist/assets/decimal-CeJ0lJls.js +2 -0
- package/dist/assets/decimal-CeJ0lJls.js.map +1 -0
- package/dist/assets/deer-91r1Gyrx.mp3 +0 -0
- package/dist/assets/deer-DPSlVch4.ogg +0 -0
- package/dist/assets/dog-BoQdnF-w.mp3 +0 -0
- package/dist/assets/dog-CxIWtkNX.ogg +0 -0
- package/dist/assets/el-app-BBr3LLTK.json +122 -0
- package/dist/assets/en-app-B0mg0RDM.json +261 -0
- package/dist/assets/es-app-Q3c7lmEj.json +88 -0
- package/dist/assets/et-app-DLvuR7m2.json +234 -0
- package/dist/assets/fi-app-tnO3DMdi.json +224 -0
- package/dist/assets/fr-app-BxTYbDfK.json +111 -0
- package/dist/assets/generic-BBbS3Wph.ogg +0 -0
- package/dist/assets/generic-BFeSb6fL.mp3 +0 -0
- package/dist/assets/id-app-BEz8ptLJ.json +223 -0
- package/dist/assets/inconsolata-latin-400-normal-DTZQ6lD6.woff2 +0 -0
- package/dist/assets/inconsolata-latin-400-normal-HYADljCo.woff +0 -0
- package/dist/assets/inconsolata-latin-700-normal-ByjKuJjN.woff2 +0 -0
- package/dist/assets/inconsolata-latin-700-normal-DzgUY3Rl.woff +0 -0
- package/dist/assets/inconsolata-latin-ext-400-normal-BaHVOdFB.woff2 +0 -0
- package/dist/assets/inconsolata-latin-ext-400-normal-yvPjCxxx.woff +0 -0
- package/dist/assets/inconsolata-latin-ext-700-normal-D0Kpgs_9.woff2 +0 -0
- package/dist/assets/inconsolata-latin-ext-700-normal-Dlt-daqV.woff +0 -0
- package/dist/assets/inconsolata-vietnamese-400-normal-ByiM2lek.woff +0 -0
- package/dist/assets/inconsolata-vietnamese-400-normal-DfC_iMic.woff2 +0 -0
- package/dist/assets/inconsolata-vietnamese-700-normal-DLCFFAUf.woff +0 -0
- package/dist/assets/inconsolata-vietnamese-700-normal-DuasYmn8.woff2 +0 -0
- package/dist/assets/index-BOka8551.js +4 -0
- package/dist/assets/index-BOka8551.js.map +1 -0
- package/dist/assets/index-Cn2ez1d4.js +3 -0
- package/dist/assets/index-Cn2ez1d4.js.map +1 -0
- package/dist/assets/index-s-IzAUGa.css +1 -0
- package/dist/assets/index-tbZc77bo.js +296 -0
- package/dist/assets/index-tbZc77bo.js.map +1 -0
- package/dist/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
- package/dist/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- package/dist/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
- package/dist/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
- package/dist/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
- package/dist/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
- package/dist/assets/inter-cyrillic-700-normal-CjBOestx.woff2 +0 -0
- package/dist/assets/inter-cyrillic-700-normal-DrXBdSj3.woff +0 -0
- package/dist/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
- package/dist/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
- package/dist/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
- package/dist/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-700-normal-BjwYoWNd.woff2 +0 -0
- package/dist/assets/inter-cyrillic-ext-700-normal-LO58E6JB.woff +0 -0
- package/dist/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- package/dist/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
- package/dist/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
- package/dist/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
- package/dist/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
- package/dist/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
- package/dist/assets/inter-greek-700-normal-BUv2fZ6O.woff +0 -0
- package/dist/assets/inter-greek-700-normal-C3JjAnD8.woff2 +0 -0
- package/dist/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- package/dist/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
- package/dist/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
- package/dist/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
- package/dist/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
- package/dist/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
- package/dist/assets/inter-greek-ext-700-normal-BoQ6DsYi.woff +0 -0
- package/dist/assets/inter-greek-ext-700-normal-qfdV9bQt.woff2 +0 -0
- package/dist/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/dist/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
- package/dist/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
- package/dist/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- package/dist/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
- package/dist/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
- package/dist/assets/inter-latin-700-normal-BLAVimhd.woff +0 -0
- package/dist/assets/inter-latin-700-normal-Yt3aPRUw.woff2 +0 -0
- package/dist/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
- package/dist/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- package/dist/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
- package/dist/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
- package/dist/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
- package/dist/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
- package/dist/assets/inter-latin-ext-700-normal-Ca8adRJv.woff2 +0 -0
- package/dist/assets/inter-latin-ext-700-normal-TidjK2hL.woff +0 -0
- package/dist/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
- package/dist/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- package/dist/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
- package/dist/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
- package/dist/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
- package/dist/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
- package/dist/assets/inter-vietnamese-700-normal-BZaoP0fm.woff +0 -0
- package/dist/assets/inter-vietnamese-700-normal-DlLaEgI2.woff2 +0 -0
- package/dist/assets/it-app-Cik25Qgd.json +215 -0
- package/dist/assets/ja-app-Cp_00ujI.json +123 -0
- package/dist/assets/join_call-DlMV9nHk.ogg +0 -0
- package/dist/assets/join_call-dEJCP2wD.mp3 +0 -0
- package/dist/assets/left_call-BbqmRgnC.mp3 +0 -0
- package/dist/assets/left_call-C7NMl6WI.ogg +0 -0
- package/dist/assets/lightbulb-BIeJtAR_.ogg +0 -0
- package/dist/assets/lightbulb-BrnY00qi.mp3 +0 -0
- package/dist/assets/livekit-client.e2ee.worker-Bmrtztct.js.map +1 -0
- package/dist/assets/lv-app-D-ZV3Ytk.json +222 -0
- package/dist/assets/matrix-sdk-crypto-wasm-BsWSMcLv.js +3 -0
- package/dist/assets/matrix-sdk-crypto-wasm-BsWSMcLv.js.map +1 -0
- package/dist/assets/matrix_sdk_crypto_wasm_bg-DU_51VO6.wasm +0 -0
- package/dist/assets/pako.esm-Cf42LiW4.js +2 -0
- package/dist/assets/pako.esm-Cf42LiW4.js.map +1 -0
- package/dist/assets/party-BZPeTgC3.mp3 +0 -0
- package/dist/assets/party-D7rIOhAQ.ogg +0 -0
- package/dist/assets/pl-app-CUkXVSZk.json +221 -0
- package/dist/assets/polyfill-force-BrOePHdV.js +2 -0
- package/dist/assets/polyfill-force-BrOePHdV.js.map +1 -0
- package/dist/assets/polyfill-force-Btq0hGFe.js +3 -0
- package/dist/assets/polyfill-force-Btq0hGFe.js.map +1 -0
- package/dist/assets/raise_hand-Bzqn65WB.mp3 +0 -0
- package/dist/assets/raise_hand-CUbxEnt9.ogg +0 -0
- package/dist/assets/ringtone-B-nJXbbw.ogg +0 -0
- package/dist/assets/ringtone-B2csBdU4.mp3 +0 -0
- package/dist/assets/ro-app-CdYgKCOW.json +206 -0
- package/dist/assets/rock-BVCJXNC-.ogg +0 -0
- package/dist/assets/rock-CHdnB31m.mp3 +0 -0
- package/dist/assets/ru-app-CIijOjFj.json +229 -0
- package/dist/assets/screen_share_started-DH3qxml5.mp3 +0 -0
- package/dist/assets/screen_share_started-IZDL-kAw.ogg +0 -0
- package/dist/assets/selfie_segmenter-DF05sdL4.tflite +0 -0
- package/dist/assets/sk-app-DaVEeQWZ.json +230 -0
- package/dist/assets/spa-f1VkEIgz.js +2 -0
- package/dist/assets/spa-f1VkEIgz.js.map +1 -0
- package/dist/assets/sv-app-DHLBEOTp.json +236 -0
- package/dist/assets/tr-app-Dk--6BpP.json +209 -0
- package/dist/assets/uk-app-DZD01h76.json +222 -0
- package/dist/assets/vision_wasm_internal-CEyeacG0.js +20 -0
- package/dist/assets/vision_wasm_internal-TmjHuG4I.wasm +0 -0
- package/dist/assets/wave-Bzf1LSMH.mp3 +0 -0
- package/dist/assets/wave-FiiOzicp.ogg +0 -0
- package/dist/assets/zh-Hans-app-BY5jJGyr.json +133 -0
- package/dist/assets/zh-Hant-app-BV1LKS_j.json +114 -0
- package/dist/config.json +1 -0
- package/dist/index.html +1 -0
- package/package.json +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BOka8551.js","sources":["../node_modules/matrix-js-sdk/lib/crypto-api/verification.js","../node_modules/matrix-js-sdk/lib/crypto-api/recovery-key.js","../node_modules/matrix-js-sdk/lib/crypto-api/key-passphrase.js","../node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js","../node_modules/@matrix-org/matrix-sdk-crypto-wasm/index.mjs","../node_modules/another-json/another-json.js","../node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js","../node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js","../node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js","../node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js","../node_modules/matrix-js-sdk/lib/models/device.js","../node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js","../node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js","../node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js","../node_modules/matrix-js-sdk/lib/types.js","../node_modules/matrix-js-sdk/lib/rust-crypto/verification.js","../node_modules/matrix-js-sdk/lib/rust-crypto/backup.js","../node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js","../node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js","../node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js","../node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js","../node_modules/matrix-js-sdk/lib/crypto/store/base.js","../node_modules/matrix-js-sdk/lib/crypto/store/memory-crypto-store.js","../node_modules/matrix-js-sdk/lib/crypto/store/localStorage-crypto-store.js","../node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store-backend.js","../node_modules/matrix-js-sdk/lib/crypto/store/indexeddb-crypto-store.js","../node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js","../node_modules/matrix-js-sdk/lib/rust-crypto/index.js"],"sourcesContent":["/*\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 * An incoming, or outgoing, request to verify a user or a device via cross-signing.\n */\n\n/** Events emitted by {@link VerificationRequest}. */\nexport var VerificationRequestEvent = /*#__PURE__*/function (VerificationRequestEvent) {\n /**\n * Fires whenever the state of the request object has changed.\n *\n * There is no payload to the event.\n */\n VerificationRequestEvent[\"Change\"] = \"change\";\n return VerificationRequestEvent;\n}({});\n\n/**\n * Listener type map for {@link VerificationRequestEvent}s.\n *\n * @internal\n */\n\n/** The current phase of a verification request. */\nexport var VerificationPhase = /*#__PURE__*/function (VerificationPhase) {\n /** Initial state: no event yet exchanged */\n VerificationPhase[VerificationPhase[\"Unsent\"] = 1] = \"Unsent\";\n /** An `m.key.verification.request` event has been sent or received */\n VerificationPhase[VerificationPhase[\"Requested\"] = 2] = \"Requested\";\n /** An `m.key.verification.ready` event has been sent or received, indicating the verification request is accepted. */\n VerificationPhase[VerificationPhase[\"Ready\"] = 3] = \"Ready\";\n /**\n * The verification is in flight.\n *\n * This means that an `m.key.verification.start` event has been sent or received, choosing a verification method;\n * however the verification has not yet completed or been cancelled.\n */\n VerificationPhase[VerificationPhase[\"Started\"] = 4] = \"Started\";\n /**\n * An `m.key.verification.cancel` event has been sent or received at any time before the `done` event, cancelling\n * the verification request\n */\n VerificationPhase[VerificationPhase[\"Cancelled\"] = 5] = \"Cancelled\";\n /**\n * The verification request is complete.\n *\n * Normally this means that `m.key.verification.done` events have been sent and received.\n */\n VerificationPhase[VerificationPhase[\"Done\"] = 6] = \"Done\";\n return VerificationPhase;\n}({});\n\n/**\n * A `Verifier` is responsible for performing the verification using a particular method, such as via QR code or SAS\n * (emojis).\n *\n * A verifier object can be created by calling `VerificationRequest.beginVerification`; one is also created\n * automatically when a `m.key.verification.start` event is received for an existing VerificationRequest.\n *\n * Once a verifier object is created, the verification can be started by calling the {@link Verifier#verify} method.\n */\n\n/** Events emitted by {@link Verifier} */\nexport var VerifierEvent = /*#__PURE__*/function (VerifierEvent) {\n /**\n * The verification has been cancelled, by us or the other side.\n *\n * The payload is either an {@link Error}, or an (incoming or outgoing) {@link MatrixEvent}, depending on\n * unspecified reasons.\n */\n VerifierEvent[\"Cancel\"] = \"cancel\";\n /**\n * SAS data has been exchanged and should be displayed to the user.\n *\n * The payload is the {@link ShowSasCallbacks} object.\n */\n VerifierEvent[\"ShowSas\"] = \"show_sas\";\n /**\n * The user should confirm if the other side has scanned our QR code.\n *\n * The payload is the {@link ShowQrCodeCallbacks} object.\n */\n VerifierEvent[\"ShowReciprocateQr\"] = \"show_reciprocate_qr\";\n return VerifierEvent;\n}({});\n\n/** Listener type map for {@link VerifierEvent}s. */\n\n/**\n * Callbacks for user actions to confirm that the other side has scanned our QR code.\n *\n * This is exposed as the payload of a `VerifierEvent.ShowReciprocateQr` event, or can be retrieved directly from the\n * verifier as `reciprocateQREvent`.\n */\n\n/**\n * Callbacks for user actions while a SAS is displayed.\n *\n * This is exposed as the payload of a `VerifierEvent.ShowSas` event, or directly from the verifier as `sasEvent`.\n */\n\n/** A generated SAS to be shown to the user, in alternative formats */\n\n/**\n * An emoji for the generated SAS. A tuple `[emoji, name]` where `emoji` is the emoji itself and `name` is the\n * English name.\n */\n\n/**\n * True if the request is in a state where it can be accepted (ie, that we're in phases {@link VerificationPhase.Unsent}\n * or {@link VerificationPhase.Requested}, and that we're not in the process of sending a `ready` or `cancel`).\n */\nexport function canAcceptVerificationRequest(req) {\n return req.phase < VerificationPhase.Ready && !req.accepting && !req.declining;\n}\n//# sourceMappingURL=verification.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 bs58 from \"bs58\";\n\n// picked arbitrarily but to try & avoid clashing with any bitcoin ones\n// (which are also base58 encoded, but bitcoin's involve a lot more hashing)\nvar OLM_RECOVERY_KEY_PREFIX = [0x8b, 0x01];\nvar KEY_SIZE = 32;\n\n/**\n * Encode a recovery key using the Matrix {@link https://spec.matrix.org/v1.11/appendices/#cryptographic-key-representation | Cryptographic key representation}\n * @param key\n */\nexport function encodeRecoveryKey(key) {\n var _base58key$match;\n var buf = new Uint8Array(OLM_RECOVERY_KEY_PREFIX.length + key.length + 1);\n buf.set(OLM_RECOVERY_KEY_PREFIX, 0);\n buf.set(key, OLM_RECOVERY_KEY_PREFIX.length);\n var parity = 0;\n for (var i = 0; i < buf.length - 1; ++i) {\n parity ^= buf[i];\n }\n buf[buf.length - 1] = parity;\n var base58key = bs58.encode(buf);\n return (_base58key$match = base58key.match(/.{1,4}/g)) === null || _base58key$match === void 0 ? void 0 : _base58key$match.join(\" \");\n}\n\n/**\n * Decode a recovery key encoded with the Matrix {@link https://spec.matrix.org/v1.11/appendices/#cryptographic-key-representation | Cryptographic key representation} encoding.\n * @param recoveryKey\n */\nexport function decodeRecoveryKey(recoveryKey) {\n var result = bs58.decode(recoveryKey.replace(/ /g, \"\"));\n var parity = 0;\n for (var b of result) {\n parity ^= b;\n }\n if (parity !== 0) {\n throw new Error(\"Incorrect parity\");\n }\n for (var i = 0; i < OLM_RECOVERY_KEY_PREFIX.length; ++i) {\n if (result[i] !== OLM_RECOVERY_KEY_PREFIX[i]) {\n throw new Error(\"Incorrect prefix\");\n }\n }\n if (result.length !== OLM_RECOVERY_KEY_PREFIX.length + KEY_SIZE + 1) {\n throw new Error(\"Incorrect length\");\n }\n return Uint8Array.from(result.slice(OLM_RECOVERY_KEY_PREFIX.length, OLM_RECOVERY_KEY_PREFIX.length + KEY_SIZE));\n}\n//# sourceMappingURL=recovery-key.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\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\nvar DEFAULT_BIT_SIZE = 256;\n\n/**\n * Derive a recovery key from a passphrase and salt using PBKDF2.\n * @see https://spec.matrix.org/v1.11/client-server-api/#deriving-keys-from-passphrases\n *\n * @param passphrase - The passphrase to derive the key from\n * @param salt - The salt to use in the derivation\n * @param iterations - The number of iterations to use in the derivation\n * @param numBits - The number of bits to derive\n */\nexport function deriveRecoveryKeyFromPassphrase(_x, _x2, _x3) {\n return _deriveRecoveryKeyFromPassphrase.apply(this, arguments);\n}\nfunction _deriveRecoveryKeyFromPassphrase() {\n _deriveRecoveryKeyFromPassphrase = _asyncToGenerator(function* (passphrase, salt, iterations) {\n var numBits = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_BIT_SIZE;\n if (!globalThis.crypto.subtle || !TextEncoder) {\n throw new Error(\"Password-based backup is not available on this platform\");\n }\n var key = yield globalThis.crypto.subtle.importKey(\"raw\", new TextEncoder().encode(passphrase), {\n name: \"PBKDF2\"\n }, false, [\"deriveBits\"]);\n var keybits = yield globalThis.crypto.subtle.deriveBits({\n name: \"PBKDF2\",\n salt: new TextEncoder().encode(salt),\n iterations: iterations,\n hash: \"SHA-512\"\n }, key, numBits);\n return new Uint8Array(keybits);\n });\n return _deriveRecoveryKeyFromPassphrase.apply(this, arguments);\n}\n//# sourceMappingURL=key-passphrase.js.map","let wasm;\nexport function __wbg_set_wasm(val) {\n wasm = val;\n}\n\nfunction addToExternrefTable0(obj) {\n const idx = wasm.__externref_table_alloc();\n wasm.__wbindgen_externrefs.set(idx, obj);\n return idx;\n}\n\nfunction _assertClass(instance, klass) {\n if (!(instance instanceof klass)) {\n throw new Error(`expected instance of ${klass.name}`);\n }\n}\n\nconst CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(state => state.dtor(state.a, state.b));\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 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_externrefs.get(mem.getUint32(i, true)));\n }\n wasm.__externref_drop_slice(ptr, len);\n return result;\n}\n\nfunction getArrayU16FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint16ArrayMemory0().subarray(ptr / 2, ptr / 2 + len);\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\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 getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint16ArrayMemory0 = null;\nfunction getUint16ArrayMemory0() {\n if (cachedUint16ArrayMemory0 === null || cachedUint16ArrayMemory0.byteLength === 0) {\n cachedUint16ArrayMemory0 = new Uint16Array(wasm.memory.buffer);\n }\n return cachedUint16ArrayMemory0;\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\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 makeMutClosure(arg0, arg1, dtor, f) {\n const state = { a: arg0, b: arg1, cnt: 1, dtor };\n const real = (...args) => {\n\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 state.a = a;\n real._wbg_cb_unref();\n }\n };\n real._wbg_cb_unref = () => {\n if (--state.cnt === 0) {\n state.dtor(state.a, state.b);\n state.a = 0;\n CLOSURE_DTORS.unregister(state);\n }\n };\n CLOSURE_DTORS.register(real, state, state);\n return real;\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 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 passStringToWasm0(arg, malloc, realloc) {\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 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 = cachedTextEncoder.encodeInto(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\nfunction takeFromExternrefTable0(idx) {\n const value = wasm.__wbindgen_externrefs.get(idx);\n wasm.__externref_table_dealloc(idx);\n return value;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\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 TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = 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}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction wasm_bindgen__convert__closures_____invoke__h89fab44ead303aca(arg0, arg1, arg2) {\n wasm.wasm_bindgen__convert__closures_____invoke__h89fab44ead303aca(arg0, arg1, arg2);\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h22e674b566e32b64(arg0, arg1) {\n wasm.wasm_bindgen__convert__closures_____invoke__h22e674b566e32b64(arg0, arg1);\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h35b0a77e54c2db90(arg0, arg1, arg2) {\n const ret = wasm.wasm_bindgen__convert__closures_____invoke__h35b0a77e54c2db90(arg0, arg1, arg2);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h8815fd477ac2dc7f(arg0, arg1, arg2, arg3) {\n wasm.wasm_bindgen__convert__closures_____invoke__h8815fd477ac2dc7f(arg0, arg1, arg2, arg3);\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\nconst BackupDecryptionKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupdecryptionkey_free(ptr >>> 0, 1));\n\nconst BackupKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupkeys_free(ptr >>> 0, 1));\n\nconst BackupSecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupsecretsbundle_free(ptr >>> 0, 1));\n\nconst Base64EncodedPkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_base64encodedpkmessage_free(ptr >>> 0, 1));\n\nconst BaseMigrationDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_basemigrationdata_free(ptr >>> 0, 1));\n\nconst CancelInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_cancelinfo_free(ptr >>> 0, 1));\n\nconst CheckCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_checkcode_free(ptr >>> 0, 1));\n\nconst CollectStrategyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_collectstrategy_free(ptr >>> 0, 1));\n\nconst CrossSigningBootstrapRequestsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningbootstraprequests_free(ptr >>> 0, 1));\n\nconst CrossSigningKeyExportFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningkeyexport_free(ptr >>> 0, 1));\n\nconst CrossSigningStatusFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningstatus_free(ptr >>> 0, 1));\n\nconst Curve25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_curve25519publickey_free(ptr >>> 0, 1));\n\nconst Curve25519SecretKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_curve25519secretkey_free(ptr >>> 0, 1));\n\nconst DecryptedRoomEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptedroomevent_free(ptr >>> 0, 1));\n\nconst DecryptedToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptedtodeviceevent_free(ptr >>> 0, 1));\n\nconst DecryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptionsettings_free(ptr >>> 0, 1));\n\nconst DehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevice_free(ptr >>> 0, 1));\n\nconst DehydratedDeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevicekey_free(ptr >>> 0, 1));\n\nconst DehydratedDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevices_free(ptr >>> 0, 1));\n\nconst DeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_device_free(ptr >>> 0, 1));\n\nconst DeviceIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_deviceid_free(ptr >>> 0, 1));\n\nconst DeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekey_free(ptr >>> 0, 1));\n\nconst DeviceKeyAlgorithmFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyalgorithm_free(ptr >>> 0, 1));\n\nconst DeviceKeyIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyid_free(ptr >>> 0, 1));\n\nconst DeviceListsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicelists_free(ptr >>> 0, 1));\n\nconst EciesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ecies_free(ptr >>> 0, 1));\n\nconst Ed25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ed25519publickey_free(ptr >>> 0, 1));\n\nconst Ed25519SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ed25519signature_free(ptr >>> 0, 1));\n\nconst EmojiFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_emoji_free(ptr >>> 0, 1));\n\nconst EncryptedAttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptedattachment_free(ptr >>> 0, 1));\n\nconst EncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptioninfo_free(ptr >>> 0, 1));\n\nconst EncryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptionsettings_free(ptr >>> 0, 1));\n\nconst EstablishedEciesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_establishedecies_free(ptr >>> 0, 1));\n\nconst EventIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_eventid_free(ptr >>> 0, 1));\n\nconst IdentityKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_identitykeys_free(ptr >>> 0, 1));\n\nconst InboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_inboundcreationresult_free(ptr >>> 0, 1));\n\nconst InboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_inboundgroupsession_free(ptr >>> 0, 1));\n\nconst InvalidToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_invalidtodeviceevent_free(ptr >>> 0, 1));\n\nconst KeysBackupRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysbackuprequest_free(ptr >>> 0, 1));\n\nconst KeysClaimRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysclaimrequest_free(ptr >>> 0, 1));\n\nconst KeysQueryRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysqueryrequest_free(ptr >>> 0, 1));\n\nconst KeysUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysuploadrequest_free(ptr >>> 0, 1));\n\nconst MaybeSignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_maybesignature_free(ptr >>> 0, 1));\n\nconst MegolmDecryptionErrorFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_megolmdecryptionerror_free(ptr >>> 0, 1));\n\nconst MegolmV1BackupKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_megolmv1backupkey_free(ptr >>> 0, 1));\n\nconst MigrationFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_migration_free(ptr >>> 0, 1));\n\nconst OlmMachineFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_olmmachine_free(ptr >>> 0, 1));\n\nconst OtherUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_otheruseridentity_free(ptr >>> 0, 1));\n\nconst OutboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_outboundcreationresult_free(ptr >>> 0, 1));\n\nconst OwnUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ownuseridentity_free(ptr >>> 0, 1));\n\nconst PickledInboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pickledinboundgroupsession_free(ptr >>> 0, 1));\n\nconst PickledSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pickledsession_free(ptr >>> 0, 1));\n\nconst PkDecryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkdecryption_free(ptr >>> 0, 1));\n\nconst PkEncryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkencryption_free(ptr >>> 0, 1));\n\nconst PkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkmessage_free(ptr >>> 0, 1));\n\nconst PlainTextToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_plaintexttodeviceevent_free(ptr >>> 0, 1));\n\nconst PutDehydratedDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_putdehydrateddevicerequest_free(ptr >>> 0, 1));\n\nconst QrFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qr_free(ptr >>> 0, 1));\n\nconst QrCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcode_free(ptr >>> 0, 1));\n\nconst QrCodeDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodedata_free(ptr >>> 0, 1));\n\nconst QrCodeScanFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodescan_free(ptr >>> 0, 1));\n\nconst RehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_rehydrateddevice_free(ptr >>> 0, 1));\n\nconst RoomIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomid_free(ptr >>> 0, 1));\n\nconst RoomKeyCountsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeycounts_free(ptr >>> 0, 1));\n\nconst RoomKeyImportResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyimportresult_free(ptr >>> 0, 1));\n\nconst RoomKeyInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyinfo_free(ptr >>> 0, 1));\n\nconst RoomKeyWithheldInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeywithheldinfo_free(ptr >>> 0, 1));\n\nconst RoomMessageRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roommessagerequest_free(ptr >>> 0, 1));\n\nconst RoomSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomsettings_free(ptr >>> 0, 1));\n\nconst SasFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_sas_free(ptr >>> 0, 1));\n\nconst SecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_secretsbundle_free(ptr >>> 0, 1));\n\nconst ServerNameFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_servername_free(ptr >>> 0, 1));\n\nconst ShieldStateFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_shieldstate_free(ptr >>> 0, 1));\n\nconst SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signature_free(ptr >>> 0, 1));\n\nconst SignatureUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatureuploadrequest_free(ptr >>> 0, 1));\n\nconst SignatureVerificationFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatureverification_free(ptr >>> 0, 1));\n\nconst SignaturesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatures_free(ptr >>> 0, 1));\n\nconst StoreHandleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_storehandle_free(ptr >>> 0, 1));\n\nconst StoredRoomKeyBundleDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_storedroomkeybundledata_free(ptr >>> 0, 1));\n\nconst ToDeviceEncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todeviceencryptioninfo_free(ptr >>> 0, 1));\n\nconst ToDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todevicerequest_free(ptr >>> 0, 1));\n\nconst ToDeviceUnableToDecryptInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todeviceunabletodecryptinfo_free(ptr >>> 0, 1));\n\nconst TracingFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_tracing_free(ptr >>> 0, 1));\n\nconst UTDToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_utdtodeviceevent_free(ptr >>> 0, 1));\n\nconst UploadSigningKeysRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_uploadsigningkeysrequest_free(ptr >>> 0, 1));\n\nconst UserDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_userdevices_free(ptr >>> 0, 1));\n\nconst UserIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_userid_free(ptr >>> 0, 1));\n\nconst VerificationRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_verificationrequest_free(ptr >>> 0, 1));\n\nconst VersionsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_versions_free(ptr >>> 0, 1));\n\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n AttachmentFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_attachment_free(ptr, 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 * 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}\nif (Symbol.dispose) Attachment.prototype[Symbol.dispose] = Attachment.prototype.free;\n\n/**\n * The private part of the backup key, the one used for recovery.\n */\nexport class BackupDecryptionKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BackupDecryptionKeyFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_backupdecryptionkey_free(ptr, 0);\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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) BackupDecryptionKey.prototype[Symbol.dispose] = BackupDecryptionKey.prototype.free;\n\n/**\n * Stored versions of the backup keys.\n */\nexport class BackupKeys {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BackupKeysFinalization.unregister(this);\n return ptr;\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, 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 * 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}\nif (Symbol.dispose) BackupKeys.prototype[Symbol.dispose] = BackupKeys.prototype.free;\n\n/**\n * The backup-specific parts of a secrets bundle.\n */\nexport class BackupSecretsBundle {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BackupSecretsBundleFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) BackupSecretsBundle.prototype[Symbol.dispose] = BackupSecretsBundle.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n Base64EncodedPkMessageFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Base64EncodedPkMessage.prototype[Symbol.dispose] = Base64EncodedPkMessage.prototype.free;\n\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BaseMigrationDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_basemigrationdata_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) BaseMigrationData.prototype[Symbol.dispose] = BaseMigrationData.prototype.free;\n\n/**\n * Information about the cancellation of a verification request or\n * verification flow.\n */\nexport class CancelInfo {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CancelInfoFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_cancelinfo_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) CancelInfo.prototype[Symbol.dispose] = CancelInfo.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CheckCodeFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) CheckCode.prototype[Symbol.dispose] = CheckCode.prototype.free;\n\n/**\n * Strategy to collect the devices that should receive room keys for the\n * current discussion.\n */\nexport class CollectStrategy {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CollectStrategyFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_collectstrategy_free(ptr, 0);\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 * 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 * 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 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 * 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 * 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}\nif (Symbol.dispose) CollectStrategy.prototype[Symbol.dispose] = CollectStrategy.prototype.free;\n\n/**\n * A set of requests to be executed when bootstrapping cross-signing using\n * {@link OlmMachine.bootstrapCrossSigning}.\n */\nexport class CrossSigningBootstrapRequests {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CrossSigningBootstrapRequestsFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) CrossSigningBootstrapRequests.prototype[Symbol.dispose] = CrossSigningBootstrapRequests.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CrossSigningKeyExportFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) CrossSigningKeyExport.prototype[Symbol.dispose] = CrossSigningKeyExport.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n CrossSigningStatusFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) CrossSigningStatus.prototype[Symbol.dispose] = CrossSigningStatus.prototype.free;\n\n/**\n * A Curve25519 public key.\n */\nexport class Curve25519PublicKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n Curve25519PublicKeyFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Curve25519PublicKey.prototype[Symbol.dispose] = Curve25519PublicKey.prototype.free;\n\n/**\n * A Curve25519 secret key.\n */\nexport class Curve25519SecretKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n Curve25519SecretKeyFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_curve25519secretkey_free(ptr, 0);\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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) Curve25519SecretKey.prototype[Symbol.dispose] = Curve25519SecretKey.prototype.free;\n\n/**\n * A decrypted room event.\n */\nexport class DecryptedRoomEvent {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DecryptedRoomEventFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_decryptedroomevent_free(ptr, 0);\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 * 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 * If the keys for this message were shared-on-invite as part of an\n * [MSC4268] key bundle, the ID of the device from which this bundle\n * was sent.\n *\n * [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268\n * @returns {DeviceId | undefined}\n */\n get forwarderDevice() {\n const ret = wasm.decryptedroomevent_forwarderDevice(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 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 * If the keys for this message were shared-on-invite as part of an\n * [MSC4268] key bundle, the ID of the user who sent us the bundle.\n *\n * [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268\n * @returns {UserId | undefined}\n */\n get forwarder() {\n const ret = wasm.decryptedroomevent_forwarder(this.__wbg_ptr);\n return ret === 0 ? undefined : UserId.__wrap(ret);\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}\nif (Symbol.dispose) DecryptedRoomEvent.prototype[Symbol.dispose] = DecryptedRoomEvent.prototype.free;\n\n/**\n * Represents an encrypted to-device event, after it has been decrypted.\n */\nexport class DecryptedToDeviceEvent {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DecryptedToDeviceEventFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) DecryptedToDeviceEvent.prototype[Symbol.dispose] = DecryptedToDeviceEvent.prototype.free;\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/**\n * Settings for decrypting messages\n */\nexport class DecryptionSettings {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DecryptionSettingsFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_decryptionsettings_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) DecryptionSettings.prototype[Symbol.dispose] = DecryptionSettings.prototype.free;\n\n/**\n * A dehydrated device that can be uploaded to the server\n */\nexport class DehydratedDevice {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DehydratedDeviceFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) DehydratedDevice.prototype[Symbol.dispose] = DehydratedDevice.prototype.free;\n\n/**\n * Dehydrated device key\n */\nexport class DehydratedDeviceKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DehydratedDeviceKeyFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) DehydratedDeviceKey.prototype[Symbol.dispose] = DehydratedDeviceKey.prototype.free;\n\n/**\n * Struct collecting methods to create and rehydrate dehydrated devices.\n */\nexport class DehydratedDevices {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DehydratedDevicesFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_dehydrateddevices_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) DehydratedDevices.prototype[Symbol.dispose] = DehydratedDevices.prototype.free;\n\n/**\n * A device represents a E2EE capable client of an user.\n */\nexport class Device {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DeviceFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_device_free(ptr, 0);\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 * 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 * 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 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) Device.prototype[Symbol.dispose] = Device.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DeviceIdFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) DeviceId.prototype[Symbol.dispose] = DeviceId.prototype.free;\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 */\nexport class DeviceKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DeviceKeyFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_devicekey_free(ptr, 0);\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 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 `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}\nif (Symbol.dispose) DeviceKey.prototype[Symbol.dispose] = DeviceKey.prototype.free;\n\n/**\n * The basic key algorithms in the specification.\n */\nexport class DeviceKeyAlgorithm {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DeviceKeyAlgorithmFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) DeviceKeyAlgorithm.prototype[Symbol.dispose] = DeviceKeyAlgorithm.prototype.free;\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/**\n * A Matrix device key ID.\n *\n * A key algorithm and a device ID, combined with a ‘:’.\n */\nexport class DeviceKeyId {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DeviceKeyIdFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) DeviceKeyId.prototype[Symbol.dispose] = DeviceKeyId.prototype.free;\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/**\n * Information on E2E device updates.\n */\nexport class DeviceLists {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n DeviceListsFinalization.unregister(this);\n return ptr;\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 * 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 * 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 * 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}\nif (Symbol.dispose) DeviceLists.prototype[Symbol.dispose] = DeviceLists.prototype.free;\n\n/**\n * An unestablished ECIES session.\n */\nexport class Ecies {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EciesFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_ecies_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) Ecies.prototype[Symbol.dispose] = Ecies.prototype.free;\n\n/**\n * An Ed25519 public key, used to verify digital signatures.\n */\nexport class Ed25519PublicKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n Ed25519PublicKeyFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Ed25519PublicKey.prototype[Symbol.dispose] = Ed25519PublicKey.prototype.free;\n\n/**\n * An Ed25519 digital signature, can be used to verify the\n * authenticity of a message.\n */\nexport class Ed25519Signature {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n Ed25519SignatureFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Ed25519Signature.prototype[Symbol.dispose] = Ed25519Signature.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EmojiFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_emoji_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) Emoji.prototype[Symbol.dispose] = Emoji.prototype.free;\n\n/**\n * An encrypted attachment, usually created from `Attachment.encrypt`.\n */\nexport class EncryptedAttachment {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EncryptedAttachmentFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_encryptedattachment_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) EncryptedAttachment.prototype[Symbol.dispose] = EncryptedAttachment.prototype.free;\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/**\n * Struct containing information on how a room event was decrypted.\n */\nexport class EncryptionInfo {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EncryptionInfoFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_encryptioninfo_free(ptr, 0);\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 * 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 ID of the user who sent us the keys with which we decrypted this\n * event as part of an MSC4268 key bundle, if present. Only applicable for\n * room events.\n * @returns {UserId | undefined}\n */\n get forwarder() {\n const ret = wasm.__wbg_get_encryptioninfo_forwarder(this.__wbg_ptr);\n return ret === 0 ? undefined : UserId.__wrap(ret);\n }\n /**\n * The ID of the user who sent us the keys with which we decrypted this\n * event as part of an MSC4268 key bundle, if present. Only applicable for\n * room events.\n * @param {UserId | null} [arg0]\n */\n set forwarder(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, UserId);\n ptr0 = arg0.__destroy_into_raw();\n }\n wasm.__wbg_set_encryptioninfo_forwarder(this.__wbg_ptr, ptr0);\n }\n /**\n * The device ID of the user who sent us the keys with which we decrypted\n * this event as part of an MSC4268 key bundle, if present. Only applicable\n * for room events.\n * @returns {DeviceId | undefined}\n */\n get forwarderDevice() {\n const ret = wasm.__wbg_get_encryptioninfo_forwarderDevice(this.__wbg_ptr);\n return ret === 0 ? undefined : DeviceId.__wrap(ret);\n }\n /**\n * The device ID of the user who sent us the keys with which we decrypted\n * this event as part of an MSC4268 key bundle, if present. Only applicable\n * for room events.\n * @param {DeviceId | null} [arg0]\n */\n set forwarderDevice(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_forwarderDevice(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}\nif (Symbol.dispose) EncryptionInfo.prototype[Symbol.dispose] = EncryptionInfo.prototype.free;\n\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EncryptionSettingsFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_encryptionsettings_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) EncryptionSettings.prototype[Symbol.dispose] = EncryptionSettings.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EstablishedEciesFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_establishedecies_free(ptr, 0);\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 * 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 * 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 * 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}\nif (Symbol.dispose) EstablishedEcies.prototype[Symbol.dispose] = EstablishedEcies.prototype.free;\n\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n EventIdFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_eventid_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) EventId.prototype[Symbol.dispose] = EventId.prototype.free;\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/**\n * Struct holding the two public identity keys of an account.\n */\nexport class IdentityKeys {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n IdentityKeysFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) IdentityKeys.prototype[Symbol.dispose] = IdentityKeys.prototype.free;\n\n/**\n * The result of an inbound ECIES channel establishment.\n */\nexport class InboundCreationResult {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n InboundCreationResultFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) InboundCreationResult.prototype[Symbol.dispose] = InboundCreationResult.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n InboundGroupSessionFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_inboundgroupsession_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) InboundGroupSession.prototype[Symbol.dispose] = InboundGroupSession.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n InvalidToDeviceEventFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) InvalidToDeviceEvent.prototype[Symbol.dispose] = InvalidToDeviceEvent.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n KeysBackupRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_keysbackuprequest_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) KeysBackupRequest.prototype[Symbol.dispose] = KeysBackupRequest.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n KeysClaimRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_keysclaimrequest_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) KeysClaimRequest.prototype[Symbol.dispose] = KeysClaimRequest.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n KeysQueryRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_keysqueryrequest_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) KeysQueryRequest.prototype[Symbol.dispose] = KeysQueryRequest.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n KeysUploadRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_keysuploadrequest_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) KeysUploadRequest.prototype[Symbol.dispose] = KeysUploadRequest.prototype.free;\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/**\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/**\n * Represents a signature that is either valid _or_ that could not be\n * decoded.\n */\nexport class MaybeSignature {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n MaybeSignatureFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_maybesignature_free(ptr, 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 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 * 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 * 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}\nif (Symbol.dispose) MaybeSignature.prototype[Symbol.dispose] = MaybeSignature.prototype.free;\n\n/**\n * Js Decryption error with code.\n */\nexport class MegolmDecryptionError {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n MegolmDecryptionErrorFinalization.unregister(this);\n return ptr;\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 * The withheld code, if any.\n *\n * Example: \"m.unverified\"\n *\n * `undefined` if we have not received a withheld code for the megolm\n * session.\n * @returns {string | undefined}\n */\n get withheldCode() {\n const ret = wasm.megolmdecryptionerror_withheldCode(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 * Textual description of the withheld code, if any.\n *\n * Example: \"The sender has disabled encrypting to unverified devices.\"\n *\n * `undefined` if we have not received a withheld code for the megolm\n * session.\n * @returns {string | undefined}\n */\n get maybe_withheld() {\n const ret = wasm.megolmdecryptionerror_maybe_withheld(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 * Creates generic error with description\n * @param {string} desc\n * @returns {MegolmDecryptionError}\n */\n static unable_to_decrypt(desc) {\n const ptr0 = passStringToWasm0(desc, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.megolmdecryptionerror_unable_to_decrypt(ptr0, len0);\n return MegolmDecryptionError.__wrap(ret);\n }\n}\nif (Symbol.dispose) MegolmDecryptionError.prototype[Symbol.dispose] = MegolmDecryptionError.prototype.free;\n\n/**\n * The public part of the backup key.\n */\nexport class MegolmV1BackupKey {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n MegolmV1BackupKeyFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) MegolmV1BackupKey.prototype[Symbol.dispose] = MegolmV1BackupKey.prototype.free;\n\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n MigrationFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Migration.prototype[Symbol.dispose] = Migration.prototype.free;\n\n/**\n * State machine implementation of the Olm/Megolm encryption protocol\n * used for Matrix end to end encryption.\n */\nexport class OlmMachine {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n OlmMachineFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_olmmachine_free(ptr, 0);\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 * 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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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 * 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 * 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 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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) OlmMachine.prototype[Symbol.dispose] = OlmMachine.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n OtherUserIdentityFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_otheruseridentity_free(ptr, 0);\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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) OtherUserIdentity.prototype[Symbol.dispose] = OtherUserIdentity.prototype.free;\n\n/**\n * The result of an outbound ECIES channel establishment.\n */\nexport class OutboundCreationResult {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n OutboundCreationResultFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) OutboundCreationResult.prototype[Symbol.dispose] = OutboundCreationResult.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n OwnUserIdentityFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_ownuseridentity_free(ptr, 0);\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 * 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 * 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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) OwnUserIdentity.prototype[Symbol.dispose] = OwnUserIdentity.prototype.free;\n\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 static __unwrap(jsValue) {\n if (!(jsValue instanceof PickledInboundGroupSession)) {\n return 0;\n }\n return jsValue.__destroy_into_raw();\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 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}\nif (Symbol.dispose) PickledInboundGroupSession.prototype[Symbol.dispose] = PickledInboundGroupSession.prototype.free;\n\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 static __unwrap(jsValue) {\n if (!(jsValue instanceof PickledSession)) {\n return 0;\n }\n return jsValue.__destroy_into_raw();\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 free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_pickledsession_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) PickledSession.prototype[Symbol.dispose] = PickledSession.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n PkDecryptionFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_pkdecryption_free(ptr, 0);\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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) PkDecryption.prototype[Symbol.dispose] = PkDecryption.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n PkEncryptionFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_pkencryption_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) PkEncryption.prototype[Symbol.dispose] = PkEncryption.prototype.free;\n\n/**\n * A class representing an encrypted message using {@link PkEncryption}.\n */\nexport class PkMessage {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n PkMessageFinalization.unregister(this);\n return ptr;\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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) PkMessage.prototype[Symbol.dispose] = PkMessage.prototype.free;\n\n/**\n * Represents a to-device event sent in the clear.\n */\nexport class PlainTextToDeviceEvent {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n PlainTextToDeviceEventFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) PlainTextToDeviceEvent.prototype[Symbol.dispose] = PlainTextToDeviceEvent.prototype.free;\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/**\n * A request that will upload a dehydrated device to the server.\n */\nexport class PutDehydratedDeviceRequest {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n PutDehydratedDeviceRequestFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) PutDehydratedDeviceRequest.prototype[Symbol.dispose] = PutDehydratedDeviceRequest.prototype.free;\n\n/**\n * QR code based verification.\n */\nexport class Qr {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n QrFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_qr_free(ptr, 0);\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 * 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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) Qr.prototype[Symbol.dispose] = Qr.prototype.free;\n\n/**\n * A QR code.\n */\nexport class QrCode {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n QrCodeFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) QrCode.prototype[Symbol.dispose] = QrCode.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n QrCodeDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_qrcodedata_free(ptr, 0);\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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) QrCodeData.prototype[Symbol.dispose] = QrCodeData.prototype.free;\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/**\n * A scanned QR code.\n */\nexport class QrCodeScan {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n QrCodeScanFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) QrCodeScan.prototype[Symbol.dispose] = QrCodeScan.prototype.free;\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/**\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RehydratedDeviceFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) RehydratedDevice.prototype[Symbol.dispose] = RehydratedDevice.prototype.free;\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/**\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 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 static __unwrap(jsValue) {\n if (!(jsValue instanceof RoomId)) {\n return 0;\n }\n return jsValue.__destroy_into_raw();\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 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}\nif (Symbol.dispose) RoomId.prototype[Symbol.dispose] = RoomId.prototype.free;\n\n/**\n * Struct holding the number of room keys we have.\n */\nexport class RoomKeyCounts {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RoomKeyCountsFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) RoomKeyCounts.prototype[Symbol.dispose] = RoomKeyCounts.prototype.free;\n\n/**\n * The result of a call to {@link OlmMachine.importExportedRoomKeys} or\n * {@link OlmMachine.importBackedUpRoomKeys}.\n */\nexport class RoomKeyImportResult {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RoomKeyImportResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roomkeyimportresult_free(ptr, 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 * 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}\nif (Symbol.dispose) RoomKeyImportResult.prototype[Symbol.dispose] = RoomKeyImportResult.prototype.free;\n\n/**\n * Information on a room key that has been received or imported.\n */\nexport class RoomKeyInfo {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RoomKeyInfoFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roomkeyinfo_free(ptr, 0);\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 * 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 {@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}\nif (Symbol.dispose) RoomKeyInfo.prototype[Symbol.dispose] = RoomKeyInfo.prototype.free;\n\n/**\n * Information on a received `m.room_key.withheld` event.\n */\nexport class RoomKeyWithheldInfo {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RoomKeyWithheldInfoFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roomkeywithheldinfo_free(ptr, 0);\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 * The `code` indicating why the key was withheld, such as `m.unverified`.\n *\n * This may be from an `m.room_key.withheld` event (such as\n * `m.unverified`), or from a shared room key bundle under MSC4268.\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 User ID of the sender of the withheld information.\n *\n * This may be the sender of an `m.room_key.withheld` event, or the sender\n * of a shared room key bundle under MSC4268.\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 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 encryption algorithm of the session that is being withheld.\n *\n * This may be from an `m.room_key.withheld` event, or from a shared room\n * key bundle under MSC4268.\n * @returns {EncryptionAlgorithm}\n */\n get algorithm() {\n const ret = wasm.roomkeywithheldinfo_algorithm(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) RoomKeyWithheldInfo.prototype[Symbol.dispose] = RoomKeyWithheldInfo.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RoomMessageRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roommessagerequest_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) RoomMessageRequest.prototype[Symbol.dispose] = RoomMessageRequest.prototype.free;\n\n/**\n * Room encryption settings which are modified by state events or user options\n */\nexport class RoomSettings {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n RoomSettingsFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roomsettings_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) RoomSettings.prototype[Symbol.dispose] = RoomSettings.prototype.free;\n\n/**\n * Short Authentication String (SAS) verification.\n */\nexport class Sas {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SasFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_sas_free(ptr, 0);\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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 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 * 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 * 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}\nif (Symbol.dispose) Sas.prototype[Symbol.dispose] = Sas.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SecretsBundleFinalization.unregister(this);\n return ptr;\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 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 * 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 * 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}\nif (Symbol.dispose) SecretsBundle.prototype[Symbol.dispose] = SecretsBundle.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ServerNameFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_servername_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) ServerName.prototype[Symbol.dispose] = ServerName.prototype.free;\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/**\n * Take a look at [`matrix_sdk_common::deserialized_responses::ShieldState`]\n * for more info.\n */\nexport class ShieldState {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ShieldStateFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_shieldstate_free(ptr, 0);\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 * 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 === 6 ? 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) ? 6 : arg0);\n }\n}\nif (Symbol.dispose) ShieldState.prototype[Symbol.dispose] = ShieldState.prototype.free;\n\n/**\n * A machine-readable representation of the authenticity for a `ShieldState`.\n * @enum {0 | 1 | 2 | 3 | 4 | 5}\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 * The sender was previously verified but changed their identity.\n */\n VerificationViolation: 4, \"4\": \"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: 5, \"5\": \"MismatchedSender\",\n});\n\n/**\n * Represents a potentially decoded signature (but not a validated\n * one).\n */\nexport class Signature {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SignatureFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Signature.prototype[Symbol.dispose] = Signature.prototype.free;\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/**\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SignatureUploadRequestFinalization.unregister(this);\n return ptr;\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 * 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 * 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}\nif (Symbol.dispose) SignatureUploadRequest.prototype[Symbol.dispose] = SignatureUploadRequest.prototype.free;\n\n/**\n * The result of a signature verification of a signed JSON object.\n */\nexport class SignatureVerification {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SignatureVerificationFinalization.unregister(this);\n return ptr;\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 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 * 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 * 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}\nif (Symbol.dispose) SignatureVerification.prototype[Symbol.dispose] = SignatureVerification.prototype.free;\n\n/**\n * A collection of `Signature`.\n */\nexport class Signatures {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n SignaturesFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_signatures_free(ptr, 0);\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 * 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 * Remove all the signatures we currently hold.\n */\n clear() {\n wasm.signatures_clear(this.__wbg_ptr);\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 * 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}\nif (Symbol.dispose) Signatures.prototype[Symbol.dispose] = Signatures.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n StoreHandleFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) StoreHandle.prototype[Symbol.dispose] = StoreHandle.prototype.free;\n\n/**\n * Information on a stored room key bundle data event.\n */\nexport class StoredRoomKeyBundleData {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n StoredRoomKeyBundleDataFinalization.unregister(this);\n return ptr;\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 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 * 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 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}\nif (Symbol.dispose) StoredRoomKeyBundleData.prototype[Symbol.dispose] = StoredRoomKeyBundleData.prototype.free;\n\n/**\n * Struct containing information on how a to-device message was decrypted.\n */\nexport class ToDeviceEncryptionInfo {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ToDeviceEncryptionInfoFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) ToDeviceEncryptionInfo.prototype[Symbol.dispose] = ToDeviceEncryptionInfo.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ToDeviceRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_todevicerequest_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) ToDeviceRequest.prototype[Symbol.dispose] = ToDeviceRequest.prototype.free;\n\n/**\n * Metadata about a to-device event that could not be decrypted.\n */\nexport class ToDeviceUnableToDecryptInfo {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ToDeviceUnableToDecryptInfoFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) ToDeviceUnableToDecryptInfo.prototype[Symbol.dispose] = ToDeviceUnableToDecryptInfo.prototype.free;\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/**\n * Type to install and to manipulate the tracing layer.\n */\nexport class Tracing {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n TracingFinalization.unregister(this);\n return ptr;\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 * 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 * 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}\nif (Symbol.dispose) Tracing.prototype[Symbol.dispose] = Tracing.prototype.free;\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/**\n * Represents an encrypted to-device event that could not be decrypted.\n */\nexport class UTDToDeviceEvent {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n UTDToDeviceEventFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_utdtodeviceevent_free(ptr, 0);\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 * 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}\nif (Symbol.dispose) UTDToDeviceEvent.prototype[Symbol.dispose] = UTDToDeviceEvent.prototype.free;\n\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n UploadSigningKeysRequestFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) UploadSigningKeysRequest.prototype[Symbol.dispose] = UploadSigningKeysRequest.prototype.free;\n\n/**\n * A read only view over all devices belonging to a user.\n */\nexport class UserDevices {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n UserDevicesFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_userdevices_free(ptr, 0);\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 * 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 * 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}\nif (Symbol.dispose) UserDevices.prototype[Symbol.dispose] = UserDevices.prototype.free;\n\n/**\n * A Matrix [user ID].\n *\n * [user ID]: https://spec.matrix.org/v1.2/appendices/#user-identifiers\n */\nexport class UserId {\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 static __unwrap(jsValue) {\n if (!(jsValue instanceof UserId)) {\n return 0;\n }\n return jsValue.__destroy_into_raw();\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 free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_userid_free(ptr, 0);\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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) UserId.prototype[Symbol.dispose] = UserId.prototype.free;\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/**\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 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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n VerificationRequestFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_verificationrequest_free(ptr, 0);\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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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 * 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}\nif (Symbol.dispose) VerificationRequest.prototype[Symbol.dispose] = VerificationRequest.prototype.free;\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\n/**\n * Object containing the versions of the Rust libraries we are using.\n */\nexport class Versions {\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 __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n VersionsFinalization.unregister(this);\n return ptr;\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}\nif (Symbol.dispose) Versions.prototype[Symbol.dispose] = Versions.prototype.free;\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\nexport function __wbg_Error_52673b7de5a0ca89(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return ret;\n};\n\nexport function __wbg_Number_2d1dcfcf4ec51736(arg0) {\n const ret = Number(arg0);\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_bad6cc2ef3d218d1(arg0) {\n const ret = arg0.Window;\n return ret;\n};\n\nexport function __wbg_WorkerGlobalScope_ce34368dd76f04b5(arg0) {\n const ret = arg0.WorkerGlobalScope;\n return ret;\n};\n\nexport function __wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d(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 __wbg___wbindgen_boolean_get_dea25b33882b895b(arg0) {\n const v = arg0;\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n};\n\nexport function __wbg___wbindgen_debug_string_adfb662ae34724b6(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 __wbg___wbindgen_in_0d3e1e8f0c669317(arg0, arg1) {\n const ret = arg0 in arg1;\n return ret;\n};\n\nexport function __wbg___wbindgen_is_bigint_0e1a2e3f55cfae27(arg0) {\n const ret = typeof(arg0) === 'bigint';\n return ret;\n};\n\nexport function __wbg___wbindgen_is_function_8d400b8b1af978cd(arg0) {\n const ret = typeof(arg0) === 'function';\n return ret;\n};\n\nexport function __wbg___wbindgen_is_null_dfda7d66506c95b5(arg0) {\n const ret = arg0 === null;\n return ret;\n};\n\nexport function __wbg___wbindgen_is_object_ce774f3490692386(arg0) {\n const val = arg0;\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n};\n\nexport function __wbg___wbindgen_is_string_704ef9c8fc131030(arg0) {\n const ret = typeof(arg0) === 'string';\n return ret;\n};\n\nexport function __wbg___wbindgen_is_undefined_f6b95eab589e0269(arg0) {\n const ret = arg0 === undefined;\n return ret;\n};\n\nexport function __wbg___wbindgen_jsval_eq_b6101cc9cef1fe36(arg0, arg1) {\n const ret = arg0 === arg1;\n return ret;\n};\n\nexport function __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d(arg0, arg1) {\n const ret = arg0 == arg1;\n return ret;\n};\n\nexport function __wbg___wbindgen_number_get_9619185a74197f95(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 __wbg___wbindgen_string_get_a2a31e16edf96e42(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 __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n};\n\nexport function __wbg___wbindgen_try_into_number_9d33ffe037a9f5e5(arg0) {\n let result;\n try { result = +arg0 } catch (e) { result = e }\n const ret = result;\n return ret;\n};\n\nexport function __wbg__wbg_cb_unref_87dfb5aaa0cbcea7(arg0) {\n arg0._wbg_cb_unref();\n};\n\nexport function __wbg_abort_45186b2c363ae467() { return handleError(function (arg0) {\n arg0.abort();\n}, arguments) };\n\nexport function __wbg_add_c1fb373a6e8701af() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.add(arg1, arg2);\n return ret;\n}, arguments) };\n\nexport function __wbg_add_f0bf6d9527665471(arg0, arg1) {\n const ret = arg0.add(arg1);\n return ret;\n};\n\nexport function __wbg_at_505937f1c4b80bfa(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_6fa641bacd961cc0() { 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_call_3020136f7a2d6e44() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.call(arg1, arg2);\n return ret;\n}, arguments) };\n\nexport function __wbg_call_78f94eb02ec7f9b2() { 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_abb4ff46ce38be40() { return handleError(function (arg0, arg1) {\n const ret = arg0.call(arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_call_c8baa5c5e72d274e() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.call(arg1, arg2, arg3);\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_0e6ff4790cdabf11() { return handleError(function (arg0) {\n const ret = arg0.clear();\n return ret;\n}, arguments) };\n\nexport function __wbg_close_cf7ef4e294ac3858(arg0) {\n arg0.close();\n};\n\nexport function __wbg_code_c2a85f2863ec11b3(arg0) {\n const ret = arg0.code;\n return ret;\n};\n\nexport function __wbg_commit_073afc947129550a() { return handleError(function (arg0) {\n arg0.commit();\n}, arguments) };\n\nexport function __wbg_continue_f42217c3ef5cf6dd() { return handleError(function (arg0) {\n arg0.continue();\n}, arguments) };\n\nexport function __wbg_count_3fa291ea0e8fceec() { return handleError(function (arg0) {\n const ret = arg0.count();\n return ret;\n}, arguments) };\n\nexport function __wbg_count_c05e51d4a5d263a1() { return handleError(function (arg0) {\n const ret = arg0.count();\n return ret;\n}, arguments) };\n\nexport function __wbg_createIndex_3889f4177a3fa5d0() { 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_createIndex_3c576f3c5564f5d7() { 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_createObjectStore_dba64acfe84d4191() { 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_949d8a9c97c02a01(arg0, arg1) {\n arg0.debug(arg1);\n};\n\nexport function __wbg_debug_9d0c87ddda3dc485(arg0) {\n console.debug(arg0);\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_88e9fff1fbbc6189() { return handleError(function (arg0, arg1, arg2) {\n arg0.deleteObjectStore(getStringFromWasm0(arg1, arg2));\n}, arguments) };\n\nexport function __wbg_delete_91010f5a5282eb97() { return handleError(function (arg0) {\n const ret = arg0.delete();\n return ret;\n}, arguments) };\n\nexport function __wbg_delete_a8cf58aab29e18d2() { 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_62ea16af4ce34b24(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_83c79938054e065f(arg0) {\n const ret = Object.entries(arg0);\n return ret;\n};\n\nexport function __wbg_entries_9af46b7eaf7dfefa(arg0) {\n const ret = arg0.entries();\n return ret;\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_error_7bc79084e71bc74a(arg0, arg1) {\n arg0.error(arg1);\n};\n\nexport function __wbg_error_7bc7d576a6aaf855(arg0) {\n console.error(arg0);\n};\n\nexport function __wbg_error_ad02a286da74488a() { return handleError(function (arg0) {\n const ret = arg0.error;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_from_29a8414a7a7cd19d(arg0) {\n const ret = Array.from(arg0);\n return ret;\n};\n\nexport function __wbg_getAllKeys_925405ffbd671e86() { return handleError(function (arg0) {\n const ret = arg0.getAllKeys();\n return ret;\n}, arguments) };\n\nexport function __wbg_getAll_236edca313646f4d() { return handleError(function (arg0) {\n const ret = arg0.getAll();\n return ret;\n}, arguments) };\n\nexport function __wbg_getAll_48e288420773a079() { return handleError(function (arg0, arg1) {\n const ret = arg0.getAll(arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_getAll_eec11317662a8eba() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.getAll(arg1, arg2 >>> 0);\n return ret;\n}, arguments) };\n\nexport function __wbg_getRandomValues_9b655bdd369112f2() { 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_ad1e9878a735af08(arg0) {\n const ret = arg0.getTime();\n return ret;\n};\n\nexport function __wbg_get_10889f5b611cd1c6() { return handleError(function (arg0, arg1) {\n const ret = arg0.get(arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_get_6b7bd52aca3f9671(arg0, arg1) {\n const ret = arg0[arg1 >>> 0];\n return ret;\n};\n\nexport function __wbg_get_7d8b665fa88606d5() { return handleError(function (arg0, arg1) {\n const ret = arg0.get(arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_get_af9dab7e9603ea93() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(arg0, arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {\n const ret = arg0[arg1];\n return ret;\n};\n\nexport function __wbg_global_e78add1f0bdfe974(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_6af68133e0cdd5f8() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.index(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments) };\n\nexport function __wbg_indexedDB_121c33bea2560f72() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_indexedDB_23c232e00a1e28ad() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_indexedDB_769a3833286f42f3() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments) };\n\nexport function __wbg_info_ce6bcc489c22f6f0(arg0) {\n console.info(arg0);\n};\n\nexport function __wbg_info_fd876dbb310ad775(arg0, arg1) {\n arg0.info(arg1);\n};\n\nexport function __wbg_instanceof_ArrayBuffer_f3320d2419cd0355(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_CursorSys_383984afc1fa1bbc(arg0) {\n let result;\n try {\n result = arg0 instanceof IDBCursorWithValue;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_DomException_d430cd4fb5284a83(arg0) {\n let result;\n try {\n result = arg0 instanceof DOMException;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_Error_3443650560328fa9(arg0) {\n let result;\n try {\n result = arg0 instanceof Error;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_IdbCursor_5641812dc2120a05(arg0) {\n let result;\n try {\n result = arg0 instanceof IDBCursor;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_IdbDatabase_f4e157055e32c479(arg0) {\n let result;\n try {\n result = arg0 instanceof IDBDatabase;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_IdbOpenDbRequest_e4a587961e53201e(arg0) {\n let result;\n try {\n result = arg0 instanceof IDBOpenDBRequest;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_IdbRequest_9000a361b4bf0dc6(arg0) {\n let result;\n try {\n result = arg0 instanceof IDBRequest;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n};\n\nexport function __wbg_instanceof_Map_084be8da74364158(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_eca6c43a2610558d(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_da54ccc9d3e09434(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_51fd9e6422c0a395(arg0) {\n const ret = Array.isArray(arg0);\n return ret;\n};\n\nexport function __wbg_isArray_ca6bc609f742df3f(arg0) {\n const ret = Array.isArray(arg0);\n return ret;\n};\n\nexport function __wbg_isSafeInteger_ae7d3f054d55fa16(arg0) {\n const ret = Number.isSafeInteger(arg0);\n return ret;\n};\n\nexport function __wbg_item_fa6253e690a05e50(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_27b7c8b35ab3e86b() {\n const ret = Symbol.iterator;\n return ret;\n};\n\nexport function __wbg_key_5ffb2273b5ffc24a() { 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_22ac23eaec9d8053(arg0) {\n const ret = arg0.length;\n return ret;\n};\n\nexport function __wbg_length_9b7368e374b28279(arg0) {\n const ret = arg0.length;\n return ret;\n};\n\nexport function __wbg_length_d45040a40c570362(arg0) {\n const ret = arg0.length;\n return ret;\n};\n\nexport function __wbg_lowerBound_13747835b262040c() { 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_0305fa7903f4b3d9(arg0) {\n const ret = arg0.message;\n return ret;\n};\n\nexport function __wbg_message_a4e9a39ee8f92b17(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_9136863a055402ff(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_1ba21ce319a06297() {\n const ret = new Object();\n return ret;\n};\n\nexport function __wbg_new_25f239778d6112b9() {\n const ret = new Array();\n return ret;\n};\n\nexport function __wbg_new_6421f6084cc5bc5a(arg0) {\n const ret = new Uint8Array(arg0);\n return ret;\n};\n\nexport function __wbg_new_746bb58304020083(arg0) {\n const ret = new Set(arg0);\n return ret;\n};\n\nexport function __wbg_new_8a6f238a6ece86ea() {\n const ret = new Error();\n return ret;\n};\n\nexport function __wbg_new_b2db8aa2650f793a(arg0) {\n const ret = new Date(arg0);\n return ret;\n};\n\nexport function __wbg_new_b546ae120718850e() {\n const ret = new Map();\n return ret;\n};\n\nexport function __wbg_new_df1173567d5ff028(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return ret;\n};\n\nexport function __wbg_new_ff12d2b041fb48f1(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 wasm_bindgen__convert__closures_____invoke__h8815fd477ac2dc7f(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_no_args_cb138f77cf6151ee(arg0, arg1) {\n const ret = new Function(getStringFromWasm0(arg0, arg1));\n return ret;\n};\n\nexport function __wbg_new_with_length_30843b434774b4c6(arg0) {\n const ret = new Uint8ClampedArray(arg0 >>> 0);\n return ret;\n};\n\nexport function __wbg_new_with_length_aa5eaf41d35235e5(arg0) {\n const ret = new Uint8Array(arg0 >>> 0);\n return ret;\n};\n\nexport function __wbg_next_138a17bbf04e926c(arg0) {\n const ret = arg0.next;\n return ret;\n};\n\nexport function __wbg_next_3cfe5c0fe2a4cc53() { 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_69d776cd24f5215b() {\n const ret = Date.now();\n return ret;\n};\n\nexport function __wbg_objectStoreNames_90900f9a531513ac(arg0) {\n const ret = arg0.objectStoreNames;\n return ret;\n};\n\nexport function __wbg_objectStore_da9a077b8849dbe9() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments) };\n\nexport function __wbg_oldVersion_2950700d81809b3e(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_065c5304428cc4d8() { return handleError(function (arg0) {\n const ret = arg0.openCursor();\n return ret;\n}, arguments) };\n\nexport function __wbg_openCursor_99b45bb4fa3166ab() { return handleError(function (arg0) {\n const ret = arg0.openCursor();\n return ret;\n}, arguments) };\n\nexport function __wbg_openCursor_c5d6ba9ba92d3ab5() { return handleError(function (arg0, arg1) {\n const ret = arg0.openCursor(arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_open_0d7b85f4c0a38ffe() { 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_2a2740c93beabe29() { 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_a09a54cf72639456() { 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_prototypesetcall_d3dc3532c827f7d3(arg0, arg1, arg2) {\n Uint8ClampedArray.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);\n};\n\nexport function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);\n};\n\nexport function __wbg_push_7d9be8f38fc13975(arg0, arg1) {\n const ret = arg0.push(arg1);\n return ret;\n};\n\nexport function __wbg_put_d40a68e5a8902a46() { 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_9b549dfce8865860(arg0) {\n const ret = arg0.queueMicrotask;\n return ret;\n};\n\nexport function __wbg_queueMicrotask_fca69f5bfad613a5(arg0) {\n queueMicrotask(arg0);\n};\n\nexport function __wbg_randomFillSync_ac0988aba3254290() { return handleError(function (arg0, arg1) {\n arg0.randomFillSync(arg1);\n}, arguments) };\n\nexport function __wbg_readyState_e534bc496011c2fd(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_request_c533970ff464e9b2(arg0) {\n const ret = arg0.request;\n return ret;\n};\n\nexport function __wbg_request_d3cccab75790c6a3(arg0) {\n const ret = arg0.request;\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_fd5bfbaa4ce36e1e(arg0) {\n const ret = Promise.resolve(arg0);\n return ret;\n};\n\nexport function __wbg_result_084f962aedb54250() { 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_7df433eea03a5c14(arg0, arg1, arg2) {\n arg0[arg1 >>> 0] = arg2;\n};\n\nexport function __wbg_set_e2f933902557a0b5(arg0, arg1, arg2) {\n arg0.set(getArrayU8FromWasm0(arg1, arg2));\n};\n\nexport function __wbg_set_efaaf145b9377369(arg0, arg1, arg2) {\n const ret = arg0.set(arg1, arg2);\n return ret;\n};\n\nexport function __wbg_set_onabort_e3f60791db69f136(arg0, arg1) {\n arg0.onabort = arg1;\n};\n\nexport function __wbg_set_oncomplete_e4a04a9244826e8b(arg0, arg1) {\n arg0.oncomplete = arg1;\n};\n\nexport function __wbg_set_onerror_08fecec3bdc9d24d(arg0, arg1) {\n arg0.onerror = arg1;\n};\n\nexport function __wbg_set_onerror_e6509e1998f7da91(arg0, arg1) {\n arg0.onerror = arg1;\n};\n\nexport function __wbg_set_onsuccess_94332a00452de699(arg0, arg1) {\n arg0.onsuccess = arg1;\n};\n\nexport function __wbg_set_onupgradeneeded_3dc6e233a6d13fe2(arg0, arg1) {\n arg0.onupgradeneeded = arg1;\n};\n\nexport function __wbg_set_unique_3dd7b4ef717ec230(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_769e6b65d6557335() {\n const ret = typeof global === 'undefined' ? null : global;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1() {\n const ret = typeof globalThis === 'undefined' ? null : globalThis;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_static_accessor_SELF_08f5a74c69739274() {\n const ret = typeof self === 'undefined' ? null : self;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_static_accessor_WINDOW_a8924b26aa92d024() {\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_655a6390e1f5eb6b() { return handleError(function (arg0) {\n const ret = JSON.stringify(arg0);\n return ret;\n}, arguments) };\n\nexport function __wbg_subarray_845f2f5bce7d061a(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n};\n\nexport function __wbg_target_0e3e05a6263c37a0(arg0) {\n const ret = arg0.target;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_then_429f7caf1026411d(arg0, arg1, arg2) {\n const ret = arg0.then(arg1, arg2);\n return ret;\n};\n\nexport function __wbg_then_4f95312d68691235(arg0, arg1) {\n const ret = arg0.then(arg1);\n return ret;\n};\n\nexport function __wbg_toString_f07112df359c997f(arg0) {\n const ret = arg0.toString();\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_257422def49a0094() { 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_transaction_790ec170b8fbc74b() { 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_94648249df85f2b3(arg0) {\n const ret = arg0.transaction;\n return ret;\n};\n\nexport function __wbg_transaction_edb5bc8f37fa6aec(arg0) {\n const ret = arg0.transaction;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n};\n\nexport function __wbg_update_9d3d984f3dbd9e8d() { return handleError(function (arg0, arg1) {\n const ret = arg0.update(arg1);\n return ret;\n}, arguments) };\n\nexport function __wbg_upperBound_91858b3be3dd9f34() { return handleError(function (arg0, arg1) {\n const ret = IDBKeyRange.upperBound(arg0, arg1 !== 0);\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_3ed795eaabbd91d4() { return handleError(function (arg0) {\n const ret = arg0.value;\n return ret;\n}, arguments) };\n\nexport function __wbg_value_57b7b035e117f7ee(arg0) {\n const ret = arg0.value;\n return ret;\n};\n\nexport function __wbg_values_9152c8c1ab032dfa(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_261774ad92018a58(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_6e567d0d926ff881(arg0) {\n console.warn(arg0);\n};\n\nexport function __wbg_warn_d7dd2130cf9e44bb(arg0, arg1) {\n arg0.warn(arg1);\n};\n\nexport function __wbindgen_cast_21f3b7099c9334bc(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 136, function: Function { arguments: [NamedExternref(\"IDBVersionChangeEvent\")], shim_idx: 137, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3add1a2c74cd908e, wasm_bindgen__convert__closures_____invoke__h35b0a77e54c2db90);\n return ret;\n};\n\nexport function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n};\n\nexport function __wbindgen_cast_3d323378c35251b8(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 121, function: Function { arguments: [NamedExternref(\"Event\")], shim_idx: 164, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3f1bc9bbb4835e8f, wasm_bindgen__convert__closures_____invoke__h89fab44ead303aca);\n return ret;\n};\n\nexport function __wbindgen_cast_4625c577ab2ec9ee(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return ret;\n};\n\nexport function __wbindgen_cast_7c76986129f237a3(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 121, function: Function { arguments: [], shim_idx: 122, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3f1bc9bbb4835e8f, wasm_bindgen__convert__closures_____invoke__h22e674b566e32b64);\n return ret;\n};\n\nexport function __wbindgen_cast_9ae0607507abb057(arg0) {\n // Cast intrinsic for `I64 -> Externref`.\n const ret = arg0;\n return ret;\n};\n\nexport function __wbindgen_cast_c415cbf6e3c3f6d4(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { dtor_idx: 121, function: Function { arguments: [Externref], shim_idx: 164, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3f1bc9bbb4835e8f, wasm_bindgen__convert__closures_____invoke__h89fab44ead303aca);\n return ret;\n};\n\nexport function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {\n // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref(\"Uint8Array\")`.\n const ret = getArrayU8FromWasm0(arg0, arg1);\n return ret;\n};\n\nexport function __wbindgen_cast_d6cd19b81560fd6e(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return ret;\n};\n\nexport function __wbindgen_cast_e481686c74984159(arg0, arg1) {\n var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();\n wasm.__wbindgen_free(arg0, arg1 * 4, 4);\n // Cast intrinsic for `Vector(Externref) -> Externref`.\n const ret = v0;\n return ret;\n};\n\nexport function __wbindgen_init_externref_table() {\n const table = wasm.__wbindgen_externrefs;\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","// 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","import _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/** State of the verification of the device. */\nexport var DeviceVerification = /*#__PURE__*/function (DeviceVerification) {\n DeviceVerification[DeviceVerification[\"Blocked\"] = -1] = \"Blocked\";\n DeviceVerification[DeviceVerification[\"Unverified\"] = 0] = \"Unverified\";\n DeviceVerification[DeviceVerification[\"Verified\"] = 1] = \"Verified\";\n return DeviceVerification;\n}({});\n\n/** A map from user ID to device ID to Device */\n\n/**\n * Information on a user's device, as returned by {@link crypto-api!CryptoApi.getUserDeviceInfo}.\n */\nexport class Device {\n constructor(opts) {\n /** id of the device */\n _defineProperty(this, \"deviceId\", void 0);\n /** id of the user that owns the device */\n _defineProperty(this, \"userId\", void 0);\n /** list of algorithms supported by this device */\n _defineProperty(this, \"algorithms\", void 0);\n /** a map from `<key type>:<id> -> <base64-encoded key>` */\n _defineProperty(this, \"keys\", void 0);\n /** whether the device has been verified/blocked by the user */\n _defineProperty(this, \"verified\", void 0);\n /** a map `<userId, map<algorithm:device_id, signature>>` */\n _defineProperty(this, \"signatures\", void 0);\n /** display name of the device */\n _defineProperty(this, \"displayName\", void 0);\n /** whether the device is a dehydrated device */\n _defineProperty(this, \"dehydrated\", false);\n this.deviceId = opts.deviceId;\n this.userId = opts.userId;\n this.algorithms = opts.algorithms;\n this.keys = opts.keys;\n this.verified = opts.verified || DeviceVerification.Unverified;\n this.signatures = opts.signatures || new Map();\n this.displayName = opts.displayName;\n this.dehydrated = !!opts.dehydrated;\n }\n\n /**\n * Get the fingerprint for this device (ie, the Ed25519 key)\n *\n * @returns base64-encoded fingerprint of this device\n */\n getFingerprint() {\n return this.keys.get(\"ed25519:\".concat(this.deviceId));\n }\n\n /**\n * Get the identity key for this device (ie, the Curve25519 key)\n *\n * @returns base64-encoded identity key of this device\n */\n getIdentityKey() {\n return this.keys.get(\"curve25519:\".concat(this.deviceId));\n }\n}\n//# sourceMappingURL=device.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","/*\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\n/*\n * This file is a secondary entrypoint for the js-sdk library, for use by Typescript projects.\n * It exposes low-level types and interfaces reflecting structures defined in the Matrix specification.\n *\n * Remember to only export *public* types from this file.\n */\n\nexport * from \"./@types/membership.js\";\n/** The different methods for device and user verification */\nexport var VerificationMethod = /*#__PURE__*/function (VerificationMethod) {\n /** Short authentication string (emoji or decimals).\n *\n * @see https://spec.matrix.org/v1.9/client-server-api/#short-authentication-string-sas-verification\n */\n VerificationMethod[\"Sas\"] = \"m.sas.v1\";\n /**\n * Verification by showing a QR code which is scanned by the other device.\n *\n * @see https://spec.matrix.org/v1.9/client-server-api/#qr-codes\n */\n VerificationMethod[\"ShowQrCode\"] = \"m.qr_code.show.v1\";\n /**\n * Verification by scanning a QR code that is shown by the other device.\n *\n * @see https://spec.matrix.org/v1.9/client-server-api/#qr-codes\n */\n VerificationMethod[\"ScanQrCode\"] = \"m.qr_code.scan.v1\";\n /**\n * Verification by confirming that we have scanned a QR code.\n *\n * @see https://spec.matrix.org/v1.9/client-server-api/#qr-codes\n */\n VerificationMethod[\"Reciprocate\"] = \"m.reciprocate.v1\";\n return VerificationMethod;\n}({});\n//# sourceMappingURL=types.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 successes = 0;\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 successes++;\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 // If we successfully handled any requests this time, more may have been queued as\n // part of that handling.\n //\n // For example, we may have processed a `/keys/claim` request, which\n // meant the rust side could establish an Olm session and is now ready to\n // send out an `m.secret.send` message.\n // (See https://github.com/element-hq/element-web/issues/30988.)\n //\n // So, if we have successfully processed any requests, flag that we need to make another\n // pass around the outgoing-requests loop, to make sure we handle any\n // pending requests immediately.\n //\n // If all requests failed (or there weren't any) we don't want to retry them in a tight\n // loop. They will be retried after the next sync.\n // (See https://github.com/element-hq/element-web/issues/31790.)\n if (successes > 0) {\n // We call doProcessOutgoingRequests but since we expect that we are\n // already processing outgoing requests, this call will not kick off\n // the processing loop, but just set `nextLoopDeferred` and return,\n // which will mean we loop one more time.\n _this2.doProcessOutgoingRequests().catch(e => {\n _this2.logger.warn(\"processOutgoingRequests: Error re-checking outgoing requests\", e);\n });\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 { 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 /** mapping of room ID -> inviter ID for rooms pending MSC4268 key bundles */\n _defineProperty(this, \"roomsPendingKeyBundles\", new Map());\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\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 false;\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 return true;\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend.markRoomAsPendingKeyBundle}.\n */\n markRoomAsPendingKeyBundle(roomId, inviter) {\n this.roomsPendingKeyBundles.set(roomId, inviter);\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 return (yield _this24.getSecretStorageStatus()).ready;\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getSecretStorageStatus}\n */\n getSecretStorageStatus() {\n var _this25 = 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 _this25.backupManager.getActiveBackupVersion()) != null;\n if (keyBackupEnabled) {\n secretsToCheck.push(\"m.megolm_backup.v1\");\n }\n var defaultKeyId = yield _this25.secretStorage.getDefaultKeyId();\n var result = {\n // Assume we have all secrets until proven otherwise\n ready: true,\n defaultKeyId,\n secretStorageKeyValidityMap: {}\n };\n for (var secretName of secretsToCheck) {\n // Check which keys this particular secret is encrypted with\n var record = (yield _this25.secretStorage.isStored(secretName)) || {};\n\n // If it's encrypted with the right key, it is valid\n var secretStored = !!defaultKeyId && defaultKeyId in record;\n result.secretStorageKeyValidityMap[secretName] = secretStored;\n result.ready = result.ready && secretStored;\n }\n return result;\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#bootstrapSecretStorage}\n */\n bootstrapSecretStorage() {\n var _arguments5 = arguments,\n _this26 = 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 _this26.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 _this26.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 _this26.addSecretStorageKeyToSecretStorage(recoveryKey);\n }\n var crossSigningPrivateKeys = yield _this26.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(_this26.secretStorage)))) {\n _this26.logger.info(\"bootstrapSecretStorage: cross-signing keys not yet exported; doing so now.\");\n yield _this26.secretStorage.store(\"m.cross_signing.master\", crossSigningPrivateKeys.masterKey);\n yield _this26.secretStorage.store(\"m.cross_signing.user_signing\", crossSigningPrivateKeys.userSigningKey);\n yield _this26.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 _this26.saveBackupKeyToStorage();\n } else {\n yield _this26.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 _this27 = this;\n return _asyncToGenerator(function* () {\n var keyBackupInfo = yield _this27.backupManager.getServerBackupInfo();\n if (!keyBackupInfo || !keyBackupInfo.version) {\n _this27.logger.info(\"Not saving backup key to secret storage: no backup info\");\n return;\n }\n var backupKeys = yield _this27.olmMachine.getBackupKeys();\n if (!backupKeys.decryptionKey) {\n _this27.logger.info(\"Not saving backup key to secret storage: no backup key\");\n return;\n }\n if (!decryptionKeyMatchesKeyBackupInfo(backupKeys.decryptionKey, keyBackupInfo)) {\n _this27.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 _this27.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 _this28 = this;\n return _asyncToGenerator(function* () {\n var _secretStorageKey$key, _secretStorageKey$key2, _this28$cryptoCallbac, _this28$cryptoCallbac2;\n var secretStorageKeyObject = yield _this28.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 _this28.secretStorage.setDefaultKeyId(secretStorageKeyObject.keyId);\n (_this28$cryptoCallbac = (_this28$cryptoCallbac2 = _this28.cryptoCallbacks).cacheSecretStorageKey) === null || _this28$cryptoCallbac === void 0 || _this28$cryptoCallbac.call(_this28$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 _this29 = this;\n return _asyncToGenerator(function* () {\n // See if we already have an AES secret-storage key.\n var secretStorageKeyTuple = yield _this29.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 _this30 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this30.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(_this30.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(_this30.secretStorage);\n var crossSigningStatus = yield _this30.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 _this31 = 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, _this31.RECOVERY_KEY_DERIVATION_ITERATIONS);\n return {\n keyInfo: {\n passphrase: {\n algorithm: \"m.pbkdf2\",\n iterations: _this31.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 _this32 = this;\n return _asyncToGenerator(function* () {\n return _this32.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 _this33 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this33.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 = _this33._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 _this33.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 _this33.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 _this34 = 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 _this34.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 _this35 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this35.olmMachine.getIdentity(new RustSdkCryptoJs.UserId(_this35.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(_this35._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n yield _this35.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n return _this35.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 _this36 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this36.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(_this36._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n yield _this36.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n return _this36.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 _this37 = this;\n return _asyncToGenerator(function* () {\n var backupKeys = yield _this37.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 _this38 = this;\n return _asyncToGenerator(function* () {\n var base64Key = encodeBase64(key);\n if (!version) {\n throw new Error(\"storeSessionBackupPrivateKey: version is required\");\n }\n yield _this38.backupManager.saveBackupDecryptionKey(RustSdkCryptoJs.BackupDecryptionKey.fromBase64(base64Key), version);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#loadSessionBackupPrivateKeyFromSecretStorage}.\n */\n loadSessionBackupPrivateKeyFromSecretStorage() {\n var _this39 = this;\n return _asyncToGenerator(function* () {\n var backupKey = yield _this39.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 _this39.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 _this39.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 _this40 = this;\n return _asyncToGenerator(function* () {\n return yield _this40.backupManager.getActiveBackupVersion();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getKeyBackupInfo}.\n */\n getKeyBackupInfo() {\n var _this41 = this;\n return _asyncToGenerator(function* () {\n return (yield _this41.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 _this42 = this;\n return _asyncToGenerator(function* () {\n return yield _this42.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 _this43 = this;\n return _asyncToGenerator(function* () {\n return yield _this43.backupManager.checkKeyBackupAndEnable(true);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#deleteKeyBackupVersion}.\n */\n deleteKeyBackupVersion(version) {\n var _this44 = this;\n return _asyncToGenerator(function* () {\n yield _this44.backupManager.deleteKeyBackupVersion(version);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#resetKeyBackup}.\n */\n resetKeyBackup() {\n var _this45 = this;\n return _asyncToGenerator(function* () {\n var backupInfo = yield _this45.backupManager.setupKeyBackup(o => _this45.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 _this45.secretStorageHasAESKey()) {\n yield _this45.secretStorage.store(\"m.megolm_backup.v1\", backupInfo.decryptionKey.toBase64());\n }\n\n // we can check and start async\n _this45.checkKeyBackupAndEnable();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#disableKeyStorage}.\n */\n disableKeyStorage() {\n var _this46 = this;\n return _asyncToGenerator(function* () {\n // Get the key backup version we're using\n var info = yield _this46.getKeyBackupInfo();\n if (info !== null && info !== void 0 && info.version) {\n yield _this46.deleteKeyBackupVersion(info.version);\n } else {\n _this46.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 _this46.deleteSecretStorage();\n yield _this46.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 _this47 = 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(_this47.userId) || {};\n var canonalizedJson = anotherjson.stringify(obj);\n var signatures = yield _this47.olmMachine.sign(canonalizedJson);\n var map = JSON.parse(signatures.asJSON());\n sigs.set(_this47.userId, _objectSpread(_objectSpread({}, userSignatures), map[_this47.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 _this48 = this;\n return _asyncToGenerator(function* () {\n var backupInfo = yield _this48.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 _this48.storeSessionBackupPrivateKey(privateKey, backupInfo.version);\n return _this48.restoreKeyBackup(opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#restoreKeyBackup}.\n */\n restoreKeyBackup(opts) {\n var _this49 = this;\n return _asyncToGenerator(function* () {\n // Get the decryption key from the crypto store\n var backupKeys = yield _this49.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 _this49.backupManager.requestKeyBackupVersion(backupVersion);\n if (!backupInfo) throw new Error(\"Backup version to restore \".concat(backupVersion, \" not found on server\"));\n var backupDecryptor = yield _this49.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 _this49.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 _this50 = this;\n return _asyncToGenerator(function* () {\n return yield _this50.dehydratedDeviceManager.isSupported();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#startDehydration}.\n */\n startDehydration() {\n var _arguments6 = arguments,\n _this51 = this;\n return _asyncToGenerator(function* () {\n var opts = _arguments6.length > 0 && _arguments6[0] !== undefined ? _arguments6[0] : {};\n if (!(yield _this51.isCrossSigningReady()) || !(yield _this51.isSecretStorageReady())) {\n throw new Error(\"Device dehydration requires cross-signing and secret storage to be set up\");\n }\n return yield _this51.dehydratedDeviceManager.start(opts || {});\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#importSecretsBundle}.\n */\n importSecretsBundle(secrets) {\n var _this52 = this;\n return _asyncToGenerator(function* () {\n var secretsBundle = RustSdkCryptoJs.SecretsBundle.from_json(secrets);\n yield _this52.getOlmMachineOrThrow().importSecretsBundle(secretsBundle); // this method frees the SecretsBundle\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#exportSecretsBundle}.\n */\n exportSecretsBundle() {\n var _this53 = this;\n return _asyncToGenerator(function* () {\n var secretsBundle = yield _this53.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 _this54 = this;\n return _asyncToGenerator(function* () {\n var logger = new LogSpan(_this54.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 _this54.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 _this54.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 _this54.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 _this55 = this;\n return _asyncToGenerator(function* () {\n _this55.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 _this55.dehydratedDeviceManager.delete();\n\n // Disable backup, and delete all the backups from the server\n yield _this55.backupManager.deleteAllKeyBackupVersions();\n yield _this55.deleteSecretStorage();\n\n // Reset the cross-signing keys\n yield _this55.crossSigningIdentity.bootstrapCrossSigning({\n setupNewCrossSigning: true,\n authUploadDeviceSigningKeys\n });\n\n // Create a new key backup\n yield _this55.resetKeyBackup();\n _this55.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 _this56 = this;\n return _asyncToGenerator(function* () {\n // Remove the stored secrets in the secret storage\n yield _this56.secretStorage.store(\"m.cross_signing.master\", null);\n yield _this56.secretStorage.store(\"m.cross_signing.self_signing\", null);\n yield _this56.secretStorage.store(\"m.cross_signing.user_signing\", null);\n yield _this56.secretStorage.store(\"m.megolm_backup.v1\", null);\n\n // Remove the recovery key\n var defaultKeyId = yield _this56.secretStorage.getDefaultKeyId();\n if (defaultKeyId) yield _this56.secretStorage.store(\"m.secret_storage.key.\".concat(defaultKeyId), null);\n // Disable the recovery key and the secret storage\n yield _this56.secretStorage.setDefaultKeyId(null);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#shareRoomHistoryWithUser}.\n */\n shareRoomHistoryWithUser(roomId, userId) {\n var _this57 = this;\n return _asyncToGenerator(function* () {\n var logger = new LogSpan(_this57.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 _this57.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 _this57.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 _this57.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 = _this57.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(userId)]);\n yield _this57.outgoingRequestProcessor.makeOutgoingRequest(req);\n\n // 4. Establish Olm sessions with all of the recipient's devices.\n yield _this57.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 _this57.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 _this57.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 _this58 = 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 _this58.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 _this59 = 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 _this59.receiveSyncChanges({\n events\n });\n var received = [];\n var _loop = function* _loop() {\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 _this59.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\n // If we have received a room key bundle message, and have previously marked the room\n // IDs it references as pending key bundles, tell the Rust SDK to try and accept it,\n // just in case it was received after invite.\n //\n // We don't actually need to validate the contents of the bundle message, or do\n // anything with its contents at all. We simply want to inform the Rust SDK we have\n // received a new room key bundle that we might be able to download.\n if (isRoomKeyBundleMessage(parsedMessage) && _this59.roomsPendingKeyBundles.has(parsedMessage.content.room_id)) {\n // No `await`-ing here, as this is called from inside the `/sync` loop.\n _this59.maybeAcceptKeyBundle(parsedMessage.content.room_id, _this59.roomsPendingKeyBundles.get(parsedMessage.content.room_id)).then(success => {\n if (success) {\n _this59.roomsPendingKeyBundles.delete(parsedMessage.content.room_id);\n }\n }, err => {\n _this59.logger.error(\"Error attempting to download key bundle for room \".concat(parsedMessage.content.room_id));\n _this59.logger.error(err);\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 for (var message of processed) {\n yield* _loop();\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 _this60 = 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 _this60.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 _this61 = 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 _this61.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 _this62 = 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 _this62.logger.warn(\"Room \".concat(room.roomId, \": ignoring crypto event with invalid algorithm \").concat(config.algorithm));\n return;\n }\n if (config[\"io.element.msc4362.encrypt_state_events\"] && _this62.enableEncryptedStateEvents) {\n _this62.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 _this62.olmMachine.setRoomSettings(new RustSdkCryptoJs.RoomId(room.roomId), settings);\n } catch (e) {\n _this62.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 = _this62.roomEncryptors[room.roomId];\n if (existingEncryptor) {\n existingEncryptor.onCryptoEvent(config);\n } else {\n _this62.roomEncryptors[room.roomId] = new RoomEncryptor(_this62.logger.getChild(\"[\".concat(room.roomId, \" encryption]\")), _this62.olmMachine, _this62.keyClaimManager, _this62.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 _this63 = this;\n return _asyncToGenerator(function* () {\n yield _this63.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 _this64 = this;\n return _asyncToGenerator(function* () {\n for (var key of keys) {\n _this64.onRoomKeyUpdated(key);\n }\n _this64.backupManager.maybeUploadKey();\n })();\n }\n onRoomKeyUpdated(key) {\n var _this65 = 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 _loop2 = function _loop2(ev) {\n ev.attemptDecryption(_this65, {\n isRetry: true\n }).catch(_e => {\n _this65.logger.info(\"Still unable to decrypt event \".concat(ev.getId(), \" after receiving key\"));\n });\n };\n for (var ev of pendingList) {\n _loop2(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 _this66 = this;\n return _asyncToGenerator(function* () {\n for (var session of withheld) {\n _this66.logger.debug(\"Got withheld message for session \".concat(session.sessionId, \" in \").concat(session.roomId.toString()));\n var pendingList = _this66.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 _this66.logger.debug(\"Retrying decryption on events:\", pendingList.map(e => \"\".concat(e.getId())));\n for (var ev of pendingList) {\n ev.attemptDecryption(_this66, {\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 _this67 = this;\n return _asyncToGenerator(function* () {\n var newVerification = yield _this67.getUserVerificationStatus(userId.toString());\n _this67.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() === _this67.userId) {\n _this67.emit(CryptoEvent.KeysChanged, {});\n yield _this67.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 _this68 = this;\n return _asyncToGenerator(function* () {\n _this68.emit(CryptoEvent.WillUpdateDevices, userIds, false);\n _this68.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 _this69 = this;\n return _asyncToGenerator(function* () {\n _this69.logger.debug(\"onReceiveSecret: Received secret \".concat(name));\n if (name === \"m.megolm_backup.v1\") {\n return yield _this69.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 _this70 = this;\n return _asyncToGenerator(function* () {\n var pendingValues = yield _this70.olmMachine.getSecretsFromInbox(name);\n for (var value of pendingValues) {\n if (yield _this70.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 _this70.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 _this71 = 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 _this71.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 _this72 = this;\n return _asyncToGenerator(function* () {\n var roomId = event.getRoomId();\n var senderId = event.getSender();\n if (!roomId) {\n throw new Error(\"missing roomId in the event\");\n }\n if (!senderId) {\n throw new Error(\"missing sender in the event\");\n }\n _this72.logger.debug(\"Incoming verification event \".concat(event.getId(), \" type \").concat(event.getType(), \" from \").concat(event.getSender()));\n var isRoomVerificationRequest = event.getType() === EventType.RoomMessage && event.getContent().msgtype === MsgType.KeyVerificationRequest;\n if (isRoomVerificationRequest) {\n // Before processing an in-room verification request, we need to\n // make sure we have the sender's device information - otherwise we\n // will immediately abort verification. So we explicitly fetch it\n // from /keys/query and wait for that request to complete before we\n // call receiveVerificationEvent.\n var req = _this72.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(senderId)]);\n yield _this72.outgoingRequestProcessor.makeOutgoingRequest(req);\n }\n yield _this72.getOlmMachineOrThrow().receiveVerificationEvent(JSON.stringify({\n event_id: event.getId(),\n type: event.getType(),\n sender: senderId,\n state_key: event.getStateKey(),\n content: event.getContent(),\n origin_server_ts: event.getTs()\n }), new RustSdkCryptoJs.RoomId(roomId));\n if (isRoomVerificationRequest) {\n _this72.onIncomingKeyVerificationRequest(senderId, event.getId());\n }\n\n // that may have caused us to queue up outgoing requests, so make sure we send them.\n _this72.outgoingRequestsManager.doProcessOutgoingRequests().catch(e => {\n _this72.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 _this73 = this;\n return _asyncToGenerator(function* () {\n return yield _this73.olmMachine.getIdentity(new RustSdkCryptoJs.UserId(_this73.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 _this74 = 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 _this74.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$forwarder;\n var res = yield _this74.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 _this74.removeEventFromPendingList(event);\n return {\n clearEvent: JSON.parse(res.event),\n claimedEd25519Key: res.senderClaimedEd25519Key,\n senderCurve25519Key: res.senderCurve25519Key,\n keyForwardedBy: (_res$forwarder = res.forwarder) === null || _res$forwarder === void 0 ? void 0 : _res$forwarder.toString()\n };\n } catch (err) {\n if (err instanceof RustSdkCryptoJs.MegolmDecryptionError) {\n _this74.onMegolmDecryptionError(event, err, yield _this74.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 _this75 = 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 _this75.olmMachine.getRoomEventEncryptionInfo(stringifyEvent(event), new RustSdkCryptoJs.RoomId(event.getRoomId()));\n return rustEncryptionInfoToJsEncryptionInfo(_this75.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.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/**\n * Determines if the given payload is a RoomKeyBundleMessage.\n *\n * A RoomKeyBundleMessage is identified by having a specific message type\n * (\"io.element.msc4268.room_key_bundle\") and a valid room_id in its content.\n *\n * @param message - The received to-device message to check.\n * @returns True if the payload matches the RoomKeyBundleMessage structure, false otherwise.\n */\nfunction isRoomKeyBundleMessage(message) {\n return message.type === \"io.element.msc4268.room_key_bundle\" && typeof message.content.room_id === \"string\";\n}\n//# sourceMappingURL=rust-crypto.js.map","/*\nCopyright 2021 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 * Internal module. Definitions for storage for the crypto module\n */\n\n/**\n * Abstraction of things that can store data required for end-to-end encryption\n */\n\n/** Data on a Megolm session */\n\n/** Extended data on a Megolm session */\n\n/** Data on an Olm session */\n\n/**\n * Represents an outgoing room key request\n */\n\n/**\n * Keys for the `account` object store to store the migration state.\n * Values are defined in `MigrationState`.\n * @internal\n */\nexport var ACCOUNT_OBJECT_KEY_MIGRATION_STATE = \"migrationState\";\n\n/**\n * A record of which steps have been completed in the libolm to Rust Crypto migration.\n *\n * Used by {@link CryptoStore#getMigrationState} and {@link CryptoStore#setMigrationState}.\n *\n * @internal\n */\nexport var MigrationState = /*#__PURE__*/function (MigrationState) {\n /** No migration steps have yet been completed. */\n MigrationState[MigrationState[\"NOT_STARTED\"] = 0] = \"NOT_STARTED\";\n /** We have migrated the account data, cross-signing keys, etc. */\n MigrationState[MigrationState[\"INITIAL_DATA_MIGRATED\"] = 1] = \"INITIAL_DATA_MIGRATED\";\n /** INITIAL_DATA_MIGRATED, and in addition, we have migrated all the Olm sessions. */\n MigrationState[MigrationState[\"OLM_SESSIONS_MIGRATED\"] = 2] = \"OLM_SESSIONS_MIGRATED\";\n /** OLM_SESSIONS_MIGRATED, and in addition, we have migrated all the Megolm sessions. */\n MigrationState[MigrationState[\"MEGOLM_SESSIONS_MIGRATED\"] = 3] = \"MEGOLM_SESSIONS_MIGRATED\";\n /** MEGOLM_SESSIONS_MIGRATED, and in addition, we have migrated all the room settings. */\n MigrationState[MigrationState[\"ROOM_SETTINGS_MIGRATED\"] = 4] = \"ROOM_SETTINGS_MIGRATED\";\n /** ROOM_SETTINGS_MIGRATED, and in addition, we have done the first own keys query in order to\n * load the public part of the keys that have been migrated */\n MigrationState[MigrationState[\"INITIAL_OWN_KEY_QUERY_DONE\"] = 5] = \"INITIAL_OWN_KEY_QUERY_DONE\";\n return MigrationState;\n}({});\n\n/**\n * The size of batches to be returned by {@link CryptoStore#getEndToEndSessionsBatch} and\n * {@link CryptoStore#getEndToEndInboundGroupSessionsBatch}.\n */\nexport var SESSION_BATCH_SIZE = 50;\n\n/* eslint-disable camelcase */\n\n/* eslint-enable camelcase */\n\nexport var TrackingStatus = /*#__PURE__*/function (TrackingStatus) {\n TrackingStatus[TrackingStatus[\"NotTracked\"] = 0] = \"NotTracked\";\n TrackingStatus[TrackingStatus[\"PendingDownload\"] = 1] = \"PendingDownload\";\n TrackingStatus[TrackingStatus[\"DownloadInProgress\"] = 2] = \"DownloadInProgress\";\n TrackingStatus[TrackingStatus[\"UpToDate\"] = 3] = \"UpToDate\";\n return TrackingStatus;\n}({});\n\n/**\n * possible states for a room key request\n *\n * The state machine looks like:\n * ```\n *\n * | (cancellation sent)\n * | .-------------------------------------------------.\n * | | |\n * V V (cancellation requested) |\n * UNSENT -----------------------------+ |\n * | | |\n * | | |\n * | (send successful) | CANCELLATION_PENDING_AND_WILL_RESEND\n * V | Λ\n * SENT | |\n * |-------------------------------- | --------------'\n * | | (cancellation requested with intent\n * | | to resend the original request)\n * | |\n * | (cancellation requested) |\n * V |\n * CANCELLATION_PENDING |\n * | |\n * | (cancellation sent) |\n * V |\n * (deleted) <---------------------------+\n * ```\n */\nexport var RoomKeyRequestState = /*#__PURE__*/function (RoomKeyRequestState) {\n /** request not yet sent */\n RoomKeyRequestState[RoomKeyRequestState[\"Unsent\"] = 0] = \"Unsent\";\n /** request sent, awaiting reply */\n RoomKeyRequestState[RoomKeyRequestState[\"Sent\"] = 1] = \"Sent\";\n /** reply received, cancellation not yet sent */\n RoomKeyRequestState[RoomKeyRequestState[\"CancellationPending\"] = 2] = \"CancellationPending\";\n /**\n * Cancellation not yet sent and will transition to UNSENT instead of\n * being deleted once the cancellation has been sent.\n */\n RoomKeyRequestState[RoomKeyRequestState[\"CancellationPendingAndWillResend\"] = 3] = \"CancellationPendingAndWillResend\";\n return RoomKeyRequestState;\n}({});\n\n/* eslint-disable camelcase */\n\n/**\n * The parameters of a room key request. The details of the request may\n * vary with the crypto algorithm, but the management and storage layers for\n * outgoing requests expect it to have 'room_id' and 'session_id' properties.\n */\n\n/* eslint-enable camelcase */\n\n/** State of the verification of the device. */\nexport var DeviceVerification = /*#__PURE__*/function (DeviceVerification) {\n DeviceVerification[DeviceVerification[\"Blocked\"] = -1] = \"Blocked\";\n DeviceVerification[DeviceVerification[\"Unverified\"] = 0] = \"Unverified\";\n DeviceVerification[DeviceVerification[\"Verified\"] = 1] = \"Verified\";\n return DeviceVerification;\n}({});\n//# sourceMappingURL=base.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 2017 - 2021 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 { safeSet } from \"../../utils.js\";\nimport { MigrationState, SESSION_BATCH_SIZE } from \"./base.js\";\nfunction encodeSessionKey(senderCurve25519Key, sessionId) {\n return encodeURIComponent(senderCurve25519Key) + \"/\" + encodeURIComponent(sessionId);\n}\nfunction decodeSessionKey(key) {\n var keyParts = key.split(\"/\");\n var senderKey = decodeURIComponent(keyParts[0]);\n var sessionId = decodeURIComponent(keyParts[1]);\n return {\n senderKey,\n sessionId\n };\n}\n\n/**\n * Internal module. in-memory storage for e2e.\n */\n\nexport class MemoryCryptoStore {\n constructor() {\n _defineProperty(this, \"migrationState\", MigrationState.NOT_STARTED);\n _defineProperty(this, \"account\", null);\n _defineProperty(this, \"crossSigningKeys\", null);\n _defineProperty(this, \"privateKeys\", {});\n _defineProperty(this, \"sessions\", {});\n _defineProperty(this, \"inboundGroupSessions\", {});\n _defineProperty(this, \"inboundGroupSessionsWithheld\", {});\n // Opaque device data object\n _defineProperty(this, \"rooms\", {});\n _defineProperty(this, \"sessionsNeedingBackup\", {});\n }\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Implementation of {@link CryptoStore.containsData}.\n *\n * @internal\n */\n containsData() {\n var _this = this;\n return _asyncToGenerator(function* () {\n // If it contains anything, it should contain an account.\n return _this.account !== null;\n })();\n }\n\n /**\n * Ensure the database exists and is up-to-date.\n *\n * This must be called before the store can be used.\n *\n * @returns resolves to the store.\n */\n startup() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // No startup work to do for the memory store.\n return _this2;\n })();\n }\n\n /**\n * Delete all data from this store.\n *\n * @returns Promise which resolves when the store has been cleared.\n */\n deleteAllData() {\n return Promise.resolve();\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n *\n * @internal\n */\n getMigrationState() {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n return _this3.migrationState;\n })();\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n *\n * @internal\n */\n setMigrationState(migrationState) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n _this4.migrationState = migrationState;\n })();\n }\n\n // Olm Account\n\n getAccount(txn, func) {\n func(this.account);\n }\n storeAccount(txn, accountPickle) {\n this.account = accountPickle;\n }\n getCrossSigningKeys(txn, func) {\n func(this.crossSigningKeys);\n }\n getSecretStorePrivateKey(txn, func, type) {\n var result = this.privateKeys[type];\n func(result || null);\n }\n storeSecretStorePrivateKey(txn, type, key) {\n this.privateKeys[type] = key;\n }\n\n // Olm Sessions\n\n countEndToEndSessions(txn, func) {\n var count = 0;\n for (var deviceSessions of Object.values(this.sessions)) {\n count += Object.keys(deviceSessions).length;\n }\n func(count);\n }\n getEndToEndSession(deviceKey, sessionId, txn, func) {\n var deviceSessions = this.sessions[deviceKey] || {};\n func(deviceSessions[sessionId] || null);\n }\n getEndToEndSessions(deviceKey, txn, func) {\n func(this.sessions[deviceKey] || {});\n }\n storeEndToEndSession(deviceKey, sessionId, sessionInfo, txn) {\n var deviceSessions = this.sessions[deviceKey];\n if (deviceSessions === undefined) {\n deviceSessions = {};\n this.sessions[deviceKey] = deviceSessions;\n }\n safeSet(deviceSessions, sessionId, sessionInfo);\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n *\n * @internal\n */\n getEndToEndSessionsBatch() {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n var result = [];\n for (var deviceSessions of Object.values(_this5.sessions)) {\n for (var session of Object.values(deviceSessions)) {\n result.push(session);\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n })();\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n for (var {\n deviceKey,\n sessionId\n } of sessions) {\n var deviceSessions = _this6.sessions[deviceKey] || {};\n delete deviceSessions[sessionId];\n if (Object.keys(deviceSessions).length === 0) {\n // No more sessions for this device.\n delete _this6.sessions[deviceKey];\n }\n }\n })();\n }\n\n // Inbound Group Sessions\n\n getEndToEndInboundGroupSession(senderCurve25519Key, sessionId, txn, func) {\n var k = encodeSessionKey(senderCurve25519Key, sessionId);\n func(this.inboundGroupSessions[k] || null, this.inboundGroupSessionsWithheld[k] || null);\n }\n storeEndToEndInboundGroupSession(senderCurve25519Key, sessionId, sessionData, txn) {\n var k = encodeSessionKey(senderCurve25519Key, sessionId);\n this.inboundGroupSessions[k] = sessionData;\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions() {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n return Object.keys(_this7.inboundGroupSessions).length;\n })();\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch() {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n var result = [];\n for (var [key, session] of Object.entries(_this8.inboundGroupSessions)) {\n result.push(_objectSpread(_objectSpread({}, decodeSessionKey(key)), {}, {\n sessionData: session,\n needsBackup: key in _this8.sessionsNeedingBackup\n }));\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n })();\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions) {\n var _this9 = this;\n return _asyncToGenerator(function* () {\n for (var {\n senderKey,\n sessionId\n } of sessions) {\n var k = encodeSessionKey(senderKey, sessionId);\n delete _this9.inboundGroupSessions[k];\n }\n })();\n }\n\n // E2E rooms\n\n getEndToEndRooms(txn, func) {\n func(this.rooms);\n }\n markSessionsNeedingBackup(sessions) {\n for (var session of sessions) {\n var sessionKey = encodeSessionKey(session.senderKey, session.sessionId);\n this.sessionsNeedingBackup[sessionKey] = true;\n }\n return Promise.resolve();\n }\n\n // Session key backups\n\n doTxn(mode, stores, func) {\n return Promise.resolve(func(null));\n }\n}\n//# sourceMappingURL=memory-crypto-store.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2017 - 2021 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 { logger } from \"../../logger.js\";\nimport { MemoryCryptoStore } from \"./memory-crypto-store.js\";\nimport { MigrationState, SESSION_BATCH_SIZE } from \"./base.js\";\n/**\n * Internal module. Partial localStorage backed storage for e2e.\n * This is not a full crypto store, just the in-memory store with\n * some things backed by localStorage. It exists because indexedDB\n * is broken in Firefox private mode or set to, \"will not remember\n * history\".\n */\n\nvar E2E_PREFIX = \"crypto.\";\nvar KEY_END_TO_END_MIGRATION_STATE = E2E_PREFIX + \"migration\";\nvar KEY_END_TO_END_ACCOUNT = E2E_PREFIX + \"account\";\nvar KEY_CROSS_SIGNING_KEYS = E2E_PREFIX + \"cross_signing_keys\";\nvar KEY_INBOUND_SESSION_PREFIX = E2E_PREFIX + \"inboundgroupsessions/\";\nvar KEY_INBOUND_SESSION_WITHHELD_PREFIX = E2E_PREFIX + \"inboundgroupsessions.withheld/\";\nvar KEY_ROOMS_PREFIX = E2E_PREFIX + \"rooms/\";\nvar KEY_SESSIONS_NEEDING_BACKUP = E2E_PREFIX + \"sessionsneedingbackup\";\nfunction keyEndToEndSessions(deviceKey) {\n return E2E_PREFIX + \"sessions/\" + deviceKey;\n}\nfunction keyEndToEndInboundGroupSession(senderKey, sessionId) {\n return KEY_INBOUND_SESSION_PREFIX + senderKey + \"/\" + sessionId;\n}\nfunction keyEndToEndInboundGroupSessionWithheld(senderKey, sessionId) {\n return KEY_INBOUND_SESSION_WITHHELD_PREFIX + senderKey + \"/\" + sessionId;\n}\nfunction keyEndToEndRoomsPrefix(roomId) {\n return KEY_ROOMS_PREFIX + roomId;\n}\nexport class LocalStorageCryptoStore extends MemoryCryptoStore {\n static exists(store) {\n var length = store.length;\n for (var i = 0; i < length; i++) {\n var _store$key;\n if ((_store$key = store.key(i)) !== null && _store$key !== void 0 && _store$key.startsWith(E2E_PREFIX)) {\n return true;\n }\n }\n return false;\n }\n constructor(store) {\n super();\n this.store = store;\n }\n\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Implementation of {@link CryptoStore.containsData}.\n *\n * @internal\n */\n containsData() {\n var _this = this;\n return _asyncToGenerator(function* () {\n return LocalStorageCryptoStore.exists(_this.store);\n })();\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n *\n * @internal\n */\n getMigrationState() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n var _getJsonItem;\n return (_getJsonItem = getJsonItem(_this2.store, KEY_END_TO_END_MIGRATION_STATE)) !== null && _getJsonItem !== void 0 ? _getJsonItem : MigrationState.NOT_STARTED;\n })();\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n *\n * @internal\n */\n setMigrationState(migrationState) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n setJsonItem(_this3.store, KEY_END_TO_END_MIGRATION_STATE, migrationState);\n })();\n }\n\n // Olm Sessions\n\n countEndToEndSessions(txn, func) {\n var count = 0;\n for (var i = 0; i < this.store.length; ++i) {\n var key = this.store.key(i);\n if (key !== null && key !== void 0 && key.startsWith(keyEndToEndSessions(\"\"))) {\n var sessions = getJsonItem(this.store, key);\n count += Object.keys(sessions !== null && sessions !== void 0 ? sessions : {}).length;\n }\n }\n func(count);\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n _getEndToEndSessions(deviceKey) {\n var sessions = getJsonItem(this.store, keyEndToEndSessions(deviceKey));\n var fixedSessions = {};\n\n // fix up any old sessions to be objects rather than just the base64 pickle\n for (var [sid, val] of Object.entries(sessions || {})) {\n if (typeof val === \"string\") {\n fixedSessions[sid] = {\n session: val\n };\n } else {\n fixedSessions[sid] = val;\n }\n }\n return fixedSessions;\n }\n getEndToEndSession(deviceKey, sessionId, txn, func) {\n var _sessions$sessionId;\n var sessions = this._getEndToEndSessions(deviceKey);\n func((_sessions$sessionId = sessions[sessionId]) !== null && _sessions$sessionId !== void 0 ? _sessions$sessionId : {});\n }\n getEndToEndSessions(deviceKey, txn, func) {\n var _this$_getEndToEndSes;\n func((_this$_getEndToEndSes = this._getEndToEndSessions(deviceKey)) !== null && _this$_getEndToEndSes !== void 0 ? _this$_getEndToEndSes : {});\n }\n storeEndToEndSession(deviceKey, sessionId, sessionInfo, txn) {\n var sessions = this._getEndToEndSessions(deviceKey) || {};\n sessions[sessionId] = sessionInfo;\n setJsonItem(this.store, keyEndToEndSessions(deviceKey), sessions);\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n *\n * @internal\n */\n getEndToEndSessionsBatch() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n var result = [];\n for (var i = 0; i < _this4.store.length; ++i) {\n var _this4$store$key;\n if ((_this4$store$key = _this4.store.key(i)) !== null && _this4$store$key !== void 0 && _this4$store$key.startsWith(keyEndToEndSessions(\"\"))) {\n var deviceKey = _this4.store.key(i).split(\"/\")[1];\n for (var session of Object.values(_this4._getEndToEndSessions(deviceKey))) {\n result.push(session);\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n }\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n })();\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n for (var {\n deviceKey,\n sessionId\n } of sessions) {\n var deviceSessions = _this5._getEndToEndSessions(deviceKey) || {};\n delete deviceSessions[sessionId];\n if (Object.keys(deviceSessions).length === 0) {\n // No more sessions for this device.\n _this5.store.removeItem(keyEndToEndSessions(deviceKey));\n } else {\n setJsonItem(_this5.store, keyEndToEndSessions(deviceKey), deviceSessions);\n }\n }\n })();\n }\n\n // Inbound Group Sessions\n\n getEndToEndInboundGroupSession(senderCurve25519Key, sessionId, txn, func) {\n func(getJsonItem(this.store, keyEndToEndInboundGroupSession(senderCurve25519Key, sessionId)), getJsonItem(this.store, keyEndToEndInboundGroupSessionWithheld(senderCurve25519Key, sessionId)));\n }\n storeEndToEndInboundGroupSession(senderCurve25519Key, sessionId, sessionData, txn) {\n setJsonItem(this.store, keyEndToEndInboundGroupSession(senderCurve25519Key, sessionId), sessionData);\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions() {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n var count = 0;\n for (var i = 0; i < _this6.store.length; ++i) {\n var key = _this6.store.key(i);\n if (key !== null && key !== void 0 && key.startsWith(KEY_INBOUND_SESSION_PREFIX)) {\n count += 1;\n }\n }\n return count;\n })();\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch() {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n var sessionsNeedingBackup = getJsonItem(_this7.store, KEY_SESSIONS_NEEDING_BACKUP) || {};\n var result = [];\n for (var i = 0; i < _this7.store.length; ++i) {\n var key = _this7.store.key(i);\n if (key !== null && key !== void 0 && key.startsWith(KEY_INBOUND_SESSION_PREFIX)) {\n var key2 = key.slice(KEY_INBOUND_SESSION_PREFIX.length);\n\n // we can't use split, as the components we are trying to split out\n // might themselves contain '/' characters. We rely on the\n // senderKey being a (32-byte) curve25519 key, base64-encoded\n // (hence 43 characters long).\n\n result.push({\n senderKey: key2.slice(0, 43),\n sessionId: key2.slice(44),\n sessionData: getJsonItem(_this7.store, key),\n needsBackup: key2 in sessionsNeedingBackup\n });\n if (result.length >= SESSION_BATCH_SIZE) {\n return result;\n }\n }\n }\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n\n // There are fewer sessions than the batch size; return the final batch of sessions.\n return result;\n })();\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions) {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n for (var {\n senderKey,\n sessionId\n } of sessions) {\n var k = keyEndToEndInboundGroupSession(senderKey, sessionId);\n _this8.store.removeItem(k);\n }\n })();\n }\n getEndToEndRooms(txn, func) {\n var result = {};\n var prefix = keyEndToEndRoomsPrefix(\"\");\n for (var i = 0; i < this.store.length; ++i) {\n var key = this.store.key(i);\n if (key !== null && key !== void 0 && key.startsWith(prefix)) {\n var roomId = key.slice(prefix.length);\n result[roomId] = getJsonItem(this.store, key);\n }\n }\n func(result);\n }\n markSessionsNeedingBackup(sessions) {\n var sessionsNeedingBackup = getJsonItem(this.store, KEY_SESSIONS_NEEDING_BACKUP) || {};\n for (var session of sessions) {\n sessionsNeedingBackup[session.senderKey + \"/\" + session.sessionId] = true;\n }\n setJsonItem(this.store, KEY_SESSIONS_NEEDING_BACKUP, sessionsNeedingBackup);\n return Promise.resolve();\n }\n\n /**\n * Delete all data from this store.\n *\n * @returns Promise which resolves when the store has been cleared.\n */\n deleteAllData() {\n this.store.removeItem(KEY_END_TO_END_ACCOUNT);\n return Promise.resolve();\n }\n\n // Olm account\n\n getAccount(txn, func) {\n var accountPickle = getJsonItem(this.store, KEY_END_TO_END_ACCOUNT);\n func(accountPickle);\n }\n storeAccount(txn, accountPickle) {\n setJsonItem(this.store, KEY_END_TO_END_ACCOUNT, accountPickle);\n }\n getCrossSigningKeys(txn, func) {\n var keys = getJsonItem(this.store, KEY_CROSS_SIGNING_KEYS);\n func(keys);\n }\n getSecretStorePrivateKey(txn, func, type) {\n var key = getJsonItem(this.store, E2E_PREFIX + \"ssss_cache.\".concat(type));\n func(key);\n }\n storeSecretStorePrivateKey(txn, type, key) {\n setJsonItem(this.store, E2E_PREFIX + \"ssss_cache.\".concat(type), key);\n }\n doTxn(mode, stores, func) {\n return Promise.resolve(func(null));\n }\n}\nfunction getJsonItem(store, key) {\n try {\n // if the key is absent, store.getItem() returns null, and\n // JSON.parse(null) === null, so this returns null.\n return JSON.parse(store.getItem(key));\n } catch (e) {\n logger.log(\"Error: Failed to get key %s: %s\", key, e.message);\n logger.log(e.stack);\n }\n return null;\n}\nfunction setJsonItem(store, key, val) {\n store.setItem(key, JSON.stringify(val));\n}\n//# sourceMappingURL=localStorage-crypto-store.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2017 - 2021 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 { logger } from \"../../logger.js\";\nimport { MigrationState, SESSION_BATCH_SIZE, ACCOUNT_OBJECT_KEY_MIGRATION_STATE } from \"./base.js\";\nimport { IndexedDBCryptoStore } from \"./indexeddb-crypto-store.js\";\nvar PROFILE_TRANSACTIONS = false;\n\n/**\n * Implementation of a CryptoStore which is backed by an existing\n * IndexedDB connection. Generally you want IndexedDBCryptoStore\n * which connects to the database and defers to one of these.\n *\n * @internal\n */\nexport class Backend {\n /**\n */\n constructor(db) {\n this.db = db;\n _defineProperty(this, \"nextTxnId\", 0);\n // make sure we close the db on `onversionchange` - otherwise\n // attempts to delete the database will block (and subsequent\n // attempts to re-create it will also block).\n db.onversionchange = () => {\n logger.log(\"versionchange for indexeddb \".concat(this.db.name, \": closing\"));\n db.close();\n };\n }\n containsData() {\n return _asyncToGenerator(function* () {\n throw Error(\"Not implemented for Backend\");\n })();\n }\n startup() {\n var _this = this;\n return _asyncToGenerator(function* () {\n // No work to do, as the startup is done by the caller (e.g IndexedDBCryptoStore)\n // by passing us a ready IDBDatabase instance\n return _this;\n })();\n }\n deleteAllData() {\n return _asyncToGenerator(function* () {\n throw Error(\"This is not implemented, call IDBFactory::deleteDatabase(dbName) instead.\");\n })();\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n */\n getMigrationState() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n var migrationState = MigrationState.NOT_STARTED;\n yield _this2.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], txn => {\n var objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n var getReq = objectStore.get(ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n getReq.onsuccess = () => {\n var _getReq$result;\n migrationState = (_getReq$result = getReq.result) !== null && _getReq$result !== void 0 ? _getReq$result : MigrationState.NOT_STARTED;\n };\n });\n return migrationState;\n })();\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n */\n setMigrationState(migrationState) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n yield _this3.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], txn => {\n var objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n objectStore.put(migrationState, ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n });\n })();\n }\n\n // Olm Account\n\n getAccount(txn, func) {\n var objectStore = txn.objectStore(\"account\");\n var getReq = objectStore.get(\"-\");\n getReq.onsuccess = function () {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n storeAccount(txn, accountPickle) {\n var objectStore = txn.objectStore(\"account\");\n objectStore.put(accountPickle, \"-\");\n }\n getCrossSigningKeys(txn, func) {\n var objectStore = txn.objectStore(\"account\");\n var getReq = objectStore.get(\"crossSigningKeys\");\n getReq.onsuccess = function () {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n getSecretStorePrivateKey(txn, func, type) {\n var objectStore = txn.objectStore(\"account\");\n var getReq = objectStore.get(\"ssss_cache:\".concat(type));\n getReq.onsuccess = function () {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n storeSecretStorePrivateKey(txn, type, key) {\n var objectStore = txn.objectStore(\"account\");\n objectStore.put(key, \"ssss_cache:\".concat(type));\n }\n\n // Olm Sessions\n\n countEndToEndSessions(txn, func) {\n var objectStore = txn.objectStore(\"sessions\");\n var countReq = objectStore.count();\n countReq.onsuccess = function () {\n try {\n func(countReq.result);\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n getEndToEndSessions(deviceKey, txn, func) {\n var objectStore = txn.objectStore(\"sessions\");\n var idx = objectStore.index(\"deviceKey\");\n var getReq = idx.openCursor(deviceKey);\n var results = {};\n getReq.onsuccess = function () {\n var cursor = getReq.result;\n if (cursor) {\n results[cursor.value.sessionId] = {\n session: cursor.value.session,\n lastReceivedMessageTs: cursor.value.lastReceivedMessageTs\n };\n cursor.continue();\n } else {\n try {\n func(results);\n } catch (e) {\n abortWithException(txn, e);\n }\n }\n };\n }\n getEndToEndSession(deviceKey, sessionId, txn, func) {\n var objectStore = txn.objectStore(\"sessions\");\n var getReq = objectStore.get([deviceKey, sessionId]);\n getReq.onsuccess = function () {\n try {\n if (getReq.result) {\n func({\n session: getReq.result.session,\n lastReceivedMessageTs: getReq.result.lastReceivedMessageTs\n });\n } else {\n func(null);\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n storeEndToEndSession(deviceKey, sessionId, sessionInfo, txn) {\n var objectStore = txn.objectStore(\"sessions\");\n objectStore.put({\n deviceKey,\n sessionId,\n session: sessionInfo.session,\n lastReceivedMessageTs: sessionInfo.lastReceivedMessageTs\n });\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n */\n getEndToEndSessionsBatch() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n var result = [];\n yield _this4.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_SESSIONS], txn => {\n var objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_SESSIONS);\n var getReq = objectStore.openCursor();\n getReq.onsuccess = function () {\n try {\n var cursor = getReq.result;\n if (cursor) {\n result.push(cursor.value);\n if (result.length < SESSION_BATCH_SIZE) {\n cursor.continue();\n }\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n });\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n return result;\n })();\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n yield _this5.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_SESSIONS], /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (txn) {\n try {\n var objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_SESSIONS);\n var _loop = function* _loop() {\n var req = objectStore.delete([deviceKey, sessionId]);\n yield new Promise(resolve => {\n req.onsuccess = resolve;\n });\n };\n for (var {\n deviceKey,\n sessionId\n } of sessions) {\n yield* _loop();\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n });\n return function (_x) {\n return _ref.apply(this, arguments);\n };\n }());\n })();\n }\n\n // Inbound group sessions\n\n getEndToEndInboundGroupSession(senderCurve25519Key, sessionId, txn, func) {\n var session = false;\n var withheld = false;\n var objectStore = txn.objectStore(\"inbound_group_sessions\");\n var getReq = objectStore.get([senderCurve25519Key, sessionId]);\n getReq.onsuccess = function () {\n try {\n if (getReq.result) {\n session = getReq.result.session;\n } else {\n session = null;\n }\n if (withheld !== false) {\n func(session, withheld);\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n var withheldObjectStore = txn.objectStore(\"inbound_group_sessions_withheld\");\n var withheldGetReq = withheldObjectStore.get([senderCurve25519Key, sessionId]);\n withheldGetReq.onsuccess = function () {\n try {\n if (withheldGetReq.result) {\n withheld = withheldGetReq.result.session;\n } else {\n withheld = null;\n }\n if (session !== false) {\n func(session, withheld);\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n storeEndToEndInboundGroupSession(senderCurve25519Key, sessionId, sessionData, txn) {\n var objectStore = txn.objectStore(\"inbound_group_sessions\");\n objectStore.put({\n senderCurve25519Key,\n sessionId,\n session: sessionData\n });\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions() {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n var result = 0;\n yield _this6.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], txn => {\n var sessionStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n var countReq = sessionStore.count();\n countReq.onsuccess = () => {\n result = countReq.result;\n };\n });\n return result;\n })();\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n */\n getEndToEndInboundGroupSessionsBatch() {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n var result = [];\n yield _this7.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS, IndexedDBCryptoStore.STORE_BACKUP], txn => {\n var sessionStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n var backupStore = txn.objectStore(IndexedDBCryptoStore.STORE_BACKUP);\n var getReq = sessionStore.openCursor();\n getReq.onsuccess = function () {\n try {\n var cursor = getReq.result;\n if (cursor) {\n var backupGetReq = backupStore.get(cursor.key);\n backupGetReq.onsuccess = () => {\n result.push({\n senderKey: cursor.value.senderCurve25519Key,\n sessionId: cursor.value.sessionId,\n sessionData: cursor.value.session,\n needsBackup: backupGetReq.result !== undefined\n });\n if (result.length < SESSION_BATCH_SIZE) {\n cursor.continue();\n }\n };\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n });\n if (result.length === 0) {\n // No sessions left.\n return null;\n }\n return result;\n })();\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions) {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n yield _this8.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS], /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (txn) {\n try {\n var objectStore = txn.objectStore(IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS);\n var _loop2 = function* _loop2() {\n var req = objectStore.delete([senderKey, sessionId]);\n yield new Promise(resolve => {\n req.onsuccess = resolve;\n });\n };\n for (var {\n senderKey,\n sessionId\n } of sessions) {\n yield* _loop2();\n }\n } catch (e) {\n abortWithException(txn, e);\n }\n });\n return function (_x2) {\n return _ref2.apply(this, arguments);\n };\n }());\n })();\n }\n getEndToEndDeviceData(txn, func) {\n var objectStore = txn.objectStore(\"device_data\");\n var getReq = objectStore.get(\"-\");\n getReq.onsuccess = function () {\n try {\n func(getReq.result || null);\n } catch (e) {\n abortWithException(txn, e);\n }\n };\n }\n getEndToEndRooms(txn, func) {\n var rooms = {};\n var objectStore = txn.objectStore(\"rooms\");\n var getReq = objectStore.openCursor();\n getReq.onsuccess = function () {\n var cursor = getReq.result;\n if (cursor) {\n rooms[cursor.key] = cursor.value;\n cursor.continue();\n } else {\n try {\n func(rooms);\n } catch (e) {\n abortWithException(txn, e);\n }\n }\n };\n }\n markSessionsNeedingBackup(sessions, txn) {\n var _this9 = this;\n return _asyncToGenerator(function* () {\n if (!txn) {\n txn = _this9.db.transaction(\"sessions_needing_backup\", \"readwrite\");\n }\n var objectStore = txn.objectStore(\"sessions_needing_backup\");\n yield Promise.all(sessions.map(session => {\n return new Promise((resolve, reject) => {\n var req = objectStore.put({\n senderCurve25519Key: session.senderKey,\n sessionId: session.sessionId\n });\n req.onsuccess = resolve;\n req.onerror = reject;\n });\n }));\n })();\n }\n doTxn(mode, stores, func) {\n var log = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : logger;\n var startTime;\n var description;\n if (PROFILE_TRANSACTIONS) {\n var txnId = this.nextTxnId++;\n startTime = Date.now();\n description = \"\".concat(mode, \" crypto store transaction \").concat(txnId, \" in \").concat(stores);\n log.debug(\"Starting \".concat(description));\n }\n var txn = this.db.transaction(stores, mode);\n var promise = promiseifyTxn(txn);\n var result = func(txn);\n if (PROFILE_TRANSACTIONS) {\n promise.then(() => {\n var elapsedTime = Date.now() - startTime;\n log.debug(\"Finished \".concat(description, \", took \").concat(elapsedTime, \" ms\"));\n }, () => {\n var elapsedTime = Date.now() - startTime;\n log.error(\"Failed \".concat(description, \", took \").concat(elapsedTime, \" ms\"));\n });\n }\n return promise.then(() => {\n return result;\n });\n }\n}\nvar DB_MIGRATIONS = [db => {\n createDatabase(db);\n}, db => {\n db.createObjectStore(\"account\");\n}, db => {\n var sessionsStore = db.createObjectStore(\"sessions\", {\n keyPath: [\"deviceKey\", \"sessionId\"]\n });\n sessionsStore.createIndex(\"deviceKey\", \"deviceKey\");\n}, db => {\n db.createObjectStore(\"inbound_group_sessions\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"]\n });\n}, db => {\n db.createObjectStore(\"device_data\");\n}, db => {\n db.createObjectStore(\"rooms\");\n}, db => {\n db.createObjectStore(\"sessions_needing_backup\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"]\n });\n}, db => {\n db.createObjectStore(\"inbound_group_sessions_withheld\", {\n keyPath: [\"senderCurve25519Key\", \"sessionId\"]\n });\n}, db => {\n var problemsStore = db.createObjectStore(\"session_problems\", {\n keyPath: [\"deviceKey\", \"time\"]\n });\n problemsStore.createIndex(\"deviceKey\", \"deviceKey\");\n db.createObjectStore(\"notified_error_devices\", {\n keyPath: [\"userId\", \"deviceId\"]\n });\n}, db => {\n db.createObjectStore(\"shared_history_inbound_group_sessions\", {\n keyPath: [\"roomId\"]\n });\n}, db => {\n db.createObjectStore(\"parked_shared_history\", {\n keyPath: [\"roomId\"]\n });\n}\n// Expand as needed.\n];\nexport var VERSION = DB_MIGRATIONS.length;\nexport function upgradeDatabase(db, oldVersion) {\n logger.log(\"Upgrading IndexedDBCryptoStore from version \".concat(oldVersion) + \" to \".concat(VERSION));\n DB_MIGRATIONS.forEach((migration, index) => {\n if (oldVersion <= index) migration(db);\n });\n}\nfunction createDatabase(db) {\n var outgoingRoomKeyRequestsStore = db.createObjectStore(\"outgoingRoomKeyRequests\", {\n keyPath: \"requestId\"\n });\n\n // we assume that the RoomKeyRequestBody will have room_id and session_id\n // properties, to make the index efficient.\n outgoingRoomKeyRequestsStore.createIndex(\"session\", [\"requestBody.room_id\", \"requestBody.session_id\"]);\n outgoingRoomKeyRequestsStore.createIndex(\"state\", \"state\");\n}\n/*\n * Aborts a transaction with a given exception\n * The transaction promise will be rejected with this exception.\n */\nfunction abortWithException(txn, e) {\n // We cheekily stick our exception onto the transaction object here\n // We could alternatively make the thing we pass back to the app\n // an object containing the transaction and exception.\n txn._mx_abortexception = e;\n try {\n txn.abort();\n } catch (_unused) {\n // sometimes we won't be able to abort the transaction\n // (ie. if it's aborted or completed)\n }\n}\nfunction promiseifyTxn(txn) {\n return new Promise((resolve, reject) => {\n txn.oncomplete = () => {\n if (txn._mx_abortexception !== undefined) {\n reject(txn._mx_abortexception);\n }\n resolve(null);\n };\n txn.onerror = event => {\n if (txn._mx_abortexception !== undefined) {\n reject(txn._mx_abortexception);\n } else {\n logger.log(\"Error performing indexeddb txn\", event);\n reject(txn.error);\n }\n };\n txn.onabort = event => {\n if (txn._mx_abortexception !== undefined) {\n reject(txn._mx_abortexception);\n } else {\n logger.log(\"Error performing indexeddb txn\", event);\n reject(txn.error);\n }\n };\n });\n}\n//# sourceMappingURL=indexeddb-crypto-store-backend.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2017 - 2021 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 { logger } from \"../../logger.js\";\nimport { LocalStorageCryptoStore } from \"./localStorage-crypto-store.js\";\nimport { MemoryCryptoStore } from \"./memory-crypto-store.js\";\nimport * as IndexedDBCryptoStoreBackend from \"./indexeddb-crypto-store-backend.js\";\nimport { InvalidCryptoStoreError, InvalidCryptoStoreState } from \"../../errors.js\";\nimport * as IndexedDBHelpers from \"../../indexeddb-helpers.js\";\nimport { MigrationState, ACCOUNT_OBJECT_KEY_MIGRATION_STATE } from \"./base.js\";\n/*\n * Internal module. indexeddb storage for e2e.\n */\n\n/**\n * An implementation of CryptoStore, which is normally backed by an indexeddb,\n * but with fallback to MemoryCryptoStore.\n */\nexport class IndexedDBCryptoStore {\n static exists(indexedDB, dbName) {\n return IndexedDBHelpers.exists(indexedDB, dbName);\n }\n\n /**\n * Utility to check if a legacy crypto store exists and has not been migrated.\n * Returns true if the store exists and has not been migrated, false otherwise.\n */\n static existsAndIsNotMigrated(indexedDb, dbName) {\n return new Promise((resolve, reject) => {\n var exists = true;\n var openDBRequest = indexedDb.open(dbName);\n openDBRequest.onupgradeneeded = () => {\n // Since we did not provide an explicit version when opening, this event\n // should only fire if the DB did not exist before at any version.\n exists = false;\n };\n openDBRequest.onblocked = () => reject(openDBRequest.error);\n openDBRequest.onsuccess = () => {\n var db = openDBRequest.result;\n if (!exists) {\n db.close();\n // The DB did not exist before, but has been created as part of this\n // existence check. Delete it now to restore previous state. Delete can\n // actually take a while to complete in some browsers, so don't wait for\n // it. This won't block future open calls that a store might issue next to\n // properly set up the DB.\n indexedDb.deleteDatabase(dbName);\n resolve(false);\n } else {\n var tx = db.transaction([IndexedDBCryptoStore.STORE_ACCOUNT], \"readonly\");\n var objectStore = tx.objectStore(IndexedDBCryptoStore.STORE_ACCOUNT);\n var getReq = objectStore.get(ACCOUNT_OBJECT_KEY_MIGRATION_STATE);\n getReq.onsuccess = () => {\n var _getReq$result;\n var migrationState = (_getReq$result = getReq.result) !== null && _getReq$result !== void 0 ? _getReq$result : MigrationState.NOT_STARTED;\n resolve(migrationState === MigrationState.NOT_STARTED);\n };\n getReq.onerror = () => {\n reject(getReq.error);\n };\n db.close();\n }\n };\n openDBRequest.onerror = () => reject(openDBRequest.error);\n });\n }\n /**\n * Create a new IndexedDBCryptoStore\n *\n * @param indexedDB - global indexedDB instance\n * @param dbName - name of db to connect to\n */\n constructor(indexedDB, dbName) {\n this.indexedDB = indexedDB;\n this.dbName = dbName;\n _defineProperty(this, \"backendPromise\", void 0);\n _defineProperty(this, \"backend\", void 0);\n }\n\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Implementation of {@link CryptoStore.containsData}.\n *\n * @internal\n */\n containsData() {\n var _this = this;\n return _asyncToGenerator(function* () {\n return IndexedDBCryptoStore.exists(_this.indexedDB, _this.dbName);\n })();\n }\n\n /**\n * Ensure the database exists and is up-to-date, or fall back to\n * a local storage or in-memory store.\n *\n * This must be called before the store can be used.\n *\n * @returns resolves to either an IndexedDBCryptoStoreBackend.Backend,\n * or a MemoryCryptoStore\n */\n startup() {\n if (this.backendPromise) {\n return this.backendPromise;\n }\n this.backendPromise = new Promise((resolve, reject) => {\n if (!this.indexedDB) {\n reject(new Error(\"no indexeddb support available\"));\n return;\n }\n logger.log(\"connecting to indexeddb \".concat(this.dbName));\n var req = this.indexedDB.open(this.dbName, IndexedDBCryptoStoreBackend.VERSION);\n req.onupgradeneeded = ev => {\n var db = req.result;\n var oldVersion = ev.oldVersion;\n IndexedDBCryptoStoreBackend.upgradeDatabase(db, oldVersion);\n };\n req.onblocked = () => {\n logger.log(\"can't yet open IndexedDBCryptoStore because it is open elsewhere\");\n };\n req.onerror = ev => {\n logger.log(\"Error connecting to indexeddb\", ev);\n reject(req.error);\n };\n req.onsuccess = () => {\n var db = req.result;\n logger.log(\"connected to indexeddb \".concat(this.dbName));\n resolve(new IndexedDBCryptoStoreBackend.Backend(db));\n };\n }).then(backend => {\n // Edge has IndexedDB but doesn't support compund keys which we use fairly extensively.\n // Try a dummy query which will fail if the browser doesn't support compund keys, so\n // we can fall back to a different backend.\n return backend.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS, IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS_WITHHELD], txn => {\n backend.getEndToEndInboundGroupSession(\"\", \"\", txn, () => {});\n }).then(() => backend);\n }).catch(e => {\n if (e.name === \"VersionError\") {\n logger.warn(\"Crypto DB is too new for us to use!\", e);\n // don't fall back to a different store: the user has crypto data\n // in this db so we should use it or nothing at all.\n throw new InvalidCryptoStoreError(InvalidCryptoStoreState.TooNew);\n }\n logger.warn(\"unable to connect to indexeddb \".concat(this.dbName) + \": falling back to localStorage store: \".concat(e));\n try {\n if (!(globalThis.localStorage instanceof Storage)) {\n throw new Error(\"localStorage is not available\");\n }\n return new LocalStorageCryptoStore(globalThis.localStorage);\n } catch (e) {\n logger.warn(\"Unable to open localStorage: falling back to in-memory store: \".concat(e));\n return new MemoryCryptoStore();\n }\n }).then(backend => {\n this.backend = backend;\n return backend;\n });\n return this.backendPromise;\n }\n\n /**\n * Delete all data from this store.\n *\n * @returns resolves when the store has been cleared.\n */\n deleteAllData() {\n return new Promise((resolve, reject) => {\n if (!this.indexedDB) {\n reject(new Error(\"no indexeddb support available\"));\n return;\n }\n logger.log(\"Removing indexeddb instance: \".concat(this.dbName));\n var req = this.indexedDB.deleteDatabase(this.dbName);\n req.onblocked = () => {\n logger.log(\"can't yet delete IndexedDBCryptoStore because it is open elsewhere\");\n };\n req.onerror = ev => {\n logger.log(\"Error deleting data from indexeddb\", ev);\n reject(req.error);\n };\n req.onsuccess = () => {\n logger.log(\"Removed indexeddb instance: \".concat(this.dbName));\n resolve();\n };\n }).catch(e => {\n // in firefox, with indexedDB disabled, this fails with a\n // DOMError. We treat this as non-fatal, so that people can\n // still use the app.\n logger.warn(\"unable to delete IndexedDBCryptoStore: \".concat(e));\n });\n }\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.getMigrationState}.\n *\n * @internal\n */\n getMigrationState() {\n return this.backend.getMigrationState();\n }\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * Implementation of {@link CryptoStore.setMigrationState}.\n *\n * @internal\n */\n setMigrationState(migrationState) {\n return this.backend.setMigrationState(migrationState);\n }\n\n // Olm Account\n\n /*\n * Get the account pickle from the store.\n * This requires an active transaction. See doTxn().\n *\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with the account pickle\n */\n getAccount(txn, func) {\n this.backend.getAccount(txn, func);\n }\n\n /**\n * Write the account pickle to the store.\n * This requires an active transaction. See doTxn().\n *\n * @param txn - An active transaction. See doTxn().\n * @param accountPickle - The new account pickle to store.\n */\n storeAccount(txn, accountPickle) {\n this.backend.storeAccount(txn, accountPickle);\n }\n\n /**\n * Get the public part of the cross-signing keys (eg. self-signing key,\n * user signing key).\n *\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with the account keys object:\n * `{ key_type: base64 encoded seed }` where key type = user_signing_key_seed or self_signing_key_seed\n */\n getCrossSigningKeys(txn, func) {\n this.backend.getCrossSigningKeys(txn, func);\n }\n\n /**\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with the private key\n * @param type - A key type\n */\n getSecretStorePrivateKey(txn, func, type) {\n this.backend.getSecretStorePrivateKey(txn, func, type);\n }\n\n /**\n * Write the cross-signing private keys back to the store\n *\n * @param txn - An active transaction. See doTxn().\n * @param type - The type of cross-signing private key to store\n * @param key - keys object as getCrossSigningKeys()\n */\n storeSecretStorePrivateKey(txn, type, key) {\n this.backend.storeSecretStorePrivateKey(txn, type, key);\n }\n\n // Olm sessions\n\n /**\n * Returns the number of end-to-end sessions in the store\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with the count of sessions\n */\n countEndToEndSessions(txn, func) {\n this.backend.countEndToEndSessions(txn, func);\n }\n\n /**\n * Retrieve a specific end-to-end session between the logged-in user\n * and another device.\n * @param deviceKey - The public key of the other device.\n * @param sessionId - The ID of the session to retrieve\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with A map from sessionId\n * to session information object with 'session' key being the\n * Base64 end-to-end session and lastReceivedMessageTs being the\n * timestamp in milliseconds at which the session last received\n * a message.\n */\n getEndToEndSession(deviceKey, sessionId, txn, func) {\n this.backend.getEndToEndSession(deviceKey, sessionId, txn, func);\n }\n\n /**\n * Retrieve the end-to-end sessions between the logged-in user and another\n * device.\n * @param deviceKey - The public key of the other device.\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with A map from sessionId\n * to session information object with 'session' key being the\n * Base64 end-to-end session and lastReceivedMessageTs being the\n * timestamp in milliseconds at which the session last received\n * a message.\n */\n getEndToEndSessions(deviceKey, txn, func) {\n this.backend.getEndToEndSessions(deviceKey, txn, func);\n }\n\n /**\n * Store a session between the logged-in user and another device\n * @param deviceKey - The public key of the other device.\n * @param sessionId - The ID for this end-to-end session.\n * @param sessionInfo - Session information object\n * @param txn - An active transaction. See doTxn().\n */\n storeEndToEndSession(deviceKey, sessionId, sessionInfo, txn) {\n this.backend.storeEndToEndSession(deviceKey, sessionId, sessionInfo, txn);\n }\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * Implementation of {@link CryptoStore.countEndToEndInboundGroupSessions}.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions() {\n return this.backend.countEndToEndInboundGroupSessions();\n }\n\n /**\n * Fetch a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndSessionsBatch}.\n *\n * @internal\n */\n getEndToEndSessionsBatch() {\n return this.backend.getEndToEndSessionsBatch();\n }\n\n /**\n * Delete a batch of Olm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions) {\n return this.backend.deleteEndToEndSessionsBatch(sessions);\n }\n\n // Inbound group sessions\n\n /**\n * Retrieve the end-to-end inbound group session for a given\n * server key and session ID\n * @param senderCurve25519Key - The sender's curve 25519 key\n * @param sessionId - The ID of the session\n * @param txn - An active transaction. See doTxn().\n * @param func - Called with A map from sessionId\n * to Base64 end-to-end session.\n */\n getEndToEndInboundGroupSession(senderCurve25519Key, sessionId, txn, func) {\n this.backend.getEndToEndInboundGroupSession(senderCurve25519Key, sessionId, txn, func);\n }\n\n /**\n * Writes an end-to-end inbound group session to the store.\n * If there already exists an inbound group session with the same\n * senderCurve25519Key and sessionID, it will be overwritten.\n * @param senderCurve25519Key - The sender's curve 25519 key\n * @param sessionId - The ID of the session\n * @param sessionData - The session data structure\n * @param txn - An active transaction. See doTxn().\n */\n storeEndToEndInboundGroupSession(senderCurve25519Key, sessionId, sessionData, txn) {\n this.backend.storeEndToEndInboundGroupSession(senderCurve25519Key, sessionId, sessionData, txn);\n }\n\n /**\n * Fetch a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.getEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch() {\n return this.backend.getEndToEndInboundGroupSessionsBatch();\n }\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Implementation of {@link CryptoStore.deleteEndToEndInboundGroupSessionsBatch}.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions) {\n return this.backend.deleteEndToEndInboundGroupSessionsBatch(sessions);\n }\n\n /**\n * Get an object of `roomId->roomInfo` for all e2e rooms in the store\n * @param txn - An active transaction. See doTxn().\n * @param func - Function called with the end-to-end encrypted rooms\n */\n getEndToEndRooms(txn, func) {\n this.backend.getEndToEndRooms(txn, func);\n }\n\n /**\n * Mark sessions as needing to be backed up.\n * @param sessions - The sessions that need to be backed up.\n * @param txn - An active transaction. See doTxn(). (optional)\n * @returns resolves when the sessions are marked\n */\n markSessionsNeedingBackup(sessions, txn) {\n return this.backend.markSessionsNeedingBackup(sessions, txn);\n }\n\n /**\n * Perform a transaction on the crypto store. Any store methods\n * that require a transaction (txn) object to be passed in may\n * only be called within a callback of either this function or\n * one of the store functions operating on the same transaction.\n *\n * @param mode - 'readwrite' if you need to call setter\n * functions with this transaction. Otherwise, 'readonly'.\n * @param stores - List IndexedDBCryptoStore.STORE_*\n * options representing all types of object that will be\n * accessed or written to with this transaction.\n * @param func - Function called with the\n * transaction object: an opaque object that should be passed\n * to store functions.\n * @param log - A possibly customised log\n * @returns Promise that resolves with the result of the `func`\n * when the transaction is complete. If the backend is\n * async (ie. the indexeddb backend) any of the callback\n * functions throwing an exception will cause this promise to\n * reject with that exception. On synchronous backends, the\n * exception will propagate to the caller of the getFoo method.\n */\n doTxn(mode, stores, func, log) {\n return this.backend.doTxn(mode, stores, func, log);\n }\n}\n_defineProperty(IndexedDBCryptoStore, \"STORE_ACCOUNT\", \"account\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_SESSIONS\", \"sessions\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_INBOUND_GROUP_SESSIONS\", \"inbound_group_sessions\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_INBOUND_GROUP_SESSIONS_WITHHELD\", \"inbound_group_sessions_withheld\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS\", \"shared_history_inbound_group_sessions\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_PARKED_SHARED_HISTORY\", \"parked_shared_history\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_DEVICE_DATA\", \"device_data\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_ROOMS\", \"rooms\");\n_defineProperty(IndexedDBCryptoStore, \"STORE_BACKUP\", \"sessions_needing_backup\");\n//# sourceMappingURL=indexeddb-crypto-store.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).slice();\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":["VerificationRequestEvent","VerificationPhase","VerifierEvent","OLM_RECOVERY_KEY_PREFIX","encodeRecoveryKey","key","_base58key$match","buf","parity","i","base58key","bs58","DEFAULT_BIT_SIZE","deriveRecoveryKeyFromPassphrase","_x","_x2","_x3","_deriveRecoveryKeyFromPassphrase","_asyncToGenerator","passphrase","salt","iterations","numBits","keybits","wasm","__wbg_set_wasm","val","addToExternrefTable0","obj","idx","_assertClass","instance","klass","CLOSURE_DTORS","state","debugString","type","description","name","length","debug","builtInMatches","className","getArrayJsValueFromWasm0","ptr","len","mem","getDataViewMemory0","result","getArrayU16FromWasm0","getUint16ArrayMemory0","getArrayU8FromWasm0","getUint8ArrayMemory0","cachedDataViewMemory0","getStringFromWasm0","decodeText","cachedUint16ArrayMemory0","cachedUint8ArrayMemory0","handleError","f","args","e","isLikeNone","x","makeMutClosure","arg0","arg1","dtor","real","passArray8ToWasm0","arg","malloc","WASM_VECTOR_LEN","passArrayJsValueToWasm0","array","add","passStringToWasm0","realloc","cachedTextEncoder","offset","code","view","ret","takeFromExternrefTable0","value","cachedTextDecoder","MAX_SAFARI_DECODE_BYTES","numBytesDecoded","wasm_bindgen__convert__closures_____invoke__h89fab44ead303aca","arg2","wasm_bindgen__convert__closures_____invoke__h22e674b566e32b64","wasm_bindgen__convert__closures_____invoke__h35b0a77e54c2db90","wasm_bindgen__convert__closures_____invoke__h8815fd477ac2dc7f","arg3","__wbindgen_enum_IdbRequestReadyState","__wbindgen_enum_IdbTransactionMode","AttachmentFinalization","BackupDecryptionKeyFinalization","BackupKeysFinalization","BackupSecretsBundleFinalization","Base64EncodedPkMessageFinalization","BaseMigrationDataFinalization","CancelInfoFinalization","CheckCodeFinalization","CollectStrategyFinalization","CrossSigningBootstrapRequestsFinalization","CrossSigningKeyExportFinalization","CrossSigningStatusFinalization","Curve25519PublicKeyFinalization","Curve25519SecretKeyFinalization","DecryptedRoomEventFinalization","DecryptedToDeviceEventFinalization","DecryptionSettingsFinalization","DehydratedDeviceFinalization","DehydratedDeviceKeyFinalization","DehydratedDevicesFinalization","DeviceFinalization","DeviceIdFinalization","DeviceKeyFinalization","DeviceKeyAlgorithmFinalization","DeviceKeyIdFinalization","DeviceListsFinalization","EciesFinalization","Ed25519PublicKeyFinalization","Ed25519SignatureFinalization","EmojiFinalization","EncryptedAttachmentFinalization","EncryptionInfoFinalization","EncryptionSettingsFinalization","EstablishedEciesFinalization","EventIdFinalization","IdentityKeysFinalization","InboundCreationResultFinalization","InboundGroupSessionFinalization","InvalidToDeviceEventFinalization","KeysBackupRequestFinalization","KeysClaimRequestFinalization","KeysQueryRequestFinalization","KeysUploadRequestFinalization","MaybeSignatureFinalization","MegolmDecryptionErrorFinalization","MegolmV1BackupKeyFinalization","MigrationFinalization","OlmMachineFinalization","OtherUserIdentityFinalization","OutboundCreationResultFinalization","OwnUserIdentityFinalization","PickledInboundGroupSessionFinalization","PickledSessionFinalization","PkDecryptionFinalization","PkEncryptionFinalization","PkMessageFinalization","PlainTextToDeviceEventFinalization","PutDehydratedDeviceRequestFinalization","QrFinalization","QrCodeFinalization","QrCodeDataFinalization","QrCodeScanFinalization","RehydratedDeviceFinalization","RoomIdFinalization","RoomKeyCountsFinalization","RoomKeyImportResultFinalization","RoomKeyInfoFinalization","RoomKeyWithheldInfoFinalization","RoomMessageRequestFinalization","RoomSettingsFinalization","SasFinalization","SecretsBundleFinalization","ServerNameFinalization","ShieldStateFinalization","SignatureFinalization","SignatureUploadRequestFinalization","SignatureVerificationFinalization","SignaturesFinalization","StoreHandleFinalization","StoredRoomKeyBundleDataFinalization","ToDeviceEncryptionInfoFinalization","ToDeviceRequestFinalization","ToDeviceUnableToDecryptInfoFinalization","TracingFinalization","UTDToDeviceEventFinalization","UploadSigningKeysRequestFinalization","UserDevicesFinalization","UserIdFinalization","VerificationRequestFinalization","VersionsFinalization","Attachment","attachment","EncryptedAttachment","v1","ptr0","len0","BackupDecryptionKey","ephemeral_key","mac","ciphertext","deferred5_0","deferred5_1","ptr1","len1","ptr2","len2","ptr4","len4","MegolmV1BackupKey","BackupKeys","BackupSecretsBundle","deferred1_0","deferred1_1","Base64EncodedPkMessage","BaseMigrationData","UserId","DeviceId","CancelInfo","CheckCode","CollectStrategy","only_allow_trusted_devices","error_on_verified_user_problem","other","CrossSigningBootstrapRequests","UploadSigningKeysRequest","SignatureUploadRequest","CrossSigningKeyExport","CrossSigningStatus","Curve25519PublicKey","Curve25519SecretKey","slice","string","DecryptedRoomEvent","strict","ShieldState","DecryptedToDeviceEvent","ToDeviceEncryptionInfo","DecryptionErrorCode","DecryptionSettings","sender_device_trust_requirement","DehydratedDevice","initial_device_display_name","dehydrated_device_key","DehydratedDeviceKey","DehydratedDevices","device_id","device_data","Device$1","Device","Signatures","Ed25519PublicKey","local_state","methods","event_type","content","share_strategy","algorithm","DeviceKey","id","DeviceKeyAlgorithm","DeviceKeyAlgorithmName","DeviceKeyId","DeviceKeyName","DeviceLists","changed","left","Ecies","initial_message","InboundCreationResult","public_key","OutboundCreationResult","Ed25519Signature","signature","Emoji","encrypted_data","media_encryption_info","EncryptionAlgorithm","EncryptionInfo","EncryptionSettings","EstablishedEcies","message","deferred3_0","deferred3_1","deferred2_0","deferred2_1","EventId","ServerName","HistoryVisibility","IdentityKeys","InboundGroupSession","RoomId","InvalidToDeviceEvent","KeysBackupRequest","body","version","KeysClaimRequest","KeysQueryRequest","KeysUploadRequest","LocalTrust","LoggerLevel","MaybeSignature","Signature","MegolmDecryptionError","desc","Migration","data","pickle_key","store_handle","logger","StoreHandle","sessions","OlmMachine","user_id","timeout_secs","store_name","store_passphrase","backup_info","room_id","users","encryption_settings","public_key_base_64","predicate","flow_id","exported_room_keys","progress_listener","room_settings","RoomSettings","event","decryption_settings","state_key","request_id","request_type","response","to_device_events","changed_devices","one_time_keys_counts","unused_fallback_keys","bundle","SecretsBundle","secret_name","reset","bundle_data","encrypted_bundle","StoredRoomKeyBundleData","VerificationRequest","master_key","self_signing_key","user_signing_key","encrypted_exported_room_keys","deferred4_0","deferred4_1","ptr3","len3","rounds","backed_up_room_keys","backup_version","decryption_key","user","room","url","sharing_strategy","enabled","callback","inviter","OtherUserIdentity","request_event_id","OwnUserIdentity","PickledInboundGroupSession","jsValue","PickledSession","PkDecryption","PkMessage","PkEncryption","PlainTextToDeviceEvent","ProcessedToDeviceEventType","PutDehydratedDeviceRequest","Qr","QrCode","QrCodeData","bytes","rendezvous_url","server_name","QrCodeMode","QrCodeScan","buffer","QrState","RehydratedDevice","RequestType","RoomKeyCounts","RoomKeyImportResult","RoomKeyInfo","RoomKeyWithheldInfo","RoomMessageRequest","txn_id","Sas","json","ShieldColor","ShieldStateCode","SignatureState","signed_keys","SignatureVerification","signer","key_id","store_key","ToDeviceRequest","ToDeviceUnableToDecryptInfo","ToDeviceUnableToDecryptReason","Tracing","min_level","TrustRequirement","UTDToDeviceEvent","UserDevices","VerificationMethod","own_user_id","own_device_id","other_user_id","VerificationRequestPhase","Versions","getVersions","start","__wbg_Error_52673b7de5a0ca89","__wbg_Number_2d1dcfcf4ec51736","__wbg_String_8f0eb39a4a4c2f66","__wbg_Window_bad6cc2ef3d218d1","__wbg_WorkerGlobalScope_ce34368dd76f04b5","__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d","v","__wbg___wbindgen_boolean_get_dea25b33882b895b","__wbg___wbindgen_debug_string_adfb662ae34724b6","__wbg___wbindgen_in_0d3e1e8f0c669317","__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27","__wbg___wbindgen_is_function_8d400b8b1af978cd","__wbg___wbindgen_is_null_dfda7d66506c95b5","__wbg___wbindgen_is_object_ce774f3490692386","__wbg___wbindgen_is_string_704ef9c8fc131030","__wbg___wbindgen_is_undefined_f6b95eab589e0269","__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36","__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d","__wbg___wbindgen_number_get_9619185a74197f95","__wbg___wbindgen_string_get_a2a31e16edf96e42","__wbg___wbindgen_throw_dd24417ed36fc46e","__wbg___wbindgen_try_into_number_9d33ffe037a9f5e5","__wbg__wbg_cb_unref_87dfb5aaa0cbcea7","__wbg_abort_45186b2c363ae467","__wbg_add_c1fb373a6e8701af","__wbg_add_f0bf6d9527665471","__wbg_at_505937f1c4b80bfa","__wbg_backupkeys_new","__wbg_bound_6fa641bacd961cc0","__wbg_call_3020136f7a2d6e44","__wbg_call_78f94eb02ec7f9b2","arg4","__wbg_call_abb4ff46ce38be40","__wbg_call_c8baa5c5e72d274e","__wbg_clearTimeout_5a54f8841c30079a","__wbg_clear_0e6ff4790cdabf11","__wbg_close_cf7ef4e294ac3858","__wbg_code_c2a85f2863ec11b3","__wbg_commit_073afc947129550a","__wbg_continue_f42217c3ef5cf6dd","__wbg_count_3fa291ea0e8fceec","__wbg_count_c05e51d4a5d263a1","__wbg_createIndex_3889f4177a3fa5d0","__wbg_createIndex_3c576f3c5564f5d7","__wbg_createObjectStore_dba64acfe84d4191","__wbg_crosssigningbootstraprequests_new","__wbg_crosssigningkeyexport_new","__wbg_crosssigningstatus_new","__wbg_crypto_574e78ad8b13b65f","__wbg_debug_949d8a9c97c02a01","__wbg_debug_9d0c87ddda3dc485","__wbg_decryptedroomevent_new","__wbg_decryptedtodeviceevent_new","__wbg_dehydrateddevice_new","__wbg_dehydrateddevicekey_new","__wbg_deleteObjectStore_88e9fff1fbbc6189","__wbg_delete_91010f5a5282eb97","__wbg_delete_a8cf58aab29e18d2","__wbg_device_new","__wbg_deviceid_new","__wbg_devicekey_new","__wbg_devicekeyid_new","__wbg_done_62ea16af4ce34b24","__wbg_emoji_new","__wbg_encryptedattachment_new","__wbg_encryptioninfo_new","__wbg_entries_83c79938054e065f","__wbg_entries_9af46b7eaf7dfefa","__wbg_error_7534b8e9a36f1ab4","deferred0_0","deferred0_1","__wbg_error_7bc79084e71bc74a","__wbg_error_7bc7d576a6aaf855","__wbg_error_ad02a286da74488a","__wbg_from_29a8414a7a7cd19d","__wbg_getAllKeys_925405ffbd671e86","__wbg_getAll_236edca313646f4d","__wbg_getAll_48e288420773a079","__wbg_getAll_eec11317662a8eba","__wbg_getRandomValues_9b655bdd369112f2","__wbg_getRandomValues_b8f5dbd5f3995a9e","__wbg_getTime_ad1e9878a735af08","__wbg_get_10889f5b611cd1c6","__wbg_get_6b7bd52aca3f9671","__wbg_get_7d8b665fa88606d5","__wbg_get_af9dab7e9603ea93","__wbg_get_with_ref_key_1dc361bd10053bfe","__wbg_global_e78add1f0bdfe974","__wbg_inboundgroupsession_new","__wbg_index_6af68133e0cdd5f8","__wbg_indexedDB_121c33bea2560f72","__wbg_indexedDB_23c232e00a1e28ad","__wbg_indexedDB_769a3833286f42f3","__wbg_info_ce6bcc489c22f6f0","__wbg_info_fd876dbb310ad775","__wbg_instanceof_ArrayBuffer_f3320d2419cd0355","__wbg_instanceof_CursorSys_383984afc1fa1bbc","__wbg_instanceof_DomException_d430cd4fb5284a83","__wbg_instanceof_Error_3443650560328fa9","__wbg_instanceof_IdbCursor_5641812dc2120a05","__wbg_instanceof_IdbDatabase_f4e157055e32c479","__wbg_instanceof_IdbOpenDbRequest_e4a587961e53201e","__wbg_instanceof_IdbRequest_9000a361b4bf0dc6","__wbg_instanceof_Map_084be8da74364158","__wbg_instanceof_Promise_eca6c43a2610558d","__wbg_instanceof_Uint8Array_da54ccc9d3e09434","__wbg_invalidtodeviceevent_new","__wbg_isArray_51fd9e6422c0a395","__wbg_isArray_ca6bc609f742df3f","__wbg_isSafeInteger_ae7d3f054d55fa16","__wbg_item_fa6253e690a05e50","__wbg_iterator_27b7c8b35ab3e86b","__wbg_key_5ffb2273b5ffc24a","__wbg_keysbackuprequest_new","__wbg_keysclaimrequest_new","__wbg_keysqueryrequest_new","__wbg_keysuploadrequest_new","__wbg_length_22ac23eaec9d8053","__wbg_length_9b7368e374b28279","__wbg_length_d45040a40c570362","__wbg_lowerBound_13747835b262040c","__wbg_maybesignature_new","__wbg_megolmdecryptionerror_new","__wbg_message_0305fa7903f4b3d9","__wbg_message_a4e9a39ee8f92b17","__wbg_msCrypto_a61aeb35a24c1329","__wbg_name_9136863a055402ff","__wbg_new_1ba21ce319a06297","__wbg_new_25f239778d6112b9","__wbg_new_6421f6084cc5bc5a","__wbg_new_746bb58304020083","__wbg_new_8a6f238a6ece86ea","__wbg_new_b2db8aa2650f793a","__wbg_new_b546ae120718850e","__wbg_new_df1173567d5ff028","__wbg_new_ff12d2b041fb48f1","state0","cb0","__wbg_new_no_args_cb138f77cf6151ee","__wbg_new_with_length_30843b434774b4c6","__wbg_new_with_length_aa5eaf41d35235e5","__wbg_next_138a17bbf04e926c","__wbg_next_3cfe5c0fe2a4cc53","__wbg_node_905d3e251edff8a2","__wbg_now_2c95c9de01293173","__wbg_now_69d776cd24f5215b","__wbg_objectStoreNames_90900f9a531513ac","__wbg_objectStore_da9a077b8849dbe9","__wbg_oldVersion_2950700d81809b3e","__wbg_olmmachine_new","__wbg_openCursor_065c5304428cc4d8","__wbg_openCursor_99b45bb4fa3166ab","__wbg_openCursor_c5d6ba9ba92d3ab5","__wbg_open_0d7b85f4c0a38ffe","__wbg_open_2a2740c93beabe29","__wbg_otheruseridentity_new","__wbg_ownuseridentity_new","__wbg_parse_a09a54cf72639456","__wbg_performance_7a3ffd0b17f663ad","__wbg_pickledinboundgroupsession_unwrap","__wbg_pickledsession_unwrap","__wbg_plaintexttodeviceevent_new","__wbg_process_dc0fbacc7c1c06f7","__wbg_prototypesetcall_d3dc3532c827f7d3","__wbg_prototypesetcall_dfe9b766cdc1f1fd","__wbg_push_7d9be8f38fc13975","__wbg_put_d40a68e5a8902a46","__wbg_putdehydrateddevicerequest_new","__wbg_qr_new","__wbg_queueMicrotask_9b549dfce8865860","__wbg_queueMicrotask_fca69f5bfad613a5","__wbg_randomFillSync_ac0988aba3254290","__wbg_readyState_e534bc496011c2fd","__wbg_rehydrateddevice_new","__wbg_request_c533970ff464e9b2","__wbg_request_d3cccab75790c6a3","__wbg_require_60cc747a6bc5215a","__wbg_resolve_fd5bfbaa4ce36e1e","__wbg_result_084f962aedb54250","__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_7df433eea03a5c14","__wbg_set_e2f933902557a0b5","__wbg_set_efaaf145b9377369","__wbg_set_onabort_e3f60791db69f136","__wbg_set_oncomplete_e4a04a9244826e8b","__wbg_set_onerror_08fecec3bdc9d24d","__wbg_set_onerror_e6509e1998f7da91","__wbg_set_onsuccess_94332a00452de699","__wbg_set_onupgradeneeded_3dc6e233a6d13fe2","__wbg_set_unique_3dd7b4ef717ec230","__wbg_signatures_new","__wbg_signatureuploadrequest_new","__wbg_signatureverification_new","__wbg_stack_0ed75d68575b0f3c","__wbg_static_accessor_GLOBAL_769e6b65d6557335","__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1","__wbg_static_accessor_SELF_08f5a74c69739274","__wbg_static_accessor_WINDOW_a8924b26aa92d024","__wbg_storedroomkeybundledata_new","__wbg_storehandle_new","__wbg_stringify_655a6390e1f5eb6b","__wbg_subarray_845f2f5bce7d061a","__wbg_target_0e3e05a6263c37a0","__wbg_then_429f7caf1026411d","__wbg_then_4f95312d68691235","__wbg_toString_f07112df359c997f","__wbg_todevicerequest_new","__wbg_transaction_257422def49a0094","__wbg_transaction_790ec170b8fbc74b","__wbg_transaction_94648249df85f2b3","__wbg_transaction_edb5bc8f37fa6aec","__wbg_update_9d3d984f3dbd9e8d","__wbg_upperBound_91858b3be3dd9f34","__wbg_userdevices_new","__wbg_userid_new","__wbg_userid_unwrap","__wbg_utdtodeviceevent_new","__wbg_value_3ed795eaabbd91d4","__wbg_value_57b7b035e117f7ee","__wbg_values_9152c8c1ab032dfa","__wbg_verificationrequest_new","__wbg_version_261774ad92018a58","__wbg_versions_c01dfd4722a88165","__wbg_warn_6e567d0d926ff881","__wbg_warn_d7dd2130cf9e44bb","__wbindgen_cast_21f3b7099c9334bc","__wbindgen_cast_2241b6af4c4b2941","__wbindgen_cast_3d323378c35251b8","__wbindgen_cast_4625c577ab2ec9ee","__wbindgen_cast_7c76986129f237a3","__wbindgen_cast_9ae0607507abb057","__wbindgen_cast_c415cbf6e3c3f6d4","__wbindgen_cast_cb9088102bce6b30","__wbindgen_cast_d6cd19b81560fd6e","__wbindgen_cast_e481686c74984159","v0","__wbindgen_init_externref_table","table","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","_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","currentRetryCount","backoff","calculateRetryBackoff","sleep","KeyClaimManager","claimRequest","DeviceVerification","rustDeviceToJsDevice","device","keyId","verified","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","_secretStorageCanAccessSecrets","secretNames","defaultKeyId","secretName","record","RustVerificationRequest","inner","supportedVerificationMethods","TypedReEmitter","weakThis","_weakThis$deref","verification","RustSdkCryptoJs.Sas","RustQrCodeVerifier","RustSASVerifier","RustSdkCryptoJs.Qr","verifier","_this$inner$roomId","_this$inner$otherDevi","otherDeviceId","phase","RustSdkCryptoJs.VerificationRequestPhase","theirMethods","requiredMethod","verificationMethodsByIdentifier","verificationMethodIdentifierToMethod","params","targetDevice","res","uint8Array","scan","RustSdkCryptoJs.QrCodeScan","innerVerifier","_this$inner$cancelInf","_this$inner$cancelInf2","cancelInfo","BaseRustVerifer","_weakThis$deref2","_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","successes","_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","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","_this25","secretsToCheck","keyBackupEnabled","secretStored","_arguments5","_this26","createSecretStorageKey","setupNewSecretStorage","setupNewKeyBackup","isNewSecretStorageKeyNeeded","recoveryKey","crossSigningPrivateKeys","hasPrivateKeys","_this27","backupKeyBase64","secretStorageKey","_this28","_secretStorageKey$key","_secretStorageKey$key2","_this28$cryptoCallbac","_this28$cryptoCallbac2","secretStorageKeyObject","SECRET_STORAGE_ALGORITHM_V1_AES","_this29","secretStorageKeyTuple","keyInfo","_this30","publicKeysOnDevice","password","_this31","secureRandomString","_this32","_request$roomId","_this33","verCont","verContObj","verificationEventContent","eventId","RustSdkCryptoJs.EventId","_this34","txId","_this35","_this36","_this37","_this38","base64Key","_this39","backupKey","_this40","_this41","_this42","_this43","_this44","_this45","_this46","_this47","sigs","unsigned","userSignatures","canonalizedJson","anotherjson","map","_this48","privateKey","_this49","decodedDecryptionKey","_this50","_arguments6","_this51","secrets","_this52","secretsBundle","RustSdkCryptoJs.SecretsBundle","_this53","eventType","devices","payload","_this54","uniqueUsers","_ref4","_ref3","encryptedPayload","_this55","_this56","_this57","uploadResponse","RustSdkCryptoJs.CollectStrategy","_req","_ref5","_this58","events","oneTimeKeysCounts","unusedFallbackKeys","RustSdkCryptoJs.DeviceLists","_this59","processed","received","parsedMessage","sender","transactionId","RustSdkCryptoJs.ProcessedToDeviceEventType","_encryptionInfo$sende","encryptionInfo","isRoomKeyBundleMessage","success","_this60","mapOneTimeKeysCount","setUnusedFallbackKeys","deviceLists","_this61","_deviceLists$changed","_deviceLists$left","_this62","settings","RustSdkCryptoJs.RoomSettings","existingEncryptor","syncState","_this63","oldMembership","enc","_this64","_this65","pendingList","_loop2","ev","_e","withheld","_this66","_this67","newVerification","_this68","_this69","_this70","pendingValues","_this71","processEvent","_ref6","evt","TIMEOUT_DELAY","timeoutId","MatrixEventEvent","onDecrypted","decryptedEvent","_this72","senderId","isRoomVerificationRequest","_this73","perSessionBackupDownloader","MapWithDefault","_this74","trustRequirement","RustSdkCryptoJs.TrustRequirement","_res$forwarder","stringifyEvent","RustSdkCryptoJs.DecryptionSettings","RustSdkCryptoJs.MegolmDecryptionError","DecryptionError","DecryptionFailureCode","serverBackupInfo","errorDetails","RustSdkCryptoJs.DecryptionErrorCode","membership","failureCode","_this75","EventShieldColour","rustEncryptionInfoToJsEncryptionInfo","roomPendingEvents","sessionPendingEvents","shieldState","shieldColour","RustSdkCryptoJs.ShieldColor","shieldReason","RustSdkCryptoJs.ShieldStateCode","EventShieldReason","ACCOUNT_OBJECT_KEY_MIGRATION_STATE","MigrationState","SESSION_BATCH_SIZE","encodeSessionKey","senderCurve25519Key","decodeSessionKey","keyParts","senderKey","MemoryCryptoStore","migrationState","txn","func","accountPickle","deviceSessions","deviceKey","safeSet","sessionKey","mode","stores","E2E_PREFIX","KEY_END_TO_END_MIGRATION_STATE","KEY_END_TO_END_ACCOUNT","KEY_CROSS_SIGNING_KEYS","KEY_INBOUND_SESSION_PREFIX","KEY_INBOUND_SESSION_WITHHELD_PREFIX","KEY_ROOMS_PREFIX","KEY_SESSIONS_NEEDING_BACKUP","keyEndToEndSessions","keyEndToEndInboundGroupSession","keyEndToEndInboundGroupSessionWithheld","keyEndToEndRoomsPrefix","LocalStorageCryptoStore","store","_store$key","_getJsonItem","getJsonItem","setJsonItem","fixedSessions","_sessions$sessionId","_this$_getEndToEndSes","_this4$store$key","sessionsNeedingBackup","key2","prefix","Backend","db","IndexedDBCryptoStore","objectStore","getReq","_getReq$result","abortWithException","countReq","results","cursor","resolve","withheldObjectStore","withheldGetReq","sessionStore","backupStore","backupGetReq","rooms","reject","promise","promiseifyTxn","DB_MIGRATIONS","createDatabase","sessionsStore","problemsStore","VERSION","upgradeDatabase","oldVersion","migration","index","outgoingRoomKeyRequestsStore","indexedDB","dbName","IndexedDBHelpers.exists","indexedDb","exists","openDBRequest","tx","IndexedDBCryptoStoreBackend.VERSION","IndexedDBCryptoStoreBackend.upgradeDatabase","IndexedDBCryptoStoreBackend.Backend","backend","InvalidCryptoStoreError","InvalidCryptoStoreState","log","migrateFromLegacyCrypto","_migrateFromLegacyCrypto","_args$legacyMigration2","legacyStore","RustSdkCryptoJs.initAsync","acctPickle","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","legacySettings","rustSettings","_x22","_x23","_x24","_getAndDecryptCachedSecretKey","legacyPickleKey","decryptAESSecretStorageItem","migrateLegacyLocalTrustIfNeeded","_x25","_migrateLegacyLocalTrustIfNeeded","legacyCryptoStore","rustCrypto","rustOwnIdentity","legacyLocallyTrustedMSK","getLegacyTrustedPublicMasterKeyBase64","mskInfo","rustSeenMSK","_x26","_getLegacyTrustedPublicMasterKeyBase","maybeTrustedKeys","msk","initRustCrypto","_initRustCrypto","initOlmMachine","_initOlmMachine","RustSdkCryptoJs.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