@element-hq/element-call-embedded 0.19.2-rc.1 → 0.19.2
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/dist/assets/_sentry-release-injection-file-C4oXeC0H.js +2 -0
- package/dist/assets/{_sentry-release-injection-file-BUU9a5PD.js.map → _sentry-release-injection-file-C4oXeC0H.js.map} +1 -1
- package/dist/assets/{index-Djc6082U.js → index-DzoaVylG.js} +5 -5
- package/dist/assets/{index-Djc6082U.js.map → index-DzoaVylG.js.map} +1 -1
- package/dist/assets/{indexeddb-crypto-store-Bpb_zi4O.js → indexeddb-crypto-store-DDjyMFqS.js} +4 -4
- package/dist/assets/{indexeddb-crypto-store-Bpb_zi4O.js.map → indexeddb-crypto-store-DDjyMFqS.js.map} +1 -1
- package/dist/assets/{matrix-DdWlnjSh.js → matrix-BMlTzVh5.js} +5 -5
- package/dist/assets/{matrix-DdWlnjSh.js.map → matrix-BMlTzVh5.js.map} +1 -1
- package/dist/assets/{pako.esm-xdBZSMA1.js → pako.esm-UZ0EWzai.js} +2 -2
- package/dist/assets/{pako.esm-xdBZSMA1.js.map → pako.esm-UZ0EWzai.js.map} +1 -1
- package/dist/assets/{polyfill-force-BjJnj5Za.js → polyfill-force-CL46JUpA.js} +2 -2
- package/dist/assets/{polyfill-force-BjJnj5Za.js.map → polyfill-force-CL46JUpA.js.map} +1 -1
- package/dist/assets/{polyfill-force-CL7owmpV.js → polyfill-force-Dey3kAQw.js} +2 -2
- package/dist/assets/{polyfill-force-CL7owmpV.js.map → polyfill-force-Dey3kAQw.js.map} +1 -1
- package/dist/assets/{rust-crypto-C0aPoIC0.js → rust-crypto-BB1QAvrJ.js} +2 -2
- package/dist/assets/{rust-crypto-C0aPoIC0.js.map → rust-crypto-BB1QAvrJ.js.map} +1 -1
- package/dist/assets/{spa-D-aVmjgn.js → spa-BW6X0pJ7.js} +2 -2
- package/dist/assets/{spa-D-aVmjgn.js.map → spa-BW6X0pJ7.js.map} +1 -1
- package/dist/assets/{tslib.es6-DQ6HU-p4.js → tslib.es6-Cgt7ctuY.js} +2 -2
- package/dist/assets/{tslib.es6-DQ6HU-p4.js.map → tslib.es6-Cgt7ctuY.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/_sentry-release-injection-file-BUU9a5PD.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rust-crypto-C0aPoIC0.js","names":["VerificationMethod","RustSdkCryptoJs.UserId","HistoryVisibility","RustHistoryVisibility","RustSdkCryptoJs.DeviceId","ownKeys","_objectSpread","DehydrationUnstablePrefix","Device","RustSdkCryptoJs.Sas","RustSdkCryptoJs.Qr","RustSdkCryptoJs.RoomId","ownKeys","_objectSpread","RustSdkCryptoJs.UserId","RustSdkCryptoJs.RoomId","RustSdkCryptoJs.getVersions","RustSdkCryptoJs.DeviceId","RustSdkCryptoJs.OtherUserIdentity","RustSdkCryptoJs.OwnUserIdentity","RustSdkCryptoJs.EventId","anotherjson","RustSdkCryptoJs.DeviceLists","RustSdkCryptoJs.RoomSettings","RustSdkCryptoJs.DecryptionSettings","RustSdkCryptoJs.MegolmDecryptionError","RustSdkCryptoJs.initAsync","RustSdkCryptoJs.BaseMigrationData","RustSdkCryptoJs.UserId","RustSdkCryptoJs.DeviceId","RustSdkCryptoJs.PickledSession","RustSdkCryptoJs.PickledInboundGroupSession","RustSdkCryptoJs.RoomId","RustSdkCryptoJs.RoomSettings","RustSdkCryptoJs.initAsync","RustSdkCryptoJs.UserId","RustSdkCryptoJs.DeviceId","RustSdkCryptoJs.RoomId"],"sources":["../../node_modules/.pnpm/@matrix-org+matrix-sdk-crypto-wasm@18.1.0/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js","../../node_modules/.pnpm/@matrix-org+matrix-sdk-crypto-wasm@18.1.0/node_modules/@matrix-org/matrix-sdk-crypto-wasm/index.mjs","../../node_modules/.pnpm/another-json@0.2.0/node_modules/another-json/another-json.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/types.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/index.js"],"sourcesContent":["/**\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 * Create a new random [`BackupDecryptionKey`].\n * @returns {BackupDecryptionKey}\n */\n static createRandomKey() {\n const ret = wasm.backupdecryptionkey_createRandomKey();\n return BackupDecryptionKey.__wrap(ret);\n }\n /**\n * Try to 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 * 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 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 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 version that we are using for backups.\n * @param {string | null} [arg0]\n */\n set backupVersion(arg0) {\n var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_backupkeys_backupVersion(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * The key used to decrypt backed up room keys\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}\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 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 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 version which this backup decryption key is used with.\n * @param {string} arg0\n */\n set backup_version(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_backupsecretsbundle_backup_version(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * 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}\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 * Creates a new base64-encoded encrypted message from its parts.\n * @param {string} ciphertext\n * @param {string} mac\n * @param {string} ephemeral_key\n */\n constructor(ciphertext, mac, ephemeral_key) {\n const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mac, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(ephemeral_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.base64encodedpkmessage_new(ptr0, len0, ptr1, len1, ptr2, len2);\n this.__wbg_ptr = ret >>> 0;\n Base64EncodedPkMessageFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * 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 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 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 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_base64encodedpkmessage_ciphertext(this.__wbg_ptr, ptr0, len0);\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 * 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_base64encodedpkmessage_mac(this.__wbg_ptr, ptr0, len0);\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 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 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 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 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 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, 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, 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 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 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 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 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 * @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_basemigrationdata_pickledAccount(this.__wbg_ptr, ptr0, len0);\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 * @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 * @param {string | null} [arg0]\n */\n set privateCrossSigningUserSigningKey(arg0) {\n var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_basemigrationdata_privateCrossSigningUserSigningKey(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * 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}\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 * 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 * 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 /**\n * Share based on identity. Only distribute to devices signed by their\n * owner. If a user has no published identity he will not receive\n * any room keys.\n * @returns {CollectStrategy}\n */\n static identityBasedStrategy() {\n const ret = wasm.collectstrategy_identityBasedStrategy();\n return CollectStrategy.__wrap(ret);\n }\n /**\n * Only share keys with devices that we \"trust\". A device is trusted if any\n * of the following is true:\n * - It was manually marked as trusted.\n * - It was marked as verified via interactive verification.\n * - It is signed by its owner identity, and this identity has been\n * trusted via interactive verification.\n * - It is the current own device of the user.\n * @returns {CollectStrategy}\n */\n static onlyTrustedDevices() {\n const ret = wasm.collectstrategy_onlyTrustedDevices();\n return CollectStrategy.__wrap(ret);\n }\n}\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 key signatures, including those for the cross-signing\n * keys, and maybe some for the optional uploaded key too.\n *\n * Should be sent last.\n * @returns {SignatureUploadRequest}\n */\n get uploadSignaturesRequest() {\n const ret = wasm.__wbg_get_crosssigningbootstraprequests_uploadSignaturesRequest(this.__wbg_ptr);\n return SignatureUploadRequest.__wrap(ret);\n }\n /**\n * 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}\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 * 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 * 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 * 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 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 * 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 * 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 * Encodes the secret key into a base64 string.\n * @returns {string}\n */\n toBase64() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.curve25519secretkey_toBase64(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * Converts the secret key into a raw byte vector.\n * @returns {Uint8Array}\n */\n toUint8Array() {\n const ret = wasm.curve25519secretkey_toUint8Array(this.__wbg_ptr);\n var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v1;\n }\n}\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 * 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 * 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 * 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 {string[]}\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 * 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 * 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 device ID of the device that sent us the event, note this\n * is untrusted data unless `verification_state` is as well\n * trusted.\n * @returns {DeviceId | undefined}\n */\n get senderDevice() {\n const ret = wasm.decryptedroomevent_senderDevice(this.__wbg_ptr);\n return ret === 0 ? undefined : DeviceId.__wrap(ret);\n }\n /**\n * The 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 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 type of processed to-device event. Always {@link\n * ProcessedToDeviceEventType.Decrypted} for this type.\n * @returns {ProcessedToDeviceEventType}\n */\n get type() {\n const ret = wasm.decryptedtodeviceevent_type(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 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}\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 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 * Generates a new random dehydrated device key.\n * @returns {DehydratedDeviceKey}\n */\n static createRandomKey() {\n const ret = wasm.dehydrateddevicekey_createRandomKey();\n return DehydratedDeviceKey.__wrap(ret);\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 * 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 * 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 * 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 * Rehydrate a dehydrated device.\n * @param {DehydratedDeviceKey} dehydrated_device_key\n * @param {DeviceId} device_id\n * @param {string} device_data\n * @returns {Promise<RehydratedDevice>}\n */\n rehydrate(dehydrated_device_key, device_id, device_data) {\n _assertClass(dehydrated_device_key, DehydratedDeviceKey);\n _assertClass(device_id, DeviceId);\n const ptr0 = passStringToWasm0(device_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.dehydrateddevices_rehydrate(this.__wbg_ptr, dehydrated_device_key.__wbg_ptr, device_id.__wbg_ptr, ptr0, len0);\n return ret;\n }\n /**\n * 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}\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 {EncryptionAlgorithm[]}\n */\n get algorithms() {\n const ret = wasm.device_algorithms(this.__wbg_ptr);\n return ret;\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 * The unique ID of the device.\n * @returns {DeviceId}\n */\n get deviceId() {\n const ret = wasm.device_deviceId(this.__wbg_ptr);\n return DeviceId.__wrap(ret);\n }\n /**\n * Get the human readable name of the device.\n * @returns {string | undefined}\n */\n get displayName() {\n const ret = wasm.device_displayName(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n }\n return v1;\n }\n /**\n * Get the 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 * 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 * 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 * 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 * Is the device locally marked as blacklisted?\n *\n * Blacklisted devices won’t receive any group sessions.\n * @returns {boolean}\n */\n isBlacklisted() {\n const ret = wasm.device_isBlacklisted(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is 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 * 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 * 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 * Is the device locally marked as trusted?\n * @returns {boolean}\n */\n isLocallyTrusted() {\n const ret = wasm.device_isLocallyTrusted(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is 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 a map containing all the device keys.\n * @returns {Map<DeviceKeyId, DeviceKey>}\n */\n get keys() {\n const ret = wasm.device_keys(this.__wbg_ptr);\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 * Request an interactive verification with this device.\n *\n * Returns a 2-element array `[VerificationRequest, ToDeviceRequest]`.\n * @param {VerificationMethod[]} [methods]\n * @returns {[VerificationRequest, ToDeviceRequest]}\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 * 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<null>}\n */\n setLocalTrust(local_state) {\n const ret = wasm.device_setLocalTrust(this.__wbg_ptr, local_state);\n return ret;\n }\n /**\n * Get a map containing all the device signatures.\n * @returns {Signatures}\n */\n get signatures() {\n const ret = wasm.device_signatures(this.__wbg_ptr);\n return Signatures.__wrap(ret);\n }\n /**\n * 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 * 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<SignatureUploadRequest>}\n */\n verify() {\n const ret = wasm.device_verify(this.__wbg_ptr);\n return 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 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 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 * Convert the `DeviceKey` into a base64 encoded string.\n * @returns {string}\n */\n toBase64() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.devicekey_toBase64(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * 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}\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 * 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 * 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 * 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 * 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 /**\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 * 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}\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 * 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 /**\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}\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 * 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 * 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 * 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 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 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 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 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 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 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 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 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 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_encryptioninfo_senderClaimedEd25519Key(this.__wbg_ptr, ptr0, len0);\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_encryptioninfo_senderCurve25519Key(this.__wbg_ptr, ptr0, len0);\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 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}\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 * 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 * 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 * 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 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 * 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 * 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 * @param {boolean} arg0\n */\n set encryptStateEvents(arg0) {\n wasm.__wbg_set_encryptionsettings_encryptStateEvents(this.__wbg_ptr, arg0);\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 * 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 * 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 * 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 * 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 /**\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}\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 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 * 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 server name of the event ID.\n * @returns {ServerName | undefined}\n */\n get serverName() {\n const ret = wasm.eventid_serverName(this.__wbg_ptr);\n return ret === 0 ? undefined : ServerName.__wrap(ret);\n }\n /**\n * Return the event ID as a string.\n * @returns {string}\n */\n toString() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.eventid_toString(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\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 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 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 Curve25519 public key, used for establish shared secrets.\n * @param {Curve25519PublicKey} arg0\n */\n set curve25519(arg0) {\n _assertClass(arg0, Curve25519PublicKey);\n var ptr0 = arg0.__destroy_into_raw();\n wasm.__wbg_set_identitykeys_curve25519(this.__wbg_ptr, ptr0);\n }\n /**\n * 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}\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 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 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 * @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_inboundcreationresult_message(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 * 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 /**\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}\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 * 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 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 * The backup version that these room keys should be part of.\n * @returns {string}\n */\n get version() {\n const ret = wasm.__wbg_get_keysbackuprequest_version(this.__wbg_ptr);\n return ret;\n }\n /**\n * Create a new `KeysBackupRequest`.\n * @param {string} id\n * @param {string} body\n * @param {string} version\n */\n constructor(id, body, version) {\n const ret = wasm.keysbackuprequest_new(id, body, version);\n this.__wbg_ptr = ret >>> 0;\n KeysBackupRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysbackuprequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * A JSON-encoded object containing the rest of the payload: `timeout`,\n * `one_time_keys`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_keysclaimrequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * Create a new `KeysClaimRequest`.\n * @param {string} id\n * @param {string} body\n */\n constructor(id, body) {\n const ret = wasm.keysclaimrequest_new(id, body);\n this.__wbg_ptr = ret >>> 0;\n KeysClaimRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysclaimrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * A JSON-encoded object containing the rest of the payload: `timeout`,\n * `device_keys`, `token`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_keysqueryrequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * Create a new `KeysQueryRequest`.\n * @param {string} id\n * @param {string} body\n */\n constructor(id, body) {\n const ret = wasm.keysqueryrequest_new(id, body);\n this.__wbg_ptr = ret >>> 0;\n KeysQueryRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysqueryrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) KeysQueryRequest.prototype[Symbol.dispose] = KeysQueryRequest.prototype.free;\n\n/**\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 * A JSON-encoded object containing the rest of the payload: `device_keys`,\n * `one_time_keys`, `fallback_keys`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_keysuploadrequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * Create a new `KeysUploadRequest`.\n * @param {string} id\n * @param {string} body\n */\n constructor(id, body) {\n const ret = wasm.keysuploadrequest_new(id, body);\n this.__wbg_ptr = ret >>> 0;\n KeysUploadRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysuploadrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * 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 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 * 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 * 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 /**\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}\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 * Get the full name of the backup algorithm this backup key supports.\n * @returns {string}\n */\n get algorithm() {\n const ret = wasm.megolmv1backupkey_algorithm(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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}\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 {JsLogger} [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 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 {JsLogger} [logger]\n * @returns {Promise<void>}\n */\n static migrateMegolmSessions(sessions, pickle_key, store_handle, logger) {\n const ptr0 = passArrayJsValueToWasm0(sessions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n _assertClass(store_handle, StoreHandle);\n const ret = wasm.migration_migrateMegolmSessions(ptr0, len0, pickle_key, store_handle.__wbg_ptr, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * 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 {JsLogger} [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}\nif (Symbol.dispose) Migration.prototype[Symbol.dispose] = Migration.prototype.free;\n\n/**\n * Intent-specific data in the case the QR code adheres to\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4108 MSC4108} of the QR code\n * data format.\n */\nexport class Msc4108IntentData {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(Msc4108IntentData.prototype);\n obj.__wbg_ptr = ptr;\n Msc4108IntentDataFinalization.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 Msc4108IntentDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_msc4108intentdata_free(ptr, 0);\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.__wbg_get_msc4108intentdata_rendezvousUrl(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * Get the server name of the homeserver which the new device will be\n * logged in to.\n *\n * This will be only available if the existing device has generated the QR\n * code and the new device is the one scanning the QR code.\n * @returns {string | undefined}\n */\n get serverName() {\n const ret = wasm.__wbg_get_msc4108intentdata_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 * @param {string} arg0\n */\n set rendezvousUrl(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_msc4108intentdata_rendezvousUrl(this.__wbg_ptr, ptr0, len0);\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 * @param {string | null} [arg0]\n */\n set serverName(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_msc4108intentdata_serverName(this.__wbg_ptr, ptr0, len0);\n }\n}\nif (Symbol.dispose) Msc4108IntentData.prototype[Symbol.dispose] = Msc4108IntentData.prototype.free;\n\n/**\n * Intent-specific data in the case the QR code adheres to\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4388 MSC4388} of the QR code\n * data format.\n */\nexport class Msc4388IntentData {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(Msc4388IntentData.prototype);\n obj.__wbg_ptr = ptr;\n Msc4388IntentDataFinalization.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 Msc4388IntentDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_msc4388intentdata_free(ptr, 0);\n }\n /**\n * The base URL of the homeserver that the device generating the QR is\n * using.\n * @returns {string}\n */\n get baseUrl() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.__wbg_get_msc4388intentdata_baseUrl(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 ID of the rendezvous session, can be used to exchange messages with\n * the other device.\n * @returns {string}\n */\n get rendezvousId() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.__wbg_get_msc4388intentdata_rendezvousId(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 base URL of the homeserver that the device generating the QR is\n * using.\n * @param {string} arg0\n */\n set baseUrl(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_msc4388intentdata_baseUrl(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * The ID of the rendezvous session, can be used to exchange messages with\n * the other device.\n * @param {string} arg0\n */\n set rendezvousId(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_msc4388intentdata_rendezvousId(this.__wbg_ptr, ptr0, len0);\n }\n}\nif (Symbol.dispose) Msc4388IntentData.prototype[Symbol.dispose] = Msc4388IntentData.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 * 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<KeysBackupRequest | undefined>}\n */\n backupRoomKeys() {\n const ret = wasm.olmmachine_backupRoomKeys(this.__wbg_ptr);\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<CrossSigningBootstrapRequests>}\n */\n bootstrapCrossSigning(reset) {\n const ret = wasm.olmmachine_bootstrapCrossSigning(this.__wbg_ptr, reset);\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 * Store the fact that we are no longer waiting for a key bundle in the\n * given room.\n *\n * The counterpart to {@link storeRoomPendingKeyBundle}. Should be called\n * when, for example, we leave a room, or have successfully imported a\n * bundle.\n *\n * @experimental\n * @param {RoomId} room_id\n * @returns {Promise<void>}\n */\n clearRoomPendingKeyBundle(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_clearRoomPendingKeyBundle(this.__wbg_ptr, room_id.__wbg_ptr);\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 * 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<CrossSigningStatus>}\n */\n crossSigningStatus() {\n const ret = wasm.olmmachine_crossSigningStatus(this.__wbg_ptr);\n return ret;\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 * 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<DecryptedRoomEvent>}\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 * 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<void>}\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 * 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 * The unique device ID that identifies this `OlmMachine`.\n * @returns {DeviceId}\n */\n get deviceId() {\n const ret = wasm.olmmachine_deviceId(this.__wbg_ptr);\n return DeviceId.__wrap(ret);\n }\n /**\n * 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<void>}\n */\n disableBackup() {\n const ret = wasm.olmmachine_disableBackup(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get the display name of our own device.\n * @returns {Promise<string | undefined>}\n */\n get displayName() {\n const ret = wasm.olmmachine_displayName(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<void>}\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 * 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 * 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<string>}\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<string>}\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 * 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 `undefined` if we don’t have any private cross signing keys;\n * otherwise returns a `CrossSigningKeyExport`.\n * @returns {Promise<CrossSigningKeyExport | undefined>}\n */\n exportCrossSigningKeys() {\n const ret = wasm.olmmachine_exportCrossSigningKeys(this.__wbg_ptr);\n return ret;\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 {(session: InboundGroupSession) => boolean} predicate\n * @returns {Promise<string>}\n */\n exportRoomKeys(predicate) {\n const ret = wasm.olmmachine_exportRoomKeys(this.__wbg_ptr, predicate);\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 * Get a list of all rooms where we are waiting for a key bundle.\n *\n * @see getPendingKeyBundleDetailsForRoom\n *\n * @experimental\n * @returns {Promise<Array<RoomPendingKeyBundleDetails>>}\n */\n getAllRoomsPendingKeyBundles() {\n const ret = wasm.olmmachine_getAllRoomsPendingKeyBundles(this.__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<BackupKeys>}\n */\n getBackupKeys() {\n const ret = wasm.olmmachine_getBackupKeys(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get a specific device of a user.\n *\n * ### Parameters\n *\n * * `user_id` - The unique ID of the user that the device belongs to.\n *\n * * `device_id` - The unique ID of the device.\n *\n * * `timeout_secs` - The amount of time we should wait for a `/keys/query`\n * response before returning if the user's device list has been marked as\n * stale. **Note**, this assumes that the requests from {@link\n * OlmMachine.outgoingRequests} are being processed and sent out.\n *\n * If unset, we will return immediately even if the device list is stale.\n *\n * ### Returns\n *\n * If the device is known, a {@link Device}. Otherwise, `undefined`.\n * @param {UserId} user_id\n * @param {DeviceId} device_id\n * @param {number | null} [timeout_secs]\n * @returns {Promise<Device | undefined>}\n */\n getDevice(user_id, device_id, timeout_secs) {\n _assertClass(user_id, UserId);\n _assertClass(device_id, DeviceId);\n const ret = wasm.olmmachine_getDevice(this.__wbg_ptr, user_id.__wbg_ptr, device_id.__wbg_ptr, !isLikeNone(timeout_secs), isLikeNone(timeout_secs) ? 0 : timeout_secs);\n return ret;\n }\n /**\n * Get 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<OwnUserIdentity | OtherUserIdentity | undefined>}\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 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<KeysClaimRequest | null>}\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 * See if we have recently accepted an invitation to the given room.\n *\n * If we have accepted an invite to a room without finding an\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4268|MSC4268}\n * key bundle, we should accept a key bundle once one arrives.\n *\n * The data returned here is populated by the application, via {@link\n * storeRoomPendingKeyBundle}.\n *\n * @experimental\n * @param {RoomId} room_id\n * @returns {Promise<RoomPendingKeyBundleDetails | undefined>}\n */\n getPendingKeyBundleDetailsForRoom(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_getPendingKeyBundleDetailsForRoom(this.__wbg_ptr, room_id.__wbg_ptr);\n return ret;\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 * 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<EncryptionInfo>}\n */\n getRoomEventEncryptionInfo(event, room_id) {\n const ptr0 = passStringToWasm0(event, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_getRoomEventEncryptionInfo(this.__wbg_ptr, ptr0, len0, room_id.__wbg_ptr);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Get the 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 * 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<Set<string>>}\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 * 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<UserDevices>}\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 {Sas | Qr | undefined}\n */\n getVerification(user_id, flow_id) {\n _assertClass(user_id, UserId);\n const ptr0 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_getVerification(this.__wbg_ptr, user_id.__wbg_ptr, ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Get a verification request object with the given flow ID.\n * @param {UserId} user_id\n * @param {string} flow_id\n * @returns {VerificationRequest | undefined}\n */\n getVerificationRequest(user_id, flow_id) {\n _assertClass(user_id, UserId);\n const ptr0 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_getVerificationRequest(this.__wbg_ptr, user_id.__wbg_ptr, ptr0, len0);\n return ret === 0 ? undefined : VerificationRequest.__wrap(ret);\n }\n /**\n * Get all the verification requests of a given user.\n * @param {UserId} user_id\n * @returns {VerificationRequest[]}\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 * Get whether we have previously downloaded all message keys for a\n * particular room from the key backup. Typically called in advance of\n * building a room key bundle.\n * @param {RoomId} room_id\n * @returns {Promise<boolean>}\n */\n hasDownloadedAllRoomKeys(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_hasDownloadedAllRoomKeys(this.__wbg_ptr, room_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 * 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<RoomId, Map<string, any>>} backed_up_room_keys\n * @param {(progress: bigint, total: bigint, failures: bigint) => void | undefined} progress_listener\n * @param {string} backup_version\n * @returns {Promise<RoomKeyImportResult>}\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 * 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<CrossSigningStatus>}\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 {(progress: bigint, total: bigint) => void} progress_listener\n * @returns {Promise<RoomKeyImportResult>}\n */\n importExportedRoomKeys(exported_room_keys, progress_listener) {\n const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_importExportedRoomKeys(this.__wbg_ptr, ptr0, len0, progress_listener);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Import the given room keys into our store.\n *\n * 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 {(imported: bigint, total: bigint) => void} progress_listener\n * @returns {Promise<string>}\n */\n importRoomKeys(exported_room_keys, progress_listener) {\n const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_importRoomKeys(this.__wbg_ptr, ptr0, len0, progress_listener);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Import 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 * 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 {JsLogger} [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 * 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} [store_name]\n * @param {string} [store_passphrase]\n * @param {JsLogger} [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 * 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<boolean>}\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 * 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<boolean>`.\n * @returns {Promise<boolean>}\n */\n isBackupEnabled() {\n const ret = wasm.olmmachine_isBackupEnabled(this.__wbg_ptr);\n return ret;\n }\n /**\n * Mark all tracked users as dirty.\n *\n * All users *whose device lists we are tracking* are flagged as needing a\n * key query. Users whose devices we are not tracking are ignored.\n * @returns {Promise<void>}\n */\n markAllTrackedUsersAsDirty() {\n const ret = wasm.olmmachine_markAllTrackedUsersAsDirty(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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<true>}\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 * 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 * 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<OutgoingRequest[]>}\n */\n outgoingRequests() {\n const ret = wasm.olmmachine_outgoingRequests(this.__wbg_ptr);\n return ret;\n }\n /**\n * Push a secret to all of our other verified devices\n *\n * This function assumes that we already have Olm sessions with the other\n * devices. This can be done by calling {@link\n * OlmMachine.getMissingSessions}.\n *\n * # Arguments\n *\n * * `secret_name` - The name of the secret to push.\n * @param {string} name\n * @returns {Promise<any>}\n */\n pushSecretToVerifiedDevices(name) {\n const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_pushSecretToVerifiedDevices(this.__wbg_ptr, ptr0, len0);\n return ret;\n }\n /**\n * Generate an \"out-of-band\" key query request for the given set of users.\n *\n * This can be useful if we need the results from `getIdentity` or\n * `getUserDevices` to be as up-to-date as possible.\n *\n * Returns a `KeysQueryRequest` object. The response of the request should\n * be passed to the `OlmMachine` with the `mark_request_as_sent`.\n *\n * Items inside `users` will be invalidated by this method. Be careful not\n * to use the `UserId`s after this method has been called.\n * @param {UserId[]} users\n * @returns {KeysQueryRequest}\n */\n queryKeysForUsers(users) {\n const ptr0 = passArrayJsValueToWasm0(users, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_queryKeysForUsers(this.__wbg_ptr, ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return KeysQueryRequest.__wrap(ret[0]);\n }\n /**\n * 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 * 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<string, number>} one_time_keys_counts\n * @param {Set<string>} [unused_fallback_keys]\n * @param {DecryptionSettings} [decryption_settings]\n * @returns {Promise<ProcessedToDeviceEvent[]>}\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 * 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<void>}\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 * 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 {(userIds: string[]) => Promise<void>} callback\n */\n registerDevicesUpdatedCallback(callback) {\n wasm.olmmachine_registerDevicesUpdatedCallback(this.__wbg_ptr, callback);\n }\n /**\n * Register a callback which will be called whenever a secret\n * (`m.secret.send`) is received.\n *\n * The only secret this will currently broadcast is the\n * `m.megolm_backup.v1` (the cross signing secrets are handled internally).\n *\n * To request a secret from other devices, a client sends an\n * `m.secret.request` device event with `action` set to `request` and\n * `name` set to the identifier of the secret. A device that wishes to\n * share the secret will reply with an `m.secret.send` event, encrypted\n * using olm.\n *\n * The secrets are guaranteed to have been received over a 1-to-1 encrypted\n * to_device message from a one of the user's own verified devices.\n *\n * See https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk_crypto/store/struct.Store.html#method.secrets_stream for more information.\n *\n * `callback` should be a function that takes 2 arguments: the secret name\n * (string) and value (string).\n *\n * **Note**: if the secret is valid and handled on the javascript side, the\n * secret inbox should be cleared by calling\n * `delete_secrets_from_inbox`.\n * @param {(name: string, value: string) => Promise<void>} callback\n */\n registerReceiveSecretCallback(callback) {\n wasm.olmmachine_registerReceiveSecretCallback(this.__wbg_ptr, callback);\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 {(info: RoomKeyInfo[]) => Promise<void>} 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 {(info: RoomKeyWithheldInfo[]) => Promise<void>} 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 {(id: UserId) => Promise<void>} callback\n */\n registerUserIdentityUpdatedCallback(callback) {\n wasm.olmmachine_registerUserIdentityUpdatedCallback(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<boolean>}\n */\n requestMissingSecretsIfNeeded() {\n const ret = wasm.olmmachine_requestMissingSecretsIfNeeded(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get the number of backed up room keys and the total number of room keys.\n * Returns a {@link RoomKeyCounts}.\n * @returns {Promise<RoomKeyCounts>}\n */\n roomKeyCounts() {\n const ret = wasm.olmmachine_roomKeyCounts(this.__wbg_ptr);\n return ret;\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 * 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 * 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<void>}\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 * Record that we have downloaded all message keys for the given room.\n * @param {RoomId} room_id\n * @returns {Promise<void>}\n */\n setHasDownloadedAllRoomKeys(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_setHasDownloadedAllRoomKeys(this.__wbg_ptr, room_id.__wbg_ptr);\n return ret;\n }\n /**\n * Store encryption settings for the given room.\n *\n * This method checks if the new settings are \"safe\" -- ie, that they do\n * not represent a downgrade in encryption security from any previous\n * settings. Attempts to downgrade security will result in an error.\n *\n * If the settings are valid, they will be persisted to the crypto store.\n * These settings are not used directly by this library, but the saved\n * settings can be retrieved via {@link getRoomSettings}.\n * @param {RoomId} room_id\n * @param {RoomSettings} room_settings\n * @returns {Promise<void>}\n */\n setRoomSettings(room_id, room_settings) {\n _assertClass(room_id, RoomId);\n _assertClass(room_settings, RoomSettings);\n const ret = wasm.olmmachine_setRoomSettings(this.__wbg_ptr, room_id.__wbg_ptr, room_settings.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * 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 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<ToDeviceRequest[]>}\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 * 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 * Sign the given message using our device key and if available\n * cross-signing master key.\n * @param {string} message\n * @returns {Promise<Signatures>}\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 * Store the fact that we have accepted an invitation to the given room, so\n * should accept a key bundle if one arrives soon.\n *\n * This should be called whenever we join a room following an invite, but\n * it has no effect other than that the room will be returned by a future\n * call to {@link getPendingKeyBundleDetailsForRoom}.\n *\n * @experimental\n * @param {RoomId} room_id\n * @param {UserId} inviter\n * @returns {Promise<void>}\n */\n storeRoomPendingKeyBundle(room_id, inviter) {\n _assertClass(room_id, RoomId);\n _assertClass(inviter, UserId);\n const ret = wasm.olmmachine_storeRoomPendingKeyBundle(this.__wbg_ptr, room_id.__wbg_ptr, inviter.__wbg_ptr);\n return 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<Set<UserId>>}\n */\n trackedUsers() {\n const ret = wasm.olmmachine_trackedUsers(this.__wbg_ptr);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Update the list of tracked users.\n *\n * The OlmMachine maintains a list of users whose devices we are keeping\n * track of: these are known as \"tracked users\". These must be users\n * that we share a room with, so that the server sends us updates for\n * their device lists.\n *\n * # Arguments\n *\n * * `users` - An array of user ids that should be added to the list of\n * tracked users\n *\n * Any users that hadn't been seen before will be flagged for a key query\n * immediately, and whenever `receive_sync_changes` receives a\n * \"changed\" notification for that user in the future.\n *\n * Users that were already in the list are unaffected.\n *\n * Items inside `users` will be invalidated by this method. Be careful not\n * to use the `UserId`s after this method has been called.\n * @param {UserId[]} users\n * @returns {Promise<void>}\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 * 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 * 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<SignatureVerification>}\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}\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 * 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 * 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 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 * Pin the current identity (public part of the master signing key).\n * @returns {Promise<void>}\n */\n pinCurrentMasterKey() {\n const ret = wasm.otheruseridentity_pinCurrentMasterKey(this.__wbg_ptr);\n return ret;\n }\n /**\n * Create a `VerificationRequest` object after the verification\n * request content has been sent out.\n * @param {RoomId} room_id\n * @param {EventId} request_event_id\n * @param {VerificationMethod[]} [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 * 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 * 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 {VerificationMethod[]} [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<SignatureUploadRequest>}\n */\n verify() {\n const ret = wasm.otheruseridentity_verify(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 * 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<void>}\n */\n withdrawVerification() {\n const ret = wasm.otheruseridentity_withdrawVerification(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_outboundcreationresult_channel(this.__wbg_ptr);\n return EstablishedEcies.__wrap(ret);\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 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_outboundcreationresult_channel(this.__wbg_ptr, ptr0);\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_outboundcreationresult_initial_message(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 * 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 * 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 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 * Send a verification request to our other devices.\n * @param {VerificationMethod[]} [methods]\n * @returns {Promise<[VerificationRequest, OutgoingVerificationRequest]>}\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 * 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 * 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<boolean>}\n */\n trustsOurOwnDevice() {\n const ret = wasm.ownuseridentity_trustsOurOwnDevice(this.__wbg_ptr);\n return ret;\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 * 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<SignatureUploadRequest>}\n */\n verify() {\n const ret = wasm.ownuseridentity_verify(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 * 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<void>}\n */\n withdrawVerification() {\n const ret = wasm.ownuseridentity_withdrawVerification(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 * 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 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 * 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 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 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 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 * Construct a new `PickledInboundGroupSession`, with default values.\n */\n constructor() {\n const ret = wasm.pickledinboundgroupsession_new();\n this.__wbg_ptr = ret >>> 0;\n PickledInboundGroupSessionFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * 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 * 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 * 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_pickledinboundgroupsession_pickle(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 * @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 * 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_pickledinboundgroupsession_senderKey(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 * @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_pickledinboundgroupsession_senderSigningKey(this.__wbg_ptr, ptr0, len0);\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 * 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 * 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 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 * 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 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 * 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 * 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 * @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 * @param {Date} arg0\n */\n set lastUseTime(arg0) {\n wasm.__wbg_set_pickledsession_lastUseTime(this.__wbg_ptr, arg0);\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_pickledsession_pickle(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 * @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_pickledsession_senderKey(this.__wbg_ptr, ptr0, len0);\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 * 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 * 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 `PkDecryption` instance from a secret key.\n * @param {Curve25519SecretKey} key\n * @returns {PkDecryption}\n */\n static fromKey(key) {\n _assertClass(key, Curve25519SecretKey);\n const ret = wasm.pkdecryption_fromKey(key.__wbg_ptr);\n return PkDecryption.__wrap(ret);\n }\n /**\n * 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 * 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}\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 byte message and returns an encrypted {@link PkMessage}.\n * @param {Uint8Array} message\n * @returns {PkMessage}\n */\n encrypt(message) {\n const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.pkencryption_encrypt(this.__wbg_ptr, ptr0, len0);\n return PkMessage.__wrap(ret);\n }\n /**\n * Encrypts a string message and returns an encrypted {@link PkMessage}.\n * @param {string} message\n * @returns {PkMessage}\n */\n encryptString(message) {\n const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.pkencryption_encryptString(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 * Returns the ephemeral public key used during encryption.\n * @returns {Curve25519PublicKey}\n */\n ephemeralKey() {\n const ret = wasm.pkmessage_ephemeralKey(this.__wbg_ptr);\n return Curve25519PublicKey.__wrap(ret);\n }\n /**\n * Constructs a `PkMessage` from 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 * 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 * 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 * Cancel the verification flow.\n *\n * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @returns {OutgoingVerificationRequest | undefined}\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 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 * Cancel the verification.\n *\n * This cancels the verification with given code (e.g. `m.user`).\n *\n * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @param {string} code\n * @returns {OutgoingVerificationRequest | undefined}\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 `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already confirmed.\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 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 * 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 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 * 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 * 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 * 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 * 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 * 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 {OutgoingVerificationRequest | undefined}\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 * 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 * 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 {() => Promise<void>} callback\n */\n registerChangesCallback(callback) {\n wasm.qr_registerChangesCallback(this.__wbg_ptr, callback);\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 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 * Generate a the raw bytes that should be encoded as a QR code\n * is representing this verification flow.\n *\n * The `to_qr_code` method can be used to instead output a QrCode\n * object that can be rendered.\n * @returns {Uint8ClampedArray}\n */\n toBytes() {\n const ret = wasm.qr_toBytes(this.__wbg_ptr);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * 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 * 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 * 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}\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 *\n * This type supports both the format originally speicied in\n * {link https://github.com/matrix-org/matrix-spec-proposals/pull/4108 MSC4108} as well as the\n * updated format found in\n * {link https://github.com/matrix-org/matrix-spec-proposals/pull/4388 MSC4388}.\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 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 * 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 intent-specific data embedded in the {@link QrCodeData}.\n * @returns {QrCodeIntentData}\n */\n get intentData() {\n const ret = wasm.qrcodedata_intentData(this.__wbg_ptr);\n return QrCodeIntentData.__wrap(ret);\n }\n /**\n * Get the mode of this {@link QrCodeData} instance.\n * @returns {QrCodeIntent}\n */\n get mode() {\n const ret = wasm.qrcodedata_mode(this.__wbg_ptr);\n return ret;\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 QrCodeIntent.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 QrCodeIntent.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 * Create new {@link QrCodeData} from a given public key, a rendezvous ID\n * and, a base homeserver URL.\n *\n * This creates a QR code which conforms to\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4388 MSC4388} of the data\n * format for QR login.\n * @param {Curve25519PublicKey} public_key\n * @param {string} rendezvous_id\n * @param {string} base_url\n * @param {QrCodeIntent} intent\n * @returns {QrCodeData}\n */\n static newMsc4388(public_key, rendezvous_id, base_url, intent) {\n _assertClass(public_key, Curve25519PublicKey);\n var ptr0 = public_key.__destroy_into_raw();\n const ptr1 = passStringToWasm0(rendezvous_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.qrcodedata_newMsc4388(ptr0, ptr1, len1, ptr2, len2, intent);\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 * [HPKE](https://www.rfc-editor.org/rfc/rfc9180.html)\n * (Hybrid Public Key Encryption) channel with the other device.\n * @returns {Curve25519PublicKey}\n */\n get publicKey() {\n const ret = wasm.qrcodedata_publicKey(this.__wbg_ptr);\n return Curve25519PublicKey.__wrap(ret);\n }\n /**\n * Get the URL of the rendezvous server which will be used to exchange\n * messages between the two devices.\n * @returns {string | undefined}\n */\n get rendezvousUrl() {\n const ret = wasm.qrcodedata_rendezvousUrl(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 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 * Encode the {@link QrCodeData} into a string using base64.\n *\n * This format can be used for debugging purposes and the\n * [`QrcodeData::from_base64()`] method can be used to parse the string\n * again.\n * @returns {string}\n */\n toBase64() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.qrcodedata_toBase64(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * 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}\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 QrCodeIntent = 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 * Intent and MSC-specific data class for the QR code login support.\n */\nexport class QrCodeIntentData {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(QrCodeIntentData.prototype);\n obj.__wbg_ptr = ptr;\n QrCodeIntentDataFinalization.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 QrCodeIntentDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_qrcodeintentdata_free(ptr, 0);\n }\n /**\n * The MSC4108-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4108. Otherwise it will contain\n * MSC4388-specific intent data.\n * @returns {Msc4108IntentData | undefined}\n */\n get msc4108() {\n const ret = wasm.__wbg_get_qrcodeintentdata_msc4108(this.__wbg_ptr);\n return ret === 0 ? undefined : Msc4108IntentData.__wrap(ret);\n }\n /**\n * The MSC4833-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4388. Otherwise it will contain\n * MSC4108-specific intent data.\n * @returns {Msc4388IntentData | undefined}\n */\n get msc4388() {\n const ret = wasm.__wbg_get_qrcodeintentdata_msc4388(this.__wbg_ptr);\n return ret === 0 ? undefined : Msc4388IntentData.__wrap(ret);\n }\n /**\n * The MSC4108-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4108. Otherwise it will contain\n * MSC4388-specific intent data.\n * @param {Msc4108IntentData | null} [arg0]\n */\n set msc4108(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Msc4108IntentData);\n ptr0 = arg0.__destroy_into_raw();\n }\n wasm.__wbg_set_qrcodeintentdata_msc4108(this.__wbg_ptr, ptr0);\n }\n /**\n * The MSC4833-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4388. Otherwise it will contain\n * MSC4108-specific intent data.\n * @param {Msc4388IntentData | null} [arg0]\n */\n set msc4388(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Msc4388IntentData);\n ptr0 = arg0.__destroy_into_raw();\n }\n wasm.__wbg_set_qrcodeintentdata_msc4388(this.__wbg_ptr, ptr0);\n }\n}\nif (Symbol.dispose) QrCodeIntentData.prototype[Symbol.dispose] = QrCodeIntentData.prototype.free;\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<RoomKeyInfo[]>}\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 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 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 number of backed up room keys.\n * @param {number} arg0\n */\n set backedUp(arg0) {\n wasm.__wbg_set_roomkeycounts_backedUp(this.__wbg_ptr, arg0);\n }\n /**\n * 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}\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 number of room keys that were imported.\n * @returns {number}\n */\n get importedCount() {\n const ret = wasm.__wbg_get_roomkeyimportresult_importedCount(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * The total number of room keys that were found in the export.\n * @returns {number}\n */\n get totalCount() {\n const ret = wasm.__wbg_get_roomkeyimportresult_totalCount(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * The keys that were imported.\n *\n * A Map from room id to a Map of the sender key to a Set of session ids.\n *\n * Typescript type: `Map<string, Map<string, Set<string>>`.\n * @returns {Map<string, Map<string, Set<string>>>}\n */\n keys() {\n const ret = wasm.roomkeyimportresult_keys(this.__wbg_ptr);\n return ret;\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 {@link EncryptionAlgorithm} that this key is used for. Will be one\n * of the `m.megolm.*` algorithms.\n * @returns {EncryptionAlgorithm}\n */\n get algorithm() {\n const ret = wasm.roomkeyinfo_algorithm(this.__wbg_ptr);\n return ret;\n }\n /**\n * The room where the key is used.\n * @returns {RoomId}\n */\n get roomId() {\n const ret = wasm.roomkeyinfo_roomId(this.__wbg_ptr);\n return RoomId.__wrap(ret);\n }\n /**\n * The Curve25519 key of the device which initiated the session originally.\n * @returns {Curve25519PublicKey}\n */\n get senderKey() {\n const ret = wasm.roomkeyinfo_senderKey(this.__wbg_ptr);\n return Curve25519PublicKey.__wrap(ret);\n }\n /**\n * The ID of the session that the key is for.\n * @returns {string}\n */\n get sessionId() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.roomkeyinfo_sessionId(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\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 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 /**\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 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 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}\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 * A JSON-encoded object containing the message's content.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_roommessagerequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * 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 * Create a new `RoomMessageRequest`.\n * @param {string} id\n * @param {string} room_id\n * @param {string} txn_id\n * @param {string} event_type\n * @param {string} content\n */\n constructor(id, room_id, txn_id, event_type, content) {\n const ret = wasm.roommessagerequest_new(id, room_id, txn_id, event_type, content);\n this.__wbg_ptr = ret >>> 0;\n RoomMessageRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.roommessagerequest_type(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) RoomMessageRequest.prototype[Symbol.dispose] = RoomMessageRequest.prototype.free;\n\n/**\n * Information on a room which is waiting for a key bundle to arrive.\n */\nexport class RoomPendingKeyBundleDetails {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(RoomPendingKeyBundleDetails.prototype);\n obj.__wbg_ptr = ptr;\n RoomPendingKeyBundleDetailsFinalization.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 RoomPendingKeyBundleDetailsFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roompendingkeybundledetails_free(ptr, 0);\n }\n /**\n * The time that the invite was accepted.\n * @returns {number}\n */\n get inviteAcceptedAtMillis() {\n const ret = wasm.roompendingkeybundledetails_inviteAcceptedAtMillis(this.__wbg_ptr);\n return ret;\n }\n /**\n * The ID of the user that invited us\n * @returns {UserId}\n */\n get inviterId() {\n const ret = wasm.roompendingkeybundledetails_inviterId(this.__wbg_ptr);\n return UserId.__wrap(ret);\n }\n /**\n * The room that is waiting for a key bundle.\n * @returns {RoomId}\n */\n get roomId() {\n const ret = wasm.roompendingkeybundledetails_roomId(this.__wbg_ptr);\n return RoomId.__wrap(ret);\n }\n}\nif (Symbol.dispose) RoomPendingKeyBundleDetails.prototype[Symbol.dispose] = RoomPendingKeyBundleDetails.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 * 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 * 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 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 * 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 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 * 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 * @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 * @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 * @param {boolean} arg0\n */\n set onlyAllowTrustedDevices(arg0) {\n wasm.__wbg_set_roomsettings_onlyAllowTrustedDevices(this.__wbg_ptr, arg0);\n }\n /**\n * The maximum number of messages an encryption session should be used for,\n * before it is rotated.\n * @param {number | null} [arg0]\n */\n set sessionRotationPeriodMessages(arg0) {\n wasm.__wbg_set_roomsettings_sessionRotationPeriodMessages(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? 0 : arg0);\n }\n /**\n * 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}\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 * Accept the SAS verification.\n *\n * This does nothing (and returns `undefined`) if the verification was\n * already accepted, otherwise it returns an `OutgoingVerificationRequest`\n * that needs to be sent out.\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 * Cancel the verification.\n *\n * This cancels the verification with given code (e.g. `m.user`).\n *\n * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @param {string} code\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 `OutgoingVerificationRequest`s.\n * @returns {Promise<OutgoingVerificationRequest[]>}\n */\n confirm() {\n const ret = wasm.sas_confirm(this.__wbg_ptr);\n return 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 * Get the emoji version of the short auth string.\n *\n * Returns `undefined` if we can't yet present the short auth string,\n * otherwise an array of seven `Emoji` objects.\n * @returns {Emoji[] | undefined}\n */\n emoji() {\n const ret = wasm.sas_emoji(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n }\n return v1;\n }\n /**\n * Get the index of the emoji representing the short auth string\n *\n * Returns `undefined` if we can’t yet present the short auth\n * string, otherwise seven `u8` numbers in the range from 0 to 63\n * inclusive which can be converted to an emoji using [the\n * relevant specification\n * entry](https://spec.matrix.org/unstable/client-server-api/#sas-method-emoji).\n * @returns {Uint8Array | undefined}\n */\n emojiIndex() {\n const ret = wasm.sas_emojiIndex(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n }\n return v1;\n }\n /**\n * Get the 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 * 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 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 * Is the SAS flow done?\n * @returns {boolean}\n */\n isDone() {\n const ret = wasm.sas_isDone(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is 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 * Get the device ID of the other side.\n * @returns {DeviceId}\n */\n get otherDeviceId() {\n const ret = wasm.sas_otherDeviceId(this.__wbg_ptr);\n return DeviceId.__wrap(ret);\n }\n /**\n * Get the 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 * 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 {() => Promise<void>} callback\n */\n registerChangesCallback(callback) {\n wasm.sas_registerChangesCallback(this.__wbg_ptr, callback);\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 * 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 * 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 * Has the SAS verification flow timed out?\n * @returns {boolean}\n */\n timedOut() {\n const ret = wasm.sas_timedOut(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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 * 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}\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 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 * Deserialize the [`SecretsBundle`] from a JSON object.\n * @param {unknown} json\n * @returns {SecretsBundle}\n */\n static from_json(json) {\n const ret = wasm.secretsbundle_from_json(json);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return SecretsBundle.__wrap(ret[0]);\n }\n /**\n * The seed of the master key encoded as unpadded base64.\n * @returns {string}\n */\n get masterKey() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.secretsbundle_masterKey(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * The seed of the self signing key encoded as unpadded base64.\n * @returns {string}\n */\n get selfSigningKey() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.secretsbundle_selfSigningKey(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * Serialize the [`SecretsBundle`] to a JSON object.\n * @returns {unknown}\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 * 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}\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 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 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 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 * 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 * 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 * 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 /**\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 * 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}\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 * 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 * 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 * Create a new `SignatureUploadRequest`.\n * @param {string} id\n * @param {string} signed_keys\n */\n constructor(id, signed_keys) {\n const ret = wasm.signatureuploadrequest_new(id, signed_keys);\n this.__wbg_ptr = ret >>> 0;\n SignatureUploadRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.signatureuploadrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 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 /**\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}\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 * 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 * 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 map of signatures that belong to the given user.\n * @param {UserId} signer\n * @returns {Map<string, MaybeSignature> | 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 * 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 * Do we hold any signatures or is our collection completely\n * empty.\n * @returns {boolean}\n */\n isEmpty() {\n const ret = wasm.signatures_isEmpty(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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}\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 | undefined} store_name\n * @param {string | null | undefined} store_passphrase\n * @param {JsLogger} [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 {JsLogger} [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 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 room that these keys are for.\n * @returns {RoomId}\n */\n get roomId() {\n const ret = wasm.storedroomkeybundledata_roomId(this.__wbg_ptr);\n return RoomId.__wrap(ret);\n }\n /**\n * The 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 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}\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 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 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 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_todeviceencryptioninfo_senderCurve25519Key(this.__wbg_ptr, ptr0, len0);\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 * 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 * 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 * A JSON-encoded object containing the rest of the payload: `messages`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_todevicerequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * 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 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 * Create a new `ToDeviceRequest`.\n * @param {string} id\n * @param {string} event_type\n * @param {string} txn_id\n * @param {string} body\n */\n constructor(id, event_type, txn_id, body) {\n const ret = wasm.todevicerequest_new(id, event_type, txn_id, body);\n this.__wbg_ptr = ret >>> 0;\n ToDeviceRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.todevicerequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * Re-define the minimum logger level.\n * @param {LoggerLevel} min_level\n */\n set minLevel(min_level) {\n const ret = wasm.tracing_set_minLevel(this.__wbg_ptr, min_level);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n }\n /**\n * Turn the logger 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 * 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}\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 original message (of type `m.room.encrypted`) that failed to be\n * decrypted, encoded as JSON.\n * @returns {string}\n */\n get rawEvent() {\n const ret = wasm.__wbg_get_utdtodeviceevent_rawEvent(this.__wbg_ptr);\n return ret;\n }\n /**\n * Information on the reason we failed to decrypt\n * @returns {ToDeviceUnableToDecryptInfo}\n */\n get utdInfo() {\n const ret = wasm.__wbg_get_utdtodeviceevent_utdInfo(this.__wbg_ptr);\n return ToDeviceUnableToDecryptInfo.__wrap(ret);\n }\n /**\n * The type of processed to-device event. Always {@link\n * ProcessedToDeviceEventType.UnableToDecrypt} for this type.\n * @returns {ProcessedToDeviceEventType}\n */\n get type() {\n const ret = wasm.utdtodeviceevent_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * Iterator over all the devices of the user devices.\n * @returns {Device[]}\n */\n devices() {\n const ret = wasm.userdevices_devices(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get the specific device with the given device ID.\n * @param {DeviceId} device_id\n * @returns {Device | undefined}\n */\n get(device_id) {\n _assertClass(device_id, DeviceId);\n const ret = wasm.userdevices_get(this.__wbg_ptr, device_id.__wbg_ptr);\n return ret === 0 ? undefined : Device.__wrap(ret);\n }\n /**\n * Returns true if there is at least one devices of this user\n * that is considered to be verified, false otherwise.\n *\n * This won't consider your own device as verified, as your own\n * device is always implicitly verified.\n * @returns {boolean}\n */\n isAnyVerified() {\n const ret = wasm.userdevices_isAnyVerified(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Array over all the device IDs of the user devices.\n * @returns {DeviceId[]}\n */\n keys() {\n const ret = wasm.userdevices_keys(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 * 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 * 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 * 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 * Parse/validate and create a new `UserId`.\n * @param {string} id\n */\n constructor(id) {\n const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.userid_new(ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n this.__wbg_ptr = ret[0] >>> 0;\n UserIdFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Returns the 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 * 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 * 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 {OutgoingVerificationRequest | undefined}\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 * 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 {VerificationMethod[]} methods\n * @returns {OutgoingVerificationRequest | undefined}\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 * Cancel the verification request.\n *\n * It returns either a `ToDeviceRequest`, a `RoomMessageRequest`\n * or `undefined`.\n * @returns {OutgoingVerificationRequest | undefined}\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 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 * 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 * 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<Qr | undefined>}\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 {Sas | Qr | undefined}\n */\n getVerification() {\n const ret = wasm.verificationrequest_getVerification(this.__wbg_ptr);\n return 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 * 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 * Has the verification request been answered by another device?\n * @returns {boolean}\n */\n isPassive() {\n const ret = wasm.verificationrequest_isPassive(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is the verification request ready to start a verification flow?\n * @returns {boolean}\n */\n isReady() {\n const ret = wasm.verificationrequest_isReady(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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 * 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 * 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 * 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 {VerificationMethod[] | 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 * 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 * 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 * 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 {() => Promise<void>} callback\n */\n registerChangesCallback(callback) {\n wasm.verificationrequest_registerChangesCallback(this.__wbg_ptr, callback);\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 {VerificationMethod[]} [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 * Start a QR code verification by providing a scanned QR code\n * for this verification flow.\n * @param {QrCodeScan} data\n * @returns {Promise<Qr>}\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 * Transition from this verification request into a SAS verification flow.\n *\n * Returns `Promise<[Sas, OutgoingVerificationRequest] | undefined>`\n * @returns {Promise<[Sas, OutgoingVerificationRequest] | undefined>}\n */\n startSas() {\n const ret = wasm.verificationrequest_startSas(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 {VerificationMethod[] | 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 * 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 * Has the verification flow timed out?\n * @returns {boolean}\n */\n timedOut() {\n const ret = wasm.verificationrequest_timedOut(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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}\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 build-time output of the `git describe` command of the source tree\n * of crate.\n * @returns {string}\n */\n get git_description() {\n const ret = wasm.__wbg_get_versions_git_description(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 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 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}\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}\nexport function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return ret;\n}\nexport function __wbg_Number_32bf70a599af1d4b(arg0) {\n const ret = Number(arg0);\n return ret;\n}\nexport function __wbg_String_8564e559799eccda(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}\nexport function __wbg_Window_241244be8c9776c1(arg0) {\n const ret = arg0.Window;\n return ret;\n}\nexport function __wbg_WorkerGlobalScope_8623a7c9030fbce2(arg0) {\n const ret = arg0.WorkerGlobalScope;\n return ret;\n}\nexport function __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51(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}\nexport function __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff(arg0) {\n const v = arg0;\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n}\nexport function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(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}\nexport function __wbg___wbindgen_in_a5d8b22e52b24dd1(arg0, arg1) {\n const ret = arg0 in arg1;\n return ret;\n}\nexport function __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93(arg0) {\n const ret = typeof(arg0) === 'bigint';\n return ret;\n}\nexport function __wbg___wbindgen_is_function_3baa9db1a987f47d(arg0) {\n const ret = typeof(arg0) === 'function';\n return ret;\n}\nexport function __wbg___wbindgen_is_null_52ff4ec04186736f(arg0) {\n const ret = arg0 === null;\n return ret;\n}\nexport function __wbg___wbindgen_is_object_63322ec0cd6ea4ef(arg0) {\n const val = arg0;\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n}\nexport function __wbg___wbindgen_is_string_6df3bf7ef1164ed3(arg0) {\n const ret = typeof(arg0) === 'string';\n return ret;\n}\nexport function __wbg___wbindgen_is_undefined_29a43b4d42920abd(arg0) {\n const ret = arg0 === undefined;\n return ret;\n}\nexport function __wbg___wbindgen_jsval_eq_d3465d8a07697228(arg0, arg1) {\n const ret = arg0 === arg1;\n return ret;\n}\nexport function __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c(arg0, arg1) {\n const ret = arg0 == arg1;\n return ret;\n}\nexport function __wbg___wbindgen_number_get_c7f42aed0525c451(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}\nexport function __wbg___wbindgen_string_get_7ed5322991caaec5(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}\nexport function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n}\nexport function __wbg___wbindgen_try_into_number_d7832e9de41bafc5(arg0) {\n let result;\n try { result = +arg0 } catch (e) { result = e }\n const ret = result;\n return ret;\n}\nexport function __wbg__wbg_cb_unref_b46c9b5a9f08ec37(arg0) {\n arg0._wbg_cb_unref();\n}\nexport function __wbg_abort_b64b5c37b7b5156d() { return handleError(function (arg0) {\n arg0.abort();\n}, arguments); }\nexport function __wbg_add_af6966918740a569(arg0, arg1) {\n const ret = arg0.add(arg1);\n return ret;\n}\nexport function __wbg_add_e04fd556bc38ef11() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.add(arg1, arg2);\n return ret;\n}, arguments); }\nexport function __wbg_at_03a250b9f2ce7aa5(arg0, arg1) {\n const ret = arg0.at(arg1);\n return ret;\n}\nexport function __wbg_backupkeys_new(arg0) {\n const ret = BackupKeys.__wrap(arg0);\n return ret;\n}\nexport function __wbg_bound_d976f60d9eb7b26b() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = IDBKeyRange.bound(arg0, arg1, arg2 !== 0, arg3 !== 0);\n return ret;\n}, arguments); }\nexport function __wbg_call_14b169f759b26747() { return handleError(function (arg0, arg1) {\n const ret = arg0.call(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_call_86e39d65afc3d9db() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n const ret = arg0.call(arg1, arg2, arg3, arg4);\n return ret;\n}, arguments); }\nexport function __wbg_call_a24592a6f349a97e() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.call(arg1, arg2);\n return ret;\n}, arguments); }\nexport function __wbg_call_bb28efe6b2f55b86() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.call(arg1, arg2, arg3);\n return ret;\n}, arguments); }\nexport function __wbg_clearTimeout_113b1cde814ec762(arg0) {\n const ret = clearTimeout(arg0);\n return ret;\n}\nexport function __wbg_clear_e20ff80e7eda7707() { return handleError(function (arg0) {\n const ret = arg0.clear();\n return ret;\n}, arguments); }\nexport function __wbg_close_a7d2c11ae747c112(arg0) {\n arg0.close();\n}\nexport function __wbg_code_e2d14bb68011f972(arg0) {\n const ret = arg0.code;\n return ret;\n}\nexport function __wbg_commit_ebd6d9676954e0d2() { return handleError(function (arg0) {\n arg0.commit();\n}, arguments); }\nexport function __wbg_continue_8576ea85aa470fb3() { return handleError(function (arg0) {\n arg0.continue();\n}, arguments); }\nexport function __wbg_count_9fc90fc071a17693() { return handleError(function (arg0) {\n const ret = arg0.count();\n return ret;\n}, arguments); }\nexport function __wbg_count_b3e4ca49e145e073() { return handleError(function (arg0) {\n const ret = arg0.count();\n return ret;\n}, arguments); }\nexport function __wbg_createIndex_b7dc3a4f19fc4231() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n const ret = arg0.createIndex(getStringFromWasm0(arg1, arg2), arg3, arg4);\n return ret;\n}, arguments); }\nexport function __wbg_createIndex_b9253d2f61b19445() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.createIndex(getStringFromWasm0(arg1, arg2), arg3);\n return ret;\n}, arguments); }\nexport function __wbg_createObjectStore_fda2c8d772b080f5() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_crosssigningbootstraprequests_new(arg0) {\n const ret = CrossSigningBootstrapRequests.__wrap(arg0);\n return ret;\n}\nexport function __wbg_crosssigningkeyexport_new(arg0) {\n const ret = CrossSigningKeyExport.__wrap(arg0);\n return ret;\n}\nexport function __wbg_crosssigningstatus_new(arg0) {\n const ret = CrossSigningStatus.__wrap(arg0);\n return ret;\n}\nexport function __wbg_crypto_38df2bab126b63dc(arg0) {\n const ret = arg0.crypto;\n return ret;\n}\nexport function __wbg_debug_ae77527a1d0ebaf4(arg0, arg1) {\n arg0.debug(arg1);\n}\nexport function __wbg_debug_c014a160490283dc(arg0) {\n console.debug(arg0);\n}\nexport function __wbg_decryptedroomevent_new(arg0) {\n const ret = DecryptedRoomEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_decryptedtodeviceevent_new(arg0) {\n const ret = DecryptedToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_dehydrateddevice_new(arg0) {\n const ret = DehydratedDevice.__wrap(arg0);\n return ret;\n}\nexport function __wbg_dehydrateddevicekey_new(arg0) {\n const ret = DehydratedDeviceKey.__wrap(arg0);\n return ret;\n}\nexport function __wbg_deleteObjectStore_081280ffb13f9792() { return handleError(function (arg0, arg1, arg2) {\n arg0.deleteObjectStore(getStringFromWasm0(arg1, arg2));\n}, arguments); }\nexport function __wbg_delete_10b3489d089185d7() { return handleError(function (arg0, arg1) {\n const ret = arg0.delete(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_delete_be787f4f73f54f72() { return handleError(function (arg0) {\n const ret = arg0.delete();\n return ret;\n}, arguments); }\nexport function __wbg_device_new(arg0) {\n const ret = Device.__wrap(arg0);\n return ret;\n}\nexport function __wbg_deviceid_new(arg0) {\n const ret = DeviceId.__wrap(arg0);\n return ret;\n}\nexport function __wbg_devicekey_new(arg0) {\n const ret = DeviceKey.__wrap(arg0);\n return ret;\n}\nexport function __wbg_devicekeyid_new(arg0) {\n const ret = DeviceKeyId.__wrap(arg0);\n return ret;\n}\nexport function __wbg_done_9158f7cc8751ba32(arg0) {\n const ret = arg0.done;\n return ret;\n}\nexport function __wbg_emoji_new(arg0) {\n const ret = Emoji.__wrap(arg0);\n return ret;\n}\nexport function __wbg_encryptedattachment_new(arg0) {\n const ret = EncryptedAttachment.__wrap(arg0);\n return ret;\n}\nexport function __wbg_encryptioninfo_new(arg0) {\n const ret = EncryptionInfo.__wrap(arg0);\n return ret;\n}\nexport function __wbg_entries_2bf997cf82353e47(arg0) {\n const ret = arg0.entries();\n return ret;\n}\nexport function __wbg_entries_e0b73aa8571ddb56(arg0) {\n const ret = Object.entries(arg0);\n return ret;\n}\nexport function __wbg_error_2001591ad2463697(arg0) {\n console.error(arg0);\n}\nexport function __wbg_error_43690a185e0311ac() { return handleError(function (arg0) {\n const ret = arg0.error;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_error_a6fa202b58aa1cd3(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}\nexport function __wbg_error_f90e6029c0c95d2f(arg0, arg1) {\n arg0.error(arg1);\n}\nexport function __wbg_from_0dbf29f09e7fb200(arg0) {\n const ret = Array.from(arg0);\n return ret;\n}\nexport function __wbg_getAllKeys_e28d29be9123b6fe() { return handleError(function (arg0) {\n const ret = arg0.getAllKeys();\n return ret;\n}, arguments); }\nexport function __wbg_getAll_1050a25926d2df6c() { return handleError(function (arg0, arg1) {\n const ret = arg0.getAll(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_getAll_3e09c6ad8427b762() { return handleError(function (arg0) {\n const ret = arg0.getAll();\n return ret;\n}, arguments); }\nexport function __wbg_getAll_73e044a8374165f8() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.getAll(arg1, arg2 >>> 0);\n return ret;\n}, arguments); }\nexport function __wbg_getAll_a898878594f5e590() { return handleError(function (arg0) {\n const ret = arg0.getAll();\n return ret;\n}, arguments); }\nexport function __wbg_getRandomValues_76dfc69825c9c552() { return handleError(function (arg0, arg1) {\n globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n}, arguments); }\nexport function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {\n arg0.getRandomValues(arg1);\n}, arguments); }\nexport function __wbg_getRandomValues_d49329ff89a07af1() { return handleError(function (arg0, arg1) {\n globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n}, arguments); }\nexport function __wbg_getTime_da7c55f52b71e8c6(arg0) {\n const ret = arg0.getTime();\n return ret;\n}\nexport function __wbg_get_1affdbdd5573b16a() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(arg0, arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_6011fa3a58f61074() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(arg0, arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_803cfa78503173c3() { return handleError(function (arg0, arg1) {\n const ret = arg0.get(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_8360291721e2339f(arg0, arg1) {\n const ret = arg0[arg1 >>> 0];\n return ret;\n}\nexport function __wbg_get_eb2958ee233cccd9() { return handleError(function (arg0, arg1) {\n const ret = arg0.get(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {\n const ret = arg0[arg1 >>> 0];\n return ret;\n}\nexport function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {\n const ret = arg0[arg1];\n return ret;\n}\nexport function __wbg_global_94a489d2e6a0c5fd(arg0) {\n const ret = arg0.global;\n return ret;\n}\nexport function __wbg_inboundgroupsession_new(arg0) {\n const ret = InboundGroupSession.__wrap(arg0);\n return ret;\n}\nexport function __wbg_index_072be17bcbd46242() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.index(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_indexedDB_47c354eb27472a00() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_indexedDB_9cd90e32ea3da2e4() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_indexedDB_ac4afadd7c87762a() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_info_33de32580bb04e23(arg0, arg1) {\n arg0.info(arg1);\n}\nexport function __wbg_info_7479429238bffbce(arg0) {\n console.info(arg0);\n}\nexport function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(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}\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}\nexport function __wbg_instanceof_DomException_2ce86bc775566ba2(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}\nexport function __wbg_instanceof_Error_6872d63ba7922898(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}\nexport function __wbg_instanceof_IdbCursor_98630480e23ef2a1(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}\nexport function __wbg_instanceof_IdbDatabase_3b6930bc25a91170(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}\nexport function __wbg_instanceof_IdbOpenDbRequest_d0071b8c6aae51ff(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}\nexport function __wbg_instanceof_IdbRequest_cb20b218916840b2(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}\nexport function __wbg_instanceof_Map_1b76fd4635be43eb(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}\nexport function __wbg_instanceof_Promise_78658358a9b27cd4(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}\nexport function __wbg_instanceof_Uint8Array_152ba1f289edcf3f(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}\nexport function __wbg_invalidtodeviceevent_new(arg0) {\n const ret = InvalidToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_isArray_2790516aa848bf18(arg0) {\n const ret = Array.isArray(arg0);\n return ret;\n}\nexport function __wbg_isArray_c3109d14ffc06469(arg0) {\n const ret = Array.isArray(arg0);\n return ret;\n}\nexport function __wbg_isSafeInteger_4fc213d1989d6d2a(arg0) {\n const ret = Number.isSafeInteger(arg0);\n return ret;\n}\nexport function __wbg_item_16fa9d71e7623fb3(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}\nexport function __wbg_iterator_013bc09ec998c2a7() {\n const ret = Symbol.iterator;\n return ret;\n}\nexport function __wbg_key_3b366eba0fc3946a() { return handleError(function (arg0) {\n const ret = arg0.key;\n return ret;\n}, arguments); }\nexport function __wbg_keysbackuprequest_new(arg0) {\n const ret = KeysBackupRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_keysclaimrequest_new(arg0) {\n const ret = KeysClaimRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_keysqueryrequest_new(arg0) {\n const ret = KeysQueryRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_keysuploadrequest_new(arg0) {\n const ret = KeysUploadRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_length_3d4ecd04bd8d22f1(arg0) {\n const ret = arg0.length;\n return ret;\n}\nexport function __wbg_length_89fece2ef3016355(arg0) {\n const ret = arg0.length;\n return ret;\n}\nexport function __wbg_length_9f1775224cf1d815(arg0) {\n const ret = arg0.length;\n return ret;\n}\nexport function __wbg_lowerBound_9b7902b146dbf8c5() { return handleError(function (arg0, arg1) {\n const ret = IDBKeyRange.lowerBound(arg0, arg1 !== 0);\n return ret;\n}, arguments); }\nexport function __wbg_maybesignature_new(arg0) {\n const ret = MaybeSignature.__wrap(arg0);\n return ret;\n}\nexport function __wbg_megolmdecryptionerror_new(arg0) {\n const ret = MegolmDecryptionError.__wrap(arg0);\n return ret;\n}\nexport function __wbg_message_cb4f84ee66e5e341(arg0) {\n const ret = arg0.message;\n return ret;\n}\nexport function __wbg_message_ec476bcf269dd7c4(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}\nexport function __wbg_msCrypto_bd5a034af96bcba6(arg0) {\n const ret = arg0.msCrypto;\n return ret;\n}\nexport function __wbg_name_fce2a531eb1066ad(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}\nexport function __wbg_new_036bd6cd9cea9e73(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__h5838d1bd7a4e22fb(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 = 0;\n }\n}\nexport function __wbg_new_0c7403db6e782f19(arg0) {\n const ret = new Uint8Array(arg0);\n return ret;\n}\nexport function __wbg_new_227d7c05414eb861() {\n const ret = new Error();\n return ret;\n}\nexport function __wbg_new_34d45cc8e36aaead() {\n const ret = new Map();\n return ret;\n}\nexport function __wbg_new_3aa13540487cda43(arg0) {\n const ret = new Set(arg0);\n return ret;\n}\nexport function __wbg_new_5e360d2ff7b9e1c3(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return ret;\n}\nexport function __wbg_new_682678e2f47e32bc() {\n const ret = new Array();\n return ret;\n}\nexport function __wbg_new_7913666fe5070684(arg0) {\n const ret = new Date(arg0);\n return ret;\n}\nexport function __wbg_new_aa8d0fa9762c29bd() {\n const ret = new Object();\n return ret;\n}\nexport function __wbg_new_typed_323f37fd55ab048d(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__h5838d1bd7a4e22fb(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 = 0;\n }\n}\nexport function __wbg_new_with_length_8c854e41ea4dae9b(arg0) {\n const ret = new Uint8Array(arg0 >>> 0);\n return ret;\n}\nexport function __wbg_new_with_length_a1be700db9996280(arg0) {\n const ret = new Uint8ClampedArray(arg0 >>> 0);\n return ret;\n}\nexport function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {\n const ret = arg0.next();\n return ret;\n}, arguments); }\nexport function __wbg_next_7646edaa39458ef7(arg0) {\n const ret = arg0.next;\n return ret;\n}\nexport function __wbg_node_84ea875411254db1(arg0) {\n const ret = arg0.node;\n return ret;\n}\nexport function __wbg_now_a9b7df1cbee90986() {\n const ret = Date.now();\n return ret;\n}\nexport function __wbg_now_e7c6795a7f81e10f(arg0) {\n const ret = arg0.now();\n return ret;\n}\nexport function __wbg_objectStoreNames_c755717c02e8876b(arg0) {\n const ret = arg0.objectStoreNames;\n return ret;\n}\nexport function __wbg_objectStore_5942e8f91c946be8() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_oldVersion_ff254e9849b7065c(arg0) {\n const ret = arg0.oldVersion;\n return ret;\n}\nexport function __wbg_olmmachine_new(arg0) {\n const ret = OlmMachine.__wrap(arg0);\n return ret;\n}\nexport function __wbg_openCursor_75d823082c002e28() { return handleError(function (arg0, arg1) {\n const ret = arg0.openCursor(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_openCursor_8a56937bddd04c64() { return handleError(function (arg0) {\n const ret = arg0.openCursor();\n return ret;\n}, arguments); }\nexport function __wbg_openCursor_a2ea782733f4ca2a() { return handleError(function (arg0) {\n const ret = arg0.openCursor();\n return ret;\n}, arguments); }\nexport function __wbg_open_0949b7cdde2ab99a() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.open(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_open_90f4e40d36c2c9f5() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);\n return ret;\n}, arguments); }\nexport function __wbg_otheruseridentity_new(arg0) {\n const ret = OtherUserIdentity.__wrap(arg0);\n return ret;\n}\nexport function __wbg_ownuseridentity_new(arg0) {\n const ret = OwnUserIdentity.__wrap(arg0);\n return ret;\n}\nexport function __wbg_parse_1bbc9c053611d0a7() { return handleError(function (arg0, arg1) {\n const ret = JSON.parse(getStringFromWasm0(arg0, arg1));\n return ret;\n}, arguments); }\nexport function __wbg_performance_3fcf6e32a7e1ed0a(arg0) {\n const ret = arg0.performance;\n return ret;\n}\nexport function __wbg_pickledinboundgroupsession_unwrap(arg0) {\n const ret = PickledInboundGroupSession.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_pickledsession_unwrap(arg0) {\n const ret = PickledSession.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_plaintexttodeviceevent_new(arg0) {\n const ret = PlainTextToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_process_44c7a14e11e9f69e(arg0) {\n const ret = arg0.process;\n return ret;\n}\nexport function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);\n}\nexport function __wbg_prototypesetcall_c80d19814faa696a(arg0, arg1, arg2) {\n Uint8ClampedArray.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);\n}\nexport function __wbg_push_471a5b068a5295f6(arg0, arg1) {\n const ret = arg0.push(arg1);\n return ret;\n}\nexport function __wbg_put_fd02d3070a55994c() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.put(arg1, arg2);\n return ret;\n}, arguments); }\nexport function __wbg_putdehydrateddevicerequest_new(arg0) {\n const ret = PutDehydratedDeviceRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_qr_new(arg0) {\n const ret = Qr.__wrap(arg0);\n return ret;\n}\nexport function __wbg_queueMicrotask_5d15a957e6aa920e(arg0) {\n queueMicrotask(arg0);\n}\nexport function __wbg_queueMicrotask_f8819e5ffc402f36(arg0) {\n const ret = arg0.queueMicrotask;\n return ret;\n}\nexport function __wbg_randomFillSync_6c25eac9869eb53c() { return handleError(function (arg0, arg1) {\n arg0.randomFillSync(arg1);\n}, arguments); }\nexport function __wbg_readyState_57c2b80a75527431(arg0) {\n const ret = arg0.readyState;\n return (__wbindgen_enum_IdbRequestReadyState.indexOf(ret) + 1 || 3) - 1;\n}\nexport function __wbg_rehydrateddevice_new(arg0) {\n const ret = RehydratedDevice.__wrap(arg0);\n return ret;\n}\nexport function __wbg_request_64abeba15a72c084(arg0) {\n const ret = arg0.request;\n return ret;\n}\nexport function __wbg_request_72a78988f2edecad(arg0) {\n const ret = arg0.request;\n return ret;\n}\nexport function __wbg_require_b4edbdcf3e2a1ef0() { return handleError(function () {\n const ret = module.require;\n return ret;\n}, arguments); }\nexport function __wbg_resolve_e6c466bc1052f16c(arg0) {\n const ret = Promise.resolve(arg0);\n return ret;\n}\nexport function __wbg_result_f782323755b96dc8() { return handleError(function (arg0) {\n const ret = arg0.result;\n return ret;\n}, arguments); }\nexport function __wbg_roomid_unwrap(arg0) {\n const ret = RoomId.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeycounts_new(arg0) {\n const ret = RoomKeyCounts.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeyimportresult_new(arg0) {\n const ret = RoomKeyImportResult.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeyinfo_new(arg0) {\n const ret = RoomKeyInfo.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeywithheldinfo_new(arg0) {\n const ret = RoomKeyWithheldInfo.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roommessagerequest_new(arg0) {\n const ret = RoomMessageRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roompendingkeybundledetails_new(arg0) {\n const ret = RoomPendingKeyBundleDetails.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomsettings_new(arg0) {\n const ret = RoomSettings.__wrap(arg0);\n return ret;\n}\nexport function __wbg_sas_new(arg0) {\n const ret = Sas.__wrap(arg0);\n return ret;\n}\nexport function __wbg_secretsbundle_new(arg0) {\n const ret = SecretsBundle.__wrap(arg0);\n return ret;\n}\nexport function __wbg_setTimeout_ef24d2fc3ad97385() { return handleError(function (arg0, arg1) {\n const ret = setTimeout(arg0, arg1);\n return ret;\n}, arguments); }\nexport function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {\n arg0[arg1 >>> 0] = arg2;\n}\nexport function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {\n arg0[arg1] = arg2;\n}\nexport function __wbg_set_adfc330e444aa3b4(arg0, arg1, arg2) {\n arg0.set(getArrayU8FromWasm0(arg1, arg2));\n}\nexport function __wbg_set_fde2cec06c23692b(arg0, arg1, arg2) {\n const ret = arg0.set(arg1, arg2);\n return ret;\n}\nexport function __wbg_set_onabort_7eecdbabbc4fd5f8(arg0, arg1) {\n arg0.onabort = arg1;\n}\nexport function __wbg_set_oncomplete_8c9c4dac8e331f19(arg0, arg1) {\n arg0.oncomplete = arg1;\n}\nexport function __wbg_set_onerror_5cae5e3b994ad11f(arg0, arg1) {\n arg0.onerror = arg1;\n}\nexport function __wbg_set_onerror_ed658d0b50b67e95(arg0, arg1) {\n arg0.onerror = arg1;\n}\nexport function __wbg_set_onsuccess_bf03d6c06709ef09(arg0, arg1) {\n arg0.onsuccess = arg1;\n}\nexport function __wbg_set_onupgradeneeded_3fc8649a687213f5(arg0, arg1) {\n arg0.onupgradeneeded = arg1;\n}\nexport function __wbg_set_unique_0a396b97f5b68657(arg0, arg1) {\n arg0.unique = arg1 !== 0;\n}\nexport function __wbg_signatures_new(arg0) {\n const ret = Signatures.__wrap(arg0);\n return ret;\n}\nexport function __wbg_signatureuploadrequest_new(arg0) {\n const ret = SignatureUploadRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_signatureverification_new(arg0) {\n const ret = SignatureVerification.__wrap(arg0);\n return ret;\n}\nexport function __wbg_stack_3b0d974bbf31e44f(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}\nexport function __wbg_static_accessor_GLOBAL_8cfadc87a297ca02() {\n const ret = typeof global === 'undefined' ? null : global;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf() {\n const ret = typeof globalThis === 'undefined' ? null : globalThis;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_static_accessor_SELF_e445c1c7484aecc3() {\n const ret = typeof self === 'undefined' ? null : self;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_static_accessor_WINDOW_f20e8576ef1e0f17() {\n const ret = typeof window === 'undefined' ? null : window;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_storedroomkeybundledata_new(arg0) {\n const ret = StoredRoomKeyBundleData.__wrap(arg0);\n return ret;\n}\nexport function __wbg_storehandle_new(arg0) {\n const ret = StoreHandle.__wrap(arg0);\n return ret;\n}\nexport function __wbg_stringify_91082ed7a5a5769e() { return handleError(function (arg0) {\n const ret = JSON.stringify(arg0);\n return ret;\n}, arguments); }\nexport function __wbg_subarray_f8ca46a25b1f5e0d(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n}\nexport function __wbg_target_6d97e221d11b71b6(arg0) {\n const ret = arg0.target;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_then_792e0c862b060889(arg0, arg1, arg2) {\n const ret = arg0.then(arg1, arg2);\n return ret;\n}\nexport function __wbg_then_8e16ee11f05e4827(arg0, arg1) {\n const ret = arg0.then(arg1);\n return ret;\n}\nexport function __wbg_toString_306ed0b9f320c1ca(arg0) {\n const ret = arg0.toString();\n return ret;\n}\nexport function __wbg_todevicerequest_new(arg0) {\n const ret = ToDeviceRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_transaction_246d4ade615944eb(arg0) {\n const ret = arg0.transaction;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_transaction_653efe7dcf307618() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);\n return ret;\n}, arguments); }\nexport function __wbg_transaction_9af5475ca3bd3fa9() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.transaction(arg1, __wbindgen_enum_IdbTransactionMode[arg2]);\n return ret;\n}, arguments); }\nexport function __wbg_transaction_c61e2c5f1a671b7d(arg0) {\n const ret = arg0.transaction;\n return ret;\n}\nexport function __wbg_update_23505c717f36067e() { return handleError(function (arg0, arg1) {\n const ret = arg0.update(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_upperBound_9b433e92228dea8e() { return handleError(function (arg0, arg1) {\n const ret = IDBKeyRange.upperBound(arg0, arg1 !== 0);\n return ret;\n}, arguments); }\nexport function __wbg_userdevices_new(arg0) {\n const ret = UserDevices.__wrap(arg0);\n return ret;\n}\nexport function __wbg_userid_new(arg0) {\n const ret = UserId.__wrap(arg0);\n return ret;\n}\nexport function __wbg_userid_unwrap(arg0) {\n const ret = UserId.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_utdtodeviceevent_new(arg0) {\n const ret = UTDToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_value_cd3e83709dea7716() { return handleError(function (arg0) {\n const ret = arg0.value;\n return ret;\n}, arguments); }\nexport function __wbg_value_ee3a06f4579184fa(arg0) {\n const ret = arg0.value;\n return ret;\n}\nexport function __wbg_values_10e8da5f1d194ede(arg0) {\n const ret = arg0.values();\n return ret;\n}\nexport function __wbg_verificationrequest_new(arg0) {\n const ret = VerificationRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_version_f332be76aa57f24c(arg0) {\n const ret = arg0.version;\n return ret;\n}\nexport function __wbg_versions_276b2795b1c6a219(arg0) {\n const ret = arg0.versions;\n return ret;\n}\nexport function __wbg_warn_308e79ff0bb1cadb(arg0, arg1) {\n arg0.warn(arg1);\n}\nexport function __wbg_warn_3cc416af27dbdc02(arg0) {\n console.warn(arg0);\n}\nexport function __wbindgen_cast_0000000000000001(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 140, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000002(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref(\"Event\")], shim_idx: 499, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h216bb57a5c23ce59);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000003(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref(\"IDBVersionChangeEvent\")], shim_idx: 140, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f_2);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000004(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 125, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6cf898dfbf0ceb81);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000005(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return ret;\n}\nexport function __wbindgen_cast_0000000000000006(arg0) {\n // Cast intrinsic for `I64 -> Externref`.\n const ret = arg0;\n return ret;\n}\nexport function __wbindgen_cast_0000000000000007(arg0, arg1) {\n // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref(\"Uint8Array\")`.\n const ret = getArrayU8FromWasm0(arg0, arg1);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000008(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000009(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return ret;\n}\nexport function __wbindgen_cast_000000000000000a(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}\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}\nfunction wasm_bindgen__convert__closures_____invoke__h6cf898dfbf0ceb81(arg0, arg1) {\n wasm.wasm_bindgen__convert__closures_____invoke__h6cf898dfbf0ceb81(arg0, arg1);\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h216bb57a5c23ce59(arg0, arg1, arg2) {\n wasm.wasm_bindgen__convert__closures_____invoke__h216bb57a5c23ce59(arg0, arg1, arg2);\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f(arg0, arg1, arg2) {\n const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f(arg0, arg1, arg2);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f_2(arg0, arg1, arg2) {\n const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f_2(arg0, arg1, arg2);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h5838d1bd7a4e22fb(arg0, arg1, arg2, arg3) {\n wasm.wasm_bindgen__convert__closures_____invoke__h5838d1bd7a4e22fb(arg0, arg1, arg2, arg3);\n}\n\n\nconst __wbindgen_enum_IdbRequestReadyState = [\"pending\", \"done\"];\n\n\nconst __wbindgen_enum_IdbTransactionMode = [\"readonly\", \"readwrite\", \"versionchange\", \"readwriteflush\", \"cleanup\"];\nconst AttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_attachment_free(ptr >>> 0, 1));\nconst BackupDecryptionKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupdecryptionkey_free(ptr >>> 0, 1));\nconst BackupKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupkeys_free(ptr >>> 0, 1));\nconst BackupSecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupsecretsbundle_free(ptr >>> 0, 1));\nconst Base64EncodedPkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_base64encodedpkmessage_free(ptr >>> 0, 1));\nconst BaseMigrationDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_basemigrationdata_free(ptr >>> 0, 1));\nconst CancelInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_cancelinfo_free(ptr >>> 0, 1));\nconst CheckCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_checkcode_free(ptr >>> 0, 1));\nconst CollectStrategyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_collectstrategy_free(ptr >>> 0, 1));\nconst CrossSigningBootstrapRequestsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningbootstraprequests_free(ptr >>> 0, 1));\nconst CrossSigningKeyExportFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningkeyexport_free(ptr >>> 0, 1));\nconst CrossSigningStatusFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningstatus_free(ptr >>> 0, 1));\nconst Curve25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_curve25519publickey_free(ptr >>> 0, 1));\nconst Curve25519SecretKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_curve25519secretkey_free(ptr >>> 0, 1));\nconst DecryptedRoomEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptedroomevent_free(ptr >>> 0, 1));\nconst DecryptedToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptedtodeviceevent_free(ptr >>> 0, 1));\nconst DecryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptionsettings_free(ptr >>> 0, 1));\nconst DehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevice_free(ptr >>> 0, 1));\nconst DehydratedDeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevicekey_free(ptr >>> 0, 1));\nconst DehydratedDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevices_free(ptr >>> 0, 1));\nconst DeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_device_free(ptr >>> 0, 1));\nconst DeviceIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_deviceid_free(ptr >>> 0, 1));\nconst DeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekey_free(ptr >>> 0, 1));\nconst DeviceKeyAlgorithmFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyalgorithm_free(ptr >>> 0, 1));\nconst DeviceKeyIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyid_free(ptr >>> 0, 1));\nconst DeviceListsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicelists_free(ptr >>> 0, 1));\nconst EciesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ecies_free(ptr >>> 0, 1));\nconst Ed25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ed25519publickey_free(ptr >>> 0, 1));\nconst Ed25519SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ed25519signature_free(ptr >>> 0, 1));\nconst EmojiFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_emoji_free(ptr >>> 0, 1));\nconst EncryptedAttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptedattachment_free(ptr >>> 0, 1));\nconst EncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptioninfo_free(ptr >>> 0, 1));\nconst EncryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptionsettings_free(ptr >>> 0, 1));\nconst EstablishedEciesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_establishedecies_free(ptr >>> 0, 1));\nconst EventIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_eventid_free(ptr >>> 0, 1));\nconst IdentityKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_identitykeys_free(ptr >>> 0, 1));\nconst InboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_inboundcreationresult_free(ptr >>> 0, 1));\nconst InboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_inboundgroupsession_free(ptr >>> 0, 1));\nconst InvalidToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_invalidtodeviceevent_free(ptr >>> 0, 1));\nconst KeysBackupRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysbackuprequest_free(ptr >>> 0, 1));\nconst KeysClaimRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysclaimrequest_free(ptr >>> 0, 1));\nconst KeysQueryRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysqueryrequest_free(ptr >>> 0, 1));\nconst KeysUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysuploadrequest_free(ptr >>> 0, 1));\nconst MaybeSignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_maybesignature_free(ptr >>> 0, 1));\nconst MegolmDecryptionErrorFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_megolmdecryptionerror_free(ptr >>> 0, 1));\nconst MegolmV1BackupKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_megolmv1backupkey_free(ptr >>> 0, 1));\nconst MigrationFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_migration_free(ptr >>> 0, 1));\nconst Msc4108IntentDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_msc4108intentdata_free(ptr >>> 0, 1));\nconst Msc4388IntentDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_msc4388intentdata_free(ptr >>> 0, 1));\nconst OlmMachineFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_olmmachine_free(ptr >>> 0, 1));\nconst OtherUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_otheruseridentity_free(ptr >>> 0, 1));\nconst OutboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_outboundcreationresult_free(ptr >>> 0, 1));\nconst OwnUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ownuseridentity_free(ptr >>> 0, 1));\nconst PickledInboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pickledinboundgroupsession_free(ptr >>> 0, 1));\nconst PickledSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pickledsession_free(ptr >>> 0, 1));\nconst PkDecryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkdecryption_free(ptr >>> 0, 1));\nconst PkEncryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkencryption_free(ptr >>> 0, 1));\nconst PkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkmessage_free(ptr >>> 0, 1));\nconst PlainTextToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_plaintexttodeviceevent_free(ptr >>> 0, 1));\nconst PutDehydratedDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_putdehydrateddevicerequest_free(ptr >>> 0, 1));\nconst QrFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qr_free(ptr >>> 0, 1));\nconst QrCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcode_free(ptr >>> 0, 1));\nconst QrCodeDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodedata_free(ptr >>> 0, 1));\nconst QrCodeIntentDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodeintentdata_free(ptr >>> 0, 1));\nconst QrCodeScanFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodescan_free(ptr >>> 0, 1));\nconst RehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_rehydrateddevice_free(ptr >>> 0, 1));\nconst RoomIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomid_free(ptr >>> 0, 1));\nconst RoomKeyCountsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeycounts_free(ptr >>> 0, 1));\nconst RoomKeyImportResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyimportresult_free(ptr >>> 0, 1));\nconst RoomKeyInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyinfo_free(ptr >>> 0, 1));\nconst RoomKeyWithheldInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeywithheldinfo_free(ptr >>> 0, 1));\nconst RoomMessageRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roommessagerequest_free(ptr >>> 0, 1));\nconst RoomPendingKeyBundleDetailsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roompendingkeybundledetails_free(ptr >>> 0, 1));\nconst RoomSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomsettings_free(ptr >>> 0, 1));\nconst SasFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_sas_free(ptr >>> 0, 1));\nconst SecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_secretsbundle_free(ptr >>> 0, 1));\nconst ServerNameFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_servername_free(ptr >>> 0, 1));\nconst ShieldStateFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_shieldstate_free(ptr >>> 0, 1));\nconst SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signature_free(ptr >>> 0, 1));\nconst SignatureUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatureuploadrequest_free(ptr >>> 0, 1));\nconst SignatureVerificationFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatureverification_free(ptr >>> 0, 1));\nconst SignaturesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatures_free(ptr >>> 0, 1));\nconst StoreHandleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_storehandle_free(ptr >>> 0, 1));\nconst StoredRoomKeyBundleDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_storedroomkeybundledata_free(ptr >>> 0, 1));\nconst ToDeviceEncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todeviceencryptioninfo_free(ptr >>> 0, 1));\nconst ToDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todevicerequest_free(ptr >>> 0, 1));\nconst ToDeviceUnableToDecryptInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todeviceunabletodecryptinfo_free(ptr >>> 0, 1));\nconst TracingFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_tracing_free(ptr >>> 0, 1));\nconst UTDToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_utdtodeviceevent_free(ptr >>> 0, 1));\nconst UploadSigningKeysRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_uploadsigningkeysrequest_free(ptr >>> 0, 1));\nconst UserDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_userdevices_free(ptr >>> 0, 1));\nconst UserIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_userid_free(ptr >>> 0, 1));\nconst VerificationRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_verificationrequest_free(ptr >>> 0, 1));\nconst VersionsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_versions_free(ptr >>> 0, 1));\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 => wasm.__wbindgen_destroy_closure(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, f) {\n const state = { a: arg0, b: arg1, cnt: 1 };\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 wasm.__wbindgen_destroy_closure(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\n\nlet wasm;\nexport function __wbg_set_wasm(val) {\n wasm = val;\n}\n","// Copyright 2024 The Matrix.org Foundation C.I.C.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @ts-check\n\n/**\n * This is the entrypoint on non-node ESM environments.\n * `asyncLoad` will load the WASM module using a `fetch` call.\n */\n\nimport * as bindings from \"./pkg/matrix_sdk_crypto_wasm_bg.js\";\n\nconst defaultURL = new URL(\"./pkg/matrix_sdk_crypto_wasm_bg.wasm\", import.meta.url);\n\n// Although we could simply instantiate the WASM at import time with a top-level `await`,\n// we avoid that, to make it easier for callers to delay loading the WASM (and instead\n// wait until `initAsync` is called). (Also, Safari 14 doesn't support top-level `await`.)\n//\n// However, having done so, there is no way to synchronously load the WASM if the user ends\n// up using the bindings before calling `initAsync` (unlike under Node.js), so we just throw\n// an error.\nbindings.__wbg_set_wasm(\n new Proxy(\n {},\n {\n get() {\n throw new Error(\n \"@matrix-org/matrix-sdk-crypto-wasm was used before it was initialized. Call `initAsync` first.\",\n );\n },\n },\n ),\n);\n\n/**\n * Stores a promise of the `loadModuleAsync` call\n * @type {Promise<void> | null}\n */\nlet modPromise = null;\n\n/**\n * Loads and instantiates the WASM module asynchronously\n *\n * @param {URL | string} url - The URL to fetch the WebAssembly module from\n * @returns {Promise<void>}\n */\nasync function loadModuleAsync(url) {\n const { instance } = await WebAssembly.instantiateStreaming(fetch(url), {\n // @ts-expect-error: The bindings don't exactly match the 'ExportValue' type\n \"./matrix_sdk_crypto_wasm_bg.js\": bindings,\n });\n\n bindings.__wbg_set_wasm(instance.exports);\n // @ts-expect-error: Typescript doesn't know what the module exports are\n instance.exports.__wbindgen_start();\n}\n\n/**\n * Load the WebAssembly module in the background, if it has not already been loaded.\n *\n * Returns a promise which will resolve once the other methods are ready.\n *\n * @param {URL | string} [url] - The URL to fetch the WebAssembly module from. If not provided, a default URL will be used.\n * @returns {Promise<void>}\n */\nexport async function initAsync(url = defaultURL) {\n if (!modPromise) modPromise = loadModuleAsync(url);\n await modPromise;\n}\n\n// Re-export everything from the generated javascript wrappers\nexport * from \"./pkg/matrix_sdk_crypto_wasm_bg.js\";\n","/* Copyright 2015 Mark Haines\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use strict';\n\nvar escaped = /[\\\\\\\"\\x00-\\x1F]/g;\nvar escapes = {};\nfor (var i = 0; i < 0x20; ++i) {\n escapes[String.fromCharCode(i)] = (\n '\\\\U' + ('0000' + i.toString(16)).slice(-4).toUpperCase()\n );\n}\nescapes['\\b'] = '\\\\b';\nescapes['\\t'] = '\\\\t';\nescapes['\\n'] = '\\\\n';\nescapes['\\f'] = '\\\\f';\nescapes['\\r'] = '\\\\r';\nescapes['\\\"'] = '\\\\\\\"';\nescapes['\\\\'] = '\\\\\\\\';\n\nfunction escapeString(value) {\n escaped.lastIndex = 0;\n return value.replace(escaped, function(c) { return escapes[c]; });\n}\n\nfunction stringify(value) {\n switch (typeof value) {\n case 'string':\n return '\"' + escapeString(value) + '\"';\n case 'number':\n return isFinite(value) ? value : 'null';\n case 'boolean':\n return value;\n case 'object':\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return stringifyArray(value);\n }\n return stringifyObject(value);\n default:\n throw new Error('Cannot stringify: ' + typeof value);\n }\n}\n\nfunction stringifyArray(array) {\n var sep = '[';\n var result = '';\n for (var i = 0; i < array.length; ++i) {\n result += sep;\n sep = ',';\n result += stringify(array[i]);\n }\n if (sep != ',') {\n return '[]';\n } else {\n return result + ']';\n }\n}\n\nfunction stringifyObject(object) {\n var sep = '{';\n var result = '';\n var keys = Object.keys(object);\n keys.sort();\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n result += sep + '\"' + escapeString(key) + '\":';\n sep = ',';\n result += stringify(object[key]);\n }\n if (sep != ',') {\n return '{}';\n } else {\n return result + '}';\n }\n}\n\n/** */\nmodule.exports = {stringify: stringify};\n","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { CollectStrategy, EncryptionAlgorithm, EncryptionSettings, HistoryVisibility as RustHistoryVisibility, RoomId, UserId } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { EventType } from \"../@types/event.js\";\nimport { LogSpan } from \"../logger.js\";\nimport { HistoryVisibility } from \"../@types/partials.js\";\nimport { logDuration } from \"../utils.js\";\nimport { KnownMembership } from \"../@types/membership.js\";\nimport { DeviceIsolationModeKind } from \"../crypto-api/index.js\";\n\n/**\n * RoomEncryptor: responsible for encrypting messages to a given room\n *\n * @internal\n */\nexport class RoomEncryptor {\n /**\n * @param prefixedLogger - A logger to use for log messages.\n * @param olmMachine - The rust-sdk's OlmMachine\n * @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests\n * @param outgoingRequestManager - The OutgoingRequestManager, which manages the queue of outgoing requests.\n * @param room - The room we want to encrypt for\n * @param encryptionSettings - body of the m.room.encryption event currently in force in this room\n */\n constructor(prefixedLogger, olmMachine, keyClaimManager, outgoingRequestManager, room, encryptionSettings) {\n this.prefixedLogger = prefixedLogger;\n this.olmMachine = olmMachine;\n this.keyClaimManager = keyClaimManager;\n this.outgoingRequestManager = outgoingRequestManager;\n this.room = room;\n this.encryptionSettings = encryptionSettings;\n /** whether the room members have been loaded and tracked for the first time */\n _defineProperty(this, \"lazyLoadedMembersResolved\", false);\n /**\n * Ensures that there is only one encryption operation at a time for that room.\n *\n * An encryption operation is either a {@link prepareForEncryption} or an {@link encryptEvent} call.\n */\n _defineProperty(this, \"currentEncryptionPromise\", Promise.resolve());\n // start tracking devices for any users already known to be in this room.\n // Do not load members here, would defeat lazy loading.\n var members = room.getJoinedMembers();\n\n // At this point just mark the known members as tracked, it might not be the full list of members\n // because of lazy loading. This is fine, because we will get a member list update when sending a message for\n // the first time, see `RoomEncryptor#ensureEncryptionSession`\n this.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId))).catch(e => this.prefixedLogger.error(\"Error initializing tracked users\", e));\n }\n\n /**\n * Handle a new `m.room.encryption` event in this room\n *\n * @param config - The content of the encryption event\n */\n onCryptoEvent(config) {\n if (JSON.stringify(this.encryptionSettings) != JSON.stringify(config)) {\n // This should currently be unreachable, since the Rust SDK will reject any attempts to change config.\n throw new Error(\"Cannot reconfigure an active RoomEncryptor\");\n }\n }\n\n /**\n * Handle a new `m.room.member` event in this room\n *\n * @param member - new membership state\n */\n onRoomMembership(member) {\n if (member.membership == KnownMembership.Join || member.membership == KnownMembership.Invite && this.room.shouldEncryptForInvitedMembers()) {\n // make sure we are tracking the deviceList for this user\n this.olmMachine.updateTrackedUsers([new UserId(member.userId)]).catch(e => {\n this.prefixedLogger.error(\"Unable to update tracked users\", e);\n });\n }\n\n // TODO: handle leaves (including our own)\n }\n\n /**\n * Prepare to encrypt events in this room.\n *\n * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n * in the room.\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n prepareForEncryption(globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n var _this = this;\n return _asyncToGenerator(function* () {\n // We consider a prepareForEncryption as an encryption promise as it will potentially share keys\n // even if it doesn't send an event.\n // Usually this is called when the user starts typing, so we want to make sure we have keys ready when the\n // message is finally sent.\n // If `encryptEvent` is invoked before `prepareForEncryption` has completed, the `encryptEvent` call will wait for\n // `prepareForEncryption` to complete before executing.\n // The part where `encryptEvent` shares the room key will then usually be a no-op as it was already performed by `prepareForEncryption`.\n yield _this.encryptEvent(null, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n })();\n }\n\n /**\n * Encrypt an event for this room, or prepare for encryption.\n *\n * This will ensure that we have a megolm session for this room, share it with the devices in the room, and\n * then, if an event is provided, encrypt it using the session.\n *\n * @param event - Event to be encrypted, or null if only preparing for encryption (in which case we will pre-share the room key).\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n encryptEvent(event, globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n var _event$getTxnId,\n _this2 = this;\n var logger = new LogSpan(this.prefixedLogger, event ? (_event$getTxnId = event.getTxnId()) !== null && _event$getTxnId !== void 0 ? _event$getTxnId : \"\" : \"prepareForEncryption\");\n // Ensure order of encryption to avoid message ordering issues, as the scheduler only ensures\n // events order after they have been encrypted.\n var prom = this.currentEncryptionPromise.catch(() => {\n // Any errors in the previous call will have been reported already, so there is nothing to do here.\n // we just throw away the error and start anew.\n }).then(/*#__PURE__*/_asyncToGenerator(function* () {\n yield logDuration(logger, \"ensureEncryptionSession\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this2.ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n }));\n if (event) {\n yield logDuration(logger, \"encryptEventInner\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this2.encryptEventInner(logger, event);\n }));\n }\n }));\n this.currentEncryptionPromise = prom;\n return prom;\n }\n\n /**\n * Prepare to encrypt events in this room.\n *\n * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n * in the room.\n *\n * @param logger - a place to write diagnostics to\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (_this3.encryptionSettings.algorithm !== \"m.megolm.v1.aes-sha2\") {\n throw new Error(\"Cannot encrypt in \".concat(_this3.room.roomId, \" for unsupported algorithm '\").concat(_this3.encryptionSettings.algorithm, \"'\"));\n }\n logger.debug(\"Starting encryption\");\n var members = yield _this3.room.getEncryptionTargetMembers();\n\n // If this is the first time we are sending a message to the room, we may not yet have seen all the members\n // (so the Crypto SDK might not have a device list for them). So, if this is the first time we are encrypting\n // for this room, give the SDK the full list of members, to be on the safe side.\n //\n // This could end up being racy (if two calls to ensureEncryptionSession happen at the same time), but that's\n // not a particular problem, since `OlmMachine.updateTrackedUsers` just adds any users that weren't already tracked.\n if (!_this3.lazyLoadedMembersResolved) {\n yield logDuration(logger, \"loadMembersIfNeeded: updateTrackedUsers\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this3.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId)));\n }));\n logger.debug(\"Updated tracked users\");\n _this3.lazyLoadedMembersResolved = true;\n\n // Query keys in case we don't have them for newly tracked members.\n // It's important after loading members for the first time, as likely most of them won't be\n // known yet and will be unable to decrypt messages despite being in the room for long.\n // This must be done before ensuring sessions. If not the devices of these users are not\n // known yet and will not get the room key.\n // We don't have API to only get the keys queries related to this member list, so we just\n // process the pending requests from the olmMachine. (usually these are processed\n // at the end of the sync, but we can't wait for that).\n // XXX future improvement process only KeysQueryRequests for the users that have never been queried.\n logger.debug(\"Processing outgoing requests\");\n yield logDuration(logger, \"doProcessOutgoingRequests\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this3.outgoingRequestManager.doProcessOutgoingRequests();\n }));\n } else {\n // If members are already loaded it's less critical to await on key queries.\n // We might still want to trigger a processOutgoingRequests here.\n // The call to `ensureSessionsForUsers` below will wait a bit on in-flight key queries we are\n // interested in. If a sync handling happens in the meantime, and some new members are added to the room\n // or have new devices it would give us a chance to query them before sending.\n // It's less critical due to the racy nature of this process.\n logger.debug(\"Processing outgoing requests in background\");\n _this3.outgoingRequestManager.doProcessOutgoingRequests();\n }\n logger.debug(\"Encrypting for users (shouldEncryptForInvitedMembers: \".concat(_this3.room.shouldEncryptForInvitedMembers(), \"):\"), members.map(u => \"\".concat(u.userId, \" (\").concat(u.membership, \")\")));\n var userList = members.map(u => new UserId(u.userId));\n yield logDuration(logger, \"ensureSessionsForUsers\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this3.keyClaimManager.ensureSessionsForUsers(logger, userList);\n }));\n var rustEncryptionSettings = new EncryptionSettings();\n rustEncryptionSettings.historyVisibility = toRustHistoryVisibility(_this3.room.getHistoryVisibility());\n\n // We only support megolm\n rustEncryptionSettings.algorithm = EncryptionAlgorithm.MegolmV1AesSha2;\n\n // We need to convert the rotation period from milliseconds to microseconds\n // See https://spec.matrix.org/v1.8/client-server-api/#mroomencryption and\n // https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/classes/EncryptionSettings.html#rotationPeriod\n if (typeof _this3.encryptionSettings.rotation_period_ms === \"number\") {\n rustEncryptionSettings.rotationPeriod = BigInt(_this3.encryptionSettings.rotation_period_ms * 1000);\n }\n if (typeof _this3.encryptionSettings.rotation_period_msgs === \"number\") {\n rustEncryptionSettings.rotationPeriodMessages = BigInt(_this3.encryptionSettings.rotation_period_msgs);\n }\n switch (deviceIsolationMode.kind) {\n case DeviceIsolationModeKind.AllDevicesIsolationMode:\n {\n var _this3$room$getBlackl;\n // When this.room.getBlacklistUnverifiedDevices() === null, the global settings should be used\n // See Room#getBlacklistUnverifiedDevices\n var onlyAllowTrustedDevices = (_this3$room$getBlackl = _this3.room.getBlacklistUnverifiedDevices()) !== null && _this3$room$getBlackl !== void 0 ? _this3$room$getBlackl : globalBlacklistUnverifiedDevices;\n rustEncryptionSettings.sharingStrategy = CollectStrategy.deviceBasedStrategy(onlyAllowTrustedDevices, deviceIsolationMode.errorOnVerifiedUserProblems);\n }\n break;\n case DeviceIsolationModeKind.OnlySignedDevicesIsolationMode:\n rustEncryptionSettings.sharingStrategy = CollectStrategy.identityBasedStrategy();\n break;\n }\n yield logDuration(logger, \"shareRoomKey\", /*#__PURE__*/_asyncToGenerator(function* () {\n var shareMessages = yield _this3.olmMachine.shareRoomKey(new RoomId(_this3.room.roomId),\n // safe to pass without cloning, as it's not reused here (before or after)\n userList, rustEncryptionSettings);\n if (shareMessages) {\n for (var m of shareMessages) {\n yield _this3.outgoingRequestManager.outgoingRequestProcessor.makeOutgoingRequest(m);\n }\n }\n }));\n })();\n }\n\n /**\n * Discard any existing group session for this room\n */\n forceDiscardSession() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n var r = yield _this4.olmMachine.invalidateGroupSession(new RoomId(_this4.room.roomId));\n if (r) {\n _this4.prefixedLogger.info(\"Discarded existing group session\");\n }\n })();\n }\n encryptEventInner(logger, event) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n logger.debug(\"Encrypting actual message content\");\n var room = new RoomId(_this5.room.roomId);\n var type = event.getType();\n var content = JSON.stringify(event.getContent());\n var encryptedContent;\n if (event.isState()) {\n encryptedContent = yield _this5.olmMachine.encryptStateEvent(room, type,\n // Safety: we've already checked above that this is a state event, so the state key must exist.\n event.getStateKey(), content);\n } else {\n encryptedContent = yield _this5.olmMachine.encryptRoomEvent(room, type, content);\n }\n event.makeEncrypted(EventType.RoomMessageEncrypted, JSON.parse(encryptedContent), _this5.olmMachine.identityKeys.curve25519.toBase64(), _this5.olmMachine.identityKeys.ed25519.toBase64());\n logger.debug(\"Encrypted event successfully\");\n })();\n }\n}\n\n/**\n * Convert a HistoryVisibility to a RustHistoryVisibility\n * @param visibility - HistoryVisibility enum\n * @returns a RustHistoryVisibility enum\n */\nexport function toRustHistoryVisibility(visibility) {\n switch (visibility) {\n case HistoryVisibility.Invited:\n return RustHistoryVisibility.Invited;\n case HistoryVisibility.Joined:\n return RustHistoryVisibility.Joined;\n case HistoryVisibility.Shared:\n return RustHistoryVisibility.Shared;\n case HistoryVisibility.WorldReadable:\n return RustHistoryVisibility.WorldReadable;\n }\n}\n//# sourceMappingURL=RoomEncryptor.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { encodeUri } from \"../utils.js\";\nimport { Method } from \"../http-api/index.js\";\nimport { decodeBase64 } from \"../base64.js\";\nimport { CryptoEvent } from \"../crypto-api/index.js\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.js\";\n\n/**\n * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device`.\n */\n\n/**\n * The response body of `POST /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/events`.\n */\n\n/**\n * The unstable URL prefix for dehydrated device endpoints\n */\nexport var UnstablePrefix = \"/_matrix/client/unstable/org.matrix.msc3814.v1\";\n/**\n * The name used for the dehydration key in Secret Storage\n */\nvar SECRET_STORAGE_NAME = \"org.matrix.msc3814\";\n\n/**\n * The interval between creating dehydrated devices. (one week)\n */\nvar DEHYDRATION_INTERVAL = 7 * 24 * 60 * 60 * 1000;\n\n/**\n * Manages dehydrated devices\n *\n * We have one of these per `RustCrypto`. It's responsible for\n *\n * * determining server support for dehydrated devices\n * * creating new dehydrated devices when requested, including periodically\n * replacing the dehydrated device with a new one\n * * rehydrating a device when requested, and when present\n *\n * @internal\n */\nexport class DehydratedDeviceManager extends TypedEventEmitter {\n constructor(logger, olmMachine, http, outgoingRequestProcessor, secretStorage) {\n super();\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.http = http;\n this.outgoingRequestProcessor = outgoingRequestProcessor;\n this.secretStorage = secretStorage;\n /** the ID of the interval for periodically replacing the dehydrated device */\n _defineProperty(this, \"intervalId\", void 0);\n }\n cacheKey(key) {\n var _this = this;\n return _asyncToGenerator(function* () {\n yield _this.olmMachine.dehydratedDevices().saveDehydratedDeviceKey(key);\n _this.emit(CryptoEvent.DehydrationKeyCached);\n })();\n }\n\n /**\n * Return whether the server supports dehydrated devices.\n */\n isSupported() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // call the endpoint to get a dehydrated device. If it returns an\n // M_UNRECOGNIZED error, then dehydration is unsupported. If it returns\n // a successful response, or an M_NOT_FOUND, then dehydration is supported.\n // Any other exceptions are passed through.\n try {\n yield _this2.http.authedRequest(Method.Get, \"/dehydrated_device\", undefined, undefined, {\n prefix: UnstablePrefix\n });\n } catch (error) {\n var err = error;\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return false;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return true;\n }\n throw error;\n }\n return true;\n })();\n }\n\n /**\n * Start using device dehydration.\n *\n * - Rehydrates a dehydrated device, if one is available and `opts.rehydrate`\n * is `true`.\n * - Creates a new dehydration key, if necessary, and stores it in Secret\n * Storage.\n * - If `opts.createNewKey` is set to true, always creates a new key.\n * - If a dehydration key is not available, creates a new one.\n * - Creates a new dehydrated device, and schedules periodically creating\n * new dehydrated devices.\n *\n * @param opts - options for device dehydration. For backwards compatibility\n * with old code, a boolean can be given here, which will be treated as\n * the `createNewKey` option. However, this is deprecated.\n */\n start() {\n var _arguments = arguments,\n _this3 = this;\n return _asyncToGenerator(function* () {\n var opts = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};\n if (typeof opts === \"boolean\") {\n opts = {\n createNewKey: opts\n };\n }\n if (opts.onlyIfKeyCached && !(yield _this3.olmMachine.dehydratedDevices().getDehydratedDeviceKey())) {\n return;\n }\n _this3.stop();\n if (opts.rehydrate !== false) {\n try {\n yield _this3.rehydrateDeviceIfAvailable();\n } catch (e) {\n // If rehydration fails, there isn't much we can do about it. Log\n // the error, and create a new device.\n _this3.logger.info(\"dehydration: Error rehydrating device:\", e);\n _this3.emit(CryptoEvent.RehydrationError, e.message);\n }\n }\n if (opts.createNewKey) {\n yield _this3.resetKey();\n }\n yield _this3.scheduleDeviceDehydration();\n })();\n }\n\n /**\n * Return whether the dehydration key is stored in Secret Storage.\n */\n isKeyStored() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n return Boolean(yield _this4.secretStorage.isStored(SECRET_STORAGE_NAME));\n })();\n }\n\n /**\n * Reset the dehydration key.\n *\n * Creates a new key and stores it in secret storage.\n *\n * @returns The newly-generated key.\n */\n resetKey() {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n var key = RustSdkCryptoJs.DehydratedDeviceKey.createRandomKey();\n yield _this5.secretStorage.store(SECRET_STORAGE_NAME, key.toBase64());\n // Also cache it in the rust SDK's crypto store.\n yield _this5.cacheKey(key);\n return key;\n })();\n }\n\n /**\n * Get and cache the encryption key from secret storage.\n *\n * If `create` is `true`, creates a new key if no existing key is present.\n *\n * @returns the key, if available, or `null` if no key is available\n */\n getKey(create) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n var cachedKey = yield _this6.olmMachine.dehydratedDevices().getDehydratedDeviceKey();\n if (cachedKey) return cachedKey;\n var keyB64 = yield _this6.secretStorage.get(SECRET_STORAGE_NAME);\n if (keyB64 === undefined) {\n if (!create) {\n return null;\n }\n return yield _this6.resetKey();\n }\n\n // We successfully found the key in secret storage: decode it, and cache it in\n // the rust SDK's crypto store.\n var bytes = decodeBase64(keyB64);\n try {\n var key = RustSdkCryptoJs.DehydratedDeviceKey.createKeyFromArray(bytes);\n yield _this6.cacheKey(key);\n return key;\n } finally {\n bytes.fill(0);\n }\n })();\n }\n\n /**\n * Rehydrate the dehydrated device stored on the server.\n *\n * Checks if there is a dehydrated device on the server. If so, rehydrates\n * the device and processes the to-device events.\n *\n * Returns whether or not a dehydrated device was found.\n */\n rehydrateDeviceIfAvailable() {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n var key = yield _this7.getKey(false);\n if (!key) {\n return false;\n }\n var dehydratedDeviceResp;\n try {\n dehydratedDeviceResp = yield _this7.http.authedRequest(Method.Get, \"/dehydrated_device\", undefined, undefined, {\n prefix: UnstablePrefix\n });\n } catch (error) {\n var err = error;\n // We ignore M_NOT_FOUND (there is no dehydrated device, so nothing\n // us to do) and M_UNRECOGNIZED (the server does not understand the\n // endpoint). We pass through any other errors.\n if (err.errcode === \"M_NOT_FOUND\" || err.errcode === \"M_UNRECOGNIZED\") {\n _this7.logger.info(\"dehydration: No dehydrated device\");\n return false;\n }\n throw err;\n }\n _this7.logger.info(\"dehydration: dehydrated device found\");\n _this7.emit(CryptoEvent.RehydrationStarted);\n var rehydratedDevice = yield _this7.olmMachine.dehydratedDevices().rehydrate(key, new RustSdkCryptoJs.DeviceId(dehydratedDeviceResp.device_id), JSON.stringify(dehydratedDeviceResp.device_data));\n _this7.logger.info(\"dehydration: device rehydrated\");\n var nextBatch = undefined;\n var toDeviceCount = 0;\n var roomKeyCount = 0;\n var path = encodeUri(\"/dehydrated_device/$device_id/events\", {\n $device_id: dehydratedDeviceResp.device_id\n });\n // eslint-disable-next-line no-constant-condition\n while (true) {\n var eventResp = yield _this7.http.authedRequest(Method.Post, path, undefined, nextBatch ? {\n next_batch: nextBatch\n } : {}, {\n prefix: UnstablePrefix\n });\n if (eventResp.events.length === 0) {\n break;\n }\n toDeviceCount += eventResp.events.length;\n nextBatch = eventResp.next_batch;\n var roomKeyInfos = yield rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));\n roomKeyCount += roomKeyInfos.length;\n _this7.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);\n }\n _this7.logger.info(\"dehydration: received \".concat(roomKeyCount, \" room keys from \").concat(toDeviceCount, \" to-device events\"));\n _this7.emit(CryptoEvent.RehydrationCompleted);\n return true;\n })();\n }\n\n /**\n * Creates and uploads a new dehydrated device.\n *\n * Creates and stores a new key in secret storage if none is available.\n */\n createAndUploadDehydratedDevice() {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n var key = yield _this8.getKey(true);\n var dehydratedDevice = yield _this8.olmMachine.dehydratedDevices().create();\n _this8.emit(CryptoEvent.DehydratedDeviceCreated);\n var request = yield dehydratedDevice.keysForUpload(\"Dehydrated device\", key);\n yield _this8.outgoingRequestProcessor.makeOutgoingRequest(request);\n _this8.emit(CryptoEvent.DehydratedDeviceUploaded);\n _this8.logger.info(\"dehydration: uploaded device\");\n })();\n }\n\n /**\n * Schedule periodic creation of dehydrated devices.\n */\n scheduleDeviceDehydration() {\n var _this9 = this;\n return _asyncToGenerator(function* () {\n // cancel any previously-scheduled tasks\n _this9.stop();\n yield _this9.createAndUploadDehydratedDevice();\n _this9.intervalId = setInterval(() => {\n _this9.createAndUploadDehydratedDevice().catch(error => {\n _this9.emit(CryptoEvent.DehydratedDeviceRotationError, error.message);\n _this9.logger.error(\"Error creating dehydrated device:\", error);\n });\n }, DEHYDRATION_INTERVAL);\n })();\n }\n\n /**\n * Stop the dehydrated device manager.\n *\n * Cancels any scheduled dehydration tasks.\n */\n stop() {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n }\n\n /**\n * Delete the current dehydrated device and stop the dehydrated device manager.\n */\n delete() {\n var _this0 = this;\n return _asyncToGenerator(function* () {\n _this0.stop();\n try {\n yield _this0.http.authedRequest(Method.Delete, \"/dehydrated_device\", undefined, {}, {\n prefix: UnstablePrefix\n });\n } catch (error) {\n var err = error;\n // If dehydrated devices aren't supported, or no dehydrated device\n // is found, we don't consider it an error, because we we'll end up\n // with no dehydrated device.\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return;\n }\n throw error;\n }\n })();\n }\n}\n\n/**\n * The events fired by the DehydratedDeviceManager\n * @internal\n */\n\n/**\n * A map of the {@link DehydratedDeviceEvents} fired by the {@link DehydratedDeviceManager} and their payloads.\n * @internal\n */\n//# sourceMappingURL=DehydratedDeviceManager.js.map","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { KeysBackupRequest, KeysClaimRequest, KeysQueryRequest, KeysUploadRequest, PutDehydratedDeviceRequest, RoomMessageRequest, SignatureUploadRequest, ToDeviceRequest, UploadSigningKeysRequest } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { calculateRetryBackoff, Method } from \"../http-api/index.js\";\nimport { logDuration, sleep } from \"../utils.js\";\nimport { ToDeviceMessageId } from \"../@types/event.js\";\nimport { UnstablePrefix as DehydrationUnstablePrefix } from \"./DehydratedDeviceManager.js\";\n\n/**\n * OutgoingRequestManager: turns `OutgoingRequest`s from the rust sdk into HTTP requests\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`), not that it does anything terribly complicated.\n * It's responsible for:\n *\n * * holding the reference to the `MatrixHttpApi`\n * * turning `OutgoingRequest`s from the rust backend into HTTP requests, and sending them\n * * sending the results of such requests back to the rust backend.\n *\n * @internal\n */\nexport class OutgoingRequestProcessor {\n constructor(logger, olmMachine, http) {\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.http = http;\n }\n makeOutgoingRequest(msg, uiaCallback) {\n var _this = this;\n return _asyncToGenerator(function* () {\n var resp;\n\n /* refer https://docs.rs/matrix-sdk-crypto/0.6.0/matrix_sdk_crypto/requests/enum.OutgoingRequests.html\n * for the complete list of request types\n */\n if (msg instanceof KeysUploadRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/upload\", {}, msg.body);\n } else if (msg instanceof KeysQueryRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/query\", {}, msg.body);\n } else if (msg instanceof KeysClaimRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/claim\", {}, msg.body);\n } else if (msg instanceof SignatureUploadRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/signatures/upload\", {}, msg.body);\n } else if (msg instanceof KeysBackupRequest) {\n resp = yield _this.requestWithRetry(Method.Put, \"/_matrix/client/v3/room_keys/keys\", {\n version: msg.version\n }, msg.body);\n } else if (msg instanceof ToDeviceRequest) {\n resp = yield _this.sendToDeviceRequest(msg);\n } else if (msg instanceof RoomMessageRequest) {\n var path = \"/_matrix/client/v3/rooms/\".concat(encodeURIComponent(msg.room_id), \"/send/\") + \"\".concat(encodeURIComponent(msg.event_type), \"/\").concat(encodeURIComponent(msg.txn_id));\n resp = yield _this.requestWithRetry(Method.Put, path, {}, msg.body);\n } else if (msg instanceof UploadSigningKeysRequest) {\n yield _this.makeRequestWithUIA(Method.Post, \"/_matrix/client/v3/keys/device_signing/upload\", {}, msg.body, uiaCallback);\n // SigningKeysUploadRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else if (msg instanceof PutDehydratedDeviceRequest) {\n var _path = DehydrationUnstablePrefix + \"/dehydrated_device\";\n yield _this.rawJsonRequest(Method.Put, _path, {}, msg.body);\n // PutDehydratedDeviceRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else {\n _this.logger.warn(\"Unsupported outgoing message\", Object.getPrototypeOf(msg));\n resp = \"\";\n }\n if (msg.id) {\n try {\n yield logDuration(_this.logger, \"Mark Request as sent \".concat(msg.type), /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this.olmMachine.markRequestAsSent(msg.id, msg.type, resp);\n }));\n } catch (e) {\n // Ignore errors which are caused by the olmMachine having been freed. The exact error message depends\n // on whether we are using a release or develop build of rust-sdk-crypto-wasm.\n if (e instanceof Error && (e.message === \"Attempt to use a moved value\" || e.message === \"null pointer passed to rust\")) {\n _this.logger.debug(\"Ignoring error '\".concat(e.message, \"': client is likely shutting down\"));\n } else {\n throw e;\n }\n }\n } else {\n _this.logger.trace(\"Outgoing request type:\".concat(msg.type, \" does not have an ID\"));\n }\n })();\n }\n\n /**\n * Send the HTTP request for a `ToDeviceRequest`\n *\n * @param request - request to send\n * @returns JSON-serialized body of the response, if successful\n */\n sendToDeviceRequest(request) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // a bit of extra logging, to help trace to-device messages through the system\n var parsedBody = JSON.parse(request.body);\n var messageList = [];\n for (var [userId, perUserMessages] of Object.entries(parsedBody.messages)) {\n for (var [deviceId, message] of Object.entries(perUserMessages)) {\n messageList.push(\"\".concat(userId, \"/\").concat(deviceId, \" (msgid \").concat(message[ToDeviceMessageId], \")\"));\n }\n }\n _this2.logger.info(\"Sending batch of to-device messages. type=\".concat(request.event_type, \" txnid=\").concat(request.txn_id), messageList);\n var path = \"/_matrix/client/v3/sendToDevice/\".concat(encodeURIComponent(request.event_type), \"/\") + encodeURIComponent(request.txn_id);\n return yield _this2.requestWithRetry(Method.Put, path, {}, request.body);\n })();\n }\n makeRequestWithUIA(method, path, queryParams, body, uiaCallback) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (!uiaCallback) {\n return yield _this3.requestWithRetry(method, path, queryParams, body);\n }\n var parsedBody = JSON.parse(body);\n var makeRequest = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (auth) {\n var newBody = _objectSpread({}, parsedBody);\n if (auth !== null) {\n newBody.auth = auth;\n }\n var resp = yield _this3.requestWithRetry(method, path, queryParams, JSON.stringify(newBody));\n return JSON.parse(resp);\n });\n return function makeRequest(_x) {\n return _ref2.apply(this, arguments);\n };\n }();\n var resp = yield uiaCallback(makeRequest);\n return JSON.stringify(resp);\n })();\n }\n requestWithRetry(method, path, queryParams, body) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n var currentRetryCount = 0;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n return yield _this4.rawJsonRequest(method, path, queryParams, body);\n } catch (e) {\n currentRetryCount++;\n var backoff = calculateRetryBackoff(e, currentRetryCount, true);\n if (backoff < 0) {\n // Max number of retries reached, or error is not retryable. rethrow the error\n throw e;\n }\n // wait for the specified time and then retry the request\n yield sleep(backoff);\n }\n }\n })();\n }\n rawJsonRequest(method, path, queryParams, body) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n var opts = {\n // inhibit the JSON stringification and parsing within HttpApi.\n json: false,\n // nevertheless, we are sending, and accept, JSON.\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\"\n },\n // we use the full prefix\n prefix: \"\",\n // We set a timeout of 60 seconds to guard against requests getting stuck forever and wedging the\n // request loop (cf https://github.com/element-hq/element-web/issues/29534).\n //\n // (XXX: should we do this in the whole of the js-sdk?)\n localTimeoutMs: 60000\n };\n return yield _this5.http.authedRequest(method, path, queryParams, body, opts);\n })();\n }\n}\n//# sourceMappingURL=OutgoingRequestProcessor.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * KeyClaimManager: linearises calls to OlmMachine.getMissingSessions to avoid races\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`).\n *\n * @internal\n */\nexport class KeyClaimManager {\n constructor(olmMachine, outgoingRequestProcessor) {\n this.olmMachine = olmMachine;\n this.outgoingRequestProcessor = outgoingRequestProcessor;\n _defineProperty(this, \"currentClaimPromise\", void 0);\n _defineProperty(this, \"stopped\", false);\n this.currentClaimPromise = Promise.resolve();\n }\n\n /**\n * Tell the KeyClaimManager to immediately stop processing requests.\n *\n * Any further calls, and any still in the queue, will fail with an error.\n */\n stop() {\n this.stopped = true;\n }\n\n /**\n * Given a list of users, attempt to ensure that we have Olm Sessions active with each of their devices\n *\n * If we don't have an active olm session, we will claim a one-time key and start one.\n * @param logger - logger to use\n * @param userList - list of userIDs to claim\n */\n ensureSessionsForUsers(logger, userList) {\n // The Rust-SDK requires that we only have one getMissingSessions process in flight at once. This little dance\n // ensures that, by only having one call to ensureSessionsForUsersInner active at once (and making them\n // queue up in order).\n var prom = this.currentClaimPromise.catch(() => {\n // any errors in the previous claim will have been reported already, so there is nothing to do here.\n // we just throw away the error and start anew.\n }).then(() => this.ensureSessionsForUsersInner(logger, userList));\n this.currentClaimPromise = prom;\n return prom;\n }\n ensureSessionsForUsersInner(logger, userList) {\n var _this = this;\n return _asyncToGenerator(function* () {\n // bail out quickly if we've been stopped.\n if (_this.stopped) {\n throw new Error(\"Cannot ensure Olm sessions: shutting down\");\n }\n logger.info(\"Checking for missing Olm sessions\");\n // By passing the userId array to rust we transfer ownership of the items to rust, causing\n // them to be invalidated on the JS side as soon as the method is called.\n // As we haven't created the `userList` let's clone the users, to not break the caller from re-using it.\n var claimRequest = yield _this.olmMachine.getMissingSessions(userList.map(u => u.clone()));\n if (claimRequest) {\n logger.info(\"Making /keys/claim request\");\n yield _this.outgoingRequestProcessor.makeOutgoingRequest(claimRequest);\n }\n logger.info(\"Olm sessions prepared\");\n })();\n }\n}\n//# sourceMappingURL=KeyClaimManager.js.map","/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { Device, DeviceVerification } from \"../models/device.js\";\n/**\n * Convert a {@link RustSdkCryptoJs.Device} to a {@link Device}\n * @param device - Rust Sdk device\n * @param userId - owner of the device\n *\n * @internal\n */\nexport function rustDeviceToJsDevice(device, userId) {\n // Copy rust device keys to Device.keys\n var keys = new Map();\n for (var [keyId, key] of device.keys.entries()) {\n keys.set(keyId.toString(), key.toBase64());\n }\n\n // Compute verified from device state\n var verified = DeviceVerification.Unverified;\n if (device.isBlacklisted()) {\n verified = DeviceVerification.Blocked;\n } else if (device.isVerified()) {\n verified = DeviceVerification.Verified;\n }\n\n // Convert rust signatures to Device.signatures\n var signatures = new Map();\n var mayBeSignatureMap = device.signatures.get(userId);\n if (mayBeSignatureMap) {\n var convertedSignatures = new Map();\n // Convert maybeSignatures map to a Map<string, string>\n for (var [_key, value] of mayBeSignatureMap.entries()) {\n if (value.isValid() && value.signature) {\n convertedSignatures.set(_key, value.signature.toBase64());\n }\n }\n signatures.set(userId.toString(), convertedSignatures);\n }\n\n // Convert rust algorithms to algorithms\n var rustAlgorithms = device.algorithms;\n // Use set to ensure that algorithms are not duplicated\n var algorithms = new Set();\n rustAlgorithms.forEach(algorithm => {\n switch (algorithm) {\n case RustSdkCryptoJs.EncryptionAlgorithm.MegolmV1AesSha2:\n algorithms.add(\"m.megolm.v1.aes-sha2\");\n break;\n case RustSdkCryptoJs.EncryptionAlgorithm.OlmV1Curve25519AesSha2:\n default:\n algorithms.add(\"m.olm.v1.curve25519-aes-sha2\");\n break;\n }\n });\n return new Device({\n deviceId: device.deviceId.toString(),\n userId: userId.toString(),\n keys,\n algorithms: Array.from(algorithms),\n verified,\n signatures,\n displayName: device.displayName,\n dehydrated: device.isDehydrated\n });\n}\n\n/**\n * Convert {@link DeviceKeys} from `/keys/query` request to a `Map<string, Device>`\n * @param deviceKeys - Device keys object to convert\n *\n * @internal\n */\nexport function deviceKeysToDeviceMap(deviceKeys) {\n return new Map(Object.entries(deviceKeys).map(_ref => {\n var [deviceId, device] = _ref;\n return [deviceId, downloadDeviceToJsDevice(device)];\n }));\n}\n\n// Device from `/keys/query` request\n\n/**\n * Convert `/keys/query` {@link QueryDevice} device to {@link Device}\n * @param device - Device from `/keys/query` request\n *\n * @internal\n */\nexport function downloadDeviceToJsDevice(device) {\n var _device$unsigned;\n var keys = new Map(Object.entries(device.keys));\n var displayName = (_device$unsigned = device.unsigned) === null || _device$unsigned === void 0 ? void 0 : _device$unsigned.device_display_name;\n var signatures = new Map();\n if (device.signatures) {\n for (var userId in device.signatures) {\n signatures.set(userId, new Map(Object.entries(device.signatures[userId])));\n }\n }\n return new Device({\n deviceId: device.device_id,\n userId: device.user_id,\n keys,\n algorithms: device.algorithms,\n verified: DeviceVerification.Unverified,\n signatures,\n displayName\n });\n}\n//# sourceMappingURL=device-converter.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/** Manages the cross-signing keys for our own user.\n *\n * @internal\n */\nexport class CrossSigningIdentity {\n constructor(logger, olmMachine, outgoingRequestProcessor, secretStorage) {\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.outgoingRequestProcessor = outgoingRequestProcessor;\n this.secretStorage = secretStorage;\n }\n\n /**\n * Initialise our cross-signing keys by creating new keys if they do not exist, and uploading to the server\n */\n bootstrapCrossSigning(opts) {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (opts.setupNewCrossSigning) {\n yield _this.resetCrossSigning(opts.authUploadDeviceSigningKeys);\n return;\n }\n var olmDeviceStatus = yield _this.olmMachine.crossSigningStatus();\n\n // Try to fetch cross signing keys from the secret storage\n var masterKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.master\");\n var selfSigningKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.self_signing\");\n var userSigningKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.user_signing\");\n var privateKeysInSecretStorage = Boolean(masterKeyFromSecretStorage && selfSigningKeyFromSecretStorage && userSigningKeyFromSecretStorage);\n var olmDeviceHasKeys = olmDeviceStatus.hasMaster && olmDeviceStatus.hasUserSigning && olmDeviceStatus.hasSelfSigning;\n\n // Log all relevant state for easier parsing of debug logs.\n _this.logger.debug(\"bootstrapCrossSigning: starting\", {\n setupNewCrossSigning: opts.setupNewCrossSigning,\n olmDeviceHasMaster: olmDeviceStatus.hasMaster,\n olmDeviceHasUserSigning: olmDeviceStatus.hasUserSigning,\n olmDeviceHasSelfSigning: olmDeviceStatus.hasSelfSigning,\n privateKeysInSecretStorage\n });\n if (olmDeviceHasKeys) {\n if (!(yield _this.secretStorage.hasKey())) {\n _this.logger.warn(\"bootstrapCrossSigning: Olm device has private keys, but secret storage is not yet set up; doing nothing for now.\");\n // the keys should get uploaded to 4S once that is set up.\n } else if (!privateKeysInSecretStorage) {\n // the device has the keys but they are not in 4S, so update it\n _this.logger.debug(\"bootstrapCrossSigning: Olm device has private keys: exporting to secret storage\");\n yield _this.exportCrossSigningKeysToStorage();\n } else {\n _this.logger.debug(\"bootstrapCrossSigning: Olm device has private keys and they are saved in secret storage; doing nothing\");\n }\n } /* (!olmDeviceHasKeys) */else {\n if (privateKeysInSecretStorage) {\n // they are in 4S, so import from there\n _this.logger.debug(\"bootstrapCrossSigning: Cross-signing private keys not found locally, but they are available \" + \"in secret storage, reading storage and caching locally\");\n var status = yield _this.olmMachine.importCrossSigningKeys(masterKeyFromSecretStorage, selfSigningKeyFromSecretStorage, userSigningKeyFromSecretStorage);\n\n // Check that `importCrossSigningKeys` worked correctly (for example, it will fail silently if the\n // public keys are not available).\n if (!status.hasMaster || !status.hasSelfSigning || !status.hasUserSigning) {\n throw new Error(\"importCrossSigningKeys failed to import the keys\");\n }\n\n // Get the current device\n var device = yield _this.olmMachine.getDevice(_this.olmMachine.userId, _this.olmMachine.deviceId);\n try {\n // Sign the device with our cross-signing key and upload the signature\n var request = yield device.verify();\n yield _this.outgoingRequestProcessor.makeOutgoingRequest(request);\n } finally {\n device.free();\n }\n } else {\n _this.logger.debug(\"bootstrapCrossSigning: Cross-signing private keys not found locally or in secret storage, creating new keys\");\n yield _this.resetCrossSigning(opts.authUploadDeviceSigningKeys);\n }\n }\n\n // TODO: we might previously have bootstrapped cross-signing but not completed uploading the keys to the\n // server -- in which case we should call OlmDevice.bootstrap_cross_signing. How do we know?\n _this.logger.debug(\"bootstrapCrossSigning: complete\");\n })();\n }\n\n /** Reset our cross-signing keys\n *\n * This method will:\n * * Tell the OlmMachine to create new keys\n * * Upload the new public keys and the device signature to the server\n * * Upload the private keys to SSSS, if it is set up\n */\n resetCrossSigning(authUploadDeviceSigningKeys) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // XXX: We must find a way to make this atomic, currently if the user does not remember his account password\n // or 4S passphrase/key the process will fail in a bad state, with keys rotated but not uploaded or saved in 4S.\n var outgoingRequests = yield _this2.olmMachine.bootstrapCrossSigning(true);\n\n // If 4S is configured we need to update it.\n if (!(yield _this2.secretStorage.hasKey())) {\n _this2.logger.warn(\"resetCrossSigning: Secret storage is not yet set up; not exporting keys to secret storage yet.\");\n // the keys should get uploaded to 4S once that is set up.\n } else {\n // Update 4S before uploading cross-signing keys, to stay consistent with legacy that asks\n // 4S passphrase before asking for account password.\n // Ultimately should be made atomic and resistant to forgotten password/passphrase.\n _this2.logger.debug(\"resetCrossSigning: exporting private keys to secret storage\");\n yield _this2.exportCrossSigningKeysToStorage();\n }\n _this2.logger.debug(\"resetCrossSigning: publishing public keys to server\");\n for (var req of [outgoingRequests.uploadKeysRequest, outgoingRequests.uploadSigningKeysRequest, outgoingRequests.uploadSignaturesRequest]) {\n if (req) {\n yield _this2.outgoingRequestProcessor.makeOutgoingRequest(req, authUploadDeviceSigningKeys);\n }\n }\n })();\n }\n\n /**\n * Extract the cross-signing keys from the olm machine and save them to secret storage, if it is configured\n *\n * (If secret storage is *not* configured, we assume that the export will happen when it is set up)\n */\n exportCrossSigningKeysToStorage() {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n var exported = yield _this3.olmMachine.exportCrossSigningKeys();\n /* istanbul ignore else (this function is only called when we know the olm machine has keys) */\n if (exported !== null && exported !== void 0 && exported.masterKey) {\n yield _this3.secretStorage.store(\"m.cross_signing.master\", exported.masterKey);\n } else {\n _this3.logger.error(\"Cannot export MSK to secret storage, private key unknown\");\n }\n if (exported !== null && exported !== void 0 && exported.self_signing_key) {\n yield _this3.secretStorage.store(\"m.cross_signing.self_signing\", exported.self_signing_key);\n } else {\n _this3.logger.error(\"Cannot export SSK to secret storage, private key unknown\");\n }\n if (exported !== null && exported !== void 0 && exported.userSigningKey) {\n yield _this3.secretStorage.store(\"m.cross_signing.user_signing\", exported.userSigningKey);\n } else {\n _this3.logger.error(\"Cannot export USK to secret storage, private key unknown\");\n }\n })();\n }\n}\n//# sourceMappingURL=CrossSigningIdentity.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Check that the private cross signing keys (master, self signing, user signing) are stored in the secret storage and encrypted with the default secret storage key.\n *\n * @param secretStorage - The secret store using account data\n * @returns True if the cross-signing keys are all stored and encrypted with the same secret storage key.\n *\n * @internal\n */\nexport function secretStorageContainsCrossSigningKeys(_x) {\n return _secretStorageContainsCrossSigningKeys.apply(this, arguments);\n}\n\n/**\n *\n * Check that the secret storage can access the given secrets using the default key.\n *\n * @param secretStorage - The secret store using account data\n * @param secretNames - The secret names to check\n * @returns True if all the given secrets are accessible and encrypted with the given key.\n *\n * @internal\n */\nfunction _secretStorageContainsCrossSigningKeys() {\n _secretStorageContainsCrossSigningKeys = _asyncToGenerator(function* (secretStorage) {\n return secretStorageCanAccessSecrets(secretStorage, [\"m.cross_signing.master\", \"m.cross_signing.user_signing\", \"m.cross_signing.self_signing\"]);\n });\n return _secretStorageContainsCrossSigningKeys.apply(this, arguments);\n}\nexport function secretStorageCanAccessSecrets(_x2, _x3) {\n return _secretStorageCanAccessSecrets.apply(this, arguments);\n}\nfunction _secretStorageCanAccessSecrets() {\n _secretStorageCanAccessSecrets = _asyncToGenerator(function* (secretStorage, secretNames) {\n var defaultKeyId = yield secretStorage.getDefaultKeyId();\n if (!defaultKeyId) return false;\n for (var secretName of secretNames) {\n // check which keys this particular secret is encrypted with\n var record = (yield secretStorage.isStored(secretName)) || {};\n // if it's not encrypted with the right key, there is no point continuing\n if (!(defaultKeyId in record)) return false;\n }\n return true;\n });\n return _secretStorageCanAccessSecrets.apply(this, arguments);\n}\n//# sourceMappingURL=secret-storage.js.map","/*\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 server-side key backup\");\n return false;\n }\n var backupDecryptionKey;\n try {\n backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(secret);\n } catch (e) {\n _this4.logger.warn(\"handleBackupSecretReceived: Invalid backup decryption key\", e);\n return false;\n }\n try {\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 server-side backup version (\".concat(latestBackupInfo.version, \")\"));\n // just ignore the secret\n return false;\n }\n _this4.logger.info(\"handleBackupSecretReceived: Valid decryption key for the current server-side backup version (\".concat(latestBackupInfo.version, \") received\"));\n yield _this4.saveBackupDecryptionKey(backupDecryptionKey, latestBackupInfo.version);\n return true;\n } catch (e) {\n _this4.logger.warn(\"handleBackupSecretReceived: Unable to validate 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 * Download and import the keys for a given room from the current backup version.\n *\n * @param roomId - The room in question.\n */\n downloadLatestRoomKeyBackup(roomId) {\n var _this17 = this;\n return _asyncToGenerator(function* () {\n var {\n backupVersion,\n decryptionKey\n } = yield _this17.olmMachine.getBackupKeys();\n if (!backupVersion || !decryptionKey) {\n _this17.logger.warn(\"downloadLatestRoomKeyBackup: Could not download backup (backupVersion=\".concat(backupVersion, \", hasDecryptionKey=\").concat(!!decryptionKey, \")\"));\n return;\n }\n var sessions = yield _this17.downloadRoomKeyBackup(backupVersion, roomId);\n var backupDecryptor = _this17.createBackupDecryptor(decryptionKey);\n _this17.importKeyBackup({\n rooms: {\n [roomId]: {\n sessions\n }\n }\n }, backupVersion, backupDecryptor);\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 * Call `/room/keys/keys/{roomId}` to download the key backup (room keys) for a given backup version and room ID.\n * @param backupVersion - The version to download.\n * @param roomId - The ID of the room.\n * @returns The key backup response.\n */\n downloadRoomKeyBackup(backupVersion, roomId) {\n var path = encodeUri(\"/room_keys/keys/$roomId\", {\n $roomId: roomId\n });\n return this.http.authedRequest(Method.Get, path, {\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 _this18 = 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 _this18.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 _this18.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 _this19 = this;\n return _asyncToGenerator(function* () {\n var keys = [];\n for (var [sessionId, sessionData] of Object.entries(ciphertexts)) {\n try {\n var decrypted = JSON.parse(_this19.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 _this19.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, DecryptionKeyDoesNotMatchError, 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/** The maximum time, in milliseconds, since we accepted an invite, that we should accept a key bundle. */\nexport var MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE = 24 * 60 * 60 * 1000; // 24 hours\n\n/**\n * An implementation of {@link CryptoBackend} using the Rust matrix-sdk-crypto.\n *\n * @internal\n */\nexport class RustCrypto extends TypedEventEmitter {\n constructor(logger, /** The `OlmMachine` from the underlying rust crypto sdk. */\n olmMachine,\n /**\n * Low-level HTTP interface: used to make outgoing requests required by the rust SDK.\n *\n * We expect it to set the access token, etc.\n */\n http, /** The local user's User ID. */\n userId, /** The local user's Device ID. */\n _deviceId, /** Interface to server-side secret storage */\n secretStorage, /** Crypto callbacks provided by the application */\n cryptoCallbacks) {\n var enableEncryptedStateEvents = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;\n super();\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.http = http;\n this.userId = userId;\n this.secretStorage = secretStorage;\n this.cryptoCallbacks = cryptoCallbacks;\n this.enableEncryptedStateEvents = enableEncryptedStateEvents;\n /**\n * The number of iterations to use when deriving a recovery key from a passphrase.\n */\n _defineProperty(this, \"RECOVERY_KEY_DERIVATION_ITERATIONS\", 500000);\n _defineProperty(this, \"_trustCrossSignedDevices\", true);\n _defineProperty(this, \"deviceIsolationMode\", new AllDevicesIsolationMode(false));\n /** whether {@link stop} has been called */\n _defineProperty(this, \"stopped\", false);\n /** mapping of roomId → encryptor class */\n _defineProperty(this, \"roomEncryptors\", {});\n _defineProperty(this, \"eventDecryptor\", void 0);\n _defineProperty(this, \"keyClaimManager\", void 0);\n _defineProperty(this, \"outgoingRequestProcessor\", void 0);\n _defineProperty(this, \"crossSigningIdentity\", void 0);\n _defineProperty(this, \"backupManager\", void 0);\n _defineProperty(this, \"outgoingRequestsManager\", void 0);\n _defineProperty(this, \"perSessionBackupDownloader\", void 0);\n _defineProperty(this, \"dehydratedDeviceManager\", void 0);\n _defineProperty(this, \"reemitter\", new TypedReEmitter(this));\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // CryptoApi implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n _defineProperty(this, \"globalBlacklistUnverifiedDevices\", false);\n /**\n * The verification methods we offer to the other side during an interactive verification.\n */\n _defineProperty(this, \"_supportedVerificationMethods\", ALL_VERIFICATION_METHODS);\n this.outgoingRequestProcessor = new OutgoingRequestProcessor(logger, olmMachine, http);\n this.outgoingRequestsManager = new OutgoingRequestsManager(this.logger, olmMachine, this.outgoingRequestProcessor);\n this.keyClaimManager = new KeyClaimManager(olmMachine, this.outgoingRequestProcessor);\n this.backupManager = new RustBackupManager(logger, olmMachine, http, this.outgoingRequestProcessor);\n this.perSessionBackupDownloader = new PerSessionKeyBackupDownloader(this.logger, this.olmMachine, this.http, this.backupManager);\n this.dehydratedDeviceManager = new DehydratedDeviceManager(this.logger, olmMachine, http, this.outgoingRequestProcessor, secretStorage);\n this.eventDecryptor = new EventDecryptor(this.logger, olmMachine, this.perSessionBackupDownloader);\n\n // re-emit the events emitted by managers\n this.reemitter.reEmit(this.backupManager, [CryptoEvent.KeyBackupStatus, CryptoEvent.KeyBackupSessionsRemaining, CryptoEvent.KeyBackupFailed, CryptoEvent.KeyBackupDecryptionKeyCached]);\n this.reemitter.reEmit(this.dehydratedDeviceManager, [CryptoEvent.DehydratedDeviceCreated, CryptoEvent.DehydratedDeviceUploaded, CryptoEvent.RehydrationStarted, CryptoEvent.RehydrationProgress, CryptoEvent.RehydrationCompleted, CryptoEvent.RehydrationError, CryptoEvent.DehydrationKeyCached, CryptoEvent.DehydratedDeviceRotationError]);\n this.crossSigningIdentity = new CrossSigningIdentity(logger, olmMachine, this.outgoingRequestProcessor, secretStorage);\n\n // Check and start in background the key backup connection\n this.checkKeyBackupAndEnable();\n }\n\n /**\n * Return the OlmMachine only if {@link RustCrypto#stop} has not been called.\n *\n * This allows us to better handle race conditions where the client is stopped before or during a crypto API call.\n *\n * @throws ClientStoppedError if {@link RustCrypto#stop} has been called.\n */\n getOlmMachineOrThrow() {\n if (this.stopped) {\n throw new ClientStoppedError();\n }\n return this.olmMachine;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // CryptoBackend implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n set globalErrorOnUnknownDevices(_v) {\n // Not implemented for rust crypto.\n }\n get globalErrorOnUnknownDevices() {\n // Not implemented for rust crypto.\n return false;\n }\n stop() {\n // stop() may be called multiple times, but attempting to close() the OlmMachine twice\n // will cause an error.\n if (this.stopped) {\n return;\n }\n this.stopped = true;\n this.keyClaimManager.stop();\n this.backupManager.stop();\n this.outgoingRequestsManager.stop();\n this.perSessionBackupDownloader.stop();\n this.dehydratedDeviceManager.stop();\n\n // make sure we close() the OlmMachine; doing so means that all the Rust objects will be\n // cleaned up; in particular, the indexeddb connections will be closed, which means they\n // can then be deleted.\n this.olmMachine.close();\n }\n encryptEvent(event, _room) {\n var _this = this;\n return _asyncToGenerator(function* () {\n var roomId = event.getRoomId();\n var encryptor = _this.roomEncryptors[roomId];\n if (!encryptor) {\n throw new Error(\"Cannot encrypt event in unconfigured room \".concat(roomId));\n }\n yield encryptor.encryptEvent(event, _this.globalBlacklistUnverifiedDevices, _this.deviceIsolationMode);\n })();\n }\n decryptEvent(event) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n var roomId = event.getRoomId();\n if (!roomId) {\n // presumably, a to-device message. These are normally decrypted in preprocessToDeviceMessages\n // so the fact it has come back here suggests that decryption failed.\n //\n // once we drop support for the libolm crypto implementation, we can stop passing to-device messages\n // through decryptEvent and hence get rid of this case.\n throw new Error(\"to-device event was not decrypted in preprocessToDeviceMessages\");\n }\n return yield _this2.eventDecryptor.attemptEventDecryption(event, _this2.deviceIsolationMode);\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend#getBackupDecryptor}.\n */\n getBackupDecryptor(backupInfo, privKey) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (!(privKey instanceof Uint8Array)) {\n throw new Error(\"getBackupDecryptor: expects Uint8Array\");\n }\n if (backupInfo.algorithm != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n throw new Error(\"getBackupDecryptor: Unsupported algorithm \".concat(backupInfo.algorithm));\n }\n var backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(encodeBase64(privKey));\n if (!decryptionKeyMatchesKeyBackupInfo(backupDecryptionKey, backupInfo)) {\n throw new Error(\"getBackupDecryptor: key backup on server does not match the decryption key\");\n }\n return _this3.backupManager.createBackupDecryptor(backupDecryptionKey);\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend#importBackedUpRoomKeys}.\n */\n importBackedUpRoomKeys(keys, backupVersion, opts) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n return yield _this4.backupManager.importBackedUpRoomKeys(keys, backupVersion, opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend.maybeAcceptKeyBundle}.\n */\n maybeAcceptKeyBundle(roomId, inviter) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n // TODO: retry this if it gets interrupted or it fails. (https://github.com/matrix-org/matrix-rust-sdk/issues/5112)\n // TODO: do this in the background.\n\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 var encryptedBundleBlob = yield _this5.http.authedRequest(Method.Get, bundleUrl.pathname + bundleUrl.search, {}, undefined, {\n rawResponseBody: true,\n prefix: \"\"\n });\n logger.info(\"Received blob of length \".concat(encryptedBundleBlob.size));\n encryptedBundle = new Uint8Array(yield encryptedBundleBlob.arrayBuffer());\n } catch (err) {\n logger.warn(\"Error downloading encrypted bundle from \".concat(url, \":\"), err);\n throw err;\n }\n try {\n yield _this5.olmMachine.receiveRoomKeyBundle(bundleData, encryptedBundle);\n } catch (err) {\n logger.warn(\"Error receiving encrypted bundle:\", err);\n throw err;\n } finally {\n // Even if we were unable to import the bundle, we still clear the flag that indicates that we\n // are waiting for the bundle to be received. The only reason this can happen is that the bundle was\n // malformed somehow, so we don't want to keep retrying it.\n yield _this5.olmMachine.clearRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n }\n return true;\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend.markRoomAsPendingKeyBundle}.\n */\n markRoomAsPendingKeyBundle(roomId, inviter) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n yield _this6.olmMachine.storeRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId), new RustSdkCryptoJs.UserId(inviter));\n })();\n }\n /**\n * Implementation of {@link CryptoApi#getVersion}.\n */\n getVersion() {\n var versions = RustSdkCryptoJs.getVersions();\n return \"Rust SDK \".concat(versions.matrix_sdk_crypto, \" (\").concat(versions.git_sha, \"), Vodozemac \").concat(versions.vodozemac);\n }\n\n /**\n * Implementation of {@link CryptoApi#setDeviceIsolationMode}.\n */\n setDeviceIsolationMode(isolationMode) {\n this.deviceIsolationMode = isolationMode;\n }\n\n /**\n * Implementation of {@link CryptoApi#isEncryptionEnabledInRoom}.\n */\n isEncryptionEnabledInRoom(roomId) {\n var _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.algorithm);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#isStateEncryptionEnabledInRoom}.\n */\n isStateEncryptionEnabledInRoom(roomId) {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n var roomSettings = yield _this8.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 _this9 = this;\n return _asyncToGenerator(function* () {\n var keys = _this9.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 _this0 = this;\n return _asyncToGenerator(function* () {\n var raw = yield _this0.olmMachine.exportRoomKeys(() => true);\n return JSON.parse(raw);\n })();\n }\n exportRoomKeysAsJson() {\n var _this1 = this;\n return _asyncToGenerator(function* () {\n return yield _this1.olmMachine.exportRoomKeys(() => true);\n })();\n }\n importRoomKeys(keys, opts) {\n var _this10 = this;\n return _asyncToGenerator(function* () {\n return yield _this10.backupManager.importRoomKeys(keys, opts);\n })();\n }\n importRoomKeysAsJson(keys, opts) {\n var _this11 = this;\n return _asyncToGenerator(function* () {\n return yield _this11.backupManager.importRoomKeysAsJson(keys, opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi.userHasCrossSigningKeys}.\n */\n userHasCrossSigningKeys() {\n var _arguments = arguments,\n _this12 = this;\n return _asyncToGenerator(function* () {\n var userId = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : _this12.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 _this12.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 === _this12.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 = _this12.olmMachine.queryKeysForUsers(\n // clone as rust layer will take ownership and it's reused later\n [rustTrackedUser.clone()]);\n yield _this12.outgoingRequestProcessor.makeOutgoingRequest(request);\n }\n var userIdentity = yield _this12.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 _this12.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 _this13 = 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 _this13.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 _this13.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 _this13.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 _this14 = 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 _this14.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 _this15 = this;\n return _asyncToGenerator(function* () {\n var queryBody = {\n device_keys: {}\n };\n untrackedUsers.forEach(user => queryBody.device_keys[user] = []);\n return yield _this15.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 _this16 = this;\n return _asyncToGenerator(function* () {\n var verified = _arguments3.length > 2 && _arguments3[2] !== undefined ? _arguments3[2] : true;\n var device = yield _this16.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 _this17 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this17.olmMachine.getDevice(new RustSdkCryptoJs.UserId(_this17.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 _this17.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 _this18 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this18.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: _this18._trustCrossSignedDevices\n });\n } finally {\n device.free();\n }\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getUserVerificationStatus}.\n */\n getUserVerificationStatus(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 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, true, needsUserApproval);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#pinCurrentUserIdentity}.\n */\n pinCurrentUserIdentity(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 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 _this21 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this21.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 _this22 = this;\n return _asyncToGenerator(function* () {\n var {\n privateKeysInSecretStorage,\n privateKeysCachedLocally\n } = yield _this22.getCrossSigningStatus();\n var hasKeysInCache = Boolean(privateKeysCachedLocally.masterKey) && Boolean(privateKeysCachedLocally.selfSigningKey) && Boolean(privateKeysCachedLocally.userSigningKey);\n var identity = yield _this22.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 _this23 = this;\n return _asyncToGenerator(function* () {\n var type = _arguments4.length > 0 && _arguments4[0] !== undefined ? _arguments4[0] : CrossSigningKey.Master;\n var userIdentity = yield _this23.getOwnIdentity();\n if (!userIdentity) {\n // The public keys are not available on this device\n return null;\n }\n try {\n var crossSigningStatus = yield _this23.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 _this24 = this;\n return _asyncToGenerator(function* () {\n yield _this24.crossSigningIdentity.bootstrapCrossSigning(opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#isSecretStorageReady}\n */\n isSecretStorageReady() {\n var _this25 = this;\n return _asyncToGenerator(function* () {\n return (yield _this25.getSecretStorageStatus()).ready;\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getSecretStorageStatus}\n */\n getSecretStorageStatus() {\n var _this26 = 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 _this26.backupManager.getActiveBackupVersion()) != null;\n if (keyBackupEnabled) {\n secretsToCheck.push(\"m.megolm_backup.v1\");\n }\n var defaultKeyId = yield _this26.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 _this26.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 _this27 = 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 _this27.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 _this27.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 _this27.addSecretStorageKeyToSecretStorage(recoveryKey);\n }\n var crossSigningPrivateKeys = yield _this27.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(_this27.secretStorage)))) {\n _this27.logger.info(\"bootstrapSecretStorage: cross-signing keys not yet exported; doing so now.\");\n yield _this27.secretStorage.store(\"m.cross_signing.master\", crossSigningPrivateKeys.masterKey);\n yield _this27.secretStorage.store(\"m.cross_signing.user_signing\", crossSigningPrivateKeys.userSigningKey);\n yield _this27.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 _this27.saveBackupKeyToStorage();\n } else {\n yield _this27.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 _this28 = this;\n return _asyncToGenerator(function* () {\n var keyBackupInfo = yield _this28.backupManager.getServerBackupInfo();\n if (!keyBackupInfo || !keyBackupInfo.version) {\n _this28.logger.info(\"Not saving backup key to secret storage: no backup info\");\n return;\n }\n var backupKeys = yield _this28.olmMachine.getBackupKeys();\n if (!backupKeys.decryptionKey) {\n _this28.logger.info(\"Not saving backup key to secret storage: no backup key\");\n return;\n }\n if (!decryptionKeyMatchesKeyBackupInfo(backupKeys.decryptionKey, keyBackupInfo)) {\n _this28.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 _this28.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 _this29 = this;\n return _asyncToGenerator(function* () {\n var _secretStorageKey$key, _secretStorageKey$key2, _this29$cryptoCallbac, _this29$cryptoCallbac2;\n var secretStorageKeyObject = yield _this29.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 _this29.secretStorage.setDefaultKeyId(secretStorageKeyObject.keyId);\n (_this29$cryptoCallbac = (_this29$cryptoCallbac2 = _this29.cryptoCallbacks).cacheSecretStorageKey) === null || _this29$cryptoCallbac === void 0 || _this29$cryptoCallbac.call(_this29$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 _this30 = this;\n return _asyncToGenerator(function* () {\n // See if we already have an AES secret-storage key.\n var secretStorageKeyTuple = yield _this30.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 _this31 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this31.getOwnIdentity();\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(_this31.secretStorage);\n var crossSigningStatus = yield _this31.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 _this32 = 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, _this32.RECOVERY_KEY_DERIVATION_ITERATIONS);\n return {\n keyInfo: {\n passphrase: {\n algorithm: \"m.pbkdf2\",\n iterations: _this32.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 _this33 = this;\n return _asyncToGenerator(function* () {\n return _this33.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 _this34 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this34.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 = _this34._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 _this34.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 _this34.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 _this35 = 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 _this35.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 _this36 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this36.getOwnIdentity();\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(_this36._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n yield _this36.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n return _this36.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 _this37 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this37.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(_this37._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n yield _this37.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n return _this37.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 _this38 = this;\n return _asyncToGenerator(function* () {\n var backupKeys = yield _this38.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 _this39 = this;\n return _asyncToGenerator(function* () {\n var base64Key = encodeBase64(key);\n if (!version) {\n throw new Error(\"storeSessionBackupPrivateKey: version is required\");\n }\n yield _this39.backupManager.saveBackupDecryptionKey(RustSdkCryptoJs.BackupDecryptionKey.fromBase64(base64Key), version);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#loadSessionBackupPrivateKeyFromSecretStorage}.\n */\n loadSessionBackupPrivateKeyFromSecretStorage() {\n var _this40 = this;\n return _asyncToGenerator(function* () {\n var backupKey = yield _this40.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 _this40.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 DecryptionKeyDoesNotMatchError(\"loadSessionBackupPrivateKeyFromSecretStorage: decryption key does not match backup info\");\n }\n yield _this40.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 _this41 = this;\n return _asyncToGenerator(function* () {\n return yield _this41.backupManager.getActiveBackupVersion();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getKeyBackupInfo}.\n */\n getKeyBackupInfo() {\n var _this42 = this;\n return _asyncToGenerator(function* () {\n return (yield _this42.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 _this43 = this;\n return _asyncToGenerator(function* () {\n return yield _this43.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 _this44 = this;\n return _asyncToGenerator(function* () {\n return yield _this44.backupManager.checkKeyBackupAndEnable(true);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#deleteKeyBackupVersion}.\n */\n deleteKeyBackupVersion(version) {\n var _this45 = this;\n return _asyncToGenerator(function* () {\n yield _this45.backupManager.deleteKeyBackupVersion(version);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#resetKeyBackup}.\n */\n resetKeyBackup() {\n var _this46 = this;\n return _asyncToGenerator(function* () {\n var backupInfo = yield _this46.backupManager.setupKeyBackup(o => _this46.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 _this46.secretStorageHasAESKey()) {\n yield _this46.secretStorage.store(\"m.megolm_backup.v1\", backupInfo.decryptionKey.toBase64());\n }\n\n // we can check and start async\n _this46.checkKeyBackupAndEnable();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#disableKeyStorage}.\n */\n disableKeyStorage() {\n var _this47 = this;\n return _asyncToGenerator(function* () {\n // Get the key backup version we're using\n var info = yield _this47.getKeyBackupInfo();\n if (info !== null && info !== void 0 && info.version) {\n yield _this47.deleteKeyBackupVersion(info.version);\n } else {\n _this47.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 _this47.deleteSecretStorage();\n yield _this47.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 _this48 = 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(_this48.userId) || {};\n var canonalizedJson = anotherjson.stringify(obj);\n var signatures = yield _this48.olmMachine.sign(canonalizedJson);\n var map = JSON.parse(signatures.asJSON());\n sigs.set(_this48.userId, _objectSpread(_objectSpread({}, userSignatures), map[_this48.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 _this49 = this;\n return _asyncToGenerator(function* () {\n var backupInfo = yield _this49.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 _this49.storeSessionBackupPrivateKey(privateKey, backupInfo.version);\n return _this49.restoreKeyBackup(opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#restoreKeyBackup}.\n */\n restoreKeyBackup(opts) {\n var _this50 = this;\n return _asyncToGenerator(function* () {\n // Get the decryption key from the crypto store\n var backupKeys = yield _this50.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 _this50.backupManager.requestKeyBackupVersion(backupVersion);\n if (!backupInfo) throw new Error(\"Backup version to restore \".concat(backupVersion, \" not found on server\"));\n var backupDecryptor = yield _this50.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 _this50.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 _this51 = this;\n return _asyncToGenerator(function* () {\n return yield _this51.dehydratedDeviceManager.isSupported();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#startDehydration}.\n */\n startDehydration() {\n var _arguments6 = arguments,\n _this52 = this;\n return _asyncToGenerator(function* () {\n var opts = _arguments6.length > 0 && _arguments6[0] !== undefined ? _arguments6[0] : {};\n if (!(yield _this52.isCrossSigningReady()) || !(yield _this52.isSecretStorageReady())) {\n throw new Error(\"Device dehydration requires cross-signing and secret storage to be set up\");\n }\n return yield _this52.dehydratedDeviceManager.start(opts || {});\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#importSecretsBundle}.\n */\n importSecretsBundle(secrets) {\n var _this53 = this;\n return _asyncToGenerator(function* () {\n var secretsBundle = RustSdkCryptoJs.SecretsBundle.from_json(secrets);\n yield _this53.getOlmMachineOrThrow().importSecretsBundle(secretsBundle); // this method frees the SecretsBundle\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#exportSecretsBundle}.\n */\n exportSecretsBundle() {\n var _this54 = this;\n return _asyncToGenerator(function* () {\n var secretsBundle = yield _this54.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 _this55 = this;\n return _asyncToGenerator(function* () {\n var logger = new LogSpan(_this55.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 _this55.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 _this55.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 _this55.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 _this56 = this;\n return _asyncToGenerator(function* () {\n _this56.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 _this56.dehydratedDeviceManager.delete();\n\n // Disable backup, and delete all the backups from the server\n yield _this56.backupManager.deleteAllKeyBackupVersions();\n yield _this56.deleteSecretStorage();\n\n // Reset the cross-signing keys\n yield _this56.crossSigningIdentity.bootstrapCrossSigning({\n setupNewCrossSigning: true,\n authUploadDeviceSigningKeys\n });\n\n // Create a new key backup\n yield _this56.resetKeyBackup();\n _this56.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 _this57 = this;\n return _asyncToGenerator(function* () {\n // Remove the stored secrets in the secret storage\n yield _this57.secretStorage.store(\"m.cross_signing.master\", null);\n yield _this57.secretStorage.store(\"m.cross_signing.self_signing\", null);\n yield _this57.secretStorage.store(\"m.cross_signing.user_signing\", null);\n yield _this57.secretStorage.store(\"m.megolm_backup.v1\", null);\n\n // Remove the recovery key\n var defaultKeyId = yield _this57.secretStorage.getDefaultKeyId();\n if (defaultKeyId) yield _this57.secretStorage.store(\"m.secret_storage.key.\".concat(defaultKeyId), null);\n // Disable the recovery key and the secret storage\n yield _this57.secretStorage.setDefaultKeyId(null);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#shareRoomHistoryWithUser}.\n */\n shareRoomHistoryWithUser(roomId, userId) {\n var _this58 = this;\n return _asyncToGenerator(function* () {\n var logger = new LogSpan(_this58.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 _this58.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. Download keys from backup.\n if (!(yield _this58.getOlmMachineOrThrow().hasDownloadedAllRoomKeys(new RustSdkCryptoJs.RoomId(roomId)))) {\n yield _this58.backupManager.downloadLatestRoomKeyBackup(roomId);\n yield _this58.getOlmMachineOrThrow().setHasDownloadedAllRoomKeys(new RustSdkCryptoJs.RoomId(roomId));\n }\n\n // 2. Construct the key bundle\n var bundle = yield _this58.getOlmMachineOrThrow().buildRoomKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n if (!bundle) {\n logger.info(\"No keys to share\");\n return;\n }\n\n // 3. Upload the encrypted bundle to the server\n var uploadResponse = yield _this58.http.uploadContent(bundle.encryptedData);\n logger.info(\"Uploaded encrypted key blob: \".concat(JSON.stringify(uploadResponse)));\n\n // 4. We may not share a room with the user, so get a fresh list of devices for the invited user.\n var req = _this58.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(userId)]);\n yield _this58.outgoingRequestProcessor.makeOutgoingRequest(req);\n\n // 5. Establish Olm sessions with all of the recipient's devices.\n yield _this58.keyClaimManager.ensureSessionsForUsers(logger, [new RustSdkCryptoJs.UserId(userId)]);\n\n // 6. Send to-device messages to the recipient to share the keys.\n var requests = yield _this58.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 _this58.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 _this59 = 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 _this59.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 _this60 = 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 _this60.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 _this60.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 recently joined the room in question,\n // tell the Rust SDK to try and accept the key bundle.\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)) {\n var roomId = parsedMessage.content.room_id;\n var pendingDetails = yield _this60.olmMachine.getPendingKeyBundleDetailsForRoom(new RustSdkCryptoJs.RoomId(roomId));\n // Only accept the key bundle if we joined the room less than 24 hours ago.\n if (!pendingDetails) {\n _this60.logger.debug(\"Not yet accepting key bundle for room where we are not awaiting a bundle: \".concat(roomId));\n } else if (Date.now() - pendingDetails.inviteAcceptedAtMillis > MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE) {\n _this60.logger.info(\"Ignoring key bundle for room we joined too long ago: \".concat(roomId, \", joining time: \").concat(new Date(pendingDetails.inviteAcceptedAtMillis).toISOString()));\n } else {\n _this60.logger.info(\"Considering key bundle for recently-joined room \".concat(roomId));\n // Don't block for the import to happen, here, as this is called from inside the `/sync` loop.\n _this60.maybeAcceptKeyBundle(roomId, pendingDetails.inviterId.toString()).catch(err => {\n _this60.logger.error(\"Error attempting to download key bundle for room \".concat(roomId));\n _this60.logger.error(err);\n });\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 _this61 = 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 _this61.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 _this62 = 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 _this62.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 _this63 = 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 _this63.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\"] && _this63.enableEncryptedStateEvents) {\n _this63.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 _this63.olmMachine.setRoomSettings(new RustSdkCryptoJs.RoomId(room.roomId), settings);\n } catch (e) {\n _this63.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 = _this63.roomEncryptors[room.roomId];\n if (existingEncryptor) {\n existingEncryptor.onCryptoEvent(config);\n } else {\n _this63.roomEncryptors[room.roomId] = new RoomEncryptor(_this63.logger.getChild(\"[\".concat(room.roomId, \" encryption]\")), _this63.olmMachine, _this63.keyClaimManager, _this63.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 _this64 = this;\n return _asyncToGenerator(function* () {\n yield _this64.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 roomId = event.getRoomId();\n\n // If it's our own membership, and we are no longer joined, clear any indication that we are waiting for a key\n // bundle.\n if (oldMembership === KnownMembership.Join && member.membership !== KnownMembership.Join && member.userId === this.olmMachine.userId.toString()) {\n this.olmMachine.clearRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId)).catch(e => {\n this.logger.error(\"Error clearing room pending key bundle indicator for \".concat(roomId, \": \").concat(e));\n });\n }\n var enc = this.roomEncryptors[roomId];\n if (!enc) {\n // not encrypting in this room\n return;\n }\n enc.onRoomMembership(member);\n }\n\n /**\n * Previously, it was sufficient to check if we need to rotate the room key\n * prior to sending a message. However, the history sharing feature\n * (MSC4268) breaks this logic:\n *\n * 1. Alice sends a message M1 in room X;\n * 2. Bob invites Charlie, who joins and immediately leaves the room;\n * 3. Alice sends another message M2 in room X.\n *\n * Under the old logic, Alice would not rotate her key after Charlie\n * leaves, resulting in M2 being encrypted with the same session as M1.\n * This would allow Charlie to decrypt M2 if he ever gains access to\n * the event.\n *\n * To counter this, we proactively discard any active outgoing Megolm\n * session when we see an event indicating the user left.\n *\n * Note that we have to do this in `onRoomStateEvent` rather than\n * `onRoomMembership`, because `onRoomMembership` is only called when we see\n * a *change* in membership. In the case of a gappy sync, we might miss\n * Charlie's invite and join, and only see the final `leave` event (so his\n * membership goes from `leave` to `leave`).\n */\n onRoomStateEvent(event, _state, _prevEvent) {\n if (event.getType() != EventType.RoomMember) {\n // Ignore all events that aren't member updates.\n return;\n }\n if (event.getStateKey() !== this.olmMachine.userId.toString() && event.getContent().membership !== KnownMembership.Join) {\n this.logger.info(\"Rotating session for room \".concat(event.getRoomId(), \" due to member leaving the room\"));\n this.forceDiscardSession(event.getRoomId());\n }\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 _this65 = this;\n return _asyncToGenerator(function* () {\n for (var key of keys) {\n _this65.onRoomKeyUpdated(key);\n }\n _this65.backupManager.maybeUploadKey();\n })();\n }\n onRoomKeyUpdated(key) {\n var _this66 = 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(_this66, {\n isRetry: true\n }).catch(_e => {\n _this66.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 _this67 = this;\n return _asyncToGenerator(function* () {\n for (var session of withheld) {\n _this67.logger.debug(\"Got withheld message for session \".concat(session.sessionId, \" in \").concat(session.roomId.toString()));\n var pendingList = _this67.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 _this67.logger.debug(\"Retrying decryption on events:\", pendingList.map(e => \"\".concat(e.getId())));\n for (var ev of pendingList) {\n ev.attemptDecryption(_this67, {\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 _this68 = this;\n return _asyncToGenerator(function* () {\n var newVerification = yield _this68.getUserVerificationStatus(userId.toString());\n _this68.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() === _this68.userId) {\n _this68.emit(CryptoEvent.KeysChanged, {});\n yield _this68.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 _this69 = this;\n return _asyncToGenerator(function* () {\n _this69.emit(CryptoEvent.WillUpdateDevices, userIds, false);\n _this69.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 _this70 = this;\n return _asyncToGenerator(function* () {\n _this70.logger.debug(\"onReceiveSecret: Received secret \".concat(name));\n if (name === \"m.megolm_backup.v1\") {\n return yield _this70.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 _this71 = this;\n return _asyncToGenerator(function* () {\n var pendingValues = yield _this71.olmMachine.getSecretsFromInbox(name);\n for (var value of pendingValues) {\n if (yield _this71.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 _this71.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 _this72 = 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 _this72.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 _this73 = 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 _this73.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 = _this73.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(senderId)]);\n yield _this73.outgoingRequestProcessor.makeOutgoingRequest(req);\n }\n yield _this73.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 _this73.onIncomingKeyVerificationRequest(senderId, event.getId());\n }\n\n // that may have caused us to queue up outgoing requests, so make sure we send them.\n _this73.outgoingRequestsManager.doProcessOutgoingRequests().catch(e => {\n _this73.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 _this74 = this;\n return _asyncToGenerator(function* () {\n var identity = yield _this74.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(_this74.userId));\n return identity;\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 _this75 = 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 _this75.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 _this75.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 _this75.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 _this75.onMegolmDecryptionError(event, err, yield _this75.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 _this76 = 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 _this76.olmMachine.getRoomEventEncryptionInfo(stringifyEvent(event), new RustSdkCryptoJs.RoomId(event.getRoomId()));\n return rustEncryptionInfoToJsEncryptionInfo(_this76.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","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 { MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE, 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\n // If we have any recently-joined rooms, see if we have a pending key bundle for them.\n for (var pendingDetails of yield olmMachine.getAllRoomsPendingKeyBundles()) {\n var roomId = pendingDetails.roomId.toString();\n if (Date.now() - pendingDetails.inviteAcceptedAtMillis <= MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE) {\n logger.info(\"Checking for pending key bundle for recently-joined room \".concat(roomId, \" (joined \").concat(new Date(pendingDetails.inviteAcceptedAtMillis).toISOString(), \")\"));\n yield rustCrypto.maybeAcceptKeyBundle(roomId, pendingDetails.inviterId.toString());\n } else {\n logger.info(\"Clearing pending-key-bundle flag for room \".concat(roomId, \" (too old: joined \").concat(new Date(pendingDetails.inviteAcceptedAtMillis).toISOString(), \")\"));\n yield olmMachine.clearRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n }\n }\n return rustCrypto;\n });\n return _initOlmMachine.apply(this, arguments);\n}\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],"mappings":"+xZAIa,GAAb,KAAwB,CACpB,oBAAqB,CACjB,IAAM,EAAM,KAAK,UAGjB,MAFA,MAAK,UAAY,EACjB,GAAuB,WAAW,KAAK,CAChC,EAEX,MAAO,CACH,IAAM,EAAM,KAAK,oBAAoB,CACrC,EAAK,sBAAsB,EAAK,EAAE,CAgBtC,OAAO,QAAQ,EAAY,CACvB,EAAa,EAAY,GAAoB,CAC7C,IAAM,EAAM,EAAK,mBAAmB,EAAW,UAAU,CACzD,GAAI,EAAI,GACJ,MAAM,EAAwB,EAAI,GAAG,CAEzC,IAAI,EAAK,EAAoB,EAAI,GAAI,EAAI,GAAG,CAAC,OAAO,CAEpD,OADA,EAAK,gBAAgB,EAAI,GAAI,EAAI,GAAK,EAAG,EAAE,CACpC,EAWX,OAAO,QAAQ,EAAO,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C/B,IAAsB,MAAM,EAAkB,cAAc,IACzC,MAAM,EAAkB,mBAAmB,EAC3C,EAAe,2BAA4B,CAC9D,EAAO,MAAM,+CAA+C,CAK5D,IADA,IAAI,EAAsB,GACnB,CAAC,GACN,GAAI,CACF,MAAM,EAAW,wBAAwB,EAAO,CAChD,EAAsB,SACf,EAAG,CAEV,EAAO,MAAM,mEAAoE,EAAE,CASvF,MAAM,GAAgC,CACpC,oBACA,aACA,SACD,CAAC,CACF,MAAM,EAAkB,kBAAkB,EAAe,2BAA2B,CAKxF,IAAK,IAAI,KAAkB,MAAM,EAAW,8BAA8B,CAAE,CAC1E,IAAI,EAAS,EAAe,OAAO,UAAU,CACzC,KAAK,KAAK,CAAG,EAAe,wBAAA,OAC9B,EAAO,KAAK,4DAAmE,aAA4B,IAAI,KAAK,EAAe,uBAAuB,CAAC,aAAa,IAAO,CAC/K,MAAM,EAAW,qBAAqB,EAAQ,EAAe,UAAU,UAAU,CAAC,GAElF,EAAO,KAAK,6CAAoD,sBAAqC,IAAI,KAAK,EAAe,uBAAuB,CAAC,aAAa,IAAO,CACzK,MAAM,EAAW,0BAA0B,IAAIC,EAAuB,EAAO,CAAC,EAGlF,OAAO,GACP,CACK,GAAgB,MAAM,KAAM,UAAU"}
|
|
1
|
+
{"version":3,"file":"rust-crypto-BB1QAvrJ.js","names":["VerificationMethod","RustSdkCryptoJs.UserId","HistoryVisibility","RustHistoryVisibility","RustSdkCryptoJs.DeviceId","ownKeys","_objectSpread","DehydrationUnstablePrefix","Device","RustSdkCryptoJs.Sas","RustSdkCryptoJs.Qr","RustSdkCryptoJs.RoomId","ownKeys","_objectSpread","RustSdkCryptoJs.UserId","RustSdkCryptoJs.RoomId","RustSdkCryptoJs.getVersions","RustSdkCryptoJs.DeviceId","RustSdkCryptoJs.OtherUserIdentity","RustSdkCryptoJs.OwnUserIdentity","RustSdkCryptoJs.EventId","anotherjson","RustSdkCryptoJs.DeviceLists","RustSdkCryptoJs.RoomSettings","RustSdkCryptoJs.DecryptionSettings","RustSdkCryptoJs.MegolmDecryptionError","RustSdkCryptoJs.initAsync","RustSdkCryptoJs.BaseMigrationData","RustSdkCryptoJs.UserId","RustSdkCryptoJs.DeviceId","RustSdkCryptoJs.PickledSession","RustSdkCryptoJs.PickledInboundGroupSession","RustSdkCryptoJs.RoomId","RustSdkCryptoJs.RoomSettings","RustSdkCryptoJs.initAsync","RustSdkCryptoJs.UserId","RustSdkCryptoJs.DeviceId","RustSdkCryptoJs.RoomId"],"sources":["../../node_modules/.pnpm/@matrix-org+matrix-sdk-crypto-wasm@18.1.0/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js","../../node_modules/.pnpm/@matrix-org+matrix-sdk-crypto-wasm@18.1.0/node_modules/@matrix-org/matrix-sdk-crypto-wasm/index.mjs","../../node_modules/.pnpm/another-json@0.2.0/node_modules/another-json/another-json.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/RoomEncryptor.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/DehydratedDeviceManager.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestProcessor.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/KeyClaimManager.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/device-converter.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/CrossSigningIdentity.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/secret-storage.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/types.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/verification.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/backup.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/OutgoingRequestsManager.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/PerSessionKeyBackupDownloader.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/common-crypto/key-passphrase.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/rust-crypto.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/libolm_migration.js","../../node_modules/.pnpm/matrix-js-sdk@https+++codeload.github.com+matrix-org+matrix-js-sdk+tar.gz+668183d7226ccb4819788018fb48e9a58f85a45b/node_modules/matrix-js-sdk/lib/rust-crypto/index.js"],"sourcesContent":["/**\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 * Create a new random [`BackupDecryptionKey`].\n * @returns {BackupDecryptionKey}\n */\n static createRandomKey() {\n const ret = wasm.backupdecryptionkey_createRandomKey();\n return BackupDecryptionKey.__wrap(ret);\n }\n /**\n * Try to 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 * 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 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 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 version that we are using for backups.\n * @param {string | null} [arg0]\n */\n set backupVersion(arg0) {\n var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_backupkeys_backupVersion(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * The key used to decrypt backed up room keys\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}\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 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 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 version which this backup decryption key is used with.\n * @param {string} arg0\n */\n set backup_version(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_backupsecretsbundle_backup_version(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * 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}\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 * Creates a new base64-encoded encrypted message from its parts.\n * @param {string} ciphertext\n * @param {string} mac\n * @param {string} ephemeral_key\n */\n constructor(ciphertext, mac, ephemeral_key) {\n const ptr0 = passStringToWasm0(ciphertext, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(mac, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(ephemeral_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.base64encodedpkmessage_new(ptr0, len0, ptr1, len1, ptr2, len2);\n this.__wbg_ptr = ret >>> 0;\n Base64EncodedPkMessageFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * 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 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 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 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_base64encodedpkmessage_ciphertext(this.__wbg_ptr, ptr0, len0);\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 * 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_base64encodedpkmessage_mac(this.__wbg_ptr, ptr0, len0);\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 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 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 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 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 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, 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, 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 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 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 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 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 * @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_basemigrationdata_pickledAccount(this.__wbg_ptr, ptr0, len0);\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 * @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 * @param {string | null} [arg0]\n */\n set privateCrossSigningUserSigningKey(arg0) {\n var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_basemigrationdata_privateCrossSigningUserSigningKey(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * 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}\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 * 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 * 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 /**\n * Share based on identity. Only distribute to devices signed by their\n * owner. If a user has no published identity he will not receive\n * any room keys.\n * @returns {CollectStrategy}\n */\n static identityBasedStrategy() {\n const ret = wasm.collectstrategy_identityBasedStrategy();\n return CollectStrategy.__wrap(ret);\n }\n /**\n * Only share keys with devices that we \"trust\". A device is trusted if any\n * of the following is true:\n * - It was manually marked as trusted.\n * - It was marked as verified via interactive verification.\n * - It is signed by its owner identity, and this identity has been\n * trusted via interactive verification.\n * - It is the current own device of the user.\n * @returns {CollectStrategy}\n */\n static onlyTrustedDevices() {\n const ret = wasm.collectstrategy_onlyTrustedDevices();\n return CollectStrategy.__wrap(ret);\n }\n}\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 key signatures, including those for the cross-signing\n * keys, and maybe some for the optional uploaded key too.\n *\n * Should be sent last.\n * @returns {SignatureUploadRequest}\n */\n get uploadSignaturesRequest() {\n const ret = wasm.__wbg_get_crosssigningbootstraprequests_uploadSignaturesRequest(this.__wbg_ptr);\n return SignatureUploadRequest.__wrap(ret);\n }\n /**\n * 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}\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 * 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 * 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 * 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 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 * 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 * 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 * Encodes the secret key into a base64 string.\n * @returns {string}\n */\n toBase64() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.curve25519secretkey_toBase64(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * Converts the secret key into a raw byte vector.\n * @returns {Uint8Array}\n */\n toUint8Array() {\n const ret = wasm.curve25519secretkey_toUint8Array(this.__wbg_ptr);\n var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n return v1;\n }\n}\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 * 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 * 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 * 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 {string[]}\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 * 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 * 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 device ID of the device that sent us the event, note this\n * is untrusted data unless `verification_state` is as well\n * trusted.\n * @returns {DeviceId | undefined}\n */\n get senderDevice() {\n const ret = wasm.decryptedroomevent_senderDevice(this.__wbg_ptr);\n return ret === 0 ? undefined : DeviceId.__wrap(ret);\n }\n /**\n * The 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 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 type of processed to-device event. Always {@link\n * ProcessedToDeviceEventType.Decrypted} for this type.\n * @returns {ProcessedToDeviceEventType}\n */\n get type() {\n const ret = wasm.decryptedtodeviceevent_type(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 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}\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 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 * Generates a new random dehydrated device key.\n * @returns {DehydratedDeviceKey}\n */\n static createRandomKey() {\n const ret = wasm.dehydrateddevicekey_createRandomKey();\n return DehydratedDeviceKey.__wrap(ret);\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 * 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 * 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 * 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 * Rehydrate a dehydrated device.\n * @param {DehydratedDeviceKey} dehydrated_device_key\n * @param {DeviceId} device_id\n * @param {string} device_data\n * @returns {Promise<RehydratedDevice>}\n */\n rehydrate(dehydrated_device_key, device_id, device_data) {\n _assertClass(dehydrated_device_key, DehydratedDeviceKey);\n _assertClass(device_id, DeviceId);\n const ptr0 = passStringToWasm0(device_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.dehydrateddevices_rehydrate(this.__wbg_ptr, dehydrated_device_key.__wbg_ptr, device_id.__wbg_ptr, ptr0, len0);\n return ret;\n }\n /**\n * 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}\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 {EncryptionAlgorithm[]}\n */\n get algorithms() {\n const ret = wasm.device_algorithms(this.__wbg_ptr);\n return ret;\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 * The unique ID of the device.\n * @returns {DeviceId}\n */\n get deviceId() {\n const ret = wasm.device_deviceId(this.__wbg_ptr);\n return DeviceId.__wrap(ret);\n }\n /**\n * Get the human readable name of the device.\n * @returns {string | undefined}\n */\n get displayName() {\n const ret = wasm.device_displayName(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getStringFromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n }\n return v1;\n }\n /**\n * Get the 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 * 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 * 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 * 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 * Is the device locally marked as blacklisted?\n *\n * Blacklisted devices won’t receive any group sessions.\n * @returns {boolean}\n */\n isBlacklisted() {\n const ret = wasm.device_isBlacklisted(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is 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 * 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 * 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 * Is the device locally marked as trusted?\n * @returns {boolean}\n */\n isLocallyTrusted() {\n const ret = wasm.device_isLocallyTrusted(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is 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 a map containing all the device keys.\n * @returns {Map<DeviceKeyId, DeviceKey>}\n */\n get keys() {\n const ret = wasm.device_keys(this.__wbg_ptr);\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 * Request an interactive verification with this device.\n *\n * Returns a 2-element array `[VerificationRequest, ToDeviceRequest]`.\n * @param {VerificationMethod[]} [methods]\n * @returns {[VerificationRequest, ToDeviceRequest]}\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 * 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<null>}\n */\n setLocalTrust(local_state) {\n const ret = wasm.device_setLocalTrust(this.__wbg_ptr, local_state);\n return ret;\n }\n /**\n * Get a map containing all the device signatures.\n * @returns {Signatures}\n */\n get signatures() {\n const ret = wasm.device_signatures(this.__wbg_ptr);\n return Signatures.__wrap(ret);\n }\n /**\n * 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 * 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<SignatureUploadRequest>}\n */\n verify() {\n const ret = wasm.device_verify(this.__wbg_ptr);\n return 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 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 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 * Convert the `DeviceKey` into a base64 encoded string.\n * @returns {string}\n */\n toBase64() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.devicekey_toBase64(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * 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}\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 * 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 * 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 * 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 * 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 /**\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 * 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}\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 * 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 /**\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}\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 * 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 * 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 * 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 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 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 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 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 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 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 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 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 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_encryptioninfo_senderClaimedEd25519Key(this.__wbg_ptr, ptr0, len0);\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_encryptioninfo_senderCurve25519Key(this.__wbg_ptr, ptr0, len0);\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 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}\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 * 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 * 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 * 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 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 * 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 * 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 * @param {boolean} arg0\n */\n set encryptStateEvents(arg0) {\n wasm.__wbg_set_encryptionsettings_encryptStateEvents(this.__wbg_ptr, arg0);\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 * 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 * 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 * 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 * 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 /**\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}\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 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 * 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 server name of the event ID.\n * @returns {ServerName | undefined}\n */\n get serverName() {\n const ret = wasm.eventid_serverName(this.__wbg_ptr);\n return ret === 0 ? undefined : ServerName.__wrap(ret);\n }\n /**\n * Return the event ID as a string.\n * @returns {string}\n */\n toString() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.eventid_toString(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\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 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 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 Curve25519 public key, used for establish shared secrets.\n * @param {Curve25519PublicKey} arg0\n */\n set curve25519(arg0) {\n _assertClass(arg0, Curve25519PublicKey);\n var ptr0 = arg0.__destroy_into_raw();\n wasm.__wbg_set_identitykeys_curve25519(this.__wbg_ptr, ptr0);\n }\n /**\n * 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}\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 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 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 * @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_inboundcreationresult_message(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 * 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 /**\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}\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 * 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 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 * The backup version that these room keys should be part of.\n * @returns {string}\n */\n get version() {\n const ret = wasm.__wbg_get_keysbackuprequest_version(this.__wbg_ptr);\n return ret;\n }\n /**\n * Create a new `KeysBackupRequest`.\n * @param {string} id\n * @param {string} body\n * @param {string} version\n */\n constructor(id, body, version) {\n const ret = wasm.keysbackuprequest_new(id, body, version);\n this.__wbg_ptr = ret >>> 0;\n KeysBackupRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysbackuprequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * A JSON-encoded object containing the rest of the payload: `timeout`,\n * `one_time_keys`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_keysclaimrequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * Create a new `KeysClaimRequest`.\n * @param {string} id\n * @param {string} body\n */\n constructor(id, body) {\n const ret = wasm.keysclaimrequest_new(id, body);\n this.__wbg_ptr = ret >>> 0;\n KeysClaimRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysclaimrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * A JSON-encoded object containing the rest of the payload: `timeout`,\n * `device_keys`, `token`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_keysqueryrequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * Create a new `KeysQueryRequest`.\n * @param {string} id\n * @param {string} body\n */\n constructor(id, body) {\n const ret = wasm.keysqueryrequest_new(id, body);\n this.__wbg_ptr = ret >>> 0;\n KeysQueryRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysqueryrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) KeysQueryRequest.prototype[Symbol.dispose] = KeysQueryRequest.prototype.free;\n\n/**\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 * A JSON-encoded object containing the rest of the payload: `device_keys`,\n * `one_time_keys`, `fallback_keys`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_keysuploadrequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * Create a new `KeysUploadRequest`.\n * @param {string} id\n * @param {string} body\n */\n constructor(id, body) {\n const ret = wasm.keysuploadrequest_new(id, body);\n this.__wbg_ptr = ret >>> 0;\n KeysUploadRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.keysuploadrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * 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 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 * 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 * 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 /**\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}\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 * Get the full name of the backup algorithm this backup key supports.\n * @returns {string}\n */\n get algorithm() {\n const ret = wasm.megolmv1backupkey_algorithm(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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}\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 {JsLogger} [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 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 {JsLogger} [logger]\n * @returns {Promise<void>}\n */\n static migrateMegolmSessions(sessions, pickle_key, store_handle, logger) {\n const ptr0 = passArrayJsValueToWasm0(sessions, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n _assertClass(store_handle, StoreHandle);\n const ret = wasm.migration_migrateMegolmSessions(ptr0, len0, pickle_key, store_handle.__wbg_ptr, isLikeNone(logger) ? 0 : addToExternrefTable0(logger));\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * 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 {JsLogger} [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}\nif (Symbol.dispose) Migration.prototype[Symbol.dispose] = Migration.prototype.free;\n\n/**\n * Intent-specific data in the case the QR code adheres to\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4108 MSC4108} of the QR code\n * data format.\n */\nexport class Msc4108IntentData {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(Msc4108IntentData.prototype);\n obj.__wbg_ptr = ptr;\n Msc4108IntentDataFinalization.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 Msc4108IntentDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_msc4108intentdata_free(ptr, 0);\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.__wbg_get_msc4108intentdata_rendezvousUrl(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * Get the server name of the homeserver which the new device will be\n * logged in to.\n *\n * This will be only available if the existing device has generated the QR\n * code and the new device is the one scanning the QR code.\n * @returns {string | undefined}\n */\n get serverName() {\n const ret = wasm.__wbg_get_msc4108intentdata_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 * @param {string} arg0\n */\n set rendezvousUrl(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_msc4108intentdata_rendezvousUrl(this.__wbg_ptr, ptr0, len0);\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 * @param {string | null} [arg0]\n */\n set serverName(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_msc4108intentdata_serverName(this.__wbg_ptr, ptr0, len0);\n }\n}\nif (Symbol.dispose) Msc4108IntentData.prototype[Symbol.dispose] = Msc4108IntentData.prototype.free;\n\n/**\n * Intent-specific data in the case the QR code adheres to\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4388 MSC4388} of the QR code\n * data format.\n */\nexport class Msc4388IntentData {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(Msc4388IntentData.prototype);\n obj.__wbg_ptr = ptr;\n Msc4388IntentDataFinalization.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 Msc4388IntentDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_msc4388intentdata_free(ptr, 0);\n }\n /**\n * The base URL of the homeserver that the device generating the QR is\n * using.\n * @returns {string}\n */\n get baseUrl() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.__wbg_get_msc4388intentdata_baseUrl(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 ID of the rendezvous session, can be used to exchange messages with\n * the other device.\n * @returns {string}\n */\n get rendezvousId() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.__wbg_get_msc4388intentdata_rendezvousId(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 base URL of the homeserver that the device generating the QR is\n * using.\n * @param {string} arg0\n */\n set baseUrl(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_msc4388intentdata_baseUrl(this.__wbg_ptr, ptr0, len0);\n }\n /**\n * The ID of the rendezvous session, can be used to exchange messages with\n * the other device.\n * @param {string} arg0\n */\n set rendezvousId(arg0) {\n const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n wasm.__wbg_set_msc4388intentdata_rendezvousId(this.__wbg_ptr, ptr0, len0);\n }\n}\nif (Symbol.dispose) Msc4388IntentData.prototype[Symbol.dispose] = Msc4388IntentData.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 * 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<KeysBackupRequest | undefined>}\n */\n backupRoomKeys() {\n const ret = wasm.olmmachine_backupRoomKeys(this.__wbg_ptr);\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<CrossSigningBootstrapRequests>}\n */\n bootstrapCrossSigning(reset) {\n const ret = wasm.olmmachine_bootstrapCrossSigning(this.__wbg_ptr, reset);\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 * Store the fact that we are no longer waiting for a key bundle in the\n * given room.\n *\n * The counterpart to {@link storeRoomPendingKeyBundle}. Should be called\n * when, for example, we leave a room, or have successfully imported a\n * bundle.\n *\n * @experimental\n * @param {RoomId} room_id\n * @returns {Promise<void>}\n */\n clearRoomPendingKeyBundle(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_clearRoomPendingKeyBundle(this.__wbg_ptr, room_id.__wbg_ptr);\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 * 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<CrossSigningStatus>}\n */\n crossSigningStatus() {\n const ret = wasm.olmmachine_crossSigningStatus(this.__wbg_ptr);\n return ret;\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 * 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<DecryptedRoomEvent>}\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 * 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<void>}\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 * 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 * The unique device ID that identifies this `OlmMachine`.\n * @returns {DeviceId}\n */\n get deviceId() {\n const ret = wasm.olmmachine_deviceId(this.__wbg_ptr);\n return DeviceId.__wrap(ret);\n }\n /**\n * 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<void>}\n */\n disableBackup() {\n const ret = wasm.olmmachine_disableBackup(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get the display name of our own device.\n * @returns {Promise<string | undefined>}\n */\n get displayName() {\n const ret = wasm.olmmachine_displayName(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<void>}\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 * 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 * 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<string>}\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<string>}\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 * 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 `undefined` if we don’t have any private cross signing keys;\n * otherwise returns a `CrossSigningKeyExport`.\n * @returns {Promise<CrossSigningKeyExport | undefined>}\n */\n exportCrossSigningKeys() {\n const ret = wasm.olmmachine_exportCrossSigningKeys(this.__wbg_ptr);\n return ret;\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 {(session: InboundGroupSession) => boolean} predicate\n * @returns {Promise<string>}\n */\n exportRoomKeys(predicate) {\n const ret = wasm.olmmachine_exportRoomKeys(this.__wbg_ptr, predicate);\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 * Get a list of all rooms where we are waiting for a key bundle.\n *\n * @see getPendingKeyBundleDetailsForRoom\n *\n * @experimental\n * @returns {Promise<Array<RoomPendingKeyBundleDetails>>}\n */\n getAllRoomsPendingKeyBundles() {\n const ret = wasm.olmmachine_getAllRoomsPendingKeyBundles(this.__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<BackupKeys>}\n */\n getBackupKeys() {\n const ret = wasm.olmmachine_getBackupKeys(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get a specific device of a user.\n *\n * ### Parameters\n *\n * * `user_id` - The unique ID of the user that the device belongs to.\n *\n * * `device_id` - The unique ID of the device.\n *\n * * `timeout_secs` - The amount of time we should wait for a `/keys/query`\n * response before returning if the user's device list has been marked as\n * stale. **Note**, this assumes that the requests from {@link\n * OlmMachine.outgoingRequests} are being processed and sent out.\n *\n * If unset, we will return immediately even if the device list is stale.\n *\n * ### Returns\n *\n * If the device is known, a {@link Device}. Otherwise, `undefined`.\n * @param {UserId} user_id\n * @param {DeviceId} device_id\n * @param {number | null} [timeout_secs]\n * @returns {Promise<Device | undefined>}\n */\n getDevice(user_id, device_id, timeout_secs) {\n _assertClass(user_id, UserId);\n _assertClass(device_id, DeviceId);\n const ret = wasm.olmmachine_getDevice(this.__wbg_ptr, user_id.__wbg_ptr, device_id.__wbg_ptr, !isLikeNone(timeout_secs), isLikeNone(timeout_secs) ? 0 : timeout_secs);\n return ret;\n }\n /**\n * Get 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<OwnUserIdentity | OtherUserIdentity | undefined>}\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 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<KeysClaimRequest | null>}\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 * See if we have recently accepted an invitation to the given room.\n *\n * If we have accepted an invite to a room without finding an\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4268|MSC4268}\n * key bundle, we should accept a key bundle once one arrives.\n *\n * The data returned here is populated by the application, via {@link\n * storeRoomPendingKeyBundle}.\n *\n * @experimental\n * @param {RoomId} room_id\n * @returns {Promise<RoomPendingKeyBundleDetails | undefined>}\n */\n getPendingKeyBundleDetailsForRoom(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_getPendingKeyBundleDetailsForRoom(this.__wbg_ptr, room_id.__wbg_ptr);\n return ret;\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 * 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<EncryptionInfo>}\n */\n getRoomEventEncryptionInfo(event, room_id) {\n const ptr0 = passStringToWasm0(event, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_getRoomEventEncryptionInfo(this.__wbg_ptr, ptr0, len0, room_id.__wbg_ptr);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Get the 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 * 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<Set<string>>}\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 * 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<UserDevices>}\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 {Sas | Qr | undefined}\n */\n getVerification(user_id, flow_id) {\n _assertClass(user_id, UserId);\n const ptr0 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_getVerification(this.__wbg_ptr, user_id.__wbg_ptr, ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Get a verification request object with the given flow ID.\n * @param {UserId} user_id\n * @param {string} flow_id\n * @returns {VerificationRequest | undefined}\n */\n getVerificationRequest(user_id, flow_id) {\n _assertClass(user_id, UserId);\n const ptr0 = passStringToWasm0(flow_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_getVerificationRequest(this.__wbg_ptr, user_id.__wbg_ptr, ptr0, len0);\n return ret === 0 ? undefined : VerificationRequest.__wrap(ret);\n }\n /**\n * Get all the verification requests of a given user.\n * @param {UserId} user_id\n * @returns {VerificationRequest[]}\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 * Get whether we have previously downloaded all message keys for a\n * particular room from the key backup. Typically called in advance of\n * building a room key bundle.\n * @param {RoomId} room_id\n * @returns {Promise<boolean>}\n */\n hasDownloadedAllRoomKeys(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_hasDownloadedAllRoomKeys(this.__wbg_ptr, room_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 * 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<RoomId, Map<string, any>>} backed_up_room_keys\n * @param {(progress: bigint, total: bigint, failures: bigint) => void | undefined} progress_listener\n * @param {string} backup_version\n * @returns {Promise<RoomKeyImportResult>}\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 * 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<CrossSigningStatus>}\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 {(progress: bigint, total: bigint) => void} progress_listener\n * @returns {Promise<RoomKeyImportResult>}\n */\n importExportedRoomKeys(exported_room_keys, progress_listener) {\n const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_importExportedRoomKeys(this.__wbg_ptr, ptr0, len0, progress_listener);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Import the given room keys into our store.\n *\n * 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 {(imported: bigint, total: bigint) => void} progress_listener\n * @returns {Promise<string>}\n */\n importRoomKeys(exported_room_keys, progress_listener) {\n const ptr0 = passStringToWasm0(exported_room_keys, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_importRoomKeys(this.__wbg_ptr, ptr0, len0, progress_listener);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Import 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 * 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 {JsLogger} [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 * 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} [store_name]\n * @param {string} [store_passphrase]\n * @param {JsLogger} [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 * 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<boolean>}\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 * 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<boolean>`.\n * @returns {Promise<boolean>}\n */\n isBackupEnabled() {\n const ret = wasm.olmmachine_isBackupEnabled(this.__wbg_ptr);\n return ret;\n }\n /**\n * Mark all tracked users as dirty.\n *\n * All users *whose device lists we are tracking* are flagged as needing a\n * key query. Users whose devices we are not tracking are ignored.\n * @returns {Promise<void>}\n */\n markAllTrackedUsersAsDirty() {\n const ret = wasm.olmmachine_markAllTrackedUsersAsDirty(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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<true>}\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 * 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 * 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<OutgoingRequest[]>}\n */\n outgoingRequests() {\n const ret = wasm.olmmachine_outgoingRequests(this.__wbg_ptr);\n return ret;\n }\n /**\n * Push a secret to all of our other verified devices\n *\n * This function assumes that we already have Olm sessions with the other\n * devices. This can be done by calling {@link\n * OlmMachine.getMissingSessions}.\n *\n * # Arguments\n *\n * * `secret_name` - The name of the secret to push.\n * @param {string} name\n * @returns {Promise<any>}\n */\n pushSecretToVerifiedDevices(name) {\n const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_pushSecretToVerifiedDevices(this.__wbg_ptr, ptr0, len0);\n return ret;\n }\n /**\n * Generate an \"out-of-band\" key query request for the given set of users.\n *\n * This can be useful if we need the results from `getIdentity` or\n * `getUserDevices` to be as up-to-date as possible.\n *\n * Returns a `KeysQueryRequest` object. The response of the request should\n * be passed to the `OlmMachine` with the `mark_request_as_sent`.\n *\n * Items inside `users` will be invalidated by this method. Be careful not\n * to use the `UserId`s after this method has been called.\n * @param {UserId[]} users\n * @returns {KeysQueryRequest}\n */\n queryKeysForUsers(users) {\n const ptr0 = passArrayJsValueToWasm0(users, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.olmmachine_queryKeysForUsers(this.__wbg_ptr, ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return KeysQueryRequest.__wrap(ret[0]);\n }\n /**\n * 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 * 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<string, number>} one_time_keys_counts\n * @param {Set<string>} [unused_fallback_keys]\n * @param {DecryptionSettings} [decryption_settings]\n * @returns {Promise<ProcessedToDeviceEvent[]>}\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 * 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<void>}\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 * 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 {(userIds: string[]) => Promise<void>} callback\n */\n registerDevicesUpdatedCallback(callback) {\n wasm.olmmachine_registerDevicesUpdatedCallback(this.__wbg_ptr, callback);\n }\n /**\n * Register a callback which will be called whenever a secret\n * (`m.secret.send`) is received.\n *\n * The only secret this will currently broadcast is the\n * `m.megolm_backup.v1` (the cross signing secrets are handled internally).\n *\n * To request a secret from other devices, a client sends an\n * `m.secret.request` device event with `action` set to `request` and\n * `name` set to the identifier of the secret. A device that wishes to\n * share the secret will reply with an `m.secret.send` event, encrypted\n * using olm.\n *\n * The secrets are guaranteed to have been received over a 1-to-1 encrypted\n * to_device message from a one of the user's own verified devices.\n *\n * See https://matrix-org.github.io/matrix-rust-sdk/matrix_sdk_crypto/store/struct.Store.html#method.secrets_stream for more information.\n *\n * `callback` should be a function that takes 2 arguments: the secret name\n * (string) and value (string).\n *\n * **Note**: if the secret is valid and handled on the javascript side, the\n * secret inbox should be cleared by calling\n * `delete_secrets_from_inbox`.\n * @param {(name: string, value: string) => Promise<void>} callback\n */\n registerReceiveSecretCallback(callback) {\n wasm.olmmachine_registerReceiveSecretCallback(this.__wbg_ptr, callback);\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 {(info: RoomKeyInfo[]) => Promise<void>} 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 {(info: RoomKeyWithheldInfo[]) => Promise<void>} 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 {(id: UserId) => Promise<void>} callback\n */\n registerUserIdentityUpdatedCallback(callback) {\n wasm.olmmachine_registerUserIdentityUpdatedCallback(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<boolean>}\n */\n requestMissingSecretsIfNeeded() {\n const ret = wasm.olmmachine_requestMissingSecretsIfNeeded(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get the number of backed up room keys and the total number of room keys.\n * Returns a {@link RoomKeyCounts}.\n * @returns {Promise<RoomKeyCounts>}\n */\n roomKeyCounts() {\n const ret = wasm.olmmachine_roomKeyCounts(this.__wbg_ptr);\n return ret;\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 * 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 * 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<void>}\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 * Record that we have downloaded all message keys for the given room.\n * @param {RoomId} room_id\n * @returns {Promise<void>}\n */\n setHasDownloadedAllRoomKeys(room_id) {\n _assertClass(room_id, RoomId);\n const ret = wasm.olmmachine_setHasDownloadedAllRoomKeys(this.__wbg_ptr, room_id.__wbg_ptr);\n return ret;\n }\n /**\n * Store encryption settings for the given room.\n *\n * This method checks if the new settings are \"safe\" -- ie, that they do\n * not represent a downgrade in encryption security from any previous\n * settings. Attempts to downgrade security will result in an error.\n *\n * If the settings are valid, they will be persisted to the crypto store.\n * These settings are not used directly by this library, but the saved\n * settings can be retrieved via {@link getRoomSettings}.\n * @param {RoomId} room_id\n * @param {RoomSettings} room_settings\n * @returns {Promise<void>}\n */\n setRoomSettings(room_id, room_settings) {\n _assertClass(room_id, RoomId);\n _assertClass(room_settings, RoomSettings);\n const ret = wasm.olmmachine_setRoomSettings(this.__wbg_ptr, room_id.__wbg_ptr, room_settings.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * 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 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<ToDeviceRequest[]>}\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 * 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 * Sign the given message using our device key and if available\n * cross-signing master key.\n * @param {string} message\n * @returns {Promise<Signatures>}\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 * Store the fact that we have accepted an invitation to the given room, so\n * should accept a key bundle if one arrives soon.\n *\n * This should be called whenever we join a room following an invite, but\n * it has no effect other than that the room will be returned by a future\n * call to {@link getPendingKeyBundleDetailsForRoom}.\n *\n * @experimental\n * @param {RoomId} room_id\n * @param {UserId} inviter\n * @returns {Promise<void>}\n */\n storeRoomPendingKeyBundle(room_id, inviter) {\n _assertClass(room_id, RoomId);\n _assertClass(inviter, UserId);\n const ret = wasm.olmmachine_storeRoomPendingKeyBundle(this.__wbg_ptr, room_id.__wbg_ptr, inviter.__wbg_ptr);\n return 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<Set<UserId>>}\n */\n trackedUsers() {\n const ret = wasm.olmmachine_trackedUsers(this.__wbg_ptr);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * Update the list of tracked users.\n *\n * The OlmMachine maintains a list of users whose devices we are keeping\n * track of: these are known as \"tracked users\". These must be users\n * that we share a room with, so that the server sends us updates for\n * their device lists.\n *\n * # Arguments\n *\n * * `users` - An array of user ids that should be added to the list of\n * tracked users\n *\n * Any users that hadn't been seen before will be flagged for a key query\n * immediately, and whenever `receive_sync_changes` receives a\n * \"changed\" notification for that user in the future.\n *\n * Users that were already in the list are unaffected.\n *\n * Items inside `users` will be invalidated by this method. Be careful not\n * to use the `UserId`s after this method has been called.\n * @param {UserId[]} users\n * @returns {Promise<void>}\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 * 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 * 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<SignatureVerification>}\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}\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 * 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 * 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 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 * Pin the current identity (public part of the master signing key).\n * @returns {Promise<void>}\n */\n pinCurrentMasterKey() {\n const ret = wasm.otheruseridentity_pinCurrentMasterKey(this.__wbg_ptr);\n return ret;\n }\n /**\n * Create a `VerificationRequest` object after the verification\n * request content has been sent out.\n * @param {RoomId} room_id\n * @param {EventId} request_event_id\n * @param {VerificationMethod[]} [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 * 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 * 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 {VerificationMethod[]} [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<SignatureUploadRequest>}\n */\n verify() {\n const ret = wasm.otheruseridentity_verify(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 * 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<void>}\n */\n withdrawVerification() {\n const ret = wasm.otheruseridentity_withdrawVerification(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_outboundcreationresult_channel(this.__wbg_ptr);\n return EstablishedEcies.__wrap(ret);\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 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_outboundcreationresult_channel(this.__wbg_ptr, ptr0);\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_outboundcreationresult_initial_message(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 * 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 * 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 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 * Send a verification request to our other devices.\n * @param {VerificationMethod[]} [methods]\n * @returns {Promise<[VerificationRequest, OutgoingVerificationRequest]>}\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 * 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 * 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<boolean>}\n */\n trustsOurOwnDevice() {\n const ret = wasm.ownuseridentity_trustsOurOwnDevice(this.__wbg_ptr);\n return ret;\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 * 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<SignatureUploadRequest>}\n */\n verify() {\n const ret = wasm.ownuseridentity_verify(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 * 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<void>}\n */\n withdrawVerification() {\n const ret = wasm.ownuseridentity_withdrawVerification(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 * 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 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 * 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 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 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 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 * Construct a new `PickledInboundGroupSession`, with default values.\n */\n constructor() {\n const ret = wasm.pickledinboundgroupsession_new();\n this.__wbg_ptr = ret >>> 0;\n PickledInboundGroupSessionFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * 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 * 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 * 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_pickledinboundgroupsession_pickle(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 * @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 * 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_pickledinboundgroupsession_senderKey(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 * @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_pickledinboundgroupsession_senderSigningKey(this.__wbg_ptr, ptr0, len0);\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 * 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 * 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 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 * 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 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 * 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 * 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 * @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 * @param {Date} arg0\n */\n set lastUseTime(arg0) {\n wasm.__wbg_set_pickledsession_lastUseTime(this.__wbg_ptr, arg0);\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_pickledsession_pickle(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 * @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_pickledsession_senderKey(this.__wbg_ptr, ptr0, len0);\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 * 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 * 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 `PkDecryption` instance from a secret key.\n * @param {Curve25519SecretKey} key\n * @returns {PkDecryption}\n */\n static fromKey(key) {\n _assertClass(key, Curve25519SecretKey);\n const ret = wasm.pkdecryption_fromKey(key.__wbg_ptr);\n return PkDecryption.__wrap(ret);\n }\n /**\n * 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 * 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}\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 byte message and returns an encrypted {@link PkMessage}.\n * @param {Uint8Array} message\n * @returns {PkMessage}\n */\n encrypt(message) {\n const ptr0 = passArray8ToWasm0(message, wasm.__wbindgen_malloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.pkencryption_encrypt(this.__wbg_ptr, ptr0, len0);\n return PkMessage.__wrap(ret);\n }\n /**\n * Encrypts a string message and returns an encrypted {@link PkMessage}.\n * @param {string} message\n * @returns {PkMessage}\n */\n encryptString(message) {\n const ptr0 = passStringToWasm0(message, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.pkencryption_encryptString(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 * Returns the ephemeral public key used during encryption.\n * @returns {Curve25519PublicKey}\n */\n ephemeralKey() {\n const ret = wasm.pkmessage_ephemeralKey(this.__wbg_ptr);\n return Curve25519PublicKey.__wrap(ret);\n }\n /**\n * Constructs a `PkMessage` from 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 * 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 * 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 * Cancel the verification flow.\n *\n * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @returns {OutgoingVerificationRequest | undefined}\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 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 * Cancel the verification.\n *\n * This cancels the verification with given code (e.g. `m.user`).\n *\n * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @param {string} code\n * @returns {OutgoingVerificationRequest | undefined}\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 `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already confirmed.\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 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 * 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 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 * 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 * 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 * 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 * 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 * 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 {OutgoingVerificationRequest | undefined}\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 * 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 * 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 {() => Promise<void>} callback\n */\n registerChangesCallback(callback) {\n wasm.qr_registerChangesCallback(this.__wbg_ptr, callback);\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 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 * Generate a the raw bytes that should be encoded as a QR code\n * is representing this verification flow.\n *\n * The `to_qr_code` method can be used to instead output a QrCode\n * object that can be rendered.\n * @returns {Uint8ClampedArray}\n */\n toBytes() {\n const ret = wasm.qr_toBytes(this.__wbg_ptr);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return takeFromExternrefTable0(ret[0]);\n }\n /**\n * 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 * 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 * 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}\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 *\n * This type supports both the format originally speicied in\n * {link https://github.com/matrix-org/matrix-spec-proposals/pull/4108 MSC4108} as well as the\n * updated format found in\n * {link https://github.com/matrix-org/matrix-spec-proposals/pull/4388 MSC4388}.\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 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 * 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 intent-specific data embedded in the {@link QrCodeData}.\n * @returns {QrCodeIntentData}\n */\n get intentData() {\n const ret = wasm.qrcodedata_intentData(this.__wbg_ptr);\n return QrCodeIntentData.__wrap(ret);\n }\n /**\n * Get the mode of this {@link QrCodeData} instance.\n * @returns {QrCodeIntent}\n */\n get mode() {\n const ret = wasm.qrcodedata_mode(this.__wbg_ptr);\n return ret;\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 QrCodeIntent.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 QrCodeIntent.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 * Create new {@link QrCodeData} from a given public key, a rendezvous ID\n * and, a base homeserver URL.\n *\n * This creates a QR code which conforms to\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/4388 MSC4388} of the data\n * format for QR login.\n * @param {Curve25519PublicKey} public_key\n * @param {string} rendezvous_id\n * @param {string} base_url\n * @param {QrCodeIntent} intent\n * @returns {QrCodeData}\n */\n static newMsc4388(public_key, rendezvous_id, base_url, intent) {\n _assertClass(public_key, Curve25519PublicKey);\n var ptr0 = public_key.__destroy_into_raw();\n const ptr1 = passStringToWasm0(rendezvous_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(base_url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len2 = WASM_VECTOR_LEN;\n const ret = wasm.qrcodedata_newMsc4388(ptr0, ptr1, len1, ptr2, len2, intent);\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 * [HPKE](https://www.rfc-editor.org/rfc/rfc9180.html)\n * (Hybrid Public Key Encryption) channel with the other device.\n * @returns {Curve25519PublicKey}\n */\n get publicKey() {\n const ret = wasm.qrcodedata_publicKey(this.__wbg_ptr);\n return Curve25519PublicKey.__wrap(ret);\n }\n /**\n * Get the URL of the rendezvous server which will be used to exchange\n * messages between the two devices.\n * @returns {string | undefined}\n */\n get rendezvousUrl() {\n const ret = wasm.qrcodedata_rendezvousUrl(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 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 * Encode the {@link QrCodeData} into a string using base64.\n *\n * This format can be used for debugging purposes and the\n * [`QrcodeData::from_base64()`] method can be used to parse the string\n * again.\n * @returns {string}\n */\n toBase64() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.qrcodedata_toBase64(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * 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}\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 QrCodeIntent = 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 * Intent and MSC-specific data class for the QR code login support.\n */\nexport class QrCodeIntentData {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(QrCodeIntentData.prototype);\n obj.__wbg_ptr = ptr;\n QrCodeIntentDataFinalization.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 QrCodeIntentDataFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_qrcodeintentdata_free(ptr, 0);\n }\n /**\n * The MSC4108-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4108. Otherwise it will contain\n * MSC4388-specific intent data.\n * @returns {Msc4108IntentData | undefined}\n */\n get msc4108() {\n const ret = wasm.__wbg_get_qrcodeintentdata_msc4108(this.__wbg_ptr);\n return ret === 0 ? undefined : Msc4108IntentData.__wrap(ret);\n }\n /**\n * The MSC4833-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4388. Otherwise it will contain\n * MSC4108-specific intent data.\n * @returns {Msc4388IntentData | undefined}\n */\n get msc4388() {\n const ret = wasm.__wbg_get_qrcodeintentdata_msc4388(this.__wbg_ptr);\n return ret === 0 ? undefined : Msc4388IntentData.__wrap(ret);\n }\n /**\n * The MSC4108-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4108. Otherwise it will contain\n * MSC4388-specific intent data.\n * @param {Msc4108IntentData | null} [arg0]\n */\n set msc4108(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Msc4108IntentData);\n ptr0 = arg0.__destroy_into_raw();\n }\n wasm.__wbg_set_qrcodeintentdata_msc4108(this.__wbg_ptr, ptr0);\n }\n /**\n * The MSC4833-specific intent data.\n *\n * This will not be `null` only if the {@link QrCodeData} contains data as\n * specified in the QR code format of MSC4388. Otherwise it will contain\n * MSC4108-specific intent data.\n * @param {Msc4388IntentData | null} [arg0]\n */\n set msc4388(arg0) {\n let ptr0 = 0;\n if (!isLikeNone(arg0)) {\n _assertClass(arg0, Msc4388IntentData);\n ptr0 = arg0.__destroy_into_raw();\n }\n wasm.__wbg_set_qrcodeintentdata_msc4388(this.__wbg_ptr, ptr0);\n }\n}\nif (Symbol.dispose) QrCodeIntentData.prototype[Symbol.dispose] = QrCodeIntentData.prototype.free;\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<RoomKeyInfo[]>}\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 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 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 number of backed up room keys.\n * @param {number} arg0\n */\n set backedUp(arg0) {\n wasm.__wbg_set_roomkeycounts_backedUp(this.__wbg_ptr, arg0);\n }\n /**\n * 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}\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 number of room keys that were imported.\n * @returns {number}\n */\n get importedCount() {\n const ret = wasm.__wbg_get_roomkeyimportresult_importedCount(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * The total number of room keys that were found in the export.\n * @returns {number}\n */\n get totalCount() {\n const ret = wasm.__wbg_get_roomkeyimportresult_totalCount(this.__wbg_ptr);\n return ret >>> 0;\n }\n /**\n * The keys that were imported.\n *\n * A Map from room id to a Map of the sender key to a Set of session ids.\n *\n * Typescript type: `Map<string, Map<string, Set<string>>`.\n * @returns {Map<string, Map<string, Set<string>>>}\n */\n keys() {\n const ret = wasm.roomkeyimportresult_keys(this.__wbg_ptr);\n return ret;\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 {@link EncryptionAlgorithm} that this key is used for. Will be one\n * of the `m.megolm.*` algorithms.\n * @returns {EncryptionAlgorithm}\n */\n get algorithm() {\n const ret = wasm.roomkeyinfo_algorithm(this.__wbg_ptr);\n return ret;\n }\n /**\n * The room where the key is used.\n * @returns {RoomId}\n */\n get roomId() {\n const ret = wasm.roomkeyinfo_roomId(this.__wbg_ptr);\n return RoomId.__wrap(ret);\n }\n /**\n * The Curve25519 key of the device which initiated the session originally.\n * @returns {Curve25519PublicKey}\n */\n get senderKey() {\n const ret = wasm.roomkeyinfo_senderKey(this.__wbg_ptr);\n return Curve25519PublicKey.__wrap(ret);\n }\n /**\n * The ID of the session that the key is for.\n * @returns {string}\n */\n get sessionId() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.roomkeyinfo_sessionId(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n}\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 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 /**\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 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 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}\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 * A JSON-encoded object containing the message's content.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_roommessagerequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * 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 * Create a new `RoomMessageRequest`.\n * @param {string} id\n * @param {string} room_id\n * @param {string} txn_id\n * @param {string} event_type\n * @param {string} content\n */\n constructor(id, room_id, txn_id, event_type, content) {\n const ret = wasm.roommessagerequest_new(id, room_id, txn_id, event_type, content);\n this.__wbg_ptr = ret >>> 0;\n RoomMessageRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.roommessagerequest_type(this.__wbg_ptr);\n return ret;\n }\n}\nif (Symbol.dispose) RoomMessageRequest.prototype[Symbol.dispose] = RoomMessageRequest.prototype.free;\n\n/**\n * Information on a room which is waiting for a key bundle to arrive.\n */\nexport class RoomPendingKeyBundleDetails {\n static __wrap(ptr) {\n ptr = ptr >>> 0;\n const obj = Object.create(RoomPendingKeyBundleDetails.prototype);\n obj.__wbg_ptr = ptr;\n RoomPendingKeyBundleDetailsFinalization.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 RoomPendingKeyBundleDetailsFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_roompendingkeybundledetails_free(ptr, 0);\n }\n /**\n * The time that the invite was accepted.\n * @returns {number}\n */\n get inviteAcceptedAtMillis() {\n const ret = wasm.roompendingkeybundledetails_inviteAcceptedAtMillis(this.__wbg_ptr);\n return ret;\n }\n /**\n * The ID of the user that invited us\n * @returns {UserId}\n */\n get inviterId() {\n const ret = wasm.roompendingkeybundledetails_inviterId(this.__wbg_ptr);\n return UserId.__wrap(ret);\n }\n /**\n * The room that is waiting for a key bundle.\n * @returns {RoomId}\n */\n get roomId() {\n const ret = wasm.roompendingkeybundledetails_roomId(this.__wbg_ptr);\n return RoomId.__wrap(ret);\n }\n}\nif (Symbol.dispose) RoomPendingKeyBundleDetails.prototype[Symbol.dispose] = RoomPendingKeyBundleDetails.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 * 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 * 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 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 * 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 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 * 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 * @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 * @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 * @param {boolean} arg0\n */\n set onlyAllowTrustedDevices(arg0) {\n wasm.__wbg_set_roomsettings_onlyAllowTrustedDevices(this.__wbg_ptr, arg0);\n }\n /**\n * The maximum number of messages an encryption session should be used for,\n * before it is rotated.\n * @param {number | null} [arg0]\n */\n set sessionRotationPeriodMessages(arg0) {\n wasm.__wbg_set_roomsettings_sessionRotationPeriodMessages(this.__wbg_ptr, !isLikeNone(arg0), isLikeNone(arg0) ? 0 : arg0);\n }\n /**\n * 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}\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 * Accept the SAS verification.\n *\n * This does nothing (and returns `undefined`) if the verification was\n * already accepted, otherwise it returns an `OutgoingVerificationRequest`\n * that needs to be sent out.\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 * Cancel the verification.\n *\n * This cancels the verification with given code (e.g. `m.user`).\n *\n * Returns either an `OutgoingVerificationRequest` which should be sent\n * out, or `undefined` if the verification is already cancelled.\n * @param {string} code\n * @returns {OutgoingVerificationRequest | undefined}\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 * 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 `OutgoingVerificationRequest`s.\n * @returns {Promise<OutgoingVerificationRequest[]>}\n */\n confirm() {\n const ret = wasm.sas_confirm(this.__wbg_ptr);\n return 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 * Get the emoji version of the short auth string.\n *\n * Returns `undefined` if we can't yet present the short auth string,\n * otherwise an array of seven `Emoji` objects.\n * @returns {Emoji[] | undefined}\n */\n emoji() {\n const ret = wasm.sas_emoji(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);\n }\n return v1;\n }\n /**\n * Get the index of the emoji representing the short auth string\n *\n * Returns `undefined` if we can’t yet present the short auth\n * string, otherwise seven `u8` numbers in the range from 0 to 63\n * inclusive which can be converted to an emoji using [the\n * relevant specification\n * entry](https://spec.matrix.org/unstable/client-server-api/#sas-method-emoji).\n * @returns {Uint8Array | undefined}\n */\n emojiIndex() {\n const ret = wasm.sas_emojiIndex(this.__wbg_ptr);\n let v1;\n if (ret[0] !== 0) {\n v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();\n wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);\n }\n return v1;\n }\n /**\n * Get the 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 * 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 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 * Is the SAS flow done?\n * @returns {boolean}\n */\n isDone() {\n const ret = wasm.sas_isDone(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is 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 * Get the device ID of the other side.\n * @returns {DeviceId}\n */\n get otherDeviceId() {\n const ret = wasm.sas_otherDeviceId(this.__wbg_ptr);\n return DeviceId.__wrap(ret);\n }\n /**\n * Get the 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 * 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 {() => Promise<void>} callback\n */\n registerChangesCallback(callback) {\n wasm.sas_registerChangesCallback(this.__wbg_ptr, callback);\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 * 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 * 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 * Has the SAS verification flow timed out?\n * @returns {boolean}\n */\n timedOut() {\n const ret = wasm.sas_timedOut(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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 * 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}\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 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 * Deserialize the [`SecretsBundle`] from a JSON object.\n * @param {unknown} json\n * @returns {SecretsBundle}\n */\n static from_json(json) {\n const ret = wasm.secretsbundle_from_json(json);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n return SecretsBundle.__wrap(ret[0]);\n }\n /**\n * The seed of the master key encoded as unpadded base64.\n * @returns {string}\n */\n get masterKey() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.secretsbundle_masterKey(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * The seed of the self signing key encoded as unpadded base64.\n * @returns {string}\n */\n get selfSigningKey() {\n let deferred1_0;\n let deferred1_1;\n try {\n const ret = wasm.secretsbundle_selfSigningKey(this.__wbg_ptr);\n deferred1_0 = ret[0];\n deferred1_1 = ret[1];\n return getStringFromWasm0(ret[0], ret[1]);\n } finally {\n wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);\n }\n }\n /**\n * Serialize the [`SecretsBundle`] to a JSON object.\n * @returns {unknown}\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 * 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}\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 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 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 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 * 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 * 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 * 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 /**\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 * 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}\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 * 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 * 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 * Create a new `SignatureUploadRequest`.\n * @param {string} id\n * @param {string} signed_keys\n */\n constructor(id, signed_keys) {\n const ret = wasm.signatureuploadrequest_new(id, signed_keys);\n this.__wbg_ptr = ret >>> 0;\n SignatureUploadRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.signatureuploadrequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 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 /**\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}\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 * 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 * 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 map of signatures that belong to the given user.\n * @param {UserId} signer\n * @returns {Map<string, MaybeSignature> | 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 * 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 * Do we hold any signatures or is our collection completely\n * empty.\n * @returns {boolean}\n */\n isEmpty() {\n const ret = wasm.signatures_isEmpty(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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}\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 | undefined} store_name\n * @param {string | null | undefined} store_passphrase\n * @param {JsLogger} [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 {JsLogger} [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 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 room that these keys are for.\n * @returns {RoomId}\n */\n get roomId() {\n const ret = wasm.storedroomkeybundledata_roomId(this.__wbg_ptr);\n return RoomId.__wrap(ret);\n }\n /**\n * The 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 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}\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 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 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 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_todeviceencryptioninfo_senderCurve25519Key(this.__wbg_ptr, ptr0, len0);\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 * 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 * 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 * A JSON-encoded object containing the rest of the payload: `messages`.\n *\n * It represents the body of the HTTP request.\n * @returns {string}\n */\n get body() {\n const ret = wasm.__wbg_get_todevicerequest_body(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 * 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 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 * Create a new `ToDeviceRequest`.\n * @param {string} id\n * @param {string} event_type\n * @param {string} txn_id\n * @param {string} body\n */\n constructor(id, event_type, txn_id, body) {\n const ret = wasm.todevicerequest_new(id, event_type, txn_id, body);\n this.__wbg_ptr = ret >>> 0;\n ToDeviceRequestFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Get its request type.\n * @returns {RequestType}\n */\n get type() {\n const ret = wasm.todevicerequest_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * Re-define the minimum logger level.\n * @param {LoggerLevel} min_level\n */\n set minLevel(min_level) {\n const ret = wasm.tracing_set_minLevel(this.__wbg_ptr, min_level);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n }\n /**\n * Turn the logger 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 * 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}\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 original message (of type `m.room.encrypted`) that failed to be\n * decrypted, encoded as JSON.\n * @returns {string}\n */\n get rawEvent() {\n const ret = wasm.__wbg_get_utdtodeviceevent_rawEvent(this.__wbg_ptr);\n return ret;\n }\n /**\n * Information on the reason we failed to decrypt\n * @returns {ToDeviceUnableToDecryptInfo}\n */\n get utdInfo() {\n const ret = wasm.__wbg_get_utdtodeviceevent_utdInfo(this.__wbg_ptr);\n return ToDeviceUnableToDecryptInfo.__wrap(ret);\n }\n /**\n * The type of processed to-device event. Always {@link\n * ProcessedToDeviceEventType.UnableToDecrypt} for this type.\n * @returns {ProcessedToDeviceEventType}\n */\n get type() {\n const ret = wasm.utdtodeviceevent_type(this.__wbg_ptr);\n return ret;\n }\n}\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 * Iterator over all the devices of the user devices.\n * @returns {Device[]}\n */\n devices() {\n const ret = wasm.userdevices_devices(this.__wbg_ptr);\n return ret;\n }\n /**\n * Get the specific device with the given device ID.\n * @param {DeviceId} device_id\n * @returns {Device | undefined}\n */\n get(device_id) {\n _assertClass(device_id, DeviceId);\n const ret = wasm.userdevices_get(this.__wbg_ptr, device_id.__wbg_ptr);\n return ret === 0 ? undefined : Device.__wrap(ret);\n }\n /**\n * Returns true if there is at least one devices of this user\n * that is considered to be verified, false otherwise.\n *\n * This won't consider your own device as verified, as your own\n * device is always implicitly verified.\n * @returns {boolean}\n */\n isAnyVerified() {\n const ret = wasm.userdevices_isAnyVerified(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Array over all the device IDs of the user devices.\n * @returns {DeviceId[]}\n */\n keys() {\n const ret = wasm.userdevices_keys(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 * 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 * 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 * 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 * Parse/validate and create a new `UserId`.\n * @param {string} id\n */\n constructor(id) {\n const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);\n const len0 = WASM_VECTOR_LEN;\n const ret = wasm.userid_new(ptr0, len0);\n if (ret[2]) {\n throw takeFromExternrefTable0(ret[1]);\n }\n this.__wbg_ptr = ret[0] >>> 0;\n UserIdFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n /**\n * Returns the 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 * 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 * 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 {OutgoingVerificationRequest | undefined}\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 * 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 {VerificationMethod[]} methods\n * @returns {OutgoingVerificationRequest | undefined}\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 * Cancel the verification request.\n *\n * It returns either a `ToDeviceRequest`, a `RoomMessageRequest`\n * or `undefined`.\n * @returns {OutgoingVerificationRequest | undefined}\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 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 * 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 * 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<Qr | undefined>}\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 {Sas | Qr | undefined}\n */\n getVerification() {\n const ret = wasm.verificationrequest_getVerification(this.__wbg_ptr);\n return 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 * 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 * Has the verification request been answered by another device?\n * @returns {boolean}\n */\n isPassive() {\n const ret = wasm.verificationrequest_isPassive(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * Is the verification request ready to start a verification flow?\n * @returns {boolean}\n */\n isReady() {\n const ret = wasm.verificationrequest_isReady(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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 * 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 * 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 * 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 {VerificationMethod[] | 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 * 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 * 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 * 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 {() => Promise<void>} callback\n */\n registerChangesCallback(callback) {\n wasm.verificationrequest_registerChangesCallback(this.__wbg_ptr, callback);\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 {VerificationMethod[]} [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 * Start a QR code verification by providing a scanned QR code\n * for this verification flow.\n * @param {QrCodeScan} data\n * @returns {Promise<Qr>}\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 * Transition from this verification request into a SAS verification flow.\n *\n * Returns `Promise<[Sas, OutgoingVerificationRequest] | undefined>`\n * @returns {Promise<[Sas, OutgoingVerificationRequest] | undefined>}\n */\n startSas() {\n const ret = wasm.verificationrequest_startSas(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 {VerificationMethod[] | 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 * 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 * Has the verification flow timed out?\n * @returns {boolean}\n */\n timedOut() {\n const ret = wasm.verificationrequest_timedOut(this.__wbg_ptr);\n return ret !== 0;\n }\n /**\n * 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}\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 build-time output of the `git describe` command of the source tree\n * of crate.\n * @returns {string}\n */\n get git_description() {\n const ret = wasm.__wbg_get_versions_git_description(this.__wbg_ptr);\n return ret;\n }\n /**\n * 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 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 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}\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}\nexport function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return ret;\n}\nexport function __wbg_Number_32bf70a599af1d4b(arg0) {\n const ret = Number(arg0);\n return ret;\n}\nexport function __wbg_String_8564e559799eccda(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}\nexport function __wbg_Window_241244be8c9776c1(arg0) {\n const ret = arg0.Window;\n return ret;\n}\nexport function __wbg_WorkerGlobalScope_8623a7c9030fbce2(arg0) {\n const ret = arg0.WorkerGlobalScope;\n return ret;\n}\nexport function __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51(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}\nexport function __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff(arg0) {\n const v = arg0;\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n}\nexport function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(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}\nexport function __wbg___wbindgen_in_a5d8b22e52b24dd1(arg0, arg1) {\n const ret = arg0 in arg1;\n return ret;\n}\nexport function __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93(arg0) {\n const ret = typeof(arg0) === 'bigint';\n return ret;\n}\nexport function __wbg___wbindgen_is_function_3baa9db1a987f47d(arg0) {\n const ret = typeof(arg0) === 'function';\n return ret;\n}\nexport function __wbg___wbindgen_is_null_52ff4ec04186736f(arg0) {\n const ret = arg0 === null;\n return ret;\n}\nexport function __wbg___wbindgen_is_object_63322ec0cd6ea4ef(arg0) {\n const val = arg0;\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n}\nexport function __wbg___wbindgen_is_string_6df3bf7ef1164ed3(arg0) {\n const ret = typeof(arg0) === 'string';\n return ret;\n}\nexport function __wbg___wbindgen_is_undefined_29a43b4d42920abd(arg0) {\n const ret = arg0 === undefined;\n return ret;\n}\nexport function __wbg___wbindgen_jsval_eq_d3465d8a07697228(arg0, arg1) {\n const ret = arg0 === arg1;\n return ret;\n}\nexport function __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c(arg0, arg1) {\n const ret = arg0 == arg1;\n return ret;\n}\nexport function __wbg___wbindgen_number_get_c7f42aed0525c451(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}\nexport function __wbg___wbindgen_string_get_7ed5322991caaec5(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}\nexport function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n}\nexport function __wbg___wbindgen_try_into_number_d7832e9de41bafc5(arg0) {\n let result;\n try { result = +arg0 } catch (e) { result = e }\n const ret = result;\n return ret;\n}\nexport function __wbg__wbg_cb_unref_b46c9b5a9f08ec37(arg0) {\n arg0._wbg_cb_unref();\n}\nexport function __wbg_abort_b64b5c37b7b5156d() { return handleError(function (arg0) {\n arg0.abort();\n}, arguments); }\nexport function __wbg_add_af6966918740a569(arg0, arg1) {\n const ret = arg0.add(arg1);\n return ret;\n}\nexport function __wbg_add_e04fd556bc38ef11() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.add(arg1, arg2);\n return ret;\n}, arguments); }\nexport function __wbg_at_03a250b9f2ce7aa5(arg0, arg1) {\n const ret = arg0.at(arg1);\n return ret;\n}\nexport function __wbg_backupkeys_new(arg0) {\n const ret = BackupKeys.__wrap(arg0);\n return ret;\n}\nexport function __wbg_bound_d976f60d9eb7b26b() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = IDBKeyRange.bound(arg0, arg1, arg2 !== 0, arg3 !== 0);\n return ret;\n}, arguments); }\nexport function __wbg_call_14b169f759b26747() { return handleError(function (arg0, arg1) {\n const ret = arg0.call(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_call_86e39d65afc3d9db() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n const ret = arg0.call(arg1, arg2, arg3, arg4);\n return ret;\n}, arguments); }\nexport function __wbg_call_a24592a6f349a97e() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.call(arg1, arg2);\n return ret;\n}, arguments); }\nexport function __wbg_call_bb28efe6b2f55b86() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.call(arg1, arg2, arg3);\n return ret;\n}, arguments); }\nexport function __wbg_clearTimeout_113b1cde814ec762(arg0) {\n const ret = clearTimeout(arg0);\n return ret;\n}\nexport function __wbg_clear_e20ff80e7eda7707() { return handleError(function (arg0) {\n const ret = arg0.clear();\n return ret;\n}, arguments); }\nexport function __wbg_close_a7d2c11ae747c112(arg0) {\n arg0.close();\n}\nexport function __wbg_code_e2d14bb68011f972(arg0) {\n const ret = arg0.code;\n return ret;\n}\nexport function __wbg_commit_ebd6d9676954e0d2() { return handleError(function (arg0) {\n arg0.commit();\n}, arguments); }\nexport function __wbg_continue_8576ea85aa470fb3() { return handleError(function (arg0) {\n arg0.continue();\n}, arguments); }\nexport function __wbg_count_9fc90fc071a17693() { return handleError(function (arg0) {\n const ret = arg0.count();\n return ret;\n}, arguments); }\nexport function __wbg_count_b3e4ca49e145e073() { return handleError(function (arg0) {\n const ret = arg0.count();\n return ret;\n}, arguments); }\nexport function __wbg_createIndex_b7dc3a4f19fc4231() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {\n const ret = arg0.createIndex(getStringFromWasm0(arg1, arg2), arg3, arg4);\n return ret;\n}, arguments); }\nexport function __wbg_createIndex_b9253d2f61b19445() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.createIndex(getStringFromWasm0(arg1, arg2), arg3);\n return ret;\n}, arguments); }\nexport function __wbg_createObjectStore_fda2c8d772b080f5() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.createObjectStore(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_crosssigningbootstraprequests_new(arg0) {\n const ret = CrossSigningBootstrapRequests.__wrap(arg0);\n return ret;\n}\nexport function __wbg_crosssigningkeyexport_new(arg0) {\n const ret = CrossSigningKeyExport.__wrap(arg0);\n return ret;\n}\nexport function __wbg_crosssigningstatus_new(arg0) {\n const ret = CrossSigningStatus.__wrap(arg0);\n return ret;\n}\nexport function __wbg_crypto_38df2bab126b63dc(arg0) {\n const ret = arg0.crypto;\n return ret;\n}\nexport function __wbg_debug_ae77527a1d0ebaf4(arg0, arg1) {\n arg0.debug(arg1);\n}\nexport function __wbg_debug_c014a160490283dc(arg0) {\n console.debug(arg0);\n}\nexport function __wbg_decryptedroomevent_new(arg0) {\n const ret = DecryptedRoomEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_decryptedtodeviceevent_new(arg0) {\n const ret = DecryptedToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_dehydrateddevice_new(arg0) {\n const ret = DehydratedDevice.__wrap(arg0);\n return ret;\n}\nexport function __wbg_dehydrateddevicekey_new(arg0) {\n const ret = DehydratedDeviceKey.__wrap(arg0);\n return ret;\n}\nexport function __wbg_deleteObjectStore_081280ffb13f9792() { return handleError(function (arg0, arg1, arg2) {\n arg0.deleteObjectStore(getStringFromWasm0(arg1, arg2));\n}, arguments); }\nexport function __wbg_delete_10b3489d089185d7() { return handleError(function (arg0, arg1) {\n const ret = arg0.delete(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_delete_be787f4f73f54f72() { return handleError(function (arg0) {\n const ret = arg0.delete();\n return ret;\n}, arguments); }\nexport function __wbg_device_new(arg0) {\n const ret = Device.__wrap(arg0);\n return ret;\n}\nexport function __wbg_deviceid_new(arg0) {\n const ret = DeviceId.__wrap(arg0);\n return ret;\n}\nexport function __wbg_devicekey_new(arg0) {\n const ret = DeviceKey.__wrap(arg0);\n return ret;\n}\nexport function __wbg_devicekeyid_new(arg0) {\n const ret = DeviceKeyId.__wrap(arg0);\n return ret;\n}\nexport function __wbg_done_9158f7cc8751ba32(arg0) {\n const ret = arg0.done;\n return ret;\n}\nexport function __wbg_emoji_new(arg0) {\n const ret = Emoji.__wrap(arg0);\n return ret;\n}\nexport function __wbg_encryptedattachment_new(arg0) {\n const ret = EncryptedAttachment.__wrap(arg0);\n return ret;\n}\nexport function __wbg_encryptioninfo_new(arg0) {\n const ret = EncryptionInfo.__wrap(arg0);\n return ret;\n}\nexport function __wbg_entries_2bf997cf82353e47(arg0) {\n const ret = arg0.entries();\n return ret;\n}\nexport function __wbg_entries_e0b73aa8571ddb56(arg0) {\n const ret = Object.entries(arg0);\n return ret;\n}\nexport function __wbg_error_2001591ad2463697(arg0) {\n console.error(arg0);\n}\nexport function __wbg_error_43690a185e0311ac() { return handleError(function (arg0) {\n const ret = arg0.error;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_error_a6fa202b58aa1cd3(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}\nexport function __wbg_error_f90e6029c0c95d2f(arg0, arg1) {\n arg0.error(arg1);\n}\nexport function __wbg_from_0dbf29f09e7fb200(arg0) {\n const ret = Array.from(arg0);\n return ret;\n}\nexport function __wbg_getAllKeys_e28d29be9123b6fe() { return handleError(function (arg0) {\n const ret = arg0.getAllKeys();\n return ret;\n}, arguments); }\nexport function __wbg_getAll_1050a25926d2df6c() { return handleError(function (arg0, arg1) {\n const ret = arg0.getAll(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_getAll_3e09c6ad8427b762() { return handleError(function (arg0) {\n const ret = arg0.getAll();\n return ret;\n}, arguments); }\nexport function __wbg_getAll_73e044a8374165f8() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.getAll(arg1, arg2 >>> 0);\n return ret;\n}, arguments); }\nexport function __wbg_getAll_a898878594f5e590() { return handleError(function (arg0) {\n const ret = arg0.getAll();\n return ret;\n}, arguments); }\nexport function __wbg_getRandomValues_76dfc69825c9c552() { return handleError(function (arg0, arg1) {\n globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n}, arguments); }\nexport function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {\n arg0.getRandomValues(arg1);\n}, arguments); }\nexport function __wbg_getRandomValues_d49329ff89a07af1() { return handleError(function (arg0, arg1) {\n globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));\n}, arguments); }\nexport function __wbg_getTime_da7c55f52b71e8c6(arg0) {\n const ret = arg0.getTime();\n return ret;\n}\nexport function __wbg_get_1affdbdd5573b16a() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(arg0, arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_6011fa3a58f61074() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(arg0, arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_803cfa78503173c3() { return handleError(function (arg0, arg1) {\n const ret = arg0.get(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_8360291721e2339f(arg0, arg1) {\n const ret = arg0[arg1 >>> 0];\n return ret;\n}\nexport function __wbg_get_eb2958ee233cccd9() { return handleError(function (arg0, arg1) {\n const ret = arg0.get(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {\n const ret = arg0[arg1 >>> 0];\n return ret;\n}\nexport function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {\n const ret = arg0[arg1];\n return ret;\n}\nexport function __wbg_global_94a489d2e6a0c5fd(arg0) {\n const ret = arg0.global;\n return ret;\n}\nexport function __wbg_inboundgroupsession_new(arg0) {\n const ret = InboundGroupSession.__wrap(arg0);\n return ret;\n}\nexport function __wbg_index_072be17bcbd46242() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.index(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_indexedDB_47c354eb27472a00() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_indexedDB_9cd90e32ea3da2e4() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_indexedDB_ac4afadd7c87762a() { return handleError(function (arg0) {\n const ret = arg0.indexedDB;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}, arguments); }\nexport function __wbg_info_33de32580bb04e23(arg0, arg1) {\n arg0.info(arg1);\n}\nexport function __wbg_info_7479429238bffbce(arg0) {\n console.info(arg0);\n}\nexport function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(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}\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}\nexport function __wbg_instanceof_DomException_2ce86bc775566ba2(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}\nexport function __wbg_instanceof_Error_6872d63ba7922898(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}\nexport function __wbg_instanceof_IdbCursor_98630480e23ef2a1(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}\nexport function __wbg_instanceof_IdbDatabase_3b6930bc25a91170(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}\nexport function __wbg_instanceof_IdbOpenDbRequest_d0071b8c6aae51ff(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}\nexport function __wbg_instanceof_IdbRequest_cb20b218916840b2(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}\nexport function __wbg_instanceof_Map_1b76fd4635be43eb(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}\nexport function __wbg_instanceof_Promise_78658358a9b27cd4(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}\nexport function __wbg_instanceof_Uint8Array_152ba1f289edcf3f(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}\nexport function __wbg_invalidtodeviceevent_new(arg0) {\n const ret = InvalidToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_isArray_2790516aa848bf18(arg0) {\n const ret = Array.isArray(arg0);\n return ret;\n}\nexport function __wbg_isArray_c3109d14ffc06469(arg0) {\n const ret = Array.isArray(arg0);\n return ret;\n}\nexport function __wbg_isSafeInteger_4fc213d1989d6d2a(arg0) {\n const ret = Number.isSafeInteger(arg0);\n return ret;\n}\nexport function __wbg_item_16fa9d71e7623fb3(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}\nexport function __wbg_iterator_013bc09ec998c2a7() {\n const ret = Symbol.iterator;\n return ret;\n}\nexport function __wbg_key_3b366eba0fc3946a() { return handleError(function (arg0) {\n const ret = arg0.key;\n return ret;\n}, arguments); }\nexport function __wbg_keysbackuprequest_new(arg0) {\n const ret = KeysBackupRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_keysclaimrequest_new(arg0) {\n const ret = KeysClaimRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_keysqueryrequest_new(arg0) {\n const ret = KeysQueryRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_keysuploadrequest_new(arg0) {\n const ret = KeysUploadRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_length_3d4ecd04bd8d22f1(arg0) {\n const ret = arg0.length;\n return ret;\n}\nexport function __wbg_length_89fece2ef3016355(arg0) {\n const ret = arg0.length;\n return ret;\n}\nexport function __wbg_length_9f1775224cf1d815(arg0) {\n const ret = arg0.length;\n return ret;\n}\nexport function __wbg_lowerBound_9b7902b146dbf8c5() { return handleError(function (arg0, arg1) {\n const ret = IDBKeyRange.lowerBound(arg0, arg1 !== 0);\n return ret;\n}, arguments); }\nexport function __wbg_maybesignature_new(arg0) {\n const ret = MaybeSignature.__wrap(arg0);\n return ret;\n}\nexport function __wbg_megolmdecryptionerror_new(arg0) {\n const ret = MegolmDecryptionError.__wrap(arg0);\n return ret;\n}\nexport function __wbg_message_cb4f84ee66e5e341(arg0) {\n const ret = arg0.message;\n return ret;\n}\nexport function __wbg_message_ec476bcf269dd7c4(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}\nexport function __wbg_msCrypto_bd5a034af96bcba6(arg0) {\n const ret = arg0.msCrypto;\n return ret;\n}\nexport function __wbg_name_fce2a531eb1066ad(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}\nexport function __wbg_new_036bd6cd9cea9e73(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__h5838d1bd7a4e22fb(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 = 0;\n }\n}\nexport function __wbg_new_0c7403db6e782f19(arg0) {\n const ret = new Uint8Array(arg0);\n return ret;\n}\nexport function __wbg_new_227d7c05414eb861() {\n const ret = new Error();\n return ret;\n}\nexport function __wbg_new_34d45cc8e36aaead() {\n const ret = new Map();\n return ret;\n}\nexport function __wbg_new_3aa13540487cda43(arg0) {\n const ret = new Set(arg0);\n return ret;\n}\nexport function __wbg_new_5e360d2ff7b9e1c3(arg0, arg1) {\n const ret = new Error(getStringFromWasm0(arg0, arg1));\n return ret;\n}\nexport function __wbg_new_682678e2f47e32bc() {\n const ret = new Array();\n return ret;\n}\nexport function __wbg_new_7913666fe5070684(arg0) {\n const ret = new Date(arg0);\n return ret;\n}\nexport function __wbg_new_aa8d0fa9762c29bd() {\n const ret = new Object();\n return ret;\n}\nexport function __wbg_new_typed_323f37fd55ab048d(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__h5838d1bd7a4e22fb(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 = 0;\n }\n}\nexport function __wbg_new_with_length_8c854e41ea4dae9b(arg0) {\n const ret = new Uint8Array(arg0 >>> 0);\n return ret;\n}\nexport function __wbg_new_with_length_a1be700db9996280(arg0) {\n const ret = new Uint8ClampedArray(arg0 >>> 0);\n return ret;\n}\nexport function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {\n const ret = arg0.next();\n return ret;\n}, arguments); }\nexport function __wbg_next_7646edaa39458ef7(arg0) {\n const ret = arg0.next;\n return ret;\n}\nexport function __wbg_node_84ea875411254db1(arg0) {\n const ret = arg0.node;\n return ret;\n}\nexport function __wbg_now_a9b7df1cbee90986() {\n const ret = Date.now();\n return ret;\n}\nexport function __wbg_now_e7c6795a7f81e10f(arg0) {\n const ret = arg0.now();\n return ret;\n}\nexport function __wbg_objectStoreNames_c755717c02e8876b(arg0) {\n const ret = arg0.objectStoreNames;\n return ret;\n}\nexport function __wbg_objectStore_5942e8f91c946be8() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.objectStore(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_oldVersion_ff254e9849b7065c(arg0) {\n const ret = arg0.oldVersion;\n return ret;\n}\nexport function __wbg_olmmachine_new(arg0) {\n const ret = OlmMachine.__wrap(arg0);\n return ret;\n}\nexport function __wbg_openCursor_75d823082c002e28() { return handleError(function (arg0, arg1) {\n const ret = arg0.openCursor(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_openCursor_8a56937bddd04c64() { return handleError(function (arg0) {\n const ret = arg0.openCursor();\n return ret;\n}, arguments); }\nexport function __wbg_openCursor_a2ea782733f4ca2a() { return handleError(function (arg0) {\n const ret = arg0.openCursor();\n return ret;\n}, arguments); }\nexport function __wbg_open_0949b7cdde2ab99a() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.open(getStringFromWasm0(arg1, arg2));\n return ret;\n}, arguments); }\nexport function __wbg_open_90f4e40d36c2c9f5() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);\n return ret;\n}, arguments); }\nexport function __wbg_otheruseridentity_new(arg0) {\n const ret = OtherUserIdentity.__wrap(arg0);\n return ret;\n}\nexport function __wbg_ownuseridentity_new(arg0) {\n const ret = OwnUserIdentity.__wrap(arg0);\n return ret;\n}\nexport function __wbg_parse_1bbc9c053611d0a7() { return handleError(function (arg0, arg1) {\n const ret = JSON.parse(getStringFromWasm0(arg0, arg1));\n return ret;\n}, arguments); }\nexport function __wbg_performance_3fcf6e32a7e1ed0a(arg0) {\n const ret = arg0.performance;\n return ret;\n}\nexport function __wbg_pickledinboundgroupsession_unwrap(arg0) {\n const ret = PickledInboundGroupSession.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_pickledsession_unwrap(arg0) {\n const ret = PickledSession.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_plaintexttodeviceevent_new(arg0) {\n const ret = PlainTextToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_process_44c7a14e11e9f69e(arg0) {\n const ret = arg0.process;\n return ret;\n}\nexport function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);\n}\nexport function __wbg_prototypesetcall_c80d19814faa696a(arg0, arg1, arg2) {\n Uint8ClampedArray.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);\n}\nexport function __wbg_push_471a5b068a5295f6(arg0, arg1) {\n const ret = arg0.push(arg1);\n return ret;\n}\nexport function __wbg_put_fd02d3070a55994c() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.put(arg1, arg2);\n return ret;\n}, arguments); }\nexport function __wbg_putdehydrateddevicerequest_new(arg0) {\n const ret = PutDehydratedDeviceRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_qr_new(arg0) {\n const ret = Qr.__wrap(arg0);\n return ret;\n}\nexport function __wbg_queueMicrotask_5d15a957e6aa920e(arg0) {\n queueMicrotask(arg0);\n}\nexport function __wbg_queueMicrotask_f8819e5ffc402f36(arg0) {\n const ret = arg0.queueMicrotask;\n return ret;\n}\nexport function __wbg_randomFillSync_6c25eac9869eb53c() { return handleError(function (arg0, arg1) {\n arg0.randomFillSync(arg1);\n}, arguments); }\nexport function __wbg_readyState_57c2b80a75527431(arg0) {\n const ret = arg0.readyState;\n return (__wbindgen_enum_IdbRequestReadyState.indexOf(ret) + 1 || 3) - 1;\n}\nexport function __wbg_rehydrateddevice_new(arg0) {\n const ret = RehydratedDevice.__wrap(arg0);\n return ret;\n}\nexport function __wbg_request_64abeba15a72c084(arg0) {\n const ret = arg0.request;\n return ret;\n}\nexport function __wbg_request_72a78988f2edecad(arg0) {\n const ret = arg0.request;\n return ret;\n}\nexport function __wbg_require_b4edbdcf3e2a1ef0() { return handleError(function () {\n const ret = module.require;\n return ret;\n}, arguments); }\nexport function __wbg_resolve_e6c466bc1052f16c(arg0) {\n const ret = Promise.resolve(arg0);\n return ret;\n}\nexport function __wbg_result_f782323755b96dc8() { return handleError(function (arg0) {\n const ret = arg0.result;\n return ret;\n}, arguments); }\nexport function __wbg_roomid_unwrap(arg0) {\n const ret = RoomId.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeycounts_new(arg0) {\n const ret = RoomKeyCounts.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeyimportresult_new(arg0) {\n const ret = RoomKeyImportResult.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeyinfo_new(arg0) {\n const ret = RoomKeyInfo.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomkeywithheldinfo_new(arg0) {\n const ret = RoomKeyWithheldInfo.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roommessagerequest_new(arg0) {\n const ret = RoomMessageRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roompendingkeybundledetails_new(arg0) {\n const ret = RoomPendingKeyBundleDetails.__wrap(arg0);\n return ret;\n}\nexport function __wbg_roomsettings_new(arg0) {\n const ret = RoomSettings.__wrap(arg0);\n return ret;\n}\nexport function __wbg_sas_new(arg0) {\n const ret = Sas.__wrap(arg0);\n return ret;\n}\nexport function __wbg_secretsbundle_new(arg0) {\n const ret = SecretsBundle.__wrap(arg0);\n return ret;\n}\nexport function __wbg_setTimeout_ef24d2fc3ad97385() { return handleError(function (arg0, arg1) {\n const ret = setTimeout(arg0, arg1);\n return ret;\n}, arguments); }\nexport function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {\n arg0[arg1 >>> 0] = arg2;\n}\nexport function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {\n arg0[arg1] = arg2;\n}\nexport function __wbg_set_adfc330e444aa3b4(arg0, arg1, arg2) {\n arg0.set(getArrayU8FromWasm0(arg1, arg2));\n}\nexport function __wbg_set_fde2cec06c23692b(arg0, arg1, arg2) {\n const ret = arg0.set(arg1, arg2);\n return ret;\n}\nexport function __wbg_set_onabort_7eecdbabbc4fd5f8(arg0, arg1) {\n arg0.onabort = arg1;\n}\nexport function __wbg_set_oncomplete_8c9c4dac8e331f19(arg0, arg1) {\n arg0.oncomplete = arg1;\n}\nexport function __wbg_set_onerror_5cae5e3b994ad11f(arg0, arg1) {\n arg0.onerror = arg1;\n}\nexport function __wbg_set_onerror_ed658d0b50b67e95(arg0, arg1) {\n arg0.onerror = arg1;\n}\nexport function __wbg_set_onsuccess_bf03d6c06709ef09(arg0, arg1) {\n arg0.onsuccess = arg1;\n}\nexport function __wbg_set_onupgradeneeded_3fc8649a687213f5(arg0, arg1) {\n arg0.onupgradeneeded = arg1;\n}\nexport function __wbg_set_unique_0a396b97f5b68657(arg0, arg1) {\n arg0.unique = arg1 !== 0;\n}\nexport function __wbg_signatures_new(arg0) {\n const ret = Signatures.__wrap(arg0);\n return ret;\n}\nexport function __wbg_signatureuploadrequest_new(arg0) {\n const ret = SignatureUploadRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_signatureverification_new(arg0) {\n const ret = SignatureVerification.__wrap(arg0);\n return ret;\n}\nexport function __wbg_stack_3b0d974bbf31e44f(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}\nexport function __wbg_static_accessor_GLOBAL_8cfadc87a297ca02() {\n const ret = typeof global === 'undefined' ? null : global;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf() {\n const ret = typeof globalThis === 'undefined' ? null : globalThis;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_static_accessor_SELF_e445c1c7484aecc3() {\n const ret = typeof self === 'undefined' ? null : self;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_static_accessor_WINDOW_f20e8576ef1e0f17() {\n const ret = typeof window === 'undefined' ? null : window;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_storedroomkeybundledata_new(arg0) {\n const ret = StoredRoomKeyBundleData.__wrap(arg0);\n return ret;\n}\nexport function __wbg_storehandle_new(arg0) {\n const ret = StoreHandle.__wrap(arg0);\n return ret;\n}\nexport function __wbg_stringify_91082ed7a5a5769e() { return handleError(function (arg0) {\n const ret = JSON.stringify(arg0);\n return ret;\n}, arguments); }\nexport function __wbg_subarray_f8ca46a25b1f5e0d(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n}\nexport function __wbg_target_6d97e221d11b71b6(arg0) {\n const ret = arg0.target;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_then_792e0c862b060889(arg0, arg1, arg2) {\n const ret = arg0.then(arg1, arg2);\n return ret;\n}\nexport function __wbg_then_8e16ee11f05e4827(arg0, arg1) {\n const ret = arg0.then(arg1);\n return ret;\n}\nexport function __wbg_toString_306ed0b9f320c1ca(arg0) {\n const ret = arg0.toString();\n return ret;\n}\nexport function __wbg_todevicerequest_new(arg0) {\n const ret = ToDeviceRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_transaction_246d4ade615944eb(arg0) {\n const ret = arg0.transaction;\n return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);\n}\nexport function __wbg_transaction_653efe7dcf307618() { return handleError(function (arg0, arg1, arg2, arg3) {\n const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);\n return ret;\n}, arguments); }\nexport function __wbg_transaction_9af5475ca3bd3fa9() { return handleError(function (arg0, arg1, arg2) {\n const ret = arg0.transaction(arg1, __wbindgen_enum_IdbTransactionMode[arg2]);\n return ret;\n}, arguments); }\nexport function __wbg_transaction_c61e2c5f1a671b7d(arg0) {\n const ret = arg0.transaction;\n return ret;\n}\nexport function __wbg_update_23505c717f36067e() { return handleError(function (arg0, arg1) {\n const ret = arg0.update(arg1);\n return ret;\n}, arguments); }\nexport function __wbg_upperBound_9b433e92228dea8e() { return handleError(function (arg0, arg1) {\n const ret = IDBKeyRange.upperBound(arg0, arg1 !== 0);\n return ret;\n}, arguments); }\nexport function __wbg_userdevices_new(arg0) {\n const ret = UserDevices.__wrap(arg0);\n return ret;\n}\nexport function __wbg_userid_new(arg0) {\n const ret = UserId.__wrap(arg0);\n return ret;\n}\nexport function __wbg_userid_unwrap(arg0) {\n const ret = UserId.__unwrap(arg0);\n return ret;\n}\nexport function __wbg_utdtodeviceevent_new(arg0) {\n const ret = UTDToDeviceEvent.__wrap(arg0);\n return ret;\n}\nexport function __wbg_value_cd3e83709dea7716() { return handleError(function (arg0) {\n const ret = arg0.value;\n return ret;\n}, arguments); }\nexport function __wbg_value_ee3a06f4579184fa(arg0) {\n const ret = arg0.value;\n return ret;\n}\nexport function __wbg_values_10e8da5f1d194ede(arg0) {\n const ret = arg0.values();\n return ret;\n}\nexport function __wbg_verificationrequest_new(arg0) {\n const ret = VerificationRequest.__wrap(arg0);\n return ret;\n}\nexport function __wbg_version_f332be76aa57f24c(arg0) {\n const ret = arg0.version;\n return ret;\n}\nexport function __wbg_versions_276b2795b1c6a219(arg0) {\n const ret = arg0.versions;\n return ret;\n}\nexport function __wbg_warn_308e79ff0bb1cadb(arg0, arg1) {\n arg0.warn(arg1);\n}\nexport function __wbg_warn_3cc416af27dbdc02(arg0) {\n console.warn(arg0);\n}\nexport function __wbindgen_cast_0000000000000001(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 140, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000002(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref(\"Event\")], shim_idx: 499, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h216bb57a5c23ce59);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000003(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref(\"IDBVersionChangeEvent\")], shim_idx: 140, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f_2);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000004(arg0, arg1) {\n // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 125, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.\n const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6cf898dfbf0ceb81);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000005(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return ret;\n}\nexport function __wbindgen_cast_0000000000000006(arg0) {\n // Cast intrinsic for `I64 -> Externref`.\n const ret = arg0;\n return ret;\n}\nexport function __wbindgen_cast_0000000000000007(arg0, arg1) {\n // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref(\"Uint8Array\")`.\n const ret = getArrayU8FromWasm0(arg0, arg1);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000008(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return ret;\n}\nexport function __wbindgen_cast_0000000000000009(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return ret;\n}\nexport function __wbindgen_cast_000000000000000a(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}\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}\nfunction wasm_bindgen__convert__closures_____invoke__h6cf898dfbf0ceb81(arg0, arg1) {\n wasm.wasm_bindgen__convert__closures_____invoke__h6cf898dfbf0ceb81(arg0, arg1);\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h216bb57a5c23ce59(arg0, arg1, arg2) {\n wasm.wasm_bindgen__convert__closures_____invoke__h216bb57a5c23ce59(arg0, arg1, arg2);\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f(arg0, arg1, arg2) {\n const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f(arg0, arg1, arg2);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f_2(arg0, arg1, arg2) {\n const ret = wasm.wasm_bindgen__convert__closures_____invoke__h6c4fdc4abebd760f_2(arg0, arg1, arg2);\n if (ret[1]) {\n throw takeFromExternrefTable0(ret[0]);\n }\n}\n\nfunction wasm_bindgen__convert__closures_____invoke__h5838d1bd7a4e22fb(arg0, arg1, arg2, arg3) {\n wasm.wasm_bindgen__convert__closures_____invoke__h5838d1bd7a4e22fb(arg0, arg1, arg2, arg3);\n}\n\n\nconst __wbindgen_enum_IdbRequestReadyState = [\"pending\", \"done\"];\n\n\nconst __wbindgen_enum_IdbTransactionMode = [\"readonly\", \"readwrite\", \"versionchange\", \"readwriteflush\", \"cleanup\"];\nconst AttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_attachment_free(ptr >>> 0, 1));\nconst BackupDecryptionKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupdecryptionkey_free(ptr >>> 0, 1));\nconst BackupKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupkeys_free(ptr >>> 0, 1));\nconst BackupSecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_backupsecretsbundle_free(ptr >>> 0, 1));\nconst Base64EncodedPkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_base64encodedpkmessage_free(ptr >>> 0, 1));\nconst BaseMigrationDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_basemigrationdata_free(ptr >>> 0, 1));\nconst CancelInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_cancelinfo_free(ptr >>> 0, 1));\nconst CheckCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_checkcode_free(ptr >>> 0, 1));\nconst CollectStrategyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_collectstrategy_free(ptr >>> 0, 1));\nconst CrossSigningBootstrapRequestsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningbootstraprequests_free(ptr >>> 0, 1));\nconst CrossSigningKeyExportFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningkeyexport_free(ptr >>> 0, 1));\nconst CrossSigningStatusFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_crosssigningstatus_free(ptr >>> 0, 1));\nconst Curve25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_curve25519publickey_free(ptr >>> 0, 1));\nconst Curve25519SecretKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_curve25519secretkey_free(ptr >>> 0, 1));\nconst DecryptedRoomEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptedroomevent_free(ptr >>> 0, 1));\nconst DecryptedToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptedtodeviceevent_free(ptr >>> 0, 1));\nconst DecryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_decryptionsettings_free(ptr >>> 0, 1));\nconst DehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevice_free(ptr >>> 0, 1));\nconst DehydratedDeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevicekey_free(ptr >>> 0, 1));\nconst DehydratedDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_dehydrateddevices_free(ptr >>> 0, 1));\nconst DeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_device_free(ptr >>> 0, 1));\nconst DeviceIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_deviceid_free(ptr >>> 0, 1));\nconst DeviceKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekey_free(ptr >>> 0, 1));\nconst DeviceKeyAlgorithmFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyalgorithm_free(ptr >>> 0, 1));\nconst DeviceKeyIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicekeyid_free(ptr >>> 0, 1));\nconst DeviceListsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_devicelists_free(ptr >>> 0, 1));\nconst EciesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ecies_free(ptr >>> 0, 1));\nconst Ed25519PublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ed25519publickey_free(ptr >>> 0, 1));\nconst Ed25519SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ed25519signature_free(ptr >>> 0, 1));\nconst EmojiFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_emoji_free(ptr >>> 0, 1));\nconst EncryptedAttachmentFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptedattachment_free(ptr >>> 0, 1));\nconst EncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptioninfo_free(ptr >>> 0, 1));\nconst EncryptionSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_encryptionsettings_free(ptr >>> 0, 1));\nconst EstablishedEciesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_establishedecies_free(ptr >>> 0, 1));\nconst EventIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_eventid_free(ptr >>> 0, 1));\nconst IdentityKeysFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_identitykeys_free(ptr >>> 0, 1));\nconst InboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_inboundcreationresult_free(ptr >>> 0, 1));\nconst InboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_inboundgroupsession_free(ptr >>> 0, 1));\nconst InvalidToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_invalidtodeviceevent_free(ptr >>> 0, 1));\nconst KeysBackupRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysbackuprequest_free(ptr >>> 0, 1));\nconst KeysClaimRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysclaimrequest_free(ptr >>> 0, 1));\nconst KeysQueryRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysqueryrequest_free(ptr >>> 0, 1));\nconst KeysUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_keysuploadrequest_free(ptr >>> 0, 1));\nconst MaybeSignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_maybesignature_free(ptr >>> 0, 1));\nconst MegolmDecryptionErrorFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_megolmdecryptionerror_free(ptr >>> 0, 1));\nconst MegolmV1BackupKeyFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_megolmv1backupkey_free(ptr >>> 0, 1));\nconst MigrationFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_migration_free(ptr >>> 0, 1));\nconst Msc4108IntentDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_msc4108intentdata_free(ptr >>> 0, 1));\nconst Msc4388IntentDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_msc4388intentdata_free(ptr >>> 0, 1));\nconst OlmMachineFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_olmmachine_free(ptr >>> 0, 1));\nconst OtherUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_otheruseridentity_free(ptr >>> 0, 1));\nconst OutboundCreationResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_outboundcreationresult_free(ptr >>> 0, 1));\nconst OwnUserIdentityFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_ownuseridentity_free(ptr >>> 0, 1));\nconst PickledInboundGroupSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pickledinboundgroupsession_free(ptr >>> 0, 1));\nconst PickledSessionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pickledsession_free(ptr >>> 0, 1));\nconst PkDecryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkdecryption_free(ptr >>> 0, 1));\nconst PkEncryptionFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkencryption_free(ptr >>> 0, 1));\nconst PkMessageFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_pkmessage_free(ptr >>> 0, 1));\nconst PlainTextToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_plaintexttodeviceevent_free(ptr >>> 0, 1));\nconst PutDehydratedDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_putdehydrateddevicerequest_free(ptr >>> 0, 1));\nconst QrFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qr_free(ptr >>> 0, 1));\nconst QrCodeFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcode_free(ptr >>> 0, 1));\nconst QrCodeDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodedata_free(ptr >>> 0, 1));\nconst QrCodeIntentDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodeintentdata_free(ptr >>> 0, 1));\nconst QrCodeScanFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_qrcodescan_free(ptr >>> 0, 1));\nconst RehydratedDeviceFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_rehydrateddevice_free(ptr >>> 0, 1));\nconst RoomIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomid_free(ptr >>> 0, 1));\nconst RoomKeyCountsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeycounts_free(ptr >>> 0, 1));\nconst RoomKeyImportResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyimportresult_free(ptr >>> 0, 1));\nconst RoomKeyInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeyinfo_free(ptr >>> 0, 1));\nconst RoomKeyWithheldInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomkeywithheldinfo_free(ptr >>> 0, 1));\nconst RoomMessageRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roommessagerequest_free(ptr >>> 0, 1));\nconst RoomPendingKeyBundleDetailsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roompendingkeybundledetails_free(ptr >>> 0, 1));\nconst RoomSettingsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_roomsettings_free(ptr >>> 0, 1));\nconst SasFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_sas_free(ptr >>> 0, 1));\nconst SecretsBundleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_secretsbundle_free(ptr >>> 0, 1));\nconst ServerNameFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_servername_free(ptr >>> 0, 1));\nconst ShieldStateFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_shieldstate_free(ptr >>> 0, 1));\nconst SignatureFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signature_free(ptr >>> 0, 1));\nconst SignatureUploadRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatureuploadrequest_free(ptr >>> 0, 1));\nconst SignatureVerificationFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatureverification_free(ptr >>> 0, 1));\nconst SignaturesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_signatures_free(ptr >>> 0, 1));\nconst StoreHandleFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_storehandle_free(ptr >>> 0, 1));\nconst StoredRoomKeyBundleDataFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_storedroomkeybundledata_free(ptr >>> 0, 1));\nconst ToDeviceEncryptionInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todeviceencryptioninfo_free(ptr >>> 0, 1));\nconst ToDeviceRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todevicerequest_free(ptr >>> 0, 1));\nconst ToDeviceUnableToDecryptInfoFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_todeviceunabletodecryptinfo_free(ptr >>> 0, 1));\nconst TracingFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_tracing_free(ptr >>> 0, 1));\nconst UTDToDeviceEventFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_utdtodeviceevent_free(ptr >>> 0, 1));\nconst UploadSigningKeysRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_uploadsigningkeysrequest_free(ptr >>> 0, 1));\nconst UserDevicesFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_userdevices_free(ptr >>> 0, 1));\nconst UserIdFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_userid_free(ptr >>> 0, 1));\nconst VerificationRequestFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_verificationrequest_free(ptr >>> 0, 1));\nconst VersionsFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_versions_free(ptr >>> 0, 1));\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 => wasm.__wbindgen_destroy_closure(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, f) {\n const state = { a: arg0, b: arg1, cnt: 1 };\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 wasm.__wbindgen_destroy_closure(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\n\nlet wasm;\nexport function __wbg_set_wasm(val) {\n wasm = val;\n}\n","// Copyright 2024 The Matrix.org Foundation C.I.C.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// @ts-check\n\n/**\n * This is the entrypoint on non-node ESM environments.\n * `asyncLoad` will load the WASM module using a `fetch` call.\n */\n\nimport * as bindings from \"./pkg/matrix_sdk_crypto_wasm_bg.js\";\n\nconst defaultURL = new URL(\"./pkg/matrix_sdk_crypto_wasm_bg.wasm\", import.meta.url);\n\n// Although we could simply instantiate the WASM at import time with a top-level `await`,\n// we avoid that, to make it easier for callers to delay loading the WASM (and instead\n// wait until `initAsync` is called). (Also, Safari 14 doesn't support top-level `await`.)\n//\n// However, having done so, there is no way to synchronously load the WASM if the user ends\n// up using the bindings before calling `initAsync` (unlike under Node.js), so we just throw\n// an error.\nbindings.__wbg_set_wasm(\n new Proxy(\n {},\n {\n get() {\n throw new Error(\n \"@matrix-org/matrix-sdk-crypto-wasm was used before it was initialized. Call `initAsync` first.\",\n );\n },\n },\n ),\n);\n\n/**\n * Stores a promise of the `loadModuleAsync` call\n * @type {Promise<void> | null}\n */\nlet modPromise = null;\n\n/**\n * Loads and instantiates the WASM module asynchronously\n *\n * @param {URL | string} url - The URL to fetch the WebAssembly module from\n * @returns {Promise<void>}\n */\nasync function loadModuleAsync(url) {\n const { instance } = await WebAssembly.instantiateStreaming(fetch(url), {\n // @ts-expect-error: The bindings don't exactly match the 'ExportValue' type\n \"./matrix_sdk_crypto_wasm_bg.js\": bindings,\n });\n\n bindings.__wbg_set_wasm(instance.exports);\n // @ts-expect-error: Typescript doesn't know what the module exports are\n instance.exports.__wbindgen_start();\n}\n\n/**\n * Load the WebAssembly module in the background, if it has not already been loaded.\n *\n * Returns a promise which will resolve once the other methods are ready.\n *\n * @param {URL | string} [url] - The URL to fetch the WebAssembly module from. If not provided, a default URL will be used.\n * @returns {Promise<void>}\n */\nexport async function initAsync(url = defaultURL) {\n if (!modPromise) modPromise = loadModuleAsync(url);\n await modPromise;\n}\n\n// Re-export everything from the generated javascript wrappers\nexport * from \"./pkg/matrix_sdk_crypto_wasm_bg.js\";\n","/* Copyright 2015 Mark Haines\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n'use strict';\n\nvar escaped = /[\\\\\\\"\\x00-\\x1F]/g;\nvar escapes = {};\nfor (var i = 0; i < 0x20; ++i) {\n escapes[String.fromCharCode(i)] = (\n '\\\\U' + ('0000' + i.toString(16)).slice(-4).toUpperCase()\n );\n}\nescapes['\\b'] = '\\\\b';\nescapes['\\t'] = '\\\\t';\nescapes['\\n'] = '\\\\n';\nescapes['\\f'] = '\\\\f';\nescapes['\\r'] = '\\\\r';\nescapes['\\\"'] = '\\\\\\\"';\nescapes['\\\\'] = '\\\\\\\\';\n\nfunction escapeString(value) {\n escaped.lastIndex = 0;\n return value.replace(escaped, function(c) { return escapes[c]; });\n}\n\nfunction stringify(value) {\n switch (typeof value) {\n case 'string':\n return '\"' + escapeString(value) + '\"';\n case 'number':\n return isFinite(value) ? value : 'null';\n case 'boolean':\n return value;\n case 'object':\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return stringifyArray(value);\n }\n return stringifyObject(value);\n default:\n throw new Error('Cannot stringify: ' + typeof value);\n }\n}\n\nfunction stringifyArray(array) {\n var sep = '[';\n var result = '';\n for (var i = 0; i < array.length; ++i) {\n result += sep;\n sep = ',';\n result += stringify(array[i]);\n }\n if (sep != ',') {\n return '[]';\n } else {\n return result + ']';\n }\n}\n\nfunction stringifyObject(object) {\n var sep = '{';\n var result = '';\n var keys = Object.keys(object);\n keys.sort();\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n result += sep + '\"' + escapeString(key) + '\":';\n sep = ',';\n result += stringify(object[key]);\n }\n if (sep != ',') {\n return '{}';\n } else {\n return result + '}';\n }\n}\n\n/** */\nmodule.exports = {stringify: stringify};\n","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { CollectStrategy, EncryptionAlgorithm, EncryptionSettings, HistoryVisibility as RustHistoryVisibility, RoomId, UserId } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { EventType } from \"../@types/event.js\";\nimport { LogSpan } from \"../logger.js\";\nimport { HistoryVisibility } from \"../@types/partials.js\";\nimport { logDuration } from \"../utils.js\";\nimport { KnownMembership } from \"../@types/membership.js\";\nimport { DeviceIsolationModeKind } from \"../crypto-api/index.js\";\n\n/**\n * RoomEncryptor: responsible for encrypting messages to a given room\n *\n * @internal\n */\nexport class RoomEncryptor {\n /**\n * @param prefixedLogger - A logger to use for log messages.\n * @param olmMachine - The rust-sdk's OlmMachine\n * @param keyClaimManager - Our KeyClaimManager, which manages the queue of one-time-key claim requests\n * @param outgoingRequestManager - The OutgoingRequestManager, which manages the queue of outgoing requests.\n * @param room - The room we want to encrypt for\n * @param encryptionSettings - body of the m.room.encryption event currently in force in this room\n */\n constructor(prefixedLogger, olmMachine, keyClaimManager, outgoingRequestManager, room, encryptionSettings) {\n this.prefixedLogger = prefixedLogger;\n this.olmMachine = olmMachine;\n this.keyClaimManager = keyClaimManager;\n this.outgoingRequestManager = outgoingRequestManager;\n this.room = room;\n this.encryptionSettings = encryptionSettings;\n /** whether the room members have been loaded and tracked for the first time */\n _defineProperty(this, \"lazyLoadedMembersResolved\", false);\n /**\n * Ensures that there is only one encryption operation at a time for that room.\n *\n * An encryption operation is either a {@link prepareForEncryption} or an {@link encryptEvent} call.\n */\n _defineProperty(this, \"currentEncryptionPromise\", Promise.resolve());\n // start tracking devices for any users already known to be in this room.\n // Do not load members here, would defeat lazy loading.\n var members = room.getJoinedMembers();\n\n // At this point just mark the known members as tracked, it might not be the full list of members\n // because of lazy loading. This is fine, because we will get a member list update when sending a message for\n // the first time, see `RoomEncryptor#ensureEncryptionSession`\n this.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId))).catch(e => this.prefixedLogger.error(\"Error initializing tracked users\", e));\n }\n\n /**\n * Handle a new `m.room.encryption` event in this room\n *\n * @param config - The content of the encryption event\n */\n onCryptoEvent(config) {\n if (JSON.stringify(this.encryptionSettings) != JSON.stringify(config)) {\n // This should currently be unreachable, since the Rust SDK will reject any attempts to change config.\n throw new Error(\"Cannot reconfigure an active RoomEncryptor\");\n }\n }\n\n /**\n * Handle a new `m.room.member` event in this room\n *\n * @param member - new membership state\n */\n onRoomMembership(member) {\n if (member.membership == KnownMembership.Join || member.membership == KnownMembership.Invite && this.room.shouldEncryptForInvitedMembers()) {\n // make sure we are tracking the deviceList for this user\n this.olmMachine.updateTrackedUsers([new UserId(member.userId)]).catch(e => {\n this.prefixedLogger.error(\"Unable to update tracked users\", e);\n });\n }\n\n // TODO: handle leaves (including our own)\n }\n\n /**\n * Prepare to encrypt events in this room.\n *\n * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n * in the room.\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n prepareForEncryption(globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n var _this = this;\n return _asyncToGenerator(function* () {\n // We consider a prepareForEncryption as an encryption promise as it will potentially share keys\n // even if it doesn't send an event.\n // Usually this is called when the user starts typing, so we want to make sure we have keys ready when the\n // message is finally sent.\n // If `encryptEvent` is invoked before `prepareForEncryption` has completed, the `encryptEvent` call will wait for\n // `prepareForEncryption` to complete before executing.\n // The part where `encryptEvent` shares the room key will then usually be a no-op as it was already performed by `prepareForEncryption`.\n yield _this.encryptEvent(null, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n })();\n }\n\n /**\n * Encrypt an event for this room, or prepare for encryption.\n *\n * This will ensure that we have a megolm session for this room, share it with the devices in the room, and\n * then, if an event is provided, encrypt it using the session.\n *\n * @param event - Event to be encrypted, or null if only preparing for encryption (in which case we will pre-share the room key).\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n encryptEvent(event, globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n var _event$getTxnId,\n _this2 = this;\n var logger = new LogSpan(this.prefixedLogger, event ? (_event$getTxnId = event.getTxnId()) !== null && _event$getTxnId !== void 0 ? _event$getTxnId : \"\" : \"prepareForEncryption\");\n // Ensure order of encryption to avoid message ordering issues, as the scheduler only ensures\n // events order after they have been encrypted.\n var prom = this.currentEncryptionPromise.catch(() => {\n // Any errors in the previous call will have been reported already, so there is nothing to do here.\n // we just throw away the error and start anew.\n }).then(/*#__PURE__*/_asyncToGenerator(function* () {\n yield logDuration(logger, \"ensureEncryptionSession\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this2.ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode);\n }));\n if (event) {\n yield logDuration(logger, \"encryptEventInner\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this2.encryptEventInner(logger, event);\n }));\n }\n }));\n this.currentEncryptionPromise = prom;\n return prom;\n }\n\n /**\n * Prepare to encrypt events in this room.\n *\n * This ensures that we have a megolm session ready to use and that we have shared its key with all the devices\n * in the room.\n *\n * @param logger - a place to write diagnostics to\n * @param globalBlacklistUnverifiedDevices - When `true`, and `deviceIsolationMode` is `AllDevicesIsolationMode`,\n * will not send encrypted messages to unverified devices.\n * Ignored when `deviceIsolationMode` is `OnlySignedDevicesIsolationMode`.\n * @param deviceIsolationMode - The device isolation mode. See {@link DeviceIsolationMode}.\n */\n ensureEncryptionSession(logger, globalBlacklistUnverifiedDevices, deviceIsolationMode) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (_this3.encryptionSettings.algorithm !== \"m.megolm.v1.aes-sha2\") {\n throw new Error(\"Cannot encrypt in \".concat(_this3.room.roomId, \" for unsupported algorithm '\").concat(_this3.encryptionSettings.algorithm, \"'\"));\n }\n logger.debug(\"Starting encryption\");\n var members = yield _this3.room.getEncryptionTargetMembers();\n\n // If this is the first time we are sending a message to the room, we may not yet have seen all the members\n // (so the Crypto SDK might not have a device list for them). So, if this is the first time we are encrypting\n // for this room, give the SDK the full list of members, to be on the safe side.\n //\n // This could end up being racy (if two calls to ensureEncryptionSession happen at the same time), but that's\n // not a particular problem, since `OlmMachine.updateTrackedUsers` just adds any users that weren't already tracked.\n if (!_this3.lazyLoadedMembersResolved) {\n yield logDuration(logger, \"loadMembersIfNeeded: updateTrackedUsers\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this3.olmMachine.updateTrackedUsers(members.map(u => new RustSdkCryptoJs.UserId(u.userId)));\n }));\n logger.debug(\"Updated tracked users\");\n _this3.lazyLoadedMembersResolved = true;\n\n // Query keys in case we don't have them for newly tracked members.\n // It's important after loading members for the first time, as likely most of them won't be\n // known yet and will be unable to decrypt messages despite being in the room for long.\n // This must be done before ensuring sessions. If not the devices of these users are not\n // known yet and will not get the room key.\n // We don't have API to only get the keys queries related to this member list, so we just\n // process the pending requests from the olmMachine. (usually these are processed\n // at the end of the sync, but we can't wait for that).\n // XXX future improvement process only KeysQueryRequests for the users that have never been queried.\n logger.debug(\"Processing outgoing requests\");\n yield logDuration(logger, \"doProcessOutgoingRequests\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this3.outgoingRequestManager.doProcessOutgoingRequests();\n }));\n } else {\n // If members are already loaded it's less critical to await on key queries.\n // We might still want to trigger a processOutgoingRequests here.\n // The call to `ensureSessionsForUsers` below will wait a bit on in-flight key queries we are\n // interested in. If a sync handling happens in the meantime, and some new members are added to the room\n // or have new devices it would give us a chance to query them before sending.\n // It's less critical due to the racy nature of this process.\n logger.debug(\"Processing outgoing requests in background\");\n _this3.outgoingRequestManager.doProcessOutgoingRequests();\n }\n logger.debug(\"Encrypting for users (shouldEncryptForInvitedMembers: \".concat(_this3.room.shouldEncryptForInvitedMembers(), \"):\"), members.map(u => \"\".concat(u.userId, \" (\").concat(u.membership, \")\")));\n var userList = members.map(u => new UserId(u.userId));\n yield logDuration(logger, \"ensureSessionsForUsers\", /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this3.keyClaimManager.ensureSessionsForUsers(logger, userList);\n }));\n var rustEncryptionSettings = new EncryptionSettings();\n rustEncryptionSettings.historyVisibility = toRustHistoryVisibility(_this3.room.getHistoryVisibility());\n\n // We only support megolm\n rustEncryptionSettings.algorithm = EncryptionAlgorithm.MegolmV1AesSha2;\n\n // We need to convert the rotation period from milliseconds to microseconds\n // See https://spec.matrix.org/v1.8/client-server-api/#mroomencryption and\n // https://matrix-org.github.io/matrix-rust-sdk-crypto-wasm/classes/EncryptionSettings.html#rotationPeriod\n if (typeof _this3.encryptionSettings.rotation_period_ms === \"number\") {\n rustEncryptionSettings.rotationPeriod = BigInt(_this3.encryptionSettings.rotation_period_ms * 1000);\n }\n if (typeof _this3.encryptionSettings.rotation_period_msgs === \"number\") {\n rustEncryptionSettings.rotationPeriodMessages = BigInt(_this3.encryptionSettings.rotation_period_msgs);\n }\n switch (deviceIsolationMode.kind) {\n case DeviceIsolationModeKind.AllDevicesIsolationMode:\n {\n var _this3$room$getBlackl;\n // When this.room.getBlacklistUnverifiedDevices() === null, the global settings should be used\n // See Room#getBlacklistUnverifiedDevices\n var onlyAllowTrustedDevices = (_this3$room$getBlackl = _this3.room.getBlacklistUnverifiedDevices()) !== null && _this3$room$getBlackl !== void 0 ? _this3$room$getBlackl : globalBlacklistUnverifiedDevices;\n rustEncryptionSettings.sharingStrategy = CollectStrategy.deviceBasedStrategy(onlyAllowTrustedDevices, deviceIsolationMode.errorOnVerifiedUserProblems);\n }\n break;\n case DeviceIsolationModeKind.OnlySignedDevicesIsolationMode:\n rustEncryptionSettings.sharingStrategy = CollectStrategy.identityBasedStrategy();\n break;\n }\n yield logDuration(logger, \"shareRoomKey\", /*#__PURE__*/_asyncToGenerator(function* () {\n var shareMessages = yield _this3.olmMachine.shareRoomKey(new RoomId(_this3.room.roomId),\n // safe to pass without cloning, as it's not reused here (before or after)\n userList, rustEncryptionSettings);\n if (shareMessages) {\n for (var m of shareMessages) {\n yield _this3.outgoingRequestManager.outgoingRequestProcessor.makeOutgoingRequest(m);\n }\n }\n }));\n })();\n }\n\n /**\n * Discard any existing group session for this room\n */\n forceDiscardSession() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n var r = yield _this4.olmMachine.invalidateGroupSession(new RoomId(_this4.room.roomId));\n if (r) {\n _this4.prefixedLogger.info(\"Discarded existing group session\");\n }\n })();\n }\n encryptEventInner(logger, event) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n logger.debug(\"Encrypting actual message content\");\n var room = new RoomId(_this5.room.roomId);\n var type = event.getType();\n var content = JSON.stringify(event.getContent());\n var encryptedContent;\n if (event.isState()) {\n encryptedContent = yield _this5.olmMachine.encryptStateEvent(room, type,\n // Safety: we've already checked above that this is a state event, so the state key must exist.\n event.getStateKey(), content);\n } else {\n encryptedContent = yield _this5.olmMachine.encryptRoomEvent(room, type, content);\n }\n event.makeEncrypted(EventType.RoomMessageEncrypted, JSON.parse(encryptedContent), _this5.olmMachine.identityKeys.curve25519.toBase64(), _this5.olmMachine.identityKeys.ed25519.toBase64());\n logger.debug(\"Encrypted event successfully\");\n })();\n }\n}\n\n/**\n * Convert a HistoryVisibility to a RustHistoryVisibility\n * @param visibility - HistoryVisibility enum\n * @returns a RustHistoryVisibility enum\n */\nexport function toRustHistoryVisibility(visibility) {\n switch (visibility) {\n case HistoryVisibility.Invited:\n return RustHistoryVisibility.Invited;\n case HistoryVisibility.Joined:\n return RustHistoryVisibility.Joined;\n case HistoryVisibility.Shared:\n return RustHistoryVisibility.Shared;\n case HistoryVisibility.WorldReadable:\n return RustHistoryVisibility.WorldReadable;\n }\n}\n//# sourceMappingURL=RoomEncryptor.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2024 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { encodeUri } from \"../utils.js\";\nimport { Method } from \"../http-api/index.js\";\nimport { decodeBase64 } from \"../base64.js\";\nimport { CryptoEvent } from \"../crypto-api/index.js\";\nimport { TypedEventEmitter } from \"../models/typed-event-emitter.js\";\n\n/**\n * The response body of `GET /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device`.\n */\n\n/**\n * The response body of `POST /_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/events`.\n */\n\n/**\n * The unstable URL prefix for dehydrated device endpoints\n */\nexport var UnstablePrefix = \"/_matrix/client/unstable/org.matrix.msc3814.v1\";\n/**\n * The name used for the dehydration key in Secret Storage\n */\nvar SECRET_STORAGE_NAME = \"org.matrix.msc3814\";\n\n/**\n * The interval between creating dehydrated devices. (one week)\n */\nvar DEHYDRATION_INTERVAL = 7 * 24 * 60 * 60 * 1000;\n\n/**\n * Manages dehydrated devices\n *\n * We have one of these per `RustCrypto`. It's responsible for\n *\n * * determining server support for dehydrated devices\n * * creating new dehydrated devices when requested, including periodically\n * replacing the dehydrated device with a new one\n * * rehydrating a device when requested, and when present\n *\n * @internal\n */\nexport class DehydratedDeviceManager extends TypedEventEmitter {\n constructor(logger, olmMachine, http, outgoingRequestProcessor, secretStorage) {\n super();\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.http = http;\n this.outgoingRequestProcessor = outgoingRequestProcessor;\n this.secretStorage = secretStorage;\n /** the ID of the interval for periodically replacing the dehydrated device */\n _defineProperty(this, \"intervalId\", void 0);\n }\n cacheKey(key) {\n var _this = this;\n return _asyncToGenerator(function* () {\n yield _this.olmMachine.dehydratedDevices().saveDehydratedDeviceKey(key);\n _this.emit(CryptoEvent.DehydrationKeyCached);\n })();\n }\n\n /**\n * Return whether the server supports dehydrated devices.\n */\n isSupported() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // call the endpoint to get a dehydrated device. If it returns an\n // M_UNRECOGNIZED error, then dehydration is unsupported. If it returns\n // a successful response, or an M_NOT_FOUND, then dehydration is supported.\n // Any other exceptions are passed through.\n try {\n yield _this2.http.authedRequest(Method.Get, \"/dehydrated_device\", undefined, undefined, {\n prefix: UnstablePrefix\n });\n } catch (error) {\n var err = error;\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return false;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return true;\n }\n throw error;\n }\n return true;\n })();\n }\n\n /**\n * Start using device dehydration.\n *\n * - Rehydrates a dehydrated device, if one is available and `opts.rehydrate`\n * is `true`.\n * - Creates a new dehydration key, if necessary, and stores it in Secret\n * Storage.\n * - If `opts.createNewKey` is set to true, always creates a new key.\n * - If a dehydration key is not available, creates a new one.\n * - Creates a new dehydrated device, and schedules periodically creating\n * new dehydrated devices.\n *\n * @param opts - options for device dehydration. For backwards compatibility\n * with old code, a boolean can be given here, which will be treated as\n * the `createNewKey` option. However, this is deprecated.\n */\n start() {\n var _arguments = arguments,\n _this3 = this;\n return _asyncToGenerator(function* () {\n var opts = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};\n if (typeof opts === \"boolean\") {\n opts = {\n createNewKey: opts\n };\n }\n if (opts.onlyIfKeyCached && !(yield _this3.olmMachine.dehydratedDevices().getDehydratedDeviceKey())) {\n return;\n }\n _this3.stop();\n if (opts.rehydrate !== false) {\n try {\n yield _this3.rehydrateDeviceIfAvailable();\n } catch (e) {\n // If rehydration fails, there isn't much we can do about it. Log\n // the error, and create a new device.\n _this3.logger.info(\"dehydration: Error rehydrating device:\", e);\n _this3.emit(CryptoEvent.RehydrationError, e.message);\n }\n }\n if (opts.createNewKey) {\n yield _this3.resetKey();\n }\n yield _this3.scheduleDeviceDehydration();\n })();\n }\n\n /**\n * Return whether the dehydration key is stored in Secret Storage.\n */\n isKeyStored() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n return Boolean(yield _this4.secretStorage.isStored(SECRET_STORAGE_NAME));\n })();\n }\n\n /**\n * Reset the dehydration key.\n *\n * Creates a new key and stores it in secret storage.\n *\n * @returns The newly-generated key.\n */\n resetKey() {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n var key = RustSdkCryptoJs.DehydratedDeviceKey.createRandomKey();\n yield _this5.secretStorage.store(SECRET_STORAGE_NAME, key.toBase64());\n // Also cache it in the rust SDK's crypto store.\n yield _this5.cacheKey(key);\n return key;\n })();\n }\n\n /**\n * Get and cache the encryption key from secret storage.\n *\n * If `create` is `true`, creates a new key if no existing key is present.\n *\n * @returns the key, if available, or `null` if no key is available\n */\n getKey(create) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n var cachedKey = yield _this6.olmMachine.dehydratedDevices().getDehydratedDeviceKey();\n if (cachedKey) return cachedKey;\n var keyB64 = yield _this6.secretStorage.get(SECRET_STORAGE_NAME);\n if (keyB64 === undefined) {\n if (!create) {\n return null;\n }\n return yield _this6.resetKey();\n }\n\n // We successfully found the key in secret storage: decode it, and cache it in\n // the rust SDK's crypto store.\n var bytes = decodeBase64(keyB64);\n try {\n var key = RustSdkCryptoJs.DehydratedDeviceKey.createKeyFromArray(bytes);\n yield _this6.cacheKey(key);\n return key;\n } finally {\n bytes.fill(0);\n }\n })();\n }\n\n /**\n * Rehydrate the dehydrated device stored on the server.\n *\n * Checks if there is a dehydrated device on the server. If so, rehydrates\n * the device and processes the to-device events.\n *\n * Returns whether or not a dehydrated device was found.\n */\n rehydrateDeviceIfAvailable() {\n var _this7 = this;\n return _asyncToGenerator(function* () {\n var key = yield _this7.getKey(false);\n if (!key) {\n return false;\n }\n var dehydratedDeviceResp;\n try {\n dehydratedDeviceResp = yield _this7.http.authedRequest(Method.Get, \"/dehydrated_device\", undefined, undefined, {\n prefix: UnstablePrefix\n });\n } catch (error) {\n var err = error;\n // We ignore M_NOT_FOUND (there is no dehydrated device, so nothing\n // us to do) and M_UNRECOGNIZED (the server does not understand the\n // endpoint). We pass through any other errors.\n if (err.errcode === \"M_NOT_FOUND\" || err.errcode === \"M_UNRECOGNIZED\") {\n _this7.logger.info(\"dehydration: No dehydrated device\");\n return false;\n }\n throw err;\n }\n _this7.logger.info(\"dehydration: dehydrated device found\");\n _this7.emit(CryptoEvent.RehydrationStarted);\n var rehydratedDevice = yield _this7.olmMachine.dehydratedDevices().rehydrate(key, new RustSdkCryptoJs.DeviceId(dehydratedDeviceResp.device_id), JSON.stringify(dehydratedDeviceResp.device_data));\n _this7.logger.info(\"dehydration: device rehydrated\");\n var nextBatch = undefined;\n var toDeviceCount = 0;\n var roomKeyCount = 0;\n var path = encodeUri(\"/dehydrated_device/$device_id/events\", {\n $device_id: dehydratedDeviceResp.device_id\n });\n // eslint-disable-next-line no-constant-condition\n while (true) {\n var eventResp = yield _this7.http.authedRequest(Method.Post, path, undefined, nextBatch ? {\n next_batch: nextBatch\n } : {}, {\n prefix: UnstablePrefix\n });\n if (eventResp.events.length === 0) {\n break;\n }\n toDeviceCount += eventResp.events.length;\n nextBatch = eventResp.next_batch;\n var roomKeyInfos = yield rehydratedDevice.receiveEvents(JSON.stringify(eventResp.events));\n roomKeyCount += roomKeyInfos.length;\n _this7.emit(CryptoEvent.RehydrationProgress, roomKeyCount, toDeviceCount);\n }\n _this7.logger.info(\"dehydration: received \".concat(roomKeyCount, \" room keys from \").concat(toDeviceCount, \" to-device events\"));\n _this7.emit(CryptoEvent.RehydrationCompleted);\n return true;\n })();\n }\n\n /**\n * Creates and uploads a new dehydrated device.\n *\n * Creates and stores a new key in secret storage if none is available.\n */\n createAndUploadDehydratedDevice() {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n var key = yield _this8.getKey(true);\n var dehydratedDevice = yield _this8.olmMachine.dehydratedDevices().create();\n _this8.emit(CryptoEvent.DehydratedDeviceCreated);\n var request = yield dehydratedDevice.keysForUpload(\"Dehydrated device\", key);\n yield _this8.outgoingRequestProcessor.makeOutgoingRequest(request);\n _this8.emit(CryptoEvent.DehydratedDeviceUploaded);\n _this8.logger.info(\"dehydration: uploaded device\");\n })();\n }\n\n /**\n * Schedule periodic creation of dehydrated devices.\n */\n scheduleDeviceDehydration() {\n var _this9 = this;\n return _asyncToGenerator(function* () {\n // cancel any previously-scheduled tasks\n _this9.stop();\n yield _this9.createAndUploadDehydratedDevice();\n _this9.intervalId = setInterval(() => {\n _this9.createAndUploadDehydratedDevice().catch(error => {\n _this9.emit(CryptoEvent.DehydratedDeviceRotationError, error.message);\n _this9.logger.error(\"Error creating dehydrated device:\", error);\n });\n }, DEHYDRATION_INTERVAL);\n })();\n }\n\n /**\n * Stop the dehydrated device manager.\n *\n * Cancels any scheduled dehydration tasks.\n */\n stop() {\n if (this.intervalId) {\n clearInterval(this.intervalId);\n this.intervalId = undefined;\n }\n }\n\n /**\n * Delete the current dehydrated device and stop the dehydrated device manager.\n */\n delete() {\n var _this0 = this;\n return _asyncToGenerator(function* () {\n _this0.stop();\n try {\n yield _this0.http.authedRequest(Method.Delete, \"/dehydrated_device\", undefined, {}, {\n prefix: UnstablePrefix\n });\n } catch (error) {\n var err = error;\n // If dehydrated devices aren't supported, or no dehydrated device\n // is found, we don't consider it an error, because we we'll end up\n // with no dehydrated device.\n if (err.errcode === \"M_UNRECOGNIZED\") {\n return;\n } else if (err.errcode === \"M_NOT_FOUND\") {\n return;\n }\n throw error;\n }\n })();\n }\n}\n\n/**\n * The events fired by the DehydratedDeviceManager\n * @internal\n */\n\n/**\n * A map of the {@link DehydratedDeviceEvents} fired by the {@link DehydratedDeviceManager} and their payloads.\n * @internal\n */\n//# sourceMappingURL=DehydratedDeviceManager.js.map","import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { KeysBackupRequest, KeysClaimRequest, KeysQueryRequest, KeysUploadRequest, PutDehydratedDeviceRequest, RoomMessageRequest, SignatureUploadRequest, ToDeviceRequest, UploadSigningKeysRequest } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { calculateRetryBackoff, Method } from \"../http-api/index.js\";\nimport { logDuration, sleep } from \"../utils.js\";\nimport { ToDeviceMessageId } from \"../@types/event.js\";\nimport { UnstablePrefix as DehydrationUnstablePrefix } from \"./DehydratedDeviceManager.js\";\n\n/**\n * OutgoingRequestManager: turns `OutgoingRequest`s from the rust sdk into HTTP requests\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`), not that it does anything terribly complicated.\n * It's responsible for:\n *\n * * holding the reference to the `MatrixHttpApi`\n * * turning `OutgoingRequest`s from the rust backend into HTTP requests, and sending them\n * * sending the results of such requests back to the rust backend.\n *\n * @internal\n */\nexport class OutgoingRequestProcessor {\n constructor(logger, olmMachine, http) {\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.http = http;\n }\n makeOutgoingRequest(msg, uiaCallback) {\n var _this = this;\n return _asyncToGenerator(function* () {\n var resp;\n\n /* refer https://docs.rs/matrix-sdk-crypto/0.6.0/matrix_sdk_crypto/requests/enum.OutgoingRequests.html\n * for the complete list of request types\n */\n if (msg instanceof KeysUploadRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/upload\", {}, msg.body);\n } else if (msg instanceof KeysQueryRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/query\", {}, msg.body);\n } else if (msg instanceof KeysClaimRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/claim\", {}, msg.body);\n } else if (msg instanceof SignatureUploadRequest) {\n resp = yield _this.requestWithRetry(Method.Post, \"/_matrix/client/v3/keys/signatures/upload\", {}, msg.body);\n } else if (msg instanceof KeysBackupRequest) {\n resp = yield _this.requestWithRetry(Method.Put, \"/_matrix/client/v3/room_keys/keys\", {\n version: msg.version\n }, msg.body);\n } else if (msg instanceof ToDeviceRequest) {\n resp = yield _this.sendToDeviceRequest(msg);\n } else if (msg instanceof RoomMessageRequest) {\n var path = \"/_matrix/client/v3/rooms/\".concat(encodeURIComponent(msg.room_id), \"/send/\") + \"\".concat(encodeURIComponent(msg.event_type), \"/\").concat(encodeURIComponent(msg.txn_id));\n resp = yield _this.requestWithRetry(Method.Put, path, {}, msg.body);\n } else if (msg instanceof UploadSigningKeysRequest) {\n yield _this.makeRequestWithUIA(Method.Post, \"/_matrix/client/v3/keys/device_signing/upload\", {}, msg.body, uiaCallback);\n // SigningKeysUploadRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else if (msg instanceof PutDehydratedDeviceRequest) {\n var _path = DehydrationUnstablePrefix + \"/dehydrated_device\";\n yield _this.rawJsonRequest(Method.Put, _path, {}, msg.body);\n // PutDehydratedDeviceRequest does not implement OutgoingRequest and does not need to be marked as sent.\n return;\n } else {\n _this.logger.warn(\"Unsupported outgoing message\", Object.getPrototypeOf(msg));\n resp = \"\";\n }\n if (msg.id) {\n try {\n yield logDuration(_this.logger, \"Mark Request as sent \".concat(msg.type), /*#__PURE__*/_asyncToGenerator(function* () {\n yield _this.olmMachine.markRequestAsSent(msg.id, msg.type, resp);\n }));\n } catch (e) {\n // Ignore errors which are caused by the olmMachine having been freed. The exact error message depends\n // on whether we are using a release or develop build of rust-sdk-crypto-wasm.\n if (e instanceof Error && (e.message === \"Attempt to use a moved value\" || e.message === \"null pointer passed to rust\")) {\n _this.logger.debug(\"Ignoring error '\".concat(e.message, \"': client is likely shutting down\"));\n } else {\n throw e;\n }\n }\n } else {\n _this.logger.trace(\"Outgoing request type:\".concat(msg.type, \" does not have an ID\"));\n }\n })();\n }\n\n /**\n * Send the HTTP request for a `ToDeviceRequest`\n *\n * @param request - request to send\n * @returns JSON-serialized body of the response, if successful\n */\n sendToDeviceRequest(request) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // a bit of extra logging, to help trace to-device messages through the system\n var parsedBody = JSON.parse(request.body);\n var messageList = [];\n for (var [userId, perUserMessages] of Object.entries(parsedBody.messages)) {\n for (var [deviceId, message] of Object.entries(perUserMessages)) {\n messageList.push(\"\".concat(userId, \"/\").concat(deviceId, \" (msgid \").concat(message[ToDeviceMessageId], \")\"));\n }\n }\n _this2.logger.info(\"Sending batch of to-device messages. type=\".concat(request.event_type, \" txnid=\").concat(request.txn_id), messageList);\n var path = \"/_matrix/client/v3/sendToDevice/\".concat(encodeURIComponent(request.event_type), \"/\") + encodeURIComponent(request.txn_id);\n return yield _this2.requestWithRetry(Method.Put, path, {}, request.body);\n })();\n }\n makeRequestWithUIA(method, path, queryParams, body, uiaCallback) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (!uiaCallback) {\n return yield _this3.requestWithRetry(method, path, queryParams, body);\n }\n var parsedBody = JSON.parse(body);\n var makeRequest = /*#__PURE__*/function () {\n var _ref2 = _asyncToGenerator(function* (auth) {\n var newBody = _objectSpread({}, parsedBody);\n if (auth !== null) {\n newBody.auth = auth;\n }\n var resp = yield _this3.requestWithRetry(method, path, queryParams, JSON.stringify(newBody));\n return JSON.parse(resp);\n });\n return function makeRequest(_x) {\n return _ref2.apply(this, arguments);\n };\n }();\n var resp = yield uiaCallback(makeRequest);\n return JSON.stringify(resp);\n })();\n }\n requestWithRetry(method, path, queryParams, body) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n var currentRetryCount = 0;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n return yield _this4.rawJsonRequest(method, path, queryParams, body);\n } catch (e) {\n currentRetryCount++;\n var backoff = calculateRetryBackoff(e, currentRetryCount, true);\n if (backoff < 0) {\n // Max number of retries reached, or error is not retryable. rethrow the error\n throw e;\n }\n // wait for the specified time and then retry the request\n yield sleep(backoff);\n }\n }\n })();\n }\n rawJsonRequest(method, path, queryParams, body) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n var opts = {\n // inhibit the JSON stringification and parsing within HttpApi.\n json: false,\n // nevertheless, we are sending, and accept, JSON.\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\"\n },\n // we use the full prefix\n prefix: \"\",\n // We set a timeout of 60 seconds to guard against requests getting stuck forever and wedging the\n // request loop (cf https://github.com/element-hq/element-web/issues/29534).\n //\n // (XXX: should we do this in the whole of the js-sdk?)\n localTimeoutMs: 60000\n };\n return yield _this5.http.authedRequest(method, path, queryParams, body, opts);\n })();\n }\n}\n//# sourceMappingURL=OutgoingRequestProcessor.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * KeyClaimManager: linearises calls to OlmMachine.getMissingSessions to avoid races\n *\n * We have one of these per `RustCrypto` (and hence per `MatrixClient`).\n *\n * @internal\n */\nexport class KeyClaimManager {\n constructor(olmMachine, outgoingRequestProcessor) {\n this.olmMachine = olmMachine;\n this.outgoingRequestProcessor = outgoingRequestProcessor;\n _defineProperty(this, \"currentClaimPromise\", void 0);\n _defineProperty(this, \"stopped\", false);\n this.currentClaimPromise = Promise.resolve();\n }\n\n /**\n * Tell the KeyClaimManager to immediately stop processing requests.\n *\n * Any further calls, and any still in the queue, will fail with an error.\n */\n stop() {\n this.stopped = true;\n }\n\n /**\n * Given a list of users, attempt to ensure that we have Olm Sessions active with each of their devices\n *\n * If we don't have an active olm session, we will claim a one-time key and start one.\n * @param logger - logger to use\n * @param userList - list of userIDs to claim\n */\n ensureSessionsForUsers(logger, userList) {\n // The Rust-SDK requires that we only have one getMissingSessions process in flight at once. This little dance\n // ensures that, by only having one call to ensureSessionsForUsersInner active at once (and making them\n // queue up in order).\n var prom = this.currentClaimPromise.catch(() => {\n // any errors in the previous claim will have been reported already, so there is nothing to do here.\n // we just throw away the error and start anew.\n }).then(() => this.ensureSessionsForUsersInner(logger, userList));\n this.currentClaimPromise = prom;\n return prom;\n }\n ensureSessionsForUsersInner(logger, userList) {\n var _this = this;\n return _asyncToGenerator(function* () {\n // bail out quickly if we've been stopped.\n if (_this.stopped) {\n throw new Error(\"Cannot ensure Olm sessions: shutting down\");\n }\n logger.info(\"Checking for missing Olm sessions\");\n // By passing the userId array to rust we transfer ownership of the items to rust, causing\n // them to be invalidated on the JS side as soon as the method is called.\n // As we haven't created the `userList` let's clone the users, to not break the caller from re-using it.\n var claimRequest = yield _this.olmMachine.getMissingSessions(userList.map(u => u.clone()));\n if (claimRequest) {\n logger.info(\"Making /keys/claim request\");\n yield _this.outgoingRequestProcessor.makeOutgoingRequest(claimRequest);\n }\n logger.info(\"Olm sessions prepared\");\n })();\n }\n}\n//# sourceMappingURL=KeyClaimManager.js.map","/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport * as RustSdkCryptoJs from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport { Device, DeviceVerification } from \"../models/device.js\";\n/**\n * Convert a {@link RustSdkCryptoJs.Device} to a {@link Device}\n * @param device - Rust Sdk device\n * @param userId - owner of the device\n *\n * @internal\n */\nexport function rustDeviceToJsDevice(device, userId) {\n // Copy rust device keys to Device.keys\n var keys = new Map();\n for (var [keyId, key] of device.keys.entries()) {\n keys.set(keyId.toString(), key.toBase64());\n }\n\n // Compute verified from device state\n var verified = DeviceVerification.Unverified;\n if (device.isBlacklisted()) {\n verified = DeviceVerification.Blocked;\n } else if (device.isVerified()) {\n verified = DeviceVerification.Verified;\n }\n\n // Convert rust signatures to Device.signatures\n var signatures = new Map();\n var mayBeSignatureMap = device.signatures.get(userId);\n if (mayBeSignatureMap) {\n var convertedSignatures = new Map();\n // Convert maybeSignatures map to a Map<string, string>\n for (var [_key, value] of mayBeSignatureMap.entries()) {\n if (value.isValid() && value.signature) {\n convertedSignatures.set(_key, value.signature.toBase64());\n }\n }\n signatures.set(userId.toString(), convertedSignatures);\n }\n\n // Convert rust algorithms to algorithms\n var rustAlgorithms = device.algorithms;\n // Use set to ensure that algorithms are not duplicated\n var algorithms = new Set();\n rustAlgorithms.forEach(algorithm => {\n switch (algorithm) {\n case RustSdkCryptoJs.EncryptionAlgorithm.MegolmV1AesSha2:\n algorithms.add(\"m.megolm.v1.aes-sha2\");\n break;\n case RustSdkCryptoJs.EncryptionAlgorithm.OlmV1Curve25519AesSha2:\n default:\n algorithms.add(\"m.olm.v1.curve25519-aes-sha2\");\n break;\n }\n });\n return new Device({\n deviceId: device.deviceId.toString(),\n userId: userId.toString(),\n keys,\n algorithms: Array.from(algorithms),\n verified,\n signatures,\n displayName: device.displayName,\n dehydrated: device.isDehydrated\n });\n}\n\n/**\n * Convert {@link DeviceKeys} from `/keys/query` request to a `Map<string, Device>`\n * @param deviceKeys - Device keys object to convert\n *\n * @internal\n */\nexport function deviceKeysToDeviceMap(deviceKeys) {\n return new Map(Object.entries(deviceKeys).map(_ref => {\n var [deviceId, device] = _ref;\n return [deviceId, downloadDeviceToJsDevice(device)];\n }));\n}\n\n// Device from `/keys/query` request\n\n/**\n * Convert `/keys/query` {@link QueryDevice} device to {@link Device}\n * @param device - Device from `/keys/query` request\n *\n * @internal\n */\nexport function downloadDeviceToJsDevice(device) {\n var _device$unsigned;\n var keys = new Map(Object.entries(device.keys));\n var displayName = (_device$unsigned = device.unsigned) === null || _device$unsigned === void 0 ? void 0 : _device$unsigned.device_display_name;\n var signatures = new Map();\n if (device.signatures) {\n for (var userId in device.signatures) {\n signatures.set(userId, new Map(Object.entries(device.signatures[userId])));\n }\n }\n return new Device({\n deviceId: device.device_id,\n userId: device.user_id,\n keys,\n algorithms: device.algorithms,\n verified: DeviceVerification.Unverified,\n signatures,\n displayName\n });\n}\n//# sourceMappingURL=device-converter.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/** Manages the cross-signing keys for our own user.\n *\n * @internal\n */\nexport class CrossSigningIdentity {\n constructor(logger, olmMachine, outgoingRequestProcessor, secretStorage) {\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.outgoingRequestProcessor = outgoingRequestProcessor;\n this.secretStorage = secretStorage;\n }\n\n /**\n * Initialise our cross-signing keys by creating new keys if they do not exist, and uploading to the server\n */\n bootstrapCrossSigning(opts) {\n var _this = this;\n return _asyncToGenerator(function* () {\n if (opts.setupNewCrossSigning) {\n yield _this.resetCrossSigning(opts.authUploadDeviceSigningKeys);\n return;\n }\n var olmDeviceStatus = yield _this.olmMachine.crossSigningStatus();\n\n // Try to fetch cross signing keys from the secret storage\n var masterKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.master\");\n var selfSigningKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.self_signing\");\n var userSigningKeyFromSecretStorage = yield _this.secretStorage.get(\"m.cross_signing.user_signing\");\n var privateKeysInSecretStorage = Boolean(masterKeyFromSecretStorage && selfSigningKeyFromSecretStorage && userSigningKeyFromSecretStorage);\n var olmDeviceHasKeys = olmDeviceStatus.hasMaster && olmDeviceStatus.hasUserSigning && olmDeviceStatus.hasSelfSigning;\n\n // Log all relevant state for easier parsing of debug logs.\n _this.logger.debug(\"bootstrapCrossSigning: starting\", {\n setupNewCrossSigning: opts.setupNewCrossSigning,\n olmDeviceHasMaster: olmDeviceStatus.hasMaster,\n olmDeviceHasUserSigning: olmDeviceStatus.hasUserSigning,\n olmDeviceHasSelfSigning: olmDeviceStatus.hasSelfSigning,\n privateKeysInSecretStorage\n });\n if (olmDeviceHasKeys) {\n if (!(yield _this.secretStorage.hasKey())) {\n _this.logger.warn(\"bootstrapCrossSigning: Olm device has private keys, but secret storage is not yet set up; doing nothing for now.\");\n // the keys should get uploaded to 4S once that is set up.\n } else if (!privateKeysInSecretStorage) {\n // the device has the keys but they are not in 4S, so update it\n _this.logger.debug(\"bootstrapCrossSigning: Olm device has private keys: exporting to secret storage\");\n yield _this.exportCrossSigningKeysToStorage();\n } else {\n _this.logger.debug(\"bootstrapCrossSigning: Olm device has private keys and they are saved in secret storage; doing nothing\");\n }\n } /* (!olmDeviceHasKeys) */else {\n if (privateKeysInSecretStorage) {\n // they are in 4S, so import from there\n _this.logger.debug(\"bootstrapCrossSigning: Cross-signing private keys not found locally, but they are available \" + \"in secret storage, reading storage and caching locally\");\n var status = yield _this.olmMachine.importCrossSigningKeys(masterKeyFromSecretStorage, selfSigningKeyFromSecretStorage, userSigningKeyFromSecretStorage);\n\n // Check that `importCrossSigningKeys` worked correctly (for example, it will fail silently if the\n // public keys are not available).\n if (!status.hasMaster || !status.hasSelfSigning || !status.hasUserSigning) {\n throw new Error(\"importCrossSigningKeys failed to import the keys\");\n }\n\n // Get the current device\n var device = yield _this.olmMachine.getDevice(_this.olmMachine.userId, _this.olmMachine.deviceId);\n try {\n // Sign the device with our cross-signing key and upload the signature\n var request = yield device.verify();\n yield _this.outgoingRequestProcessor.makeOutgoingRequest(request);\n } finally {\n device.free();\n }\n } else {\n _this.logger.debug(\"bootstrapCrossSigning: Cross-signing private keys not found locally or in secret storage, creating new keys\");\n yield _this.resetCrossSigning(opts.authUploadDeviceSigningKeys);\n }\n }\n\n // TODO: we might previously have bootstrapped cross-signing but not completed uploading the keys to the\n // server -- in which case we should call OlmDevice.bootstrap_cross_signing. How do we know?\n _this.logger.debug(\"bootstrapCrossSigning: complete\");\n })();\n }\n\n /** Reset our cross-signing keys\n *\n * This method will:\n * * Tell the OlmMachine to create new keys\n * * Upload the new public keys and the device signature to the server\n * * Upload the private keys to SSSS, if it is set up\n */\n resetCrossSigning(authUploadDeviceSigningKeys) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n // XXX: We must find a way to make this atomic, currently if the user does not remember his account password\n // or 4S passphrase/key the process will fail in a bad state, with keys rotated but not uploaded or saved in 4S.\n var outgoingRequests = yield _this2.olmMachine.bootstrapCrossSigning(true);\n\n // If 4S is configured we need to update it.\n if (!(yield _this2.secretStorage.hasKey())) {\n _this2.logger.warn(\"resetCrossSigning: Secret storage is not yet set up; not exporting keys to secret storage yet.\");\n // the keys should get uploaded to 4S once that is set up.\n } else {\n // Update 4S before uploading cross-signing keys, to stay consistent with legacy that asks\n // 4S passphrase before asking for account password.\n // Ultimately should be made atomic and resistant to forgotten password/passphrase.\n _this2.logger.debug(\"resetCrossSigning: exporting private keys to secret storage\");\n yield _this2.exportCrossSigningKeysToStorage();\n }\n _this2.logger.debug(\"resetCrossSigning: publishing public keys to server\");\n for (var req of [outgoingRequests.uploadKeysRequest, outgoingRequests.uploadSigningKeysRequest, outgoingRequests.uploadSignaturesRequest]) {\n if (req) {\n yield _this2.outgoingRequestProcessor.makeOutgoingRequest(req, authUploadDeviceSigningKeys);\n }\n }\n })();\n }\n\n /**\n * Extract the cross-signing keys from the olm machine and save them to secret storage, if it is configured\n *\n * (If secret storage is *not* configured, we assume that the export will happen when it is set up)\n */\n exportCrossSigningKeysToStorage() {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n var exported = yield _this3.olmMachine.exportCrossSigningKeys();\n /* istanbul ignore else (this function is only called when we know the olm machine has keys) */\n if (exported !== null && exported !== void 0 && exported.masterKey) {\n yield _this3.secretStorage.store(\"m.cross_signing.master\", exported.masterKey);\n } else {\n _this3.logger.error(\"Cannot export MSK to secret storage, private key unknown\");\n }\n if (exported !== null && exported !== void 0 && exported.self_signing_key) {\n yield _this3.secretStorage.store(\"m.cross_signing.self_signing\", exported.self_signing_key);\n } else {\n _this3.logger.error(\"Cannot export SSK to secret storage, private key unknown\");\n }\n if (exported !== null && exported !== void 0 && exported.userSigningKey) {\n yield _this3.secretStorage.store(\"m.cross_signing.user_signing\", exported.userSigningKey);\n } else {\n _this3.logger.error(\"Cannot export USK to secret storage, private key unknown\");\n }\n })();\n }\n}\n//# sourceMappingURL=CrossSigningIdentity.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\n/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n/**\n * Check that the private cross signing keys (master, self signing, user signing) are stored in the secret storage and encrypted with the default secret storage key.\n *\n * @param secretStorage - The secret store using account data\n * @returns True if the cross-signing keys are all stored and encrypted with the same secret storage key.\n *\n * @internal\n */\nexport function secretStorageContainsCrossSigningKeys(_x) {\n return _secretStorageContainsCrossSigningKeys.apply(this, arguments);\n}\n\n/**\n *\n * Check that the secret storage can access the given secrets using the default key.\n *\n * @param secretStorage - The secret store using account data\n * @param secretNames - The secret names to check\n * @returns True if all the given secrets are accessible and encrypted with the given key.\n *\n * @internal\n */\nfunction _secretStorageContainsCrossSigningKeys() {\n _secretStorageContainsCrossSigningKeys = _asyncToGenerator(function* (secretStorage) {\n return secretStorageCanAccessSecrets(secretStorage, [\"m.cross_signing.master\", \"m.cross_signing.user_signing\", \"m.cross_signing.self_signing\"]);\n });\n return _secretStorageContainsCrossSigningKeys.apply(this, arguments);\n}\nexport function secretStorageCanAccessSecrets(_x2, _x3) {\n return _secretStorageCanAccessSecrets.apply(this, arguments);\n}\nfunction _secretStorageCanAccessSecrets() {\n _secretStorageCanAccessSecrets = _asyncToGenerator(function* (secretStorage, secretNames) {\n var defaultKeyId = yield secretStorage.getDefaultKeyId();\n if (!defaultKeyId) return false;\n for (var secretName of secretNames) {\n // check which keys this particular secret is encrypted with\n var record = (yield secretStorage.isStored(secretName)) || {};\n // if it's not encrypted with the right key, there is no point continuing\n if (!(defaultKeyId in record)) return false;\n }\n return true;\n });\n return _secretStorageCanAccessSecrets.apply(this, arguments);\n}\n//# sourceMappingURL=secret-storage.js.map","/*\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 server-side key backup\");\n return false;\n }\n var backupDecryptionKey;\n try {\n backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(secret);\n } catch (e) {\n _this4.logger.warn(\"handleBackupSecretReceived: Invalid backup decryption key\", e);\n return false;\n }\n try {\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 server-side backup version (\".concat(latestBackupInfo.version, \")\"));\n // just ignore the secret\n return false;\n }\n _this4.logger.info(\"handleBackupSecretReceived: Valid decryption key for the current server-side backup version (\".concat(latestBackupInfo.version, \") received\"));\n yield _this4.saveBackupDecryptionKey(backupDecryptionKey, latestBackupInfo.version);\n return true;\n } catch (e) {\n _this4.logger.warn(\"handleBackupSecretReceived: Unable to validate 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 * Download and import the keys for a given room from the current backup version.\n *\n * @param roomId - The room in question.\n */\n downloadLatestRoomKeyBackup(roomId) {\n var _this17 = this;\n return _asyncToGenerator(function* () {\n var {\n backupVersion,\n decryptionKey\n } = yield _this17.olmMachine.getBackupKeys();\n if (!backupVersion || !decryptionKey) {\n _this17.logger.warn(\"downloadLatestRoomKeyBackup: Could not download backup (backupVersion=\".concat(backupVersion, \", hasDecryptionKey=\").concat(!!decryptionKey, \")\"));\n return;\n }\n var sessions = yield _this17.downloadRoomKeyBackup(backupVersion, roomId);\n var backupDecryptor = _this17.createBackupDecryptor(decryptionKey);\n _this17.importKeyBackup({\n rooms: {\n [roomId]: {\n sessions\n }\n }\n }, backupVersion, backupDecryptor);\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 * Call `/room/keys/keys/{roomId}` to download the key backup (room keys) for a given backup version and room ID.\n * @param backupVersion - The version to download.\n * @param roomId - The ID of the room.\n * @returns The key backup response.\n */\n downloadRoomKeyBackup(backupVersion, roomId) {\n var path = encodeUri(\"/room_keys/keys/$roomId\", {\n $roomId: roomId\n });\n return this.http.authedRequest(Method.Get, path, {\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 _this18 = 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 _this18.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 _this18.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 _this19 = this;\n return _asyncToGenerator(function* () {\n var keys = [];\n for (var [sessionId, sessionData] of Object.entries(ciphertexts)) {\n try {\n var decrypted = JSON.parse(_this19.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 _this19.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, DecryptionKeyDoesNotMatchError, 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/** The maximum time, in milliseconds, since we accepted an invite, that we should accept a key bundle. */\nexport var MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE = 24 * 60 * 60 * 1000; // 24 hours\n\n/**\n * An implementation of {@link CryptoBackend} using the Rust matrix-sdk-crypto.\n *\n * @internal\n */\nexport class RustCrypto extends TypedEventEmitter {\n constructor(logger, /** The `OlmMachine` from the underlying rust crypto sdk. */\n olmMachine,\n /**\n * Low-level HTTP interface: used to make outgoing requests required by the rust SDK.\n *\n * We expect it to set the access token, etc.\n */\n http, /** The local user's User ID. */\n userId, /** The local user's Device ID. */\n _deviceId, /** Interface to server-side secret storage */\n secretStorage, /** Crypto callbacks provided by the application */\n cryptoCallbacks) {\n var enableEncryptedStateEvents = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;\n super();\n this.logger = logger;\n this.olmMachine = olmMachine;\n this.http = http;\n this.userId = userId;\n this.secretStorage = secretStorage;\n this.cryptoCallbacks = cryptoCallbacks;\n this.enableEncryptedStateEvents = enableEncryptedStateEvents;\n /**\n * The number of iterations to use when deriving a recovery key from a passphrase.\n */\n _defineProperty(this, \"RECOVERY_KEY_DERIVATION_ITERATIONS\", 500000);\n _defineProperty(this, \"_trustCrossSignedDevices\", true);\n _defineProperty(this, \"deviceIsolationMode\", new AllDevicesIsolationMode(false));\n /** whether {@link stop} has been called */\n _defineProperty(this, \"stopped\", false);\n /** mapping of roomId → encryptor class */\n _defineProperty(this, \"roomEncryptors\", {});\n _defineProperty(this, \"eventDecryptor\", void 0);\n _defineProperty(this, \"keyClaimManager\", void 0);\n _defineProperty(this, \"outgoingRequestProcessor\", void 0);\n _defineProperty(this, \"crossSigningIdentity\", void 0);\n _defineProperty(this, \"backupManager\", void 0);\n _defineProperty(this, \"outgoingRequestsManager\", void 0);\n _defineProperty(this, \"perSessionBackupDownloader\", void 0);\n _defineProperty(this, \"dehydratedDeviceManager\", void 0);\n _defineProperty(this, \"reemitter\", new TypedReEmitter(this));\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // CryptoApi implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n _defineProperty(this, \"globalBlacklistUnverifiedDevices\", false);\n /**\n * The verification methods we offer to the other side during an interactive verification.\n */\n _defineProperty(this, \"_supportedVerificationMethods\", ALL_VERIFICATION_METHODS);\n this.outgoingRequestProcessor = new OutgoingRequestProcessor(logger, olmMachine, http);\n this.outgoingRequestsManager = new OutgoingRequestsManager(this.logger, olmMachine, this.outgoingRequestProcessor);\n this.keyClaimManager = new KeyClaimManager(olmMachine, this.outgoingRequestProcessor);\n this.backupManager = new RustBackupManager(logger, olmMachine, http, this.outgoingRequestProcessor);\n this.perSessionBackupDownloader = new PerSessionKeyBackupDownloader(this.logger, this.olmMachine, this.http, this.backupManager);\n this.dehydratedDeviceManager = new DehydratedDeviceManager(this.logger, olmMachine, http, this.outgoingRequestProcessor, secretStorage);\n this.eventDecryptor = new EventDecryptor(this.logger, olmMachine, this.perSessionBackupDownloader);\n\n // re-emit the events emitted by managers\n this.reemitter.reEmit(this.backupManager, [CryptoEvent.KeyBackupStatus, CryptoEvent.KeyBackupSessionsRemaining, CryptoEvent.KeyBackupFailed, CryptoEvent.KeyBackupDecryptionKeyCached]);\n this.reemitter.reEmit(this.dehydratedDeviceManager, [CryptoEvent.DehydratedDeviceCreated, CryptoEvent.DehydratedDeviceUploaded, CryptoEvent.RehydrationStarted, CryptoEvent.RehydrationProgress, CryptoEvent.RehydrationCompleted, CryptoEvent.RehydrationError, CryptoEvent.DehydrationKeyCached, CryptoEvent.DehydratedDeviceRotationError]);\n this.crossSigningIdentity = new CrossSigningIdentity(logger, olmMachine, this.outgoingRequestProcessor, secretStorage);\n\n // Check and start in background the key backup connection\n this.checkKeyBackupAndEnable();\n }\n\n /**\n * Return the OlmMachine only if {@link RustCrypto#stop} has not been called.\n *\n * This allows us to better handle race conditions where the client is stopped before or during a crypto API call.\n *\n * @throws ClientStoppedError if {@link RustCrypto#stop} has been called.\n */\n getOlmMachineOrThrow() {\n if (this.stopped) {\n throw new ClientStoppedError();\n }\n return this.olmMachine;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // CryptoBackend implementation\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n set globalErrorOnUnknownDevices(_v) {\n // Not implemented for rust crypto.\n }\n get globalErrorOnUnknownDevices() {\n // Not implemented for rust crypto.\n return false;\n }\n stop() {\n // stop() may be called multiple times, but attempting to close() the OlmMachine twice\n // will cause an error.\n if (this.stopped) {\n return;\n }\n this.stopped = true;\n this.keyClaimManager.stop();\n this.backupManager.stop();\n this.outgoingRequestsManager.stop();\n this.perSessionBackupDownloader.stop();\n this.dehydratedDeviceManager.stop();\n\n // make sure we close() the OlmMachine; doing so means that all the Rust objects will be\n // cleaned up; in particular, the indexeddb connections will be closed, which means they\n // can then be deleted.\n this.olmMachine.close();\n }\n encryptEvent(event, _room) {\n var _this = this;\n return _asyncToGenerator(function* () {\n var roomId = event.getRoomId();\n var encryptor = _this.roomEncryptors[roomId];\n if (!encryptor) {\n throw new Error(\"Cannot encrypt event in unconfigured room \".concat(roomId));\n }\n yield encryptor.encryptEvent(event, _this.globalBlacklistUnverifiedDevices, _this.deviceIsolationMode);\n })();\n }\n decryptEvent(event) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n var roomId = event.getRoomId();\n if (!roomId) {\n // presumably, a to-device message. These are normally decrypted in preprocessToDeviceMessages\n // so the fact it has come back here suggests that decryption failed.\n //\n // once we drop support for the libolm crypto implementation, we can stop passing to-device messages\n // through decryptEvent and hence get rid of this case.\n throw new Error(\"to-device event was not decrypted in preprocessToDeviceMessages\");\n }\n return yield _this2.eventDecryptor.attemptEventDecryption(event, _this2.deviceIsolationMode);\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend#getBackupDecryptor}.\n */\n getBackupDecryptor(backupInfo, privKey) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (!(privKey instanceof Uint8Array)) {\n throw new Error(\"getBackupDecryptor: expects Uint8Array\");\n }\n if (backupInfo.algorithm != \"m.megolm_backup.v1.curve25519-aes-sha2\") {\n throw new Error(\"getBackupDecryptor: Unsupported algorithm \".concat(backupInfo.algorithm));\n }\n var backupDecryptionKey = RustSdkCryptoJs.BackupDecryptionKey.fromBase64(encodeBase64(privKey));\n if (!decryptionKeyMatchesKeyBackupInfo(backupDecryptionKey, backupInfo)) {\n throw new Error(\"getBackupDecryptor: key backup on server does not match the decryption key\");\n }\n return _this3.backupManager.createBackupDecryptor(backupDecryptionKey);\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend#importBackedUpRoomKeys}.\n */\n importBackedUpRoomKeys(keys, backupVersion, opts) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n return yield _this4.backupManager.importBackedUpRoomKeys(keys, backupVersion, opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend.maybeAcceptKeyBundle}.\n */\n maybeAcceptKeyBundle(roomId, inviter) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n // TODO: retry this if it gets interrupted or it fails. (https://github.com/matrix-org/matrix-rust-sdk/issues/5112)\n // TODO: do this in the background.\n\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 var encryptedBundleBlob = yield _this5.http.authedRequest(Method.Get, bundleUrl.pathname + bundleUrl.search, {}, undefined, {\n rawResponseBody: true,\n prefix: \"\"\n });\n logger.info(\"Received blob of length \".concat(encryptedBundleBlob.size));\n encryptedBundle = new Uint8Array(yield encryptedBundleBlob.arrayBuffer());\n } catch (err) {\n logger.warn(\"Error downloading encrypted bundle from \".concat(url, \":\"), err);\n throw err;\n }\n try {\n yield _this5.olmMachine.receiveRoomKeyBundle(bundleData, encryptedBundle);\n } catch (err) {\n logger.warn(\"Error receiving encrypted bundle:\", err);\n throw err;\n } finally {\n // Even if we were unable to import the bundle, we still clear the flag that indicates that we\n // are waiting for the bundle to be received. The only reason this can happen is that the bundle was\n // malformed somehow, so we don't want to keep retrying it.\n yield _this5.olmMachine.clearRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n }\n return true;\n })();\n }\n\n /**\n * Implementation of {@link CryptoBackend.markRoomAsPendingKeyBundle}.\n */\n markRoomAsPendingKeyBundle(roomId, inviter) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n yield _this6.olmMachine.storeRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId), new RustSdkCryptoJs.UserId(inviter));\n })();\n }\n /**\n * Implementation of {@link CryptoApi#getVersion}.\n */\n getVersion() {\n var versions = RustSdkCryptoJs.getVersions();\n return \"Rust SDK \".concat(versions.matrix_sdk_crypto, \" (\").concat(versions.git_sha, \"), Vodozemac \").concat(versions.vodozemac);\n }\n\n /**\n * Implementation of {@link CryptoApi#setDeviceIsolationMode}.\n */\n setDeviceIsolationMode(isolationMode) {\n this.deviceIsolationMode = isolationMode;\n }\n\n /**\n * Implementation of {@link CryptoApi#isEncryptionEnabledInRoom}.\n */\n isEncryptionEnabledInRoom(roomId) {\n var _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.algorithm);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#isStateEncryptionEnabledInRoom}.\n */\n isStateEncryptionEnabledInRoom(roomId) {\n var _this8 = this;\n return _asyncToGenerator(function* () {\n var roomSettings = yield _this8.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 _this9 = this;\n return _asyncToGenerator(function* () {\n var keys = _this9.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 _this0 = this;\n return _asyncToGenerator(function* () {\n var raw = yield _this0.olmMachine.exportRoomKeys(() => true);\n return JSON.parse(raw);\n })();\n }\n exportRoomKeysAsJson() {\n var _this1 = this;\n return _asyncToGenerator(function* () {\n return yield _this1.olmMachine.exportRoomKeys(() => true);\n })();\n }\n importRoomKeys(keys, opts) {\n var _this10 = this;\n return _asyncToGenerator(function* () {\n return yield _this10.backupManager.importRoomKeys(keys, opts);\n })();\n }\n importRoomKeysAsJson(keys, opts) {\n var _this11 = this;\n return _asyncToGenerator(function* () {\n return yield _this11.backupManager.importRoomKeysAsJson(keys, opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi.userHasCrossSigningKeys}.\n */\n userHasCrossSigningKeys() {\n var _arguments = arguments,\n _this12 = this;\n return _asyncToGenerator(function* () {\n var userId = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : _this12.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 _this12.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 === _this12.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 = _this12.olmMachine.queryKeysForUsers(\n // clone as rust layer will take ownership and it's reused later\n [rustTrackedUser.clone()]);\n yield _this12.outgoingRequestProcessor.makeOutgoingRequest(request);\n }\n var userIdentity = yield _this12.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 _this12.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 _this13 = 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 _this13.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 _this13.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 _this13.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 _this14 = 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 _this14.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 _this15 = this;\n return _asyncToGenerator(function* () {\n var queryBody = {\n device_keys: {}\n };\n untrackedUsers.forEach(user => queryBody.device_keys[user] = []);\n return yield _this15.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 _this16 = this;\n return _asyncToGenerator(function* () {\n var verified = _arguments3.length > 2 && _arguments3[2] !== undefined ? _arguments3[2] : true;\n var device = yield _this16.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 _this17 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this17.olmMachine.getDevice(new RustSdkCryptoJs.UserId(_this17.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 _this17.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 _this18 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this18.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: _this18._trustCrossSignedDevices\n });\n } finally {\n device.free();\n }\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getUserVerificationStatus}.\n */\n getUserVerificationStatus(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 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, true, needsUserApproval);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#pinCurrentUserIdentity}.\n */\n pinCurrentUserIdentity(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 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 _this21 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this21.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 _this22 = this;\n return _asyncToGenerator(function* () {\n var {\n privateKeysInSecretStorage,\n privateKeysCachedLocally\n } = yield _this22.getCrossSigningStatus();\n var hasKeysInCache = Boolean(privateKeysCachedLocally.masterKey) && Boolean(privateKeysCachedLocally.selfSigningKey) && Boolean(privateKeysCachedLocally.userSigningKey);\n var identity = yield _this22.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 _this23 = this;\n return _asyncToGenerator(function* () {\n var type = _arguments4.length > 0 && _arguments4[0] !== undefined ? _arguments4[0] : CrossSigningKey.Master;\n var userIdentity = yield _this23.getOwnIdentity();\n if (!userIdentity) {\n // The public keys are not available on this device\n return null;\n }\n try {\n var crossSigningStatus = yield _this23.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 _this24 = this;\n return _asyncToGenerator(function* () {\n yield _this24.crossSigningIdentity.bootstrapCrossSigning(opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#isSecretStorageReady}\n */\n isSecretStorageReady() {\n var _this25 = this;\n return _asyncToGenerator(function* () {\n return (yield _this25.getSecretStorageStatus()).ready;\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getSecretStorageStatus}\n */\n getSecretStorageStatus() {\n var _this26 = 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 _this26.backupManager.getActiveBackupVersion()) != null;\n if (keyBackupEnabled) {\n secretsToCheck.push(\"m.megolm_backup.v1\");\n }\n var defaultKeyId = yield _this26.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 _this26.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 _this27 = 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 _this27.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 _this27.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 _this27.addSecretStorageKeyToSecretStorage(recoveryKey);\n }\n var crossSigningPrivateKeys = yield _this27.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(_this27.secretStorage)))) {\n _this27.logger.info(\"bootstrapSecretStorage: cross-signing keys not yet exported; doing so now.\");\n yield _this27.secretStorage.store(\"m.cross_signing.master\", crossSigningPrivateKeys.masterKey);\n yield _this27.secretStorage.store(\"m.cross_signing.user_signing\", crossSigningPrivateKeys.userSigningKey);\n yield _this27.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 _this27.saveBackupKeyToStorage();\n } else {\n yield _this27.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 _this28 = this;\n return _asyncToGenerator(function* () {\n var keyBackupInfo = yield _this28.backupManager.getServerBackupInfo();\n if (!keyBackupInfo || !keyBackupInfo.version) {\n _this28.logger.info(\"Not saving backup key to secret storage: no backup info\");\n return;\n }\n var backupKeys = yield _this28.olmMachine.getBackupKeys();\n if (!backupKeys.decryptionKey) {\n _this28.logger.info(\"Not saving backup key to secret storage: no backup key\");\n return;\n }\n if (!decryptionKeyMatchesKeyBackupInfo(backupKeys.decryptionKey, keyBackupInfo)) {\n _this28.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 _this28.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 _this29 = this;\n return _asyncToGenerator(function* () {\n var _secretStorageKey$key, _secretStorageKey$key2, _this29$cryptoCallbac, _this29$cryptoCallbac2;\n var secretStorageKeyObject = yield _this29.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 _this29.secretStorage.setDefaultKeyId(secretStorageKeyObject.keyId);\n (_this29$cryptoCallbac = (_this29$cryptoCallbac2 = _this29.cryptoCallbacks).cacheSecretStorageKey) === null || _this29$cryptoCallbac === void 0 || _this29$cryptoCallbac.call(_this29$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 _this30 = this;\n return _asyncToGenerator(function* () {\n // See if we already have an AES secret-storage key.\n var secretStorageKeyTuple = yield _this30.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 _this31 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this31.getOwnIdentity();\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(_this31.secretStorage);\n var crossSigningStatus = yield _this31.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 _this32 = 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, _this32.RECOVERY_KEY_DERIVATION_ITERATIONS);\n return {\n keyInfo: {\n passphrase: {\n algorithm: \"m.pbkdf2\",\n iterations: _this32.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 _this33 = this;\n return _asyncToGenerator(function* () {\n return _this33.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 _this34 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this34.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 = _this34._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 _this34.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 _this34.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 _this35 = 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 _this35.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 _this36 = this;\n return _asyncToGenerator(function* () {\n var userIdentity = yield _this36.getOwnIdentity();\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(_this36._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n yield _this36.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n return _this36.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 _this37 = this;\n return _asyncToGenerator(function* () {\n var device = yield _this37.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(_this37._supportedVerificationMethods.map(verificationMethodIdentifierToMethod));\n yield _this37.outgoingRequestProcessor.makeOutgoingRequest(outgoingRequest);\n return _this37.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 _this38 = this;\n return _asyncToGenerator(function* () {\n var backupKeys = yield _this38.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 _this39 = this;\n return _asyncToGenerator(function* () {\n var base64Key = encodeBase64(key);\n if (!version) {\n throw new Error(\"storeSessionBackupPrivateKey: version is required\");\n }\n yield _this39.backupManager.saveBackupDecryptionKey(RustSdkCryptoJs.BackupDecryptionKey.fromBase64(base64Key), version);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#loadSessionBackupPrivateKeyFromSecretStorage}.\n */\n loadSessionBackupPrivateKeyFromSecretStorage() {\n var _this40 = this;\n return _asyncToGenerator(function* () {\n var backupKey = yield _this40.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 _this40.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 DecryptionKeyDoesNotMatchError(\"loadSessionBackupPrivateKeyFromSecretStorage: decryption key does not match backup info\");\n }\n yield _this40.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 _this41 = this;\n return _asyncToGenerator(function* () {\n return yield _this41.backupManager.getActiveBackupVersion();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#getKeyBackupInfo}.\n */\n getKeyBackupInfo() {\n var _this42 = this;\n return _asyncToGenerator(function* () {\n return (yield _this42.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 _this43 = this;\n return _asyncToGenerator(function* () {\n return yield _this43.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 _this44 = this;\n return _asyncToGenerator(function* () {\n return yield _this44.backupManager.checkKeyBackupAndEnable(true);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#deleteKeyBackupVersion}.\n */\n deleteKeyBackupVersion(version) {\n var _this45 = this;\n return _asyncToGenerator(function* () {\n yield _this45.backupManager.deleteKeyBackupVersion(version);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#resetKeyBackup}.\n */\n resetKeyBackup() {\n var _this46 = this;\n return _asyncToGenerator(function* () {\n var backupInfo = yield _this46.backupManager.setupKeyBackup(o => _this46.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 _this46.secretStorageHasAESKey()) {\n yield _this46.secretStorage.store(\"m.megolm_backup.v1\", backupInfo.decryptionKey.toBase64());\n }\n\n // we can check and start async\n _this46.checkKeyBackupAndEnable();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#disableKeyStorage}.\n */\n disableKeyStorage() {\n var _this47 = this;\n return _asyncToGenerator(function* () {\n // Get the key backup version we're using\n var info = yield _this47.getKeyBackupInfo();\n if (info !== null && info !== void 0 && info.version) {\n yield _this47.deleteKeyBackupVersion(info.version);\n } else {\n _this47.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 _this47.deleteSecretStorage();\n yield _this47.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 _this48 = 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(_this48.userId) || {};\n var canonalizedJson = anotherjson.stringify(obj);\n var signatures = yield _this48.olmMachine.sign(canonalizedJson);\n var map = JSON.parse(signatures.asJSON());\n sigs.set(_this48.userId, _objectSpread(_objectSpread({}, userSignatures), map[_this48.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 _this49 = this;\n return _asyncToGenerator(function* () {\n var backupInfo = yield _this49.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 _this49.storeSessionBackupPrivateKey(privateKey, backupInfo.version);\n return _this49.restoreKeyBackup(opts);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#restoreKeyBackup}.\n */\n restoreKeyBackup(opts) {\n var _this50 = this;\n return _asyncToGenerator(function* () {\n // Get the decryption key from the crypto store\n var backupKeys = yield _this50.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 _this50.backupManager.requestKeyBackupVersion(backupVersion);\n if (!backupInfo) throw new Error(\"Backup version to restore \".concat(backupVersion, \" not found on server\"));\n var backupDecryptor = yield _this50.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 _this50.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 _this51 = this;\n return _asyncToGenerator(function* () {\n return yield _this51.dehydratedDeviceManager.isSupported();\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#startDehydration}.\n */\n startDehydration() {\n var _arguments6 = arguments,\n _this52 = this;\n return _asyncToGenerator(function* () {\n var opts = _arguments6.length > 0 && _arguments6[0] !== undefined ? _arguments6[0] : {};\n if (!(yield _this52.isCrossSigningReady()) || !(yield _this52.isSecretStorageReady())) {\n throw new Error(\"Device dehydration requires cross-signing and secret storage to be set up\");\n }\n return yield _this52.dehydratedDeviceManager.start(opts || {});\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#importSecretsBundle}.\n */\n importSecretsBundle(secrets) {\n var _this53 = this;\n return _asyncToGenerator(function* () {\n var secretsBundle = RustSdkCryptoJs.SecretsBundle.from_json(secrets);\n yield _this53.getOlmMachineOrThrow().importSecretsBundle(secretsBundle); // this method frees the SecretsBundle\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#exportSecretsBundle}.\n */\n exportSecretsBundle() {\n var _this54 = this;\n return _asyncToGenerator(function* () {\n var secretsBundle = yield _this54.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 _this55 = this;\n return _asyncToGenerator(function* () {\n var logger = new LogSpan(_this55.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 _this55.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 _this55.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 _this55.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 _this56 = this;\n return _asyncToGenerator(function* () {\n _this56.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 _this56.dehydratedDeviceManager.delete();\n\n // Disable backup, and delete all the backups from the server\n yield _this56.backupManager.deleteAllKeyBackupVersions();\n yield _this56.deleteSecretStorage();\n\n // Reset the cross-signing keys\n yield _this56.crossSigningIdentity.bootstrapCrossSigning({\n setupNewCrossSigning: true,\n authUploadDeviceSigningKeys\n });\n\n // Create a new key backup\n yield _this56.resetKeyBackup();\n _this56.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 _this57 = this;\n return _asyncToGenerator(function* () {\n // Remove the stored secrets in the secret storage\n yield _this57.secretStorage.store(\"m.cross_signing.master\", null);\n yield _this57.secretStorage.store(\"m.cross_signing.self_signing\", null);\n yield _this57.secretStorage.store(\"m.cross_signing.user_signing\", null);\n yield _this57.secretStorage.store(\"m.megolm_backup.v1\", null);\n\n // Remove the recovery key\n var defaultKeyId = yield _this57.secretStorage.getDefaultKeyId();\n if (defaultKeyId) yield _this57.secretStorage.store(\"m.secret_storage.key.\".concat(defaultKeyId), null);\n // Disable the recovery key and the secret storage\n yield _this57.secretStorage.setDefaultKeyId(null);\n })();\n }\n\n /**\n * Implementation of {@link CryptoApi#shareRoomHistoryWithUser}.\n */\n shareRoomHistoryWithUser(roomId, userId) {\n var _this58 = this;\n return _asyncToGenerator(function* () {\n var logger = new LogSpan(_this58.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 _this58.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. Download keys from backup.\n if (!(yield _this58.getOlmMachineOrThrow().hasDownloadedAllRoomKeys(new RustSdkCryptoJs.RoomId(roomId)))) {\n yield _this58.backupManager.downloadLatestRoomKeyBackup(roomId);\n yield _this58.getOlmMachineOrThrow().setHasDownloadedAllRoomKeys(new RustSdkCryptoJs.RoomId(roomId));\n }\n\n // 2. Construct the key bundle\n var bundle = yield _this58.getOlmMachineOrThrow().buildRoomKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n if (!bundle) {\n logger.info(\"No keys to share\");\n return;\n }\n\n // 3. Upload the encrypted bundle to the server\n var uploadResponse = yield _this58.http.uploadContent(bundle.encryptedData);\n logger.info(\"Uploaded encrypted key blob: \".concat(JSON.stringify(uploadResponse)));\n\n // 4. We may not share a room with the user, so get a fresh list of devices for the invited user.\n var req = _this58.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(userId)]);\n yield _this58.outgoingRequestProcessor.makeOutgoingRequest(req);\n\n // 5. Establish Olm sessions with all of the recipient's devices.\n yield _this58.keyClaimManager.ensureSessionsForUsers(logger, [new RustSdkCryptoJs.UserId(userId)]);\n\n // 6. Send to-device messages to the recipient to share the keys.\n var requests = yield _this58.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 _this58.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 _this59 = 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 _this59.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 _this60 = 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 _this60.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 _this60.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 recently joined the room in question,\n // tell the Rust SDK to try and accept the key bundle.\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)) {\n var roomId = parsedMessage.content.room_id;\n var pendingDetails = yield _this60.olmMachine.getPendingKeyBundleDetailsForRoom(new RustSdkCryptoJs.RoomId(roomId));\n // Only accept the key bundle if we joined the room less than 24 hours ago.\n if (!pendingDetails) {\n _this60.logger.debug(\"Not yet accepting key bundle for room where we are not awaiting a bundle: \".concat(roomId));\n } else if (Date.now() - pendingDetails.inviteAcceptedAtMillis > MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE) {\n _this60.logger.info(\"Ignoring key bundle for room we joined too long ago: \".concat(roomId, \", joining time: \").concat(new Date(pendingDetails.inviteAcceptedAtMillis).toISOString()));\n } else {\n _this60.logger.info(\"Considering key bundle for recently-joined room \".concat(roomId));\n // Don't block for the import to happen, here, as this is called from inside the `/sync` loop.\n _this60.maybeAcceptKeyBundle(roomId, pendingDetails.inviterId.toString()).catch(err => {\n _this60.logger.error(\"Error attempting to download key bundle for room \".concat(roomId));\n _this60.logger.error(err);\n });\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 _this61 = 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 _this61.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 _this62 = 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 _this62.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 _this63 = 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 _this63.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\"] && _this63.enableEncryptedStateEvents) {\n _this63.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 _this63.olmMachine.setRoomSettings(new RustSdkCryptoJs.RoomId(room.roomId), settings);\n } catch (e) {\n _this63.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 = _this63.roomEncryptors[room.roomId];\n if (existingEncryptor) {\n existingEncryptor.onCryptoEvent(config);\n } else {\n _this63.roomEncryptors[room.roomId] = new RoomEncryptor(_this63.logger.getChild(\"[\".concat(room.roomId, \" encryption]\")), _this63.olmMachine, _this63.keyClaimManager, _this63.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 _this64 = this;\n return _asyncToGenerator(function* () {\n yield _this64.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 roomId = event.getRoomId();\n\n // If it's our own membership, and we are no longer joined, clear any indication that we are waiting for a key\n // bundle.\n if (oldMembership === KnownMembership.Join && member.membership !== KnownMembership.Join && member.userId === this.olmMachine.userId.toString()) {\n this.olmMachine.clearRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId)).catch(e => {\n this.logger.error(\"Error clearing room pending key bundle indicator for \".concat(roomId, \": \").concat(e));\n });\n }\n var enc = this.roomEncryptors[roomId];\n if (!enc) {\n // not encrypting in this room\n return;\n }\n enc.onRoomMembership(member);\n }\n\n /**\n * Previously, it was sufficient to check if we need to rotate the room key\n * prior to sending a message. However, the history sharing feature\n * (MSC4268) breaks this logic:\n *\n * 1. Alice sends a message M1 in room X;\n * 2. Bob invites Charlie, who joins and immediately leaves the room;\n * 3. Alice sends another message M2 in room X.\n *\n * Under the old logic, Alice would not rotate her key after Charlie\n * leaves, resulting in M2 being encrypted with the same session as M1.\n * This would allow Charlie to decrypt M2 if he ever gains access to\n * the event.\n *\n * To counter this, we proactively discard any active outgoing Megolm\n * session when we see an event indicating the user left.\n *\n * Note that we have to do this in `onRoomStateEvent` rather than\n * `onRoomMembership`, because `onRoomMembership` is only called when we see\n * a *change* in membership. In the case of a gappy sync, we might miss\n * Charlie's invite and join, and only see the final `leave` event (so his\n * membership goes from `leave` to `leave`).\n */\n onRoomStateEvent(event, _state, _prevEvent) {\n if (event.getType() != EventType.RoomMember) {\n // Ignore all events that aren't member updates.\n return;\n }\n if (event.getStateKey() !== this.olmMachine.userId.toString() && event.getContent().membership !== KnownMembership.Join) {\n this.logger.info(\"Rotating session for room \".concat(event.getRoomId(), \" due to member leaving the room\"));\n this.forceDiscardSession(event.getRoomId());\n }\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 _this65 = this;\n return _asyncToGenerator(function* () {\n for (var key of keys) {\n _this65.onRoomKeyUpdated(key);\n }\n _this65.backupManager.maybeUploadKey();\n })();\n }\n onRoomKeyUpdated(key) {\n var _this66 = 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(_this66, {\n isRetry: true\n }).catch(_e => {\n _this66.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 _this67 = this;\n return _asyncToGenerator(function* () {\n for (var session of withheld) {\n _this67.logger.debug(\"Got withheld message for session \".concat(session.sessionId, \" in \").concat(session.roomId.toString()));\n var pendingList = _this67.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 _this67.logger.debug(\"Retrying decryption on events:\", pendingList.map(e => \"\".concat(e.getId())));\n for (var ev of pendingList) {\n ev.attemptDecryption(_this67, {\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 _this68 = this;\n return _asyncToGenerator(function* () {\n var newVerification = yield _this68.getUserVerificationStatus(userId.toString());\n _this68.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() === _this68.userId) {\n _this68.emit(CryptoEvent.KeysChanged, {});\n yield _this68.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 _this69 = this;\n return _asyncToGenerator(function* () {\n _this69.emit(CryptoEvent.WillUpdateDevices, userIds, false);\n _this69.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 _this70 = this;\n return _asyncToGenerator(function* () {\n _this70.logger.debug(\"onReceiveSecret: Received secret \".concat(name));\n if (name === \"m.megolm_backup.v1\") {\n return yield _this70.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 _this71 = this;\n return _asyncToGenerator(function* () {\n var pendingValues = yield _this71.olmMachine.getSecretsFromInbox(name);\n for (var value of pendingValues) {\n if (yield _this71.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 _this71.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 _this72 = 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 _this72.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 _this73 = 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 _this73.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 = _this73.getOlmMachineOrThrow().queryKeysForUsers([new RustSdkCryptoJs.UserId(senderId)]);\n yield _this73.outgoingRequestProcessor.makeOutgoingRequest(req);\n }\n yield _this73.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 _this73.onIncomingKeyVerificationRequest(senderId, event.getId());\n }\n\n // that may have caused us to queue up outgoing requests, so make sure we send them.\n _this73.outgoingRequestsManager.doProcessOutgoingRequests().catch(e => {\n _this73.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 _this74 = this;\n return _asyncToGenerator(function* () {\n var identity = yield _this74.getOlmMachineOrThrow().getIdentity(new RustSdkCryptoJs.UserId(_this74.userId));\n return identity;\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 _this75 = 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 _this75.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 _this75.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 _this75.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 _this75.onMegolmDecryptionError(event, err, yield _this75.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 _this76 = 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 _this76.olmMachine.getRoomEventEncryptionInfo(stringifyEvent(event), new RustSdkCryptoJs.RoomId(event.getRoomId()));\n return rustEncryptionInfoToJsEncryptionInfo(_this76.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","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 { MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE, 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\n // If we have any recently-joined rooms, see if we have a pending key bundle for them.\n for (var pendingDetails of yield olmMachine.getAllRoomsPendingKeyBundles()) {\n var roomId = pendingDetails.roomId.toString();\n if (Date.now() - pendingDetails.inviteAcceptedAtMillis <= MAX_INVITE_ACCEPTANCE_MS_FOR_KEY_BUNDLE) {\n logger.info(\"Checking for pending key bundle for recently-joined room \".concat(roomId, \" (joined \").concat(new Date(pendingDetails.inviteAcceptedAtMillis).toISOString(), \")\"));\n yield rustCrypto.maybeAcceptKeyBundle(roomId, pendingDetails.inviterId.toString());\n } else {\n logger.info(\"Clearing pending-key-bundle flag for room \".concat(roomId, \" (too old: joined \").concat(new Date(pendingDetails.inviteAcceptedAtMillis).toISOString(), \")\"));\n yield olmMachine.clearRoomPendingKeyBundle(new RustSdkCryptoJs.RoomId(roomId));\n }\n }\n return rustCrypto;\n });\n return _initOlmMachine.apply(this, arguments);\n}\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1,2,3,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