matrix-js-sdk 37.1.0 → 37.2.0-rc.0
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/git-revision.txt +1 -1
- package/lib/client.d.ts +11 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +24 -5
- package/lib/client.js.map +1 -1
- package/lib/content-helpers.d.ts.map +1 -1
- package/lib/crypto-api/index.d.ts +9 -0
- package/lib/crypto-api/index.d.ts.map +1 -1
- package/lib/crypto-api/index.js.map +1 -1
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +27 -14
- package/lib/embedded.js.map +1 -1
- package/lib/errors.d.ts +7 -0
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +11 -0
- package/lib/errors.js.map +1 -1
- package/lib/http-api/fetch.d.ts +4 -2
- package/lib/http-api/fetch.d.ts.map +1 -1
- package/lib/http-api/fetch.js.map +1 -1
- package/lib/matrixrtc/EncryptionManager.d.ts.map +1 -1
- package/lib/matrixrtc/{MembershipManager.d.ts → LegacyMembershipManager.d.ts} +4 -40
- package/lib/matrixrtc/LegacyMembershipManager.d.ts.map +1 -0
- package/lib/matrixrtc/{MembershipManager.js → LegacyMembershipManager.js} +19 -11
- package/lib/matrixrtc/LegacyMembershipManager.js.map +1 -0
- package/lib/matrixrtc/LivekitFocus.d.ts.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts +28 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.js +19 -5
- package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/lib/matrixrtc/NewMembershipManager.d.ts +210 -0
- package/lib/matrixrtc/NewMembershipManager.d.ts.map +1 -0
- package/lib/matrixrtc/NewMembershipManager.js +784 -0
- package/lib/matrixrtc/NewMembershipManager.js.map +1 -0
- package/lib/matrixrtc/NewMembershipManagerActionScheduler.d.ts +57 -0
- package/lib/matrixrtc/NewMembershipManagerActionScheduler.d.ts.map +1 -0
- package/lib/matrixrtc/NewMembershipManagerActionScheduler.js +124 -0
- package/lib/matrixrtc/NewMembershipManagerActionScheduler.js.map +1 -0
- package/lib/models/beacon.d.ts.map +1 -1
- package/lib/models/poll.d.ts.map +1 -1
- package/lib/oidc/authorize.d.ts.map +1 -1
- package/lib/oidc/discovery.d.ts.map +1 -1
- package/lib/oidc/register.d.ts +2 -1
- package/lib/oidc/register.d.ts.map +1 -1
- package/lib/oidc/register.js +15 -4
- package/lib/oidc/register.js.map +1 -1
- package/lib/oidc/validate.d.ts.map +1 -1
- package/lib/rust-crypto/rust-crypto.d.ts +9 -0
- package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/lib/rust-crypto/rust-crypto.js +136 -106
- package/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/lib/store/indexeddb-store-worker.d.ts.map +1 -1
- package/lib/testing.d.ts.map +1 -1
- package/lib/utils.d.ts +8 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +20 -3
- package/lib/utils.js.map +1 -1
- package/lib/webrtc/call.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/client.ts +35 -5
- package/src/crypto-api/index.ts +10 -0
- package/src/embedded.ts +62 -27
- package/src/errors.ts +13 -0
- package/src/http-api/fetch.ts +4 -4
- package/src/matrixrtc/{MembershipManager.ts → LegacyMembershipManager.ts} +19 -39
- package/src/matrixrtc/MatrixRTCSession.ts +52 -7
- package/src/matrixrtc/NewMembershipManager.ts +943 -0
- package/src/matrixrtc/NewMembershipManagerActionScheduler.ts +133 -0
- package/src/oidc/register.ts +17 -4
- package/src/rust-crypto/rust-crypto.ts +37 -11
- package/src/utils.ts +17 -0
- package/lib/matrixrtc/MembershipManager.d.ts.map +0 -1
- package/lib/matrixrtc/MembershipManager.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-helpers.d.ts","sourceRoot":"","sources":["../src/content-helpers.ts"],"names":[],"mappings":"A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export interface CryptoApi {
|
|
|
545
545
|
* The backup engine will be started using the new backup version (i.e., {@link checkKeyBackupAndEnable} is called).
|
|
546
546
|
*/
|
|
547
547
|
resetKeyBackup(): Promise<void>;
|
|
548
|
+
/**
|
|
549
|
+
* Disables server-side key storage and deletes server-side backups.
|
|
550
|
+
* * Deletes the current key backup version, if any (but not any previous versions).
|
|
551
|
+
* * Disables 4S, deleting the info for the default key, the default key pointer itself and any
|
|
552
|
+
* known 4S data (cross-signing keys and the megolm key backup key).
|
|
553
|
+
* * Deletes any dehydrated devices.
|
|
554
|
+
* * Sets the "m.org.matrix.custom.backup_disabled" account data flag to indicate that the user has disabled backups.
|
|
555
|
+
*/
|
|
556
|
+
disableKeyStorage(): Promise<void>;
|
|
548
557
|
/**
|
|
549
558
|
* Deletes the given key backup.
|
|
550
559
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto-api/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC9B,MAAM,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mFAAmF;IACnF,YAAY,EAAE,iBAAiB,CAAC;IAEhC;;OAEG;IACH,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,oBAAY,iBAAiB;IACzB,IAAI,IAAA;IACJ,IAAI,IAAA;IACJ,GAAG,IAAA;CACN;AAED;;GAEG;AACH,oBAAY,iBAAiB;IACzB,iGAAiG;IACjG,OAAO,IAAA;IAEP,yCAAyC;IACzC,mBAAmB,IAAA;IAEnB,yDAAyD;IACzD,eAAe,IAAA;IAEf,mDAAmD;IACnD,cAAc,IAAA;IAEd;;;;OAIG;IACH,2BAA2B,IAAA;IAE3B;;;OAGG;IACH,qBAAqB,IAAA;IAErB;;OAEG;IACH,aAAa,IAAA;IAEb;;OAEG;IACH,sBAAsB,IAAA;CACzB;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC1B,yFAAyF;IACzF,OAAO,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,cAAc,mBAAmB,CAAC;AAClC,mBAAmB,gBAAgB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,mBAAmB,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DecryptionFailureCode","DeviceIsolationModeKind","AllDevicesIsolationMode","constructor","errorOnVerifiedUserProblems","_defineProperty","OnlySignedDevicesIsolationMode","UserVerificationStatus","crossSigningVerified","crossSigningVerifiedBefore","tofu","needsUserApproval","arguments","length","undefined","isVerified","isCrossSigningVerified","wasCrossSigningVerified","isTofu","DeviceVerificationStatus","opts","_opts$signedByOwner","_opts$crossSigningVer","_opts$tofu","_opts$localVerified","_opts$trustCrossSigne","signedByOwner","localVerified","trustCrossSignedDevices","ImportRoomKeyStage","CrossSigningKey","EventShieldColour","EventShieldReason"],"sources":["../../src/crypto-api/index.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport type { SecretsBundle } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport type { IMegolmSessionData } from \"../@types/crypto.ts\";\nimport type { ToDeviceBatch, ToDevicePayload } from \"../models/ToDeviceMessage.ts\";\nimport { type Room } from \"../models/room.ts\";\nimport { type DeviceMap } from \"../models/device.ts\";\nimport { type UIAuthCallback } from \"../interactive-auth.ts\";\nimport { type PassphraseInfo, type SecretStorageKeyDescription } from \"../secret-storage.ts\";\nimport { type VerificationRequest } from \"./verification.ts\";\nimport {\n type BackupTrustInfo,\n type KeyBackupCheck,\n type KeyBackupInfo,\n type KeyBackupRestoreOpts,\n type KeyBackupRestoreResult,\n} from \"./keybackup.ts\";\nimport { type ISignatures } from \"../@types/signed.ts\";\nimport { type MatrixEvent } from \"../models/event.ts\";\n\n/**\n * `matrix-js-sdk/lib/crypto-api`: End-to-end encryption support.\n *\n * The most important type is {@link CryptoApi}, an instance of which can be retrieved via\n * {@link MatrixClient.getCrypto}.\n *\n * @packageDocumentation\n */\n\n/**\n * The options to start device dehydration.\n */\nexport interface StartDehydrationOpts {\n /**\n * Force creation of a new dehydration key, even if there is already an\n * existing dehydration key. If `false`, and `onlyIfKeyCached` is `false`, a\n * new key will be created if there is no existing dehydration key, whether\n * already cached in our local storage or stored in Secret Storage.\n *\n * Checking for the presence of the key in Secret Storage may result in the\n * `getSecretStorageKey` callback being called.\n *\n * Defaults to `false`.\n */\n createNewKey?: boolean;\n /**\n * Only start dehydration if we have a dehydration key cached in our local\n * storage. If `true`, Secret Storage will not be checked. Defaults to\n * `false`.\n */\n onlyIfKeyCached?: boolean;\n /**\n * Try to rehydrate a device before creating a new dehydrated device.\n * Setting this to `false` may be useful for situations where the client is\n * known to pre-date the dehydrated device, and so rehydration is\n * unnecessary. Defaults to `true`.\n */\n rehydrate?: boolean;\n}\n\n/**\n * Public interface to the cryptography parts of the js-sdk\n *\n * @remarks Currently, this is a work-in-progress. In time, more methods will be added here.\n */\nexport interface CryptoApi {\n /**\n * Global override for whether the client should ever send encrypted\n * messages to unverified devices. This provides the default for rooms which\n * do not specify a value.\n *\n * If true, all unverified devices will be blacklisted by default\n */\n globalBlacklistUnverifiedDevices: boolean;\n\n /**\n * The {@link DeviceIsolationMode} mode to use.\n */\n setDeviceIsolationMode(isolationMode: DeviceIsolationMode): void;\n\n /**\n * Return the current version of the crypto module.\n * For example: `Rust SDK ${versions.matrix_sdk_crypto} (${versions.git_sha}), Vodozemac ${versions.vodozemac}`.\n * @returns the formatted version\n */\n getVersion(): string;\n\n /**\n * Get the public part of the device keys for the current device.\n *\n * @returns The public device keys.\n */\n getOwnDeviceKeys(): Promise<OwnDeviceKeys>;\n\n /**\n * Check if we believe the given room to be encrypted.\n *\n * This method returns true if the room has been configured with encryption. The setting is persistent, so that\n * even if the encryption event is removed from the room state, it still returns true. This helps to guard against\n * a downgrade attack wherein a server admin attempts to remove encryption.\n *\n * @returns `true` if the room with the supplied ID is encrypted. `false` if the room is not encrypted, or is unknown to\n * us.\n */\n isEncryptionEnabledInRoom(roomId: string): Promise<boolean>;\n\n /**\n * Perform any background tasks that can be done before a message is ready to\n * send, in order to speed up sending of the message.\n *\n * @param room - the room the event is in\n */\n prepareToEncrypt(room: Room): void;\n\n /**\n * Discard any existing megolm session for the given room.\n *\n * This will ensure that a new session is created on the next call to {@link prepareToEncrypt},\n * or the next time a message is sent.\n *\n * This should not normally be necessary: it should only be used as a debugging tool if there has been a\n * problem with encryption.\n *\n * @param roomId - the room to discard sessions for\n */\n forceDiscardSession(roomId: string): Promise<void>;\n\n /**\n * Get a list containing all of the room keys\n *\n * This should be encrypted before returning it to the user.\n *\n * @returns a promise which resolves to a list of\n * session export objects\n */\n exportRoomKeys(): Promise<IMegolmSessionData[]>;\n\n /**\n * Get a JSON list containing all of the room keys\n *\n * This should be encrypted before returning it to the user.\n *\n * @returns a promise which resolves to a JSON string\n * encoding a list of session export objects,\n * each of which is an IMegolmSessionData\n */\n exportRoomKeysAsJson(): Promise<string>;\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: IMegolmSessionData[], opts?: ImportRoomKeysOpts): Promise<void>;\n\n /**\n * Import a JSON string encoding a list of room keys previously\n * exported by exportRoomKeysAsJson\n *\n * @param keys - a JSON string encoding a list of session export\n * objects, 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(keys: string, opts?: ImportRoomKeysOpts): Promise<void>;\n\n /**\n * Check if the given user has published cross-signing keys.\n *\n * - If the user is tracked, a `/keys/query` request is made to update locally the cross signing keys.\n * - If the user is not tracked locally and downloadUncached is set to true,\n * a `/keys/query` request is made to the server to retrieve the cross signing keys.\n * - Otherwise, return false\n *\n * @param userId - the user ID to check. Defaults to the local user.\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 `false` will be returned for such users.\n *\n * @returns true if the cross signing keys are available.\n */\n userHasCrossSigningKeys(userId?: string, downloadUncached?: boolean): Promise<boolean>;\n\n /**\n * Get the device information for the given list of users.\n *\n * For any users whose device lists are cached (due to sharing an encrypted room with the user), the\n * cached device data is returned.\n *\n * If there are uncached users, and the `downloadUncached` parameter is set to `true`,\n * a `/keys/query` request is made to the server to retrieve these devices.\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: string[], downloadUncached?: boolean): Promise<DeviceMap>;\n\n /**\n * Set whether to trust other user's signatures of their devices.\n *\n * If false, devices will only be considered 'verified' if we have\n * verified that device individually (effectively disabling cross-signing).\n *\n * `true` by default.\n *\n * @param val - the new value\n */\n setTrustCrossSignedDevices(val: boolean): void;\n\n /**\n * Return whether we trust other user's signatures of their devices.\n *\n * @see {@link CryptoApi.setTrustCrossSignedDevices}\n *\n * @returns `true` if we trust cross-signed devices, otherwise `false`.\n */\n getTrustCrossSignedDevices(): boolean;\n\n /**\n * Get the verification status of a given user.\n *\n * @param userId - The ID of the user to check.\n *\n */\n getUserVerificationStatus(userId: string): Promise<UserVerificationStatus>;\n\n /**\n * \"Pin\" the current identity of the given user, accepting it as genuine.\n *\n * This is useful if the user has changed identity since we first saw them (leading to\n * {@link UserVerificationStatus.needsUserApproval}), and we are now accepting their new identity.\n *\n * Throws an error if called on our own user ID, or on a user ID that we don't have an identity for.\n */\n pinCurrentUserIdentity(userId: string): Promise<void>;\n\n /**\n * Remove the requirement for this identity to be verified, and pin it.\n *\n * This is useful if the user was previously verified but is not anymore\n * ({@link UserVerificationStatus.wasCrossSigningVerified}) and it is not possible to verify him again now.\n *\n */\n withdrawVerificationRequirement(userId: string): Promise<void>;\n\n /**\n * Get the verification status of a given device.\n *\n * @param userId - The ID of the user whose device is to be checked.\n * @param deviceId - The ID of the device to check\n *\n * @returns `null` if the device is unknown, or has not published any encryption keys (implying it does not support\n * encryption); otherwise the verification status of the device.\n */\n getDeviceVerificationStatus(userId: string, deviceId: string): Promise<DeviceVerificationStatus | null>;\n\n /**\n * Mark the given device as locally verified.\n *\n * Marking a device as locally verified has much the same effect as completing the verification dance, or receiving\n * a cross-signing signature for it.\n *\n * @param userId - owner of the device\n * @param deviceId - unique identifier for the device.\n * @param verified - whether to mark the device as verified. Defaults to 'true'.\n *\n * @throws an error if the device is unknown, or has not published any encryption keys.\n */\n setDeviceVerified(userId: string, deviceId: string, verified?: boolean): Promise<void>;\n\n /**\n * Cross-sign one of our own devices.\n *\n * This will create a signature for the device using our self-signing key, and publish that signature.\n * Cross-signing a device indicates, to our other devices and to other users, that we have verified that it really\n * belongs to us.\n *\n * Requires that cross-signing has been set up on this device (normally by calling {@link bootstrapCrossSigning}).\n *\n * *Note*: Do not call this unless you have verified, somehow, that the device is genuine!\n *\n * @param deviceId - ID of the device to be signed.\n */\n crossSignDevice(deviceId: string): Promise<void>;\n\n /**\n * Checks whether cross signing:\n * - is enabled on this account and trusted by this device\n * - has private keys either cached locally or stored in secret storage\n *\n * If this function returns false, {@link bootstrapCrossSigning()} can be used\n * to fix things such that it returns true. That is to say, after\n * `bootstrapCrossSigning()` completes successfully, this function should\n * return true.\n *\n * @returns True if cross-signing is ready to be used on this device\n *\n * @throws May throw {@link matrix.ClientStoppedError} if the `MatrixClient` is stopped before or during the call.\n */\n isCrossSigningReady(): Promise<boolean>;\n\n /**\n * Get the ID of one of the user's cross-signing keys, if both private and matching\n * public parts of that key are available (ie. cached in the local crypto store).\n *\n * The public part may not be available if a `/keys/query` request has not yet been\n * performed, or if the device that created the keys failed to publish them.\n *\n * If either part of the keypair is not available, this will return `null`.\n *\n * @param type - The type of key to get the ID of. One of `CrossSigningKey.Master`, `CrossSigningKey.SelfSigning`,\n * or `CrossSigningKey.UserSigning`. Defaults to `CrossSigningKey.Master`.\n *\n * @returns If cross-signing has been initialised on this device, the ID of the given key. Otherwise, null\n */\n getCrossSigningKeyId(type?: CrossSigningKey): Promise<string | null>;\n\n /**\n * Bootstrap cross-signing by creating keys if needed.\n *\n * If everything is already set up, then no changes are made, so this is safe to run to ensure\n * cross-signing is ready for use.\n *\n * This function:\n * - creates new cross-signing keys if they are not found locally cached nor in\n * secret storage (if it has been set up)\n * - publishes the public keys to the server if they are not already published\n * - stores the private keys in secret storage if secret storage is set up.\n *\n * @param opts - options object\n */\n bootstrapCrossSigning(opts: BootstrapCrossSigningOpts): Promise<void>;\n\n /**\n * Checks whether secret storage:\n * - is enabled on this account\n * - is storing cross-signing private keys\n * - is storing session backup key (if enabled)\n *\n * If this function returns false, {@link bootstrapSecretStorage()} can be used\n * to fix things such that it returns true. That is to say, after\n * `bootstrapSecretStorage()` completes successfully, this function should\n * return true.\n *\n * @returns True if secret storage is ready to be used on this device\n */\n isSecretStorageReady(): Promise<boolean>;\n\n /**\n * Bootstrap [secret storage](https://spec.matrix.org/v1.12/client-server-api/#storage).\n *\n * - If secret storage is not already set up, or {@link CreateSecretStorageOpts.setupNewSecretStorage} is set:\n * * Calls {@link CreateSecretStorageOpts.createSecretStorageKey} to generate a new key.\n * * Stores the metadata of the new key in account data and sets it as the default secret storage key.\n * * Calls {@link CryptoCallbacks.cacheSecretStorageKey} if provided.\n * - Stores the private cross signing keys in the secret storage if they are known, and they are not\n * already stored in secret storage.\n * - If {@link CreateSecretStorageOpts.setupNewKeyBackup} is set, calls {@link CryptoApi.resetKeyBackup}; otherwise,\n * stores the key backup decryption key in secret storage if it is known, and it is not\n * already stored in secret storage.\n *\n * Note that there may be multiple accesses to secret storage during the course of this call, each of which will\n * result in a call to {@link CryptoCallbacks.getSecretStorageKey}.\n *\n * @param opts - Options object.\n */\n bootstrapSecretStorage(opts: CreateSecretStorageOpts): Promise<void>;\n\n /**\n * Get the status of our cross-signing keys.\n *\n * @returns The current status of cross-signing keys: whether we have public and private keys cached locally, and\n * whether the private keys are in secret storage.\n *\n * @throws May throw {@link matrix.ClientStoppedError} if the `MatrixClient` is stopped before or during the call.\n */\n getCrossSigningStatus(): Promise<CrossSigningStatus>;\n\n /**\n * Create a recovery key (ie, a key suitable for use with server-side secret storage).\n *\n * The key can either be based on a user-supplied passphrase, or just created randomly.\n *\n * @param password - Optional passphrase string to use to derive the key,\n * which can later be entered by the user as an alternative to entering the\n * recovery key itself. If omitted, a key is generated randomly.\n *\n * @returns Object including recovery key and server upload parameters.\n * The private key should be disposed of after displaying to the use.\n */\n createRecoveryKeyFromPassphrase(password?: string): Promise<GeneratedSecretStorageKey>;\n\n /**\n * Get information about the encryption of the given event.\n *\n * @param event - the event to get information for\n *\n * @returns `null` if the event is not encrypted, or has not (yet) been successfully decrypted. Otherwise, an\n * object with information about the encryption of the event.\n */\n getEncryptionInfoForEvent(event: MatrixEvent): Promise<EventEncryptionInfo | null>;\n\n /**\n * Encrypts a given payload object via Olm to-device messages to a given\n * set of devices.\n *\n * @param eventType - the type of the event to send.\n * @param devices - an array of devices to encrypt the payload for.\n * @param payload - the payload to encrypt.\n *\n * @returns the batch of encrypted payloads which can then be sent via {@link matrix.MatrixClient#queueToDevice}.\n */\n encryptToDeviceMessages(\n eventType: string,\n devices: { userId: string; deviceId: string }[],\n payload: ToDevicePayload,\n ): Promise<ToDeviceBatch>;\n\n /**\n * Reset the encryption of the user by going through the following steps:\n * - Remove the dehydrated device and stop the periodic creation of dehydrated devices.\n * - Disable backing up room keys and delete any existing backups.\n * - Remove the default secret storage key from the account data (ie: the recovery key).\n * - Reset the cross-signing keys.\n * - Create a new key backup.\n *\n * Note that the dehydrated device will be removed, but will not be replaced\n * and it will not schedule creating new dehydrated devices. To do this,\n * {@link startDehydration} should be called after a new secret storage key\n * is created.\n *\n * @param authUploadDeviceSigningKeys - Callback to authenticate the upload of device signing keys.\n * Used when resetting the cross signing keys.\n * See {@link BootstrapCrossSigningOpts#authUploadDeviceSigningKeys}.\n */\n resetEncryption(authUploadDeviceSigningKeys: UIAuthCallback<void>): Promise<void>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Device/User verification\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Returns to-device verification requests that are already in progress for the given user id.\n *\n * @param userId - the ID of the user to query\n *\n * @returns the VerificationRequests that are in progress\n */\n getVerificationRequestsToDeviceInProgress(userId: string): VerificationRequest[];\n\n /**\n * Finds a DM verification request that is already in progress for the given room id\n *\n * @param roomId - the room to use for verification\n *\n * @returns the VerificationRequest that is in progress, if any\n * @deprecated prefer `userId` parameter variant.\n */\n findVerificationRequestDMInProgress(roomId: string): VerificationRequest | undefined;\n\n /**\n * Finds a DM verification request that is already in progress for the given room and user.\n *\n * @param roomId - the room to use for verification.\n * @param userId - search for a verification request for the given user.\n *\n * @returns the VerificationRequest that is in progress, if any.\n */\n findVerificationRequestDMInProgress(roomId: string, userId?: string): VerificationRequest | undefined;\n\n /**\n * Request a key verification from another user, using a DM.\n *\n * @param userId - the user to request verification with.\n * @param roomId - the room to use for verification.\n *\n * @returns resolves to a VerificationRequest when the request has been sent to the other party.\n */\n requestVerificationDM(userId: string, roomId: string): Promise<VerificationRequest>;\n\n /**\n * Send a verification request to our other devices.\n *\n * This is normally used when the current device is new, and we want to ask another of our devices to cross-sign.\n *\n * If an all-devices verification is already in flight, returns it. Otherwise, initiates a new one.\n *\n * To control the methods offered, set {@link matrix.ICreateClientOpts.verificationMethods} when creating the\n * `MatrixClient`.\n *\n * @returns a VerificationRequest when the request has been sent to the other party.\n */\n requestOwnUserVerification(): Promise<VerificationRequest>;\n\n /**\n * Request an interactive verification with the given device.\n *\n * This is normally used on one of our own devices, when the current device is already cross-signed, and we want to\n * validate another device.\n *\n * If a verification for this user/device is already in flight, returns it. Otherwise, initiates a new one.\n *\n * To control the methods offered, set {@link matrix.ICreateClientOpts.verificationMethods} when creating the\n * `MatrixClient`.\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: string, deviceId: string): Promise<VerificationRequest>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Secure key backup\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Fetch the backup decryption key we have saved in our store.\n *\n * This can be used for gossiping the key to other devices.\n *\n * @returns the key, if any, or null\n */\n getSessionBackupPrivateKey(): Promise<Uint8Array | null>;\n\n /**\n * Store the backup decryption key.\n *\n * This should be called if the client has received the key from another device via secret sharing (gossiping).\n * It is the responsability of the caller to check that the decryption key is valid for the current backup version.\n *\n * @param key - the backup decryption key\n *\n * @deprecated prefer the variant with a `version` parameter.\n */\n storeSessionBackupPrivateKey(key: Uint8Array): Promise<void>;\n\n /**\n * Store the backup decryption key.\n *\n * This should be called if the client has received the key from another device via secret sharing (gossiping).\n * It is the responsability of the caller to check that the decryption key is valid for the given backup version.\n *\n * @param key - the backup decryption key\n * @param version - the backup version corresponding to this decryption key\n */\n storeSessionBackupPrivateKey(key: Uint8Array, version: string): Promise<void>;\n\n /**\n * Attempt to fetch the backup decryption key from secret storage.\n *\n * If the key is found in secret storage, checks it against the latest backup on the server;\n * if they match, stores the key in the crypto store by calling {@link storeSessionBackupPrivateKey},\n * which enables automatic restore of individual keys when an Unable-to-decrypt error is encountered.\n *\n * If we are unable to fetch the key from secret storage, there is no backup on the server, or the key\n * does not match, throws an exception.\n */\n loadSessionBackupPrivateKeyFromSecretStorage(): Promise<void>;\n\n /**\n * Get the current status of key backup.\n *\n * @returns If automatic key backups are enabled, the `version` of the active backup. Otherwise, `null`.\n */\n getActiveSessionBackupVersion(): Promise<string | null>;\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: KeyBackupInfo): Promise<BackupTrustInfo>;\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 * Return null if there is no backup.\n *\n * @returns the key backup information\n */\n getKeyBackupInfo(): Promise<KeyBackupInfo | null>;\n\n /**\n * Force a re-check of the key backup and enable/disable it as appropriate.\n *\n * Fetches the current backup information from the server. If there is a backup, and it is trusted, starts\n * backing up to it; otherwise, disables backups.\n *\n * @returns `null` if there is no backup on the server. Otherwise, data on the backup as returned by the server,\n * and trust information (as returned by {@link isKeyBackupTrusted}).\n */\n checkKeyBackupAndEnable(): Promise<KeyBackupCheck | null>;\n\n /**\n * Creates a new key backup version.\n *\n * If there are existing backups they will be replaced.\n *\n * If secret storage is set up, the new decryption key will be saved (the {@link CryptoCallbacks.getSecretStorageKey}\n * callback will be called to obtain the secret storage key).\n *\n * The backup engine will be started using the new backup version (i.e., {@link checkKeyBackupAndEnable} is called).\n */\n resetKeyBackup(): Promise<void>;\n\n /**\n * Deletes the given key backup.\n *\n * @param version - The backup version to delete.\n */\n deleteKeyBackupVersion(version: string): Promise<void>;\n\n /**\n * Download and restore the full key backup from the homeserver.\n *\n * Before calling this method, a decryption key, and the backup version to restore,\n * must have been saved in the crypto store. This happens in one of the following ways:\n *\n * - When a new backup version is created with {@link CryptoApi.resetKeyBackup}, a new key is created and cached.\n * - The key can be loaded from secret storage with {@link CryptoApi.loadSessionBackupPrivateKeyFromSecretStorage}.\n * - The key can be received from another device via secret sharing, typically as part of the interactive verification flow.\n * - The key and backup version can also be set explicitly via {@link CryptoApi.storeSessionBackupPrivateKey},\n * though this is not expected to be a common operation.\n *\n * Warning: the full key backup may be quite large, so this operation may take several hours to complete.\n * Use of {@link KeyBackupRestoreOpts.progressCallback} is recommended.\n *\n * @param opts\n */\n restoreKeyBackup(opts?: KeyBackupRestoreOpts): Promise<KeyBackupRestoreResult>;\n\n /**\n * Restores a key backup using a passphrase.\n * The decoded key (derived from the passphrase) is stored locally by calling {@link CryptoApi#storeSessionBackupPrivateKey}.\n *\n * @param passphrase - The passphrase to use to restore the key backup.\n * @param opts\n *\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 */\n restoreKeyBackupWithPassphrase(passphrase: string, opts?: KeyBackupRestoreOpts): Promise<KeyBackupRestoreResult>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Dehydrated devices\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Returns whether MSC3814 dehydrated devices are supported by the crypto\n * backend and by the server.\n *\n * This should be called before calling `startDehydration`, and if this\n * returns `false`, `startDehydration` should not be called.\n */\n isDehydrationSupported(): Promise<boolean>;\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 * This function must not be called unless `isDehydrationSupported` returns\n * `true`, and must not be called until after cross-signing and secret\n * storage have been set up.\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 startDehydration(opts?: StartDehydrationOpts | boolean): Promise<void>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Import/export of secret keys\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Export secrets bundle for transmitting to another device as part of OIDC QR login\n */\n exportSecretsBundle?(): Promise<Awaited<ReturnType<SecretsBundle[\"to_json\"]>>>;\n\n /**\n * Import secrets bundle transmitted from another device.\n * @param secrets - The secrets bundle received from the other device\n */\n importSecretsBundle?(secrets: Awaited<ReturnType<SecretsBundle[\"to_json\"]>>): Promise<void>;\n}\n\n/** A reason code for a failure to decrypt an event. */\nexport enum DecryptionFailureCode {\n /** Message was encrypted with a Megolm session whose keys have not been shared with us. */\n MEGOLM_UNKNOWN_INBOUND_SESSION_ID = \"MEGOLM_UNKNOWN_INBOUND_SESSION_ID\",\n\n /** A special case of {@link MEGOLM_UNKNOWN_INBOUND_SESSION_ID}: the sender has told us it is withholding the key. */\n MEGOLM_KEY_WITHHELD = \"MEGOLM_KEY_WITHHELD\",\n\n /** A special case of {@link MEGOLM_KEY_WITHHELD}: the sender has told us it is withholding the key, because the current device is unverified. */\n MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE = \"MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE\",\n\n /** Message was encrypted with a Megolm session which has been shared with us, but in a later ratchet state. */\n OLM_UNKNOWN_MESSAGE_INDEX = \"OLM_UNKNOWN_MESSAGE_INDEX\",\n\n /**\n * Message was sent before the current device was created; there is no key backup on the server, so this\n * decryption failure is expected.\n */\n HISTORICAL_MESSAGE_NO_KEY_BACKUP = \"HISTORICAL_MESSAGE_NO_KEY_BACKUP\",\n\n /**\n * Message was sent before the current device was created; there was a key backup on the server, but we don't\n * seem to have access to the backup. (Probably we don't have the right key.)\n */\n HISTORICAL_MESSAGE_BACKUP_UNCONFIGURED = \"HISTORICAL_MESSAGE_BACKUP_UNCONFIGURED\",\n\n /**\n * Message was sent before the current device was created; there was a (usable) key backup on the server, but we\n * still can't decrypt. (Either the session isn't in the backup, or we just haven't gotten around to checking yet.)\n */\n HISTORICAL_MESSAGE_WORKING_BACKUP = \"HISTORICAL_MESSAGE_WORKING_BACKUP\",\n\n /**\n * Message was sent when the user was not a member of the room.\n */\n HISTORICAL_MESSAGE_USER_NOT_JOINED = \"HISTORICAL_MESSAGE_USER_NOT_JOINED\",\n\n /**\n * The sender's identity is not verified, but was previously verified.\n */\n SENDER_IDENTITY_PREVIOUSLY_VERIFIED = \"SENDER_IDENTITY_PREVIOUSLY_VERIFIED\",\n\n /**\n * The sender device is not cross-signed. This will only be used if the\n * device isolation mode is set to `OnlySignedDevicesIsolationMode`.\n */\n UNSIGNED_SENDER_DEVICE = \"UNSIGNED_SENDER_DEVICE\",\n\n /**\n * We weren't able to link the message back to any known device. This will\n * only be used if the device isolation mode is set to `OnlySignedDevicesIsolationMode`.\n */\n UNKNOWN_SENDER_DEVICE = \"UNKNOWN_SENDER_DEVICE\",\n\n /** Unknown or unclassified error. */\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n\n /** @deprecated only used in legacy crypto */\n MEGOLM_BAD_ROOM = \"MEGOLM_BAD_ROOM\",\n\n /** @deprecated only used in legacy crypto */\n MEGOLM_MISSING_FIELDS = \"MEGOLM_MISSING_FIELDS\",\n\n /** @deprecated only used in legacy crypto */\n OLM_DECRYPT_GROUP_MESSAGE_ERROR = \"OLM_DECRYPT_GROUP_MESSAGE_ERROR\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_ENCRYPTED_MESSAGE = \"OLM_BAD_ENCRYPTED_MESSAGE\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_RECIPIENT = \"OLM_BAD_RECIPIENT\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_RECIPIENT_KEY = \"OLM_BAD_RECIPIENT_KEY\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_ROOM = \"OLM_BAD_ROOM\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_SENDER_CHECK_FAILED = \"OLM_BAD_SENDER_CHECK_FAILED\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_SENDER = \"OLM_BAD_SENDER\",\n\n /** @deprecated only used in legacy crypto */\n OLM_FORWARDED_MESSAGE = \"OLM_FORWARDED_MESSAGE\",\n\n /** @deprecated only used in legacy crypto */\n OLM_MISSING_CIPHERTEXT = \"OLM_MISSING_CIPHERTEXT\",\n\n /** @deprecated only used in legacy crypto */\n OLM_NOT_INCLUDED_IN_RECIPIENTS = \"OLM_NOT_INCLUDED_IN_RECIPIENTS\",\n\n /** @deprecated only used in legacy crypto */\n UNKNOWN_ENCRYPTION_ALGORITHM = \"UNKNOWN_ENCRYPTION_ALGORITHM\",\n}\n\n/** Base {@link DeviceIsolationMode} kind. */\nexport enum DeviceIsolationModeKind {\n AllDevicesIsolationMode,\n OnlySignedDevicesIsolationMode,\n}\n\n/**\n * A type of {@link DeviceIsolationMode}.\n *\n * Message encryption keys are shared with all devices in the room, except in case of\n * verified user problems (see {@link errorOnVerifiedUserProblems}).\n *\n * Events from all senders are always decrypted (and should be decorated with message shields in case\n * of authenticity warnings, see {@link EventEncryptionInfo}).\n */\nexport class AllDevicesIsolationMode {\n public readonly kind = DeviceIsolationModeKind.AllDevicesIsolationMode;\n\n /**\n *\n * @param errorOnVerifiedUserProblems - Behavior when sharing keys to remote devices.\n *\n * If set to `true`, sharing keys will fail (i.e. message sending will fail) with an error if:\n * - The user was previously verified but is not anymore, or:\n * - A verified user has some unverified devices (not cross-signed).\n *\n * If `false`, the keys will be distributed as usual. In this case, the client UX should display\n * warnings to inform the user about problematic devices/users, and stop them hitting this case.\n */\n public constructor(public readonly errorOnVerifiedUserProblems: boolean) {}\n}\n\n/**\n * A type of {@link DeviceIsolationMode}.\n *\n * Message encryption keys are only shared with devices that have been cross-signed by their owner.\n * Encryption will throw an error if a verified user replaces their identity.\n *\n * Events are decrypted only if they come from a cross-signed device. Other events will result in a decryption\n * failure. (To access the failure reason, see {@link MatrixEvent.decryptionFailureReason}.)\n */\nexport class OnlySignedDevicesIsolationMode {\n public readonly kind = DeviceIsolationModeKind.OnlySignedDevicesIsolationMode;\n}\n\n/**\n * DeviceIsolationMode represents the mode of device isolation used when encrypting or decrypting messages.\n * It can be one of two types: {@link AllDevicesIsolationMode} or {@link OnlySignedDevicesIsolationMode}.\n *\n * Only supported by rust Crypto.\n */\nexport type DeviceIsolationMode = AllDevicesIsolationMode | OnlySignedDevicesIsolationMode;\n\n/**\n * Options object for `CryptoApi.bootstrapCrossSigning`.\n */\nexport interface BootstrapCrossSigningOpts {\n /** Optional. Reset the cross-signing keys even if keys already exist. */\n setupNewCrossSigning?: boolean;\n\n /**\n * An application callback to collect the authentication data for uploading the keys. If not given, the keys\n * will not be uploaded to the server (which seems like a bad thing?).\n */\n authUploadDeviceSigningKeys?: UIAuthCallback<void>;\n}\n\n/**\n * Represents the ways in which we trust a user\n */\nexport class UserVerificationStatus {\n /**\n * Indicates if the identity has changed in a way that needs user approval.\n *\n * This happens if the identity has changed since we first saw it, *unless* the new identity has also been verified\n * by our user (eg via an interactive verification).\n *\n * To rectify this, either:\n *\n * * Conduct a verification of the new identity via {@link CryptoApi.requestVerificationDM}.\n * * Pin the new identity, via {@link CryptoApi.pinCurrentUserIdentity}.\n *\n * @returns true if the identity has changed in a way that needs user approval.\n */\n public readonly needsUserApproval: boolean;\n\n public constructor(\n private readonly crossSigningVerified: boolean,\n private readonly crossSigningVerifiedBefore: boolean,\n private readonly tofu: boolean,\n needsUserApproval: boolean = false,\n ) {\n this.needsUserApproval = needsUserApproval;\n }\n\n /**\n * @returns true if this user is verified via any means\n */\n public isVerified(): boolean {\n return this.isCrossSigningVerified();\n }\n\n /**\n * @returns true if this user is verified via cross signing\n */\n public isCrossSigningVerified(): boolean {\n return this.crossSigningVerified;\n }\n\n /**\n * @returns true if we ever verified this user before (at least for\n * the history of verifications observed by this device).\n */\n public wasCrossSigningVerified(): boolean {\n return this.crossSigningVerifiedBefore;\n }\n\n /**\n * @returns true if this user's key is trusted on first use\n *\n * @deprecated No longer supported, with the Rust crypto stack.\n */\n public isTofu(): boolean {\n return this.tofu;\n }\n}\n\nexport class DeviceVerificationStatus {\n /**\n * True if this device has been signed by its owner (and that signature verified).\n *\n * This doesn't necessarily mean that we have verified the device, since we may not have verified the\n * owner's cross-signing key.\n */\n public readonly signedByOwner: boolean;\n\n /**\n * True if this device has been verified via cross signing.\n *\n * This does *not* take into account `trustCrossSignedDevices`.\n */\n public readonly crossSigningVerified: boolean;\n\n /**\n * TODO: tofu magic wtf does this do?\n */\n public readonly tofu: boolean;\n\n /**\n * True if the device has been marked as locally verified.\n */\n public readonly localVerified: boolean;\n\n /**\n * True if the client has been configured to trust cross-signed devices via {@link CryptoApi#setTrustCrossSignedDevices}.\n */\n private readonly trustCrossSignedDevices: boolean;\n\n public constructor(\n opts: Partial<DeviceVerificationStatus> & {\n /**\n * True if cross-signed devices should be considered verified for {@link DeviceVerificationStatus#isVerified}.\n */\n trustCrossSignedDevices?: boolean;\n },\n ) {\n this.signedByOwner = opts.signedByOwner ?? false;\n this.crossSigningVerified = opts.crossSigningVerified ?? false;\n this.tofu = opts.tofu ?? false;\n this.localVerified = opts.localVerified ?? false;\n this.trustCrossSignedDevices = opts.trustCrossSignedDevices ?? false;\n }\n\n /**\n * Check if we should consider this device \"verified\".\n *\n * A device is \"verified\" if either:\n * * it has been manually marked as such via {@link CryptoApi.setDeviceVerified}.\n * * it has been cross-signed with a verified signing key, **and** the client has been configured to trust\n * cross-signed devices via {@link CryptoApi.setTrustCrossSignedDevices}.\n *\n * @returns true if this device is verified via any means.\n */\n public isVerified(): boolean {\n return this.localVerified || (this.trustCrossSignedDevices && this.crossSigningVerified);\n }\n}\n\n/**\n * Enum representing the different stages of importing room keys.\n *\n * This is the type of the `stage` property of {@link ImportRoomKeyProgressData}.\n */\nexport enum ImportRoomKeyStage {\n /**\n * The stage where room keys are being fetched.\n *\n * @see {@link ImportRoomKeyFetchProgress}.\n */\n Fetch = \"fetch\",\n /**\n * The stage where room keys are being loaded.\n *\n * @see {@link ImportRoomKeyLoadProgress}.\n */\n LoadKeys = \"load_keys\",\n}\n\n/**\n * Type representing the progress during the 'fetch' stage of the room key import process.\n *\n * @see {@link ImportRoomKeyProgressData}.\n */\nexport type ImportRoomKeyFetchProgress = {\n /**\n * The current stage of the import process.\n */\n stage: ImportRoomKeyStage.Fetch;\n};\n\n/**\n * Type representing the progress during the 'load_keys' stage of the room key import process.\n *\n * @see {@link ImportRoomKeyProgressData}.\n */\nexport type ImportRoomKeyLoadProgress = {\n /**\n * The current stage of the import process.\n */\n stage: ImportRoomKeyStage.LoadKeys;\n\n /**\n * The number of successfully loaded room keys so far.\n */\n successes: number;\n\n /**\n * The number of room keys that failed to load so far.\n */\n failures: number;\n\n /**\n * The total number of room keys being loaded.\n */\n total: number;\n};\n\n/**\n * Room key import progress report.\n * Used when calling {@link CryptoApi#importRoomKeys},\n * {@link CryptoApi#importRoomKeysAsJson} or {@link CryptoApi#restoreKeyBackup} as the parameter of\n * the progressCallback. Used to display feedback.\n */\nexport type ImportRoomKeyProgressData = ImportRoomKeyFetchProgress | ImportRoomKeyLoadProgress;\n\n/**\n * Options object for {@link CryptoApi#importRoomKeys} and\n * {@link CryptoApi#importRoomKeysAsJson}.\n */\nexport interface ImportRoomKeysOpts {\n /** Reports ongoing progress of the import process. Can be used for feedback. */\n progressCallback?: (stage: ImportRoomKeyProgressData) => void;\n /** @deprecated the rust SDK will always such imported keys as untrusted */\n untrusted?: boolean;\n /** @deprecated not useful externally */\n source?: string;\n}\n\n/**\n * The result of a call to {@link CryptoApi.getCrossSigningStatus}.\n */\nexport interface CrossSigningStatus {\n /**\n * True if the public master, self signing and user signing keys are available on this device.\n */\n publicKeysOnDevice: boolean;\n /**\n * True if the private keys are stored in the secret storage.\n */\n privateKeysInSecretStorage: boolean;\n /**\n * True if the private keys are stored locally.\n */\n privateKeysCachedLocally: {\n masterKey: boolean;\n selfSigningKey: boolean;\n userSigningKey: boolean;\n };\n}\n\n/**\n * Crypto callbacks provided by the application\n */\nexport interface CryptoCallbacks {\n /**\n * Called to retrieve a secret storage encryption key.\n *\n * [Server-side secret storage](https://spec.matrix.org/v1.12/client-server-api/#key-storage)\n * is, as the name implies, a mechanism for storing secrets which should be shared between\n * clients on the server. For example, it is typically used for storing the\n * [key backup decryption key](https://spec.matrix.org/v1.12/client-server-api/#decryption-key)\n * and the private [cross-signing keys](https://spec.matrix.org/v1.12/client-server-api/#cross-signing).\n *\n * The secret storage mechanism encrypts the secrets before uploading them to the server using a\n * secret storage key. The schema supports multiple keys, but in practice only one tends to be used\n * at once; this is the \"default secret storage key\" and may be known as the \"recovery key\" (or, sometimes,\n * the \"security key\").\n *\n * Secret storage can be set up by calling {@link CryptoApi.bootstrapSecretStorage}. Having done so, when\n * the crypto stack needs to access secret storage (for example, when setting up a new device, or to\n * store newly-generated secrets), it will use this callback (`getSecretStorageKey`).\n *\n * Note that the secret storage key may be needed several times in quick succession: it is recommended\n * that applications use a temporary cache to avoid prompting the user multiple times for the key. See\n * also {@link cacheSecretStorageKey} which is called when a new key is created.\n *\n * The helper method {@link deriveRecoveryKeyFromPassphrase} may be useful if the secret storage key\n * was derived from a passphrase.\n *\n * @param opts - An options object.\n *\n * @param name - the name of the *secret* (NB: not the encryption key) being stored or retrieved.\n * When the item is stored in account data, it will have this `type`.\n *\n * @returns a pair [`keyId`, `privateKey`], where `keyId` is one of the keys from the `keys` parameter,\n * and `privateKey` is the raw private encryption key, as appropriate for the encryption algorithm.\n * (For `m.secret_storage.v1.aes-hmac-sha2`, it is the input to an HKDF as defined in the\n * [specification](https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2).)\n *\n * Alternatively, if none of the keys are known, may return `null` — in which case the original\n * operation that requires access to a secret in secret storage may fail with an exception.\n */\n getSecretStorageKey?: (\n opts: {\n /**\n * Details of the secret storage keys required: a map from the key ID\n * (excluding the `m.secret_storage.key.` prefix) to details of the key.\n *\n * When storing a secret, `keys` will contain exactly one entry.\n *\n * For secret retrieval, `keys` may contain several entries, and the application can return\n * any one of the requested keys. Unless your application specifically wants to offer the\n * user the ability to have more than one secret storage key active at a time, it is recommended\n * to call {@link matrix.SecretStorage.ServerSideSecretStorage.getDefaultKeyId | ServerSideSecretStorage.getDefaultKeyId}\n * to figure out which is the current default key, and to return `null` if the default key is not listed in `keys`.\n */\n keys: Record<string, SecretStorageKeyDescription>;\n },\n name: string,\n ) => Promise<[string, Uint8Array] | null>;\n\n /** @deprecated: unused with the Rust crypto stack. */\n getCrossSigningKey?: (keyType: string, pubKey: string) => Promise<Uint8Array | null>;\n /** @deprecated: unused with the Rust crypto stack. */\n saveCrossSigningKeys?: (keys: Record<string, Uint8Array>) => void;\n /** @deprecated: unused with the Rust crypto stack. */\n shouldUpgradeDeviceVerifications?: (users: Record<string, any>) => Promise<string[]>;\n\n /**\n * Called by {@link CryptoApi.bootstrapSecretStorage} when a new default secret storage key is created.\n *\n * Applications can use this to (temporarily) cache the secret storage key, for later return by\n * {@link getSecretStorageKey}.\n *\n * @param keyId - secret storage key id\n * @param keyInfo - secret storage key info\n * @param key - private key to store\n */\n cacheSecretStorageKey?: (keyId: string, keyInfo: SecretStorageKeyDescription, key: Uint8Array) => void;\n\n /** @deprecated: unused with the Rust crypto stack. */\n onSecretRequested?: (\n userId: string,\n deviceId: string,\n requestId: string,\n secretName: string,\n deviceTrust: DeviceVerificationStatus,\n ) => Promise<string | undefined>;\n\n /** @deprecated: unused with the Rust crypto stack. */\n getDehydrationKey?: (\n keyInfo: SecretStorageKeyDescription,\n checkFunc: (key: Uint8Array) => void,\n ) => Promise<Uint8Array>;\n\n /** @deprecated: unused with the Rust crypto stack. */\n getBackupKey?: () => Promise<Uint8Array>;\n}\n\n/**\n * Parameter of {@link CryptoApi#bootstrapSecretStorage}\n */\nexport interface CreateSecretStorageOpts {\n /**\n * Function called to await a secret storage key creation flow.\n * @returns Promise resolving to an object with public key metadata, encoded private\n * recovery key which should be disposed of after displaying to the user,\n * and raw private key to avoid round tripping if needed.\n */\n createSecretStorageKey?: () => Promise<GeneratedSecretStorageKey>;\n\n /**\n * The current key backup object. If passed,\n * the passphrase and recovery key from this backup will be used.\n * @deprecated Not used by the Rust crypto stack.\n */\n keyBackupInfo?: KeyBackupInfo;\n\n /**\n * If true, a new key backup version will be\n * created and the private key stored in the new SSSS store. Ignored if keyBackupInfo\n * is supplied.\n */\n setupNewKeyBackup?: boolean;\n\n /**\n * Reset even if keys already exist.\n */\n setupNewSecretStorage?: boolean;\n\n /**\n * Function called to get the user's current key backup passphrase.\n *\n * Should return a promise that resolves with a Uint8Array\n * containing the key, or rejects if the key cannot be obtained.\n *\n * Only used when the client has existing key backup, but no secret storage.\n *\n * @deprecated Not used by the Rust crypto stack.\n */\n getKeyBackupPassphrase?: () => Promise<Uint8Array>;\n}\n\n/** Types of cross-signing key */\nexport enum CrossSigningKey {\n Master = \"master\",\n SelfSigning = \"self_signing\",\n UserSigning = \"user_signing\",\n}\n\n/**\n * Information on one of the cross-signing keys.\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3keysdevice_signingupload\n */\nexport interface CrossSigningKeyInfo {\n keys: { [algorithm: string]: string };\n signatures?: ISignatures;\n usage: string[];\n user_id: string;\n}\n\n/**\n * Recovery key created by {@link CryptoApi#createRecoveryKeyFromPassphrase} or {@link CreateSecretStorageOpts#createSecretStorageKey}.\n */\nexport interface GeneratedSecretStorageKey {\n keyInfo?: {\n /** If the key was derived from a passphrase, information (algorithm, salt, etc) on that derivation. */\n passphrase?: PassphraseInfo;\n /** Optional human-readable name for the key, to be stored in account_data. */\n name?: string;\n };\n /** The raw generated private key. */\n privateKey: Uint8Array;\n /** The generated key, encoded for display to the user per https://spec.matrix.org/v1.7/client-server-api/#key-representation. */\n encodedPrivateKey?: string;\n}\n\n/**\n * Result type of {@link CryptoApi#getEncryptionInfoForEvent}.\n */\nexport interface EventEncryptionInfo {\n /** \"Shield\" to be shown next to this event representing its verification status */\n shieldColour: EventShieldColour;\n\n /**\n * `null` if `shieldColour` is `EventShieldColour.NONE`; otherwise a reason code for the shield in `shieldColour`.\n */\n shieldReason: EventShieldReason | null;\n}\n\n/**\n * Types of shield to be shown for {@link EventEncryptionInfo#shieldColour}.\n */\nexport enum EventShieldColour {\n NONE,\n GREY,\n RED,\n}\n\n/**\n * Reason codes for {@link EventEncryptionInfo#shieldReason}.\n */\nexport enum EventShieldReason {\n /** An unknown reason from the crypto library (if you see this, it is a bug in matrix-js-sdk). */\n UNKNOWN,\n\n /** \"Encrypted by an unverified user.\" */\n UNVERIFIED_IDENTITY,\n\n /** \"Encrypted by a device not verified by its owner.\" */\n UNSIGNED_DEVICE,\n\n /** \"Encrypted by an unknown or deleted device.\" */\n UNKNOWN_DEVICE,\n\n /**\n * \"The authenticity of this encrypted message can't be guaranteed on this device.\"\n *\n * ie: the key has been forwarded, or retrieved from an insecure backup.\n */\n AUTHENTICITY_NOT_GUARANTEED,\n\n /**\n * The (deprecated) sender_key field in the event does not match the Ed25519 key of the device that sent us the\n * decryption keys.\n */\n MISMATCHED_SENDER_KEY,\n\n /**\n * The event was sent unencrypted in an encrypted room.\n */\n SENT_IN_CLEAR,\n\n /**\n * The sender was previously verified but changed their identity.\n */\n VERIFICATION_VIOLATION,\n}\n\n/** The result of a call to {@link CryptoApi.getOwnDeviceKeys} */\nexport interface OwnDeviceKeys {\n /** Public part of the Ed25519 fingerprint key for the current device, base64 encoded. */\n ed25519: string;\n /** Public part of the Curve25519 identity key for the current device, base64 encoded. */\n curve25519: string;\n}\n\nexport * from \"./verification.ts\";\nexport type * from \"./keybackup.ts\";\nexport * from \"./recovery-key.ts\";\nexport * from \"./key-passphrase.ts\";\nexport * from \"./CryptoEvent.ts\";\nexport type * from \"./CryptoEventHandlerMap.ts\";\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AA6BA;AACA;AACA;AACA;AACA;;AAqoBA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;;AAgGjC;AACA,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAvBA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;;AAKnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,CAAC;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A;;AAGA;AACA;AACA;AACA;;AAUA;AACA;AACA;;AAoBA;AACA;AACA;;AAiGA;AACA;AACA;;AA0CA;AACA,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;;AAM3B;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAcA;AACA;AACA;;AAWA;AACA;AACA;AACA,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;;AAM7B;AACA;AACA;AACA,WAAYC,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAjBA,iBAAiB,CAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA;;AAqC7B;;AAQA,cAAc,mBAAmB;AAEjC,cAAc,mBAAmB;AACjC,cAAc,qBAAqB;AACnC,cAAc,kBAAkB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["DecryptionFailureCode","DeviceIsolationModeKind","AllDevicesIsolationMode","constructor","errorOnVerifiedUserProblems","_defineProperty","OnlySignedDevicesIsolationMode","UserVerificationStatus","crossSigningVerified","crossSigningVerifiedBefore","tofu","needsUserApproval","arguments","length","undefined","isVerified","isCrossSigningVerified","wasCrossSigningVerified","isTofu","DeviceVerificationStatus","opts","_opts$signedByOwner","_opts$crossSigningVer","_opts$tofu","_opts$localVerified","_opts$trustCrossSigne","signedByOwner","localVerified","trustCrossSignedDevices","ImportRoomKeyStage","CrossSigningKey","EventShieldColour","EventShieldReason"],"sources":["../../src/crypto-api/index.ts"],"sourcesContent":["/*\nCopyright 2023 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport type { SecretsBundle } from \"@matrix-org/matrix-sdk-crypto-wasm\";\nimport type { IMegolmSessionData } from \"../@types/crypto.ts\";\nimport type { ToDeviceBatch, ToDevicePayload } from \"../models/ToDeviceMessage.ts\";\nimport { type Room } from \"../models/room.ts\";\nimport { type DeviceMap } from \"../models/device.ts\";\nimport { type UIAuthCallback } from \"../interactive-auth.ts\";\nimport { type PassphraseInfo, type SecretStorageKeyDescription } from \"../secret-storage.ts\";\nimport { type VerificationRequest } from \"./verification.ts\";\nimport {\n type BackupTrustInfo,\n type KeyBackupCheck,\n type KeyBackupInfo,\n type KeyBackupRestoreOpts,\n type KeyBackupRestoreResult,\n} from \"./keybackup.ts\";\nimport { type ISignatures } from \"../@types/signed.ts\";\nimport { type MatrixEvent } from \"../models/event.ts\";\n\n/**\n * `matrix-js-sdk/lib/crypto-api`: End-to-end encryption support.\n *\n * The most important type is {@link CryptoApi}, an instance of which can be retrieved via\n * {@link MatrixClient.getCrypto}.\n *\n * @packageDocumentation\n */\n\n/**\n * The options to start device dehydration.\n */\nexport interface StartDehydrationOpts {\n /**\n * Force creation of a new dehydration key, even if there is already an\n * existing dehydration key. If `false`, and `onlyIfKeyCached` is `false`, a\n * new key will be created if there is no existing dehydration key, whether\n * already cached in our local storage or stored in Secret Storage.\n *\n * Checking for the presence of the key in Secret Storage may result in the\n * `getSecretStorageKey` callback being called.\n *\n * Defaults to `false`.\n */\n createNewKey?: boolean;\n /**\n * Only start dehydration if we have a dehydration key cached in our local\n * storage. If `true`, Secret Storage will not be checked. Defaults to\n * `false`.\n */\n onlyIfKeyCached?: boolean;\n /**\n * Try to rehydrate a device before creating a new dehydrated device.\n * Setting this to `false` may be useful for situations where the client is\n * known to pre-date the dehydrated device, and so rehydration is\n * unnecessary. Defaults to `true`.\n */\n rehydrate?: boolean;\n}\n\n/**\n * Public interface to the cryptography parts of the js-sdk\n *\n * @remarks Currently, this is a work-in-progress. In time, more methods will be added here.\n */\nexport interface CryptoApi {\n /**\n * Global override for whether the client should ever send encrypted\n * messages to unverified devices. This provides the default for rooms which\n * do not specify a value.\n *\n * If true, all unverified devices will be blacklisted by default\n */\n globalBlacklistUnverifiedDevices: boolean;\n\n /**\n * The {@link DeviceIsolationMode} mode to use.\n */\n setDeviceIsolationMode(isolationMode: DeviceIsolationMode): void;\n\n /**\n * Return the current version of the crypto module.\n * For example: `Rust SDK ${versions.matrix_sdk_crypto} (${versions.git_sha}), Vodozemac ${versions.vodozemac}`.\n * @returns the formatted version\n */\n getVersion(): string;\n\n /**\n * Get the public part of the device keys for the current device.\n *\n * @returns The public device keys.\n */\n getOwnDeviceKeys(): Promise<OwnDeviceKeys>;\n\n /**\n * Check if we believe the given room to be encrypted.\n *\n * This method returns true if the room has been configured with encryption. The setting is persistent, so that\n * even if the encryption event is removed from the room state, it still returns true. This helps to guard against\n * a downgrade attack wherein a server admin attempts to remove encryption.\n *\n * @returns `true` if the room with the supplied ID is encrypted. `false` if the room is not encrypted, or is unknown to\n * us.\n */\n isEncryptionEnabledInRoom(roomId: string): Promise<boolean>;\n\n /**\n * Perform any background tasks that can be done before a message is ready to\n * send, in order to speed up sending of the message.\n *\n * @param room - the room the event is in\n */\n prepareToEncrypt(room: Room): void;\n\n /**\n * Discard any existing megolm session for the given room.\n *\n * This will ensure that a new session is created on the next call to {@link prepareToEncrypt},\n * or the next time a message is sent.\n *\n * This should not normally be necessary: it should only be used as a debugging tool if there has been a\n * problem with encryption.\n *\n * @param roomId - the room to discard sessions for\n */\n forceDiscardSession(roomId: string): Promise<void>;\n\n /**\n * Get a list containing all of the room keys\n *\n * This should be encrypted before returning it to the user.\n *\n * @returns a promise which resolves to a list of\n * session export objects\n */\n exportRoomKeys(): Promise<IMegolmSessionData[]>;\n\n /**\n * Get a JSON list containing all of the room keys\n *\n * This should be encrypted before returning it to the user.\n *\n * @returns a promise which resolves to a JSON string\n * encoding a list of session export objects,\n * each of which is an IMegolmSessionData\n */\n exportRoomKeysAsJson(): Promise<string>;\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: IMegolmSessionData[], opts?: ImportRoomKeysOpts): Promise<void>;\n\n /**\n * Import a JSON string encoding a list of room keys previously\n * exported by exportRoomKeysAsJson\n *\n * @param keys - a JSON string encoding a list of session export\n * objects, 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(keys: string, opts?: ImportRoomKeysOpts): Promise<void>;\n\n /**\n * Check if the given user has published cross-signing keys.\n *\n * - If the user is tracked, a `/keys/query` request is made to update locally the cross signing keys.\n * - If the user is not tracked locally and downloadUncached is set to true,\n * a `/keys/query` request is made to the server to retrieve the cross signing keys.\n * - Otherwise, return false\n *\n * @param userId - the user ID to check. Defaults to the local user.\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 `false` will be returned for such users.\n *\n * @returns true if the cross signing keys are available.\n */\n userHasCrossSigningKeys(userId?: string, downloadUncached?: boolean): Promise<boolean>;\n\n /**\n * Get the device information for the given list of users.\n *\n * For any users whose device lists are cached (due to sharing an encrypted room with the user), the\n * cached device data is returned.\n *\n * If there are uncached users, and the `downloadUncached` parameter is set to `true`,\n * a `/keys/query` request is made to the server to retrieve these devices.\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: string[], downloadUncached?: boolean): Promise<DeviceMap>;\n\n /**\n * Set whether to trust other user's signatures of their devices.\n *\n * If false, devices will only be considered 'verified' if we have\n * verified that device individually (effectively disabling cross-signing).\n *\n * `true` by default.\n *\n * @param val - the new value\n */\n setTrustCrossSignedDevices(val: boolean): void;\n\n /**\n * Return whether we trust other user's signatures of their devices.\n *\n * @see {@link CryptoApi.setTrustCrossSignedDevices}\n *\n * @returns `true` if we trust cross-signed devices, otherwise `false`.\n */\n getTrustCrossSignedDevices(): boolean;\n\n /**\n * Get the verification status of a given user.\n *\n * @param userId - The ID of the user to check.\n *\n */\n getUserVerificationStatus(userId: string): Promise<UserVerificationStatus>;\n\n /**\n * \"Pin\" the current identity of the given user, accepting it as genuine.\n *\n * This is useful if the user has changed identity since we first saw them (leading to\n * {@link UserVerificationStatus.needsUserApproval}), and we are now accepting their new identity.\n *\n * Throws an error if called on our own user ID, or on a user ID that we don't have an identity for.\n */\n pinCurrentUserIdentity(userId: string): Promise<void>;\n\n /**\n * Remove the requirement for this identity to be verified, and pin it.\n *\n * This is useful if the user was previously verified but is not anymore\n * ({@link UserVerificationStatus.wasCrossSigningVerified}) and it is not possible to verify him again now.\n *\n */\n withdrawVerificationRequirement(userId: string): Promise<void>;\n\n /**\n * Get the verification status of a given device.\n *\n * @param userId - The ID of the user whose device is to be checked.\n * @param deviceId - The ID of the device to check\n *\n * @returns `null` if the device is unknown, or has not published any encryption keys (implying it does not support\n * encryption); otherwise the verification status of the device.\n */\n getDeviceVerificationStatus(userId: string, deviceId: string): Promise<DeviceVerificationStatus | null>;\n\n /**\n * Mark the given device as locally verified.\n *\n * Marking a device as locally verified has much the same effect as completing the verification dance, or receiving\n * a cross-signing signature for it.\n *\n * @param userId - owner of the device\n * @param deviceId - unique identifier for the device.\n * @param verified - whether to mark the device as verified. Defaults to 'true'.\n *\n * @throws an error if the device is unknown, or has not published any encryption keys.\n */\n setDeviceVerified(userId: string, deviceId: string, verified?: boolean): Promise<void>;\n\n /**\n * Cross-sign one of our own devices.\n *\n * This will create a signature for the device using our self-signing key, and publish that signature.\n * Cross-signing a device indicates, to our other devices and to other users, that we have verified that it really\n * belongs to us.\n *\n * Requires that cross-signing has been set up on this device (normally by calling {@link bootstrapCrossSigning}).\n *\n * *Note*: Do not call this unless you have verified, somehow, that the device is genuine!\n *\n * @param deviceId - ID of the device to be signed.\n */\n crossSignDevice(deviceId: string): Promise<void>;\n\n /**\n * Checks whether cross signing:\n * - is enabled on this account and trusted by this device\n * - has private keys either cached locally or stored in secret storage\n *\n * If this function returns false, {@link bootstrapCrossSigning()} can be used\n * to fix things such that it returns true. That is to say, after\n * `bootstrapCrossSigning()` completes successfully, this function should\n * return true.\n *\n * @returns True if cross-signing is ready to be used on this device\n *\n * @throws May throw {@link matrix.ClientStoppedError} if the `MatrixClient` is stopped before or during the call.\n */\n isCrossSigningReady(): Promise<boolean>;\n\n /**\n * Get the ID of one of the user's cross-signing keys, if both private and matching\n * public parts of that key are available (ie. cached in the local crypto store).\n *\n * The public part may not be available if a `/keys/query` request has not yet been\n * performed, or if the device that created the keys failed to publish them.\n *\n * If either part of the keypair is not available, this will return `null`.\n *\n * @param type - The type of key to get the ID of. One of `CrossSigningKey.Master`, `CrossSigningKey.SelfSigning`,\n * or `CrossSigningKey.UserSigning`. Defaults to `CrossSigningKey.Master`.\n *\n * @returns If cross-signing has been initialised on this device, the ID of the given key. Otherwise, null\n */\n getCrossSigningKeyId(type?: CrossSigningKey): Promise<string | null>;\n\n /**\n * Bootstrap cross-signing by creating keys if needed.\n *\n * If everything is already set up, then no changes are made, so this is safe to run to ensure\n * cross-signing is ready for use.\n *\n * This function:\n * - creates new cross-signing keys if they are not found locally cached nor in\n * secret storage (if it has been set up)\n * - publishes the public keys to the server if they are not already published\n * - stores the private keys in secret storage if secret storage is set up.\n *\n * @param opts - options object\n */\n bootstrapCrossSigning(opts: BootstrapCrossSigningOpts): Promise<void>;\n\n /**\n * Checks whether secret storage:\n * - is enabled on this account\n * - is storing cross-signing private keys\n * - is storing session backup key (if enabled)\n *\n * If this function returns false, {@link bootstrapSecretStorage()} can be used\n * to fix things such that it returns true. That is to say, after\n * `bootstrapSecretStorage()` completes successfully, this function should\n * return true.\n *\n * @returns True if secret storage is ready to be used on this device\n */\n isSecretStorageReady(): Promise<boolean>;\n\n /**\n * Bootstrap [secret storage](https://spec.matrix.org/v1.12/client-server-api/#storage).\n *\n * - If secret storage is not already set up, or {@link CreateSecretStorageOpts.setupNewSecretStorage} is set:\n * * Calls {@link CreateSecretStorageOpts.createSecretStorageKey} to generate a new key.\n * * Stores the metadata of the new key in account data and sets it as the default secret storage key.\n * * Calls {@link CryptoCallbacks.cacheSecretStorageKey} if provided.\n * - Stores the private cross signing keys in the secret storage if they are known, and they are not\n * already stored in secret storage.\n * - If {@link CreateSecretStorageOpts.setupNewKeyBackup} is set, calls {@link CryptoApi.resetKeyBackup}; otherwise,\n * stores the key backup decryption key in secret storage if it is known, and it is not\n * already stored in secret storage.\n *\n * Note that there may be multiple accesses to secret storage during the course of this call, each of which will\n * result in a call to {@link CryptoCallbacks.getSecretStorageKey}.\n *\n * @param opts - Options object.\n */\n bootstrapSecretStorage(opts: CreateSecretStorageOpts): Promise<void>;\n\n /**\n * Get the status of our cross-signing keys.\n *\n * @returns The current status of cross-signing keys: whether we have public and private keys cached locally, and\n * whether the private keys are in secret storage.\n *\n * @throws May throw {@link matrix.ClientStoppedError} if the `MatrixClient` is stopped before or during the call.\n */\n getCrossSigningStatus(): Promise<CrossSigningStatus>;\n\n /**\n * Create a recovery key (ie, a key suitable for use with server-side secret storage).\n *\n * The key can either be based on a user-supplied passphrase, or just created randomly.\n *\n * @param password - Optional passphrase string to use to derive the key,\n * which can later be entered by the user as an alternative to entering the\n * recovery key itself. If omitted, a key is generated randomly.\n *\n * @returns Object including recovery key and server upload parameters.\n * The private key should be disposed of after displaying to the use.\n */\n createRecoveryKeyFromPassphrase(password?: string): Promise<GeneratedSecretStorageKey>;\n\n /**\n * Get information about the encryption of the given event.\n *\n * @param event - the event to get information for\n *\n * @returns `null` if the event is not encrypted, or has not (yet) been successfully decrypted. Otherwise, an\n * object with information about the encryption of the event.\n */\n getEncryptionInfoForEvent(event: MatrixEvent): Promise<EventEncryptionInfo | null>;\n\n /**\n * Encrypts a given payload object via Olm to-device messages to a given\n * set of devices.\n *\n * @param eventType - the type of the event to send.\n * @param devices - an array of devices to encrypt the payload for.\n * @param payload - the payload to encrypt.\n *\n * @returns the batch of encrypted payloads which can then be sent via {@link matrix.MatrixClient#queueToDevice}.\n */\n encryptToDeviceMessages(\n eventType: string,\n devices: { userId: string; deviceId: string }[],\n payload: ToDevicePayload,\n ): Promise<ToDeviceBatch>;\n\n /**\n * Reset the encryption of the user by going through the following steps:\n * - Remove the dehydrated device and stop the periodic creation of dehydrated devices.\n * - Disable backing up room keys and delete any existing backups.\n * - Remove the default secret storage key from the account data (ie: the recovery key).\n * - Reset the cross-signing keys.\n * - Create a new key backup.\n *\n * Note that the dehydrated device will be removed, but will not be replaced\n * and it will not schedule creating new dehydrated devices. To do this,\n * {@link startDehydration} should be called after a new secret storage key\n * is created.\n *\n * @param authUploadDeviceSigningKeys - Callback to authenticate the upload of device signing keys.\n * Used when resetting the cross signing keys.\n * See {@link BootstrapCrossSigningOpts#authUploadDeviceSigningKeys}.\n */\n resetEncryption(authUploadDeviceSigningKeys: UIAuthCallback<void>): Promise<void>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Device/User verification\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Returns to-device verification requests that are already in progress for the given user id.\n *\n * @param userId - the ID of the user to query\n *\n * @returns the VerificationRequests that are in progress\n */\n getVerificationRequestsToDeviceInProgress(userId: string): VerificationRequest[];\n\n /**\n * Finds a DM verification request that is already in progress for the given room id\n *\n * @param roomId - the room to use for verification\n *\n * @returns the VerificationRequest that is in progress, if any\n * @deprecated prefer `userId` parameter variant.\n */\n findVerificationRequestDMInProgress(roomId: string): VerificationRequest | undefined;\n\n /**\n * Finds a DM verification request that is already in progress for the given room and user.\n *\n * @param roomId - the room to use for verification.\n * @param userId - search for a verification request for the given user.\n *\n * @returns the VerificationRequest that is in progress, if any.\n */\n findVerificationRequestDMInProgress(roomId: string, userId?: string): VerificationRequest | undefined;\n\n /**\n * Request a key verification from another user, using a DM.\n *\n * @param userId - the user to request verification with.\n * @param roomId - the room to use for verification.\n *\n * @returns resolves to a VerificationRequest when the request has been sent to the other party.\n */\n requestVerificationDM(userId: string, roomId: string): Promise<VerificationRequest>;\n\n /**\n * Send a verification request to our other devices.\n *\n * This is normally used when the current device is new, and we want to ask another of our devices to cross-sign.\n *\n * If an all-devices verification is already in flight, returns it. Otherwise, initiates a new one.\n *\n * To control the methods offered, set {@link matrix.ICreateClientOpts.verificationMethods} when creating the\n * `MatrixClient`.\n *\n * @returns a VerificationRequest when the request has been sent to the other party.\n */\n requestOwnUserVerification(): Promise<VerificationRequest>;\n\n /**\n * Request an interactive verification with the given device.\n *\n * This is normally used on one of our own devices, when the current device is already cross-signed, and we want to\n * validate another device.\n *\n * If a verification for this user/device is already in flight, returns it. Otherwise, initiates a new one.\n *\n * To control the methods offered, set {@link matrix.ICreateClientOpts.verificationMethods} when creating the\n * `MatrixClient`.\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: string, deviceId: string): Promise<VerificationRequest>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Secure key backup\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Fetch the backup decryption key we have saved in our store.\n *\n * This can be used for gossiping the key to other devices.\n *\n * @returns the key, if any, or null\n */\n getSessionBackupPrivateKey(): Promise<Uint8Array | null>;\n\n /**\n * Store the backup decryption key.\n *\n * This should be called if the client has received the key from another device via secret sharing (gossiping).\n * It is the responsability of the caller to check that the decryption key is valid for the current backup version.\n *\n * @param key - the backup decryption key\n *\n * @deprecated prefer the variant with a `version` parameter.\n */\n storeSessionBackupPrivateKey(key: Uint8Array): Promise<void>;\n\n /**\n * Store the backup decryption key.\n *\n * This should be called if the client has received the key from another device via secret sharing (gossiping).\n * It is the responsability of the caller to check that the decryption key is valid for the given backup version.\n *\n * @param key - the backup decryption key\n * @param version - the backup version corresponding to this decryption key\n */\n storeSessionBackupPrivateKey(key: Uint8Array, version: string): Promise<void>;\n\n /**\n * Attempt to fetch the backup decryption key from secret storage.\n *\n * If the key is found in secret storage, checks it against the latest backup on the server;\n * if they match, stores the key in the crypto store by calling {@link storeSessionBackupPrivateKey},\n * which enables automatic restore of individual keys when an Unable-to-decrypt error is encountered.\n *\n * If we are unable to fetch the key from secret storage, there is no backup on the server, or the key\n * does not match, throws an exception.\n */\n loadSessionBackupPrivateKeyFromSecretStorage(): Promise<void>;\n\n /**\n * Get the current status of key backup.\n *\n * @returns If automatic key backups are enabled, the `version` of the active backup. Otherwise, `null`.\n */\n getActiveSessionBackupVersion(): Promise<string | null>;\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: KeyBackupInfo): Promise<BackupTrustInfo>;\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 * Return null if there is no backup.\n *\n * @returns the key backup information\n */\n getKeyBackupInfo(): Promise<KeyBackupInfo | null>;\n\n /**\n * Force a re-check of the key backup and enable/disable it as appropriate.\n *\n * Fetches the current backup information from the server. If there is a backup, and it is trusted, starts\n * backing up to it; otherwise, disables backups.\n *\n * @returns `null` if there is no backup on the server. Otherwise, data on the backup as returned by the server,\n * and trust information (as returned by {@link isKeyBackupTrusted}).\n */\n checkKeyBackupAndEnable(): Promise<KeyBackupCheck | null>;\n\n /**\n * Creates a new key backup version.\n *\n * If there are existing backups they will be replaced.\n *\n * If secret storage is set up, the new decryption key will be saved (the {@link CryptoCallbacks.getSecretStorageKey}\n * callback will be called to obtain the secret storage key).\n *\n * The backup engine will be started using the new backup version (i.e., {@link checkKeyBackupAndEnable} is called).\n */\n resetKeyBackup(): Promise<void>;\n\n /**\n * Disables server-side key storage and deletes server-side backups.\n * * Deletes the current key backup version, if any (but not any previous versions).\n * * Disables 4S, deleting the info for the default key, the default key pointer itself and any\n * known 4S data (cross-signing keys and the megolm key backup key).\n * * Deletes any dehydrated devices.\n * * Sets the \"m.org.matrix.custom.backup_disabled\" account data flag to indicate that the user has disabled backups.\n */\n disableKeyStorage(): Promise<void>;\n\n /**\n * Deletes the given key backup.\n *\n * @param version - The backup version to delete.\n */\n deleteKeyBackupVersion(version: string): Promise<void>;\n\n /**\n * Download and restore the full key backup from the homeserver.\n *\n * Before calling this method, a decryption key, and the backup version to restore,\n * must have been saved in the crypto store. This happens in one of the following ways:\n *\n * - When a new backup version is created with {@link CryptoApi.resetKeyBackup}, a new key is created and cached.\n * - The key can be loaded from secret storage with {@link CryptoApi.loadSessionBackupPrivateKeyFromSecretStorage}.\n * - The key can be received from another device via secret sharing, typically as part of the interactive verification flow.\n * - The key and backup version can also be set explicitly via {@link CryptoApi.storeSessionBackupPrivateKey},\n * though this is not expected to be a common operation.\n *\n * Warning: the full key backup may be quite large, so this operation may take several hours to complete.\n * Use of {@link KeyBackupRestoreOpts.progressCallback} is recommended.\n *\n * @param opts\n */\n restoreKeyBackup(opts?: KeyBackupRestoreOpts): Promise<KeyBackupRestoreResult>;\n\n /**\n * Restores a key backup using a passphrase.\n * The decoded key (derived from the passphrase) is stored locally by calling {@link CryptoApi#storeSessionBackupPrivateKey}.\n *\n * @param passphrase - The passphrase to use to restore the key backup.\n * @param opts\n *\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 */\n restoreKeyBackupWithPassphrase(passphrase: string, opts?: KeyBackupRestoreOpts): Promise<KeyBackupRestoreResult>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Dehydrated devices\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Returns whether MSC3814 dehydrated devices are supported by the crypto\n * backend and by the server.\n *\n * This should be called before calling `startDehydration`, and if this\n * returns `false`, `startDehydration` should not be called.\n */\n isDehydrationSupported(): Promise<boolean>;\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 * This function must not be called unless `isDehydrationSupported` returns\n * `true`, and must not be called until after cross-signing and secret\n * storage have been set up.\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 startDehydration(opts?: StartDehydrationOpts | boolean): Promise<void>;\n\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n //\n // Import/export of secret keys\n //\n ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n /**\n * Export secrets bundle for transmitting to another device as part of OIDC QR login\n */\n exportSecretsBundle?(): Promise<Awaited<ReturnType<SecretsBundle[\"to_json\"]>>>;\n\n /**\n * Import secrets bundle transmitted from another device.\n * @param secrets - The secrets bundle received from the other device\n */\n importSecretsBundle?(secrets: Awaited<ReturnType<SecretsBundle[\"to_json\"]>>): Promise<void>;\n}\n\n/** A reason code for a failure to decrypt an event. */\nexport enum DecryptionFailureCode {\n /** Message was encrypted with a Megolm session whose keys have not been shared with us. */\n MEGOLM_UNKNOWN_INBOUND_SESSION_ID = \"MEGOLM_UNKNOWN_INBOUND_SESSION_ID\",\n\n /** A special case of {@link MEGOLM_UNKNOWN_INBOUND_SESSION_ID}: the sender has told us it is withholding the key. */\n MEGOLM_KEY_WITHHELD = \"MEGOLM_KEY_WITHHELD\",\n\n /** A special case of {@link MEGOLM_KEY_WITHHELD}: the sender has told us it is withholding the key, because the current device is unverified. */\n MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE = \"MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE\",\n\n /** Message was encrypted with a Megolm session which has been shared with us, but in a later ratchet state. */\n OLM_UNKNOWN_MESSAGE_INDEX = \"OLM_UNKNOWN_MESSAGE_INDEX\",\n\n /**\n * Message was sent before the current device was created; there is no key backup on the server, so this\n * decryption failure is expected.\n */\n HISTORICAL_MESSAGE_NO_KEY_BACKUP = \"HISTORICAL_MESSAGE_NO_KEY_BACKUP\",\n\n /**\n * Message was sent before the current device was created; there was a key backup on the server, but we don't\n * seem to have access to the backup. (Probably we don't have the right key.)\n */\n HISTORICAL_MESSAGE_BACKUP_UNCONFIGURED = \"HISTORICAL_MESSAGE_BACKUP_UNCONFIGURED\",\n\n /**\n * Message was sent before the current device was created; there was a (usable) key backup on the server, but we\n * still can't decrypt. (Either the session isn't in the backup, or we just haven't gotten around to checking yet.)\n */\n HISTORICAL_MESSAGE_WORKING_BACKUP = \"HISTORICAL_MESSAGE_WORKING_BACKUP\",\n\n /**\n * Message was sent when the user was not a member of the room.\n */\n HISTORICAL_MESSAGE_USER_NOT_JOINED = \"HISTORICAL_MESSAGE_USER_NOT_JOINED\",\n\n /**\n * The sender's identity is not verified, but was previously verified.\n */\n SENDER_IDENTITY_PREVIOUSLY_VERIFIED = \"SENDER_IDENTITY_PREVIOUSLY_VERIFIED\",\n\n /**\n * The sender device is not cross-signed. This will only be used if the\n * device isolation mode is set to `OnlySignedDevicesIsolationMode`.\n */\n UNSIGNED_SENDER_DEVICE = \"UNSIGNED_SENDER_DEVICE\",\n\n /**\n * We weren't able to link the message back to any known device. This will\n * only be used if the device isolation mode is set to `OnlySignedDevicesIsolationMode`.\n */\n UNKNOWN_SENDER_DEVICE = \"UNKNOWN_SENDER_DEVICE\",\n\n /** Unknown or unclassified error. */\n UNKNOWN_ERROR = \"UNKNOWN_ERROR\",\n\n /** @deprecated only used in legacy crypto */\n MEGOLM_BAD_ROOM = \"MEGOLM_BAD_ROOM\",\n\n /** @deprecated only used in legacy crypto */\n MEGOLM_MISSING_FIELDS = \"MEGOLM_MISSING_FIELDS\",\n\n /** @deprecated only used in legacy crypto */\n OLM_DECRYPT_GROUP_MESSAGE_ERROR = \"OLM_DECRYPT_GROUP_MESSAGE_ERROR\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_ENCRYPTED_MESSAGE = \"OLM_BAD_ENCRYPTED_MESSAGE\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_RECIPIENT = \"OLM_BAD_RECIPIENT\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_RECIPIENT_KEY = \"OLM_BAD_RECIPIENT_KEY\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_ROOM = \"OLM_BAD_ROOM\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_SENDER_CHECK_FAILED = \"OLM_BAD_SENDER_CHECK_FAILED\",\n\n /** @deprecated only used in legacy crypto */\n OLM_BAD_SENDER = \"OLM_BAD_SENDER\",\n\n /** @deprecated only used in legacy crypto */\n OLM_FORWARDED_MESSAGE = \"OLM_FORWARDED_MESSAGE\",\n\n /** @deprecated only used in legacy crypto */\n OLM_MISSING_CIPHERTEXT = \"OLM_MISSING_CIPHERTEXT\",\n\n /** @deprecated only used in legacy crypto */\n OLM_NOT_INCLUDED_IN_RECIPIENTS = \"OLM_NOT_INCLUDED_IN_RECIPIENTS\",\n\n /** @deprecated only used in legacy crypto */\n UNKNOWN_ENCRYPTION_ALGORITHM = \"UNKNOWN_ENCRYPTION_ALGORITHM\",\n}\n\n/** Base {@link DeviceIsolationMode} kind. */\nexport enum DeviceIsolationModeKind {\n AllDevicesIsolationMode,\n OnlySignedDevicesIsolationMode,\n}\n\n/**\n * A type of {@link DeviceIsolationMode}.\n *\n * Message encryption keys are shared with all devices in the room, except in case of\n * verified user problems (see {@link errorOnVerifiedUserProblems}).\n *\n * Events from all senders are always decrypted (and should be decorated with message shields in case\n * of authenticity warnings, see {@link EventEncryptionInfo}).\n */\nexport class AllDevicesIsolationMode {\n public readonly kind = DeviceIsolationModeKind.AllDevicesIsolationMode;\n\n /**\n *\n * @param errorOnVerifiedUserProblems - Behavior when sharing keys to remote devices.\n *\n * If set to `true`, sharing keys will fail (i.e. message sending will fail) with an error if:\n * - The user was previously verified but is not anymore, or:\n * - A verified user has some unverified devices (not cross-signed).\n *\n * If `false`, the keys will be distributed as usual. In this case, the client UX should display\n * warnings to inform the user about problematic devices/users, and stop them hitting this case.\n */\n public constructor(public readonly errorOnVerifiedUserProblems: boolean) {}\n}\n\n/**\n * A type of {@link DeviceIsolationMode}.\n *\n * Message encryption keys are only shared with devices that have been cross-signed by their owner.\n * Encryption will throw an error if a verified user replaces their identity.\n *\n * Events are decrypted only if they come from a cross-signed device. Other events will result in a decryption\n * failure. (To access the failure reason, see {@link MatrixEvent.decryptionFailureReason}.)\n */\nexport class OnlySignedDevicesIsolationMode {\n public readonly kind = DeviceIsolationModeKind.OnlySignedDevicesIsolationMode;\n}\n\n/**\n * DeviceIsolationMode represents the mode of device isolation used when encrypting or decrypting messages.\n * It can be one of two types: {@link AllDevicesIsolationMode} or {@link OnlySignedDevicesIsolationMode}.\n *\n * Only supported by rust Crypto.\n */\nexport type DeviceIsolationMode = AllDevicesIsolationMode | OnlySignedDevicesIsolationMode;\n\n/**\n * Options object for `CryptoApi.bootstrapCrossSigning`.\n */\nexport interface BootstrapCrossSigningOpts {\n /** Optional. Reset the cross-signing keys even if keys already exist. */\n setupNewCrossSigning?: boolean;\n\n /**\n * An application callback to collect the authentication data for uploading the keys. If not given, the keys\n * will not be uploaded to the server (which seems like a bad thing?).\n */\n authUploadDeviceSigningKeys?: UIAuthCallback<void>;\n}\n\n/**\n * Represents the ways in which we trust a user\n */\nexport class UserVerificationStatus {\n /**\n * Indicates if the identity has changed in a way that needs user approval.\n *\n * This happens if the identity has changed since we first saw it, *unless* the new identity has also been verified\n * by our user (eg via an interactive verification).\n *\n * To rectify this, either:\n *\n * * Conduct a verification of the new identity via {@link CryptoApi.requestVerificationDM}.\n * * Pin the new identity, via {@link CryptoApi.pinCurrentUserIdentity}.\n *\n * @returns true if the identity has changed in a way that needs user approval.\n */\n public readonly needsUserApproval: boolean;\n\n public constructor(\n private readonly crossSigningVerified: boolean,\n private readonly crossSigningVerifiedBefore: boolean,\n private readonly tofu: boolean,\n needsUserApproval: boolean = false,\n ) {\n this.needsUserApproval = needsUserApproval;\n }\n\n /**\n * @returns true if this user is verified via any means\n */\n public isVerified(): boolean {\n return this.isCrossSigningVerified();\n }\n\n /**\n * @returns true if this user is verified via cross signing\n */\n public isCrossSigningVerified(): boolean {\n return this.crossSigningVerified;\n }\n\n /**\n * @returns true if we ever verified this user before (at least for\n * the history of verifications observed by this device).\n */\n public wasCrossSigningVerified(): boolean {\n return this.crossSigningVerifiedBefore;\n }\n\n /**\n * @returns true if this user's key is trusted on first use\n *\n * @deprecated No longer supported, with the Rust crypto stack.\n */\n public isTofu(): boolean {\n return this.tofu;\n }\n}\n\nexport class DeviceVerificationStatus {\n /**\n * True if this device has been signed by its owner (and that signature verified).\n *\n * This doesn't necessarily mean that we have verified the device, since we may not have verified the\n * owner's cross-signing key.\n */\n public readonly signedByOwner: boolean;\n\n /**\n * True if this device has been verified via cross signing.\n *\n * This does *not* take into account `trustCrossSignedDevices`.\n */\n public readonly crossSigningVerified: boolean;\n\n /**\n * TODO: tofu magic wtf does this do?\n */\n public readonly tofu: boolean;\n\n /**\n * True if the device has been marked as locally verified.\n */\n public readonly localVerified: boolean;\n\n /**\n * True if the client has been configured to trust cross-signed devices via {@link CryptoApi#setTrustCrossSignedDevices}.\n */\n private readonly trustCrossSignedDevices: boolean;\n\n public constructor(\n opts: Partial<DeviceVerificationStatus> & {\n /**\n * True if cross-signed devices should be considered verified for {@link DeviceVerificationStatus#isVerified}.\n */\n trustCrossSignedDevices?: boolean;\n },\n ) {\n this.signedByOwner = opts.signedByOwner ?? false;\n this.crossSigningVerified = opts.crossSigningVerified ?? false;\n this.tofu = opts.tofu ?? false;\n this.localVerified = opts.localVerified ?? false;\n this.trustCrossSignedDevices = opts.trustCrossSignedDevices ?? false;\n }\n\n /**\n * Check if we should consider this device \"verified\".\n *\n * A device is \"verified\" if either:\n * * it has been manually marked as such via {@link CryptoApi.setDeviceVerified}.\n * * it has been cross-signed with a verified signing key, **and** the client has been configured to trust\n * cross-signed devices via {@link CryptoApi.setTrustCrossSignedDevices}.\n *\n * @returns true if this device is verified via any means.\n */\n public isVerified(): boolean {\n return this.localVerified || (this.trustCrossSignedDevices && this.crossSigningVerified);\n }\n}\n\n/**\n * Enum representing the different stages of importing room keys.\n *\n * This is the type of the `stage` property of {@link ImportRoomKeyProgressData}.\n */\nexport enum ImportRoomKeyStage {\n /**\n * The stage where room keys are being fetched.\n *\n * @see {@link ImportRoomKeyFetchProgress}.\n */\n Fetch = \"fetch\",\n /**\n * The stage where room keys are being loaded.\n *\n * @see {@link ImportRoomKeyLoadProgress}.\n */\n LoadKeys = \"load_keys\",\n}\n\n/**\n * Type representing the progress during the 'fetch' stage of the room key import process.\n *\n * @see {@link ImportRoomKeyProgressData}.\n */\nexport type ImportRoomKeyFetchProgress = {\n /**\n * The current stage of the import process.\n */\n stage: ImportRoomKeyStage.Fetch;\n};\n\n/**\n * Type representing the progress during the 'load_keys' stage of the room key import process.\n *\n * @see {@link ImportRoomKeyProgressData}.\n */\nexport type ImportRoomKeyLoadProgress = {\n /**\n * The current stage of the import process.\n */\n stage: ImportRoomKeyStage.LoadKeys;\n\n /**\n * The number of successfully loaded room keys so far.\n */\n successes: number;\n\n /**\n * The number of room keys that failed to load so far.\n */\n failures: number;\n\n /**\n * The total number of room keys being loaded.\n */\n total: number;\n};\n\n/**\n * Room key import progress report.\n * Used when calling {@link CryptoApi#importRoomKeys},\n * {@link CryptoApi#importRoomKeysAsJson} or {@link CryptoApi#restoreKeyBackup} as the parameter of\n * the progressCallback. Used to display feedback.\n */\nexport type ImportRoomKeyProgressData = ImportRoomKeyFetchProgress | ImportRoomKeyLoadProgress;\n\n/**\n * Options object for {@link CryptoApi#importRoomKeys} and\n * {@link CryptoApi#importRoomKeysAsJson}.\n */\nexport interface ImportRoomKeysOpts {\n /** Reports ongoing progress of the import process. Can be used for feedback. */\n progressCallback?: (stage: ImportRoomKeyProgressData) => void;\n /** @deprecated the rust SDK will always such imported keys as untrusted */\n untrusted?: boolean;\n /** @deprecated not useful externally */\n source?: string;\n}\n\n/**\n * The result of a call to {@link CryptoApi.getCrossSigningStatus}.\n */\nexport interface CrossSigningStatus {\n /**\n * True if the public master, self signing and user signing keys are available on this device.\n */\n publicKeysOnDevice: boolean;\n /**\n * True if the private keys are stored in the secret storage.\n */\n privateKeysInSecretStorage: boolean;\n /**\n * True if the private keys are stored locally.\n */\n privateKeysCachedLocally: {\n masterKey: boolean;\n selfSigningKey: boolean;\n userSigningKey: boolean;\n };\n}\n\n/**\n * Crypto callbacks provided by the application\n */\nexport interface CryptoCallbacks {\n /**\n * Called to retrieve a secret storage encryption key.\n *\n * [Server-side secret storage](https://spec.matrix.org/v1.12/client-server-api/#key-storage)\n * is, as the name implies, a mechanism for storing secrets which should be shared between\n * clients on the server. For example, it is typically used for storing the\n * [key backup decryption key](https://spec.matrix.org/v1.12/client-server-api/#decryption-key)\n * and the private [cross-signing keys](https://spec.matrix.org/v1.12/client-server-api/#cross-signing).\n *\n * The secret storage mechanism encrypts the secrets before uploading them to the server using a\n * secret storage key. The schema supports multiple keys, but in practice only one tends to be used\n * at once; this is the \"default secret storage key\" and may be known as the \"recovery key\" (or, sometimes,\n * the \"security key\").\n *\n * Secret storage can be set up by calling {@link CryptoApi.bootstrapSecretStorage}. Having done so, when\n * the crypto stack needs to access secret storage (for example, when setting up a new device, or to\n * store newly-generated secrets), it will use this callback (`getSecretStorageKey`).\n *\n * Note that the secret storage key may be needed several times in quick succession: it is recommended\n * that applications use a temporary cache to avoid prompting the user multiple times for the key. See\n * also {@link cacheSecretStorageKey} which is called when a new key is created.\n *\n * The helper method {@link deriveRecoveryKeyFromPassphrase} may be useful if the secret storage key\n * was derived from a passphrase.\n *\n * @param opts - An options object.\n *\n * @param name - the name of the *secret* (NB: not the encryption key) being stored or retrieved.\n * When the item is stored in account data, it will have this `type`.\n *\n * @returns a pair [`keyId`, `privateKey`], where `keyId` is one of the keys from the `keys` parameter,\n * and `privateKey` is the raw private encryption key, as appropriate for the encryption algorithm.\n * (For `m.secret_storage.v1.aes-hmac-sha2`, it is the input to an HKDF as defined in the\n * [specification](https://spec.matrix.org/v1.6/client-server-api/#msecret_storagev1aes-hmac-sha2).)\n *\n * Alternatively, if none of the keys are known, may return `null` — in which case the original\n * operation that requires access to a secret in secret storage may fail with an exception.\n */\n getSecretStorageKey?: (\n opts: {\n /**\n * Details of the secret storage keys required: a map from the key ID\n * (excluding the `m.secret_storage.key.` prefix) to details of the key.\n *\n * When storing a secret, `keys` will contain exactly one entry.\n *\n * For secret retrieval, `keys` may contain several entries, and the application can return\n * any one of the requested keys. Unless your application specifically wants to offer the\n * user the ability to have more than one secret storage key active at a time, it is recommended\n * to call {@link matrix.SecretStorage.ServerSideSecretStorage.getDefaultKeyId | ServerSideSecretStorage.getDefaultKeyId}\n * to figure out which is the current default key, and to return `null` if the default key is not listed in `keys`.\n */\n keys: Record<string, SecretStorageKeyDescription>;\n },\n name: string,\n ) => Promise<[string, Uint8Array] | null>;\n\n /** @deprecated: unused with the Rust crypto stack. */\n getCrossSigningKey?: (keyType: string, pubKey: string) => Promise<Uint8Array | null>;\n /** @deprecated: unused with the Rust crypto stack. */\n saveCrossSigningKeys?: (keys: Record<string, Uint8Array>) => void;\n /** @deprecated: unused with the Rust crypto stack. */\n shouldUpgradeDeviceVerifications?: (users: Record<string, any>) => Promise<string[]>;\n\n /**\n * Called by {@link CryptoApi.bootstrapSecretStorage} when a new default secret storage key is created.\n *\n * Applications can use this to (temporarily) cache the secret storage key, for later return by\n * {@link getSecretStorageKey}.\n *\n * @param keyId - secret storage key id\n * @param keyInfo - secret storage key info\n * @param key - private key to store\n */\n cacheSecretStorageKey?: (keyId: string, keyInfo: SecretStorageKeyDescription, key: Uint8Array) => void;\n\n /** @deprecated: unused with the Rust crypto stack. */\n onSecretRequested?: (\n userId: string,\n deviceId: string,\n requestId: string,\n secretName: string,\n deviceTrust: DeviceVerificationStatus,\n ) => Promise<string | undefined>;\n\n /** @deprecated: unused with the Rust crypto stack. */\n getDehydrationKey?: (\n keyInfo: SecretStorageKeyDescription,\n checkFunc: (key: Uint8Array) => void,\n ) => Promise<Uint8Array>;\n\n /** @deprecated: unused with the Rust crypto stack. */\n getBackupKey?: () => Promise<Uint8Array>;\n}\n\n/**\n * Parameter of {@link CryptoApi#bootstrapSecretStorage}\n */\nexport interface CreateSecretStorageOpts {\n /**\n * Function called to await a secret storage key creation flow.\n * @returns Promise resolving to an object with public key metadata, encoded private\n * recovery key which should be disposed of after displaying to the user,\n * and raw private key to avoid round tripping if needed.\n */\n createSecretStorageKey?: () => Promise<GeneratedSecretStorageKey>;\n\n /**\n * The current key backup object. If passed,\n * the passphrase and recovery key from this backup will be used.\n * @deprecated Not used by the Rust crypto stack.\n */\n keyBackupInfo?: KeyBackupInfo;\n\n /**\n * If true, a new key backup version will be\n * created and the private key stored in the new SSSS store. Ignored if keyBackupInfo\n * is supplied.\n */\n setupNewKeyBackup?: boolean;\n\n /**\n * Reset even if keys already exist.\n */\n setupNewSecretStorage?: boolean;\n\n /**\n * Function called to get the user's current key backup passphrase.\n *\n * Should return a promise that resolves with a Uint8Array\n * containing the key, or rejects if the key cannot be obtained.\n *\n * Only used when the client has existing key backup, but no secret storage.\n *\n * @deprecated Not used by the Rust crypto stack.\n */\n getKeyBackupPassphrase?: () => Promise<Uint8Array>;\n}\n\n/** Types of cross-signing key */\nexport enum CrossSigningKey {\n Master = \"master\",\n SelfSigning = \"self_signing\",\n UserSigning = \"user_signing\",\n}\n\n/**\n * Information on one of the cross-signing keys.\n * @see https://spec.matrix.org/v1.7/client-server-api/#post_matrixclientv3keysdevice_signingupload\n */\nexport interface CrossSigningKeyInfo {\n keys: { [algorithm: string]: string };\n signatures?: ISignatures;\n usage: string[];\n user_id: string;\n}\n\n/**\n * Recovery key created by {@link CryptoApi#createRecoveryKeyFromPassphrase} or {@link CreateSecretStorageOpts#createSecretStorageKey}.\n */\nexport interface GeneratedSecretStorageKey {\n keyInfo?: {\n /** If the key was derived from a passphrase, information (algorithm, salt, etc) on that derivation. */\n passphrase?: PassphraseInfo;\n /** Optional human-readable name for the key, to be stored in account_data. */\n name?: string;\n };\n /** The raw generated private key. */\n privateKey: Uint8Array;\n /** The generated key, encoded for display to the user per https://spec.matrix.org/v1.7/client-server-api/#key-representation. */\n encodedPrivateKey?: string;\n}\n\n/**\n * Result type of {@link CryptoApi#getEncryptionInfoForEvent}.\n */\nexport interface EventEncryptionInfo {\n /** \"Shield\" to be shown next to this event representing its verification status */\n shieldColour: EventShieldColour;\n\n /**\n * `null` if `shieldColour` is `EventShieldColour.NONE`; otherwise a reason code for the shield in `shieldColour`.\n */\n shieldReason: EventShieldReason | null;\n}\n\n/**\n * Types of shield to be shown for {@link EventEncryptionInfo#shieldColour}.\n */\nexport enum EventShieldColour {\n NONE,\n GREY,\n RED,\n}\n\n/**\n * Reason codes for {@link EventEncryptionInfo#shieldReason}.\n */\nexport enum EventShieldReason {\n /** An unknown reason from the crypto library (if you see this, it is a bug in matrix-js-sdk). */\n UNKNOWN,\n\n /** \"Encrypted by an unverified user.\" */\n UNVERIFIED_IDENTITY,\n\n /** \"Encrypted by a device not verified by its owner.\" */\n UNSIGNED_DEVICE,\n\n /** \"Encrypted by an unknown or deleted device.\" */\n UNKNOWN_DEVICE,\n\n /**\n * \"The authenticity of this encrypted message can't be guaranteed on this device.\"\n *\n * ie: the key has been forwarded, or retrieved from an insecure backup.\n */\n AUTHENTICITY_NOT_GUARANTEED,\n\n /**\n * The (deprecated) sender_key field in the event does not match the Ed25519 key of the device that sent us the\n * decryption keys.\n */\n MISMATCHED_SENDER_KEY,\n\n /**\n * The event was sent unencrypted in an encrypted room.\n */\n SENT_IN_CLEAR,\n\n /**\n * The sender was previously verified but changed their identity.\n */\n VERIFICATION_VIOLATION,\n}\n\n/** The result of a call to {@link CryptoApi.getOwnDeviceKeys} */\nexport interface OwnDeviceKeys {\n /** Public part of the Ed25519 fingerprint key for the current device, base64 encoded. */\n ed25519: string;\n /** Public part of the Curve25519 identity key for the current device, base64 encoded. */\n curve25519: string;\n}\n\nexport * from \"./verification.ts\";\nexport type * from \"./keybackup.ts\";\nexport * from \"./recovery-key.ts\";\nexport * from \"./key-passphrase.ts\";\nexport * from \"./CryptoEvent.ts\";\nexport type * from \"./CryptoEventHandlerMap.ts\";\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AA6BA;AACA;AACA;AACA;AACA;;AA+oBA;AACA,WAAYA,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAqB;EAArBA,qBAAq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|
|
|
1
|
-
{"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../src/embedded.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,SAAS,EAajB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAA2C,MAAM,mBAAmB,CAAC;AACzF,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EACH,YAAY,EAEZ,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAW,SAAS,EAAE,MAAM,WAAW,CAAC;AAI/C,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,6BAA6B,CAAC;AAEvF,OAAO,EAAE,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../src/embedded.ts"],"names":[],"mappings":"AAgBA,OAAO,EACH,KAAK,SAAS,EAajB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAA2C,MAAM,mBAAmB,CAAC;AACzF,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EACH,YAAY,EAEZ,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAW,SAAS,EAAE,MAAM,WA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AO,CAAC,wBAAwB,CAAC;IAqBpC,OAAO,CAAC,gCAAgC;IAOxC;;OAEG;IAEU,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC;IAYrG,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC;IAOzF,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC;IAYvC,aAAa,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAYjE,uBAAuB,CAAC,iBAAiB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYpG;;;;;;;;;;;;OAYG;IACU,wBAAwB,CACjC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,EAClB,UAAU,EAAE,sBAAsB,GACnC,OAAO,CAAC,IAAI,CAAC;IAQH,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAK1C,YAAY,IAAI,SAAS,GAAG,IAAI;IAIvC,OAAO,CAAC,YAAY;YAMN,GAAG;IAIjB,OAAO,CAAC,UAAU,CAwChB;IAEF,OAAO,CAAC,OAAO,CA+Cb;IAEF,OAAO,CAAC,UAAU,CAchB;YAEY,gBAAgB;CAyBjC"}
|
package/lib/embedded.js
CHANGED
|
@@ -27,10 +27,10 @@ import { logger } from "./logger.js";
|
|
|
27
27
|
import { MatrixClient, ClientEvent, UNSTABLE_MSC4140_DELAYED_EVENTS } from "./client.js";
|
|
28
28
|
import { SyncApi, SyncState } from "./sync.js";
|
|
29
29
|
import { SlidingSyncSdk } from "./sliding-sync-sdk.js";
|
|
30
|
-
import { MatrixError } from "./http-api/errors.js";
|
|
30
|
+
import { ConnectionError, MatrixError } from "./http-api/errors.js";
|
|
31
31
|
import { User } from "./models/user.js";
|
|
32
32
|
import { MapWithDefault, recursiveMapToObject } from "./utils.js";
|
|
33
|
-
import { TypedEventEmitter } from "./matrix.js";
|
|
33
|
+
import { TypedEventEmitter, UnsupportedDelayedEventsEndpointError } from "./matrix.js";
|
|
34
34
|
export var RoomWidgetClientEvent = /*#__PURE__*/function (RoomWidgetClientEvent) {
|
|
35
35
|
RoomWidgetClientEvent["PendingEventsChanged"] = "PendingEvent.pendingEventsChanged";
|
|
36
36
|
return RoomWidgetClientEvent;
|
|
@@ -359,7 +359,7 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
359
359
|
// Delayed event special case.
|
|
360
360
|
if (delayOpts) {
|
|
361
361
|
// TODO: updatePendingEvent for delayed events?
|
|
362
|
-
var _response = yield _this4.widgetApi.sendRoomEvent(event.getType(), content, room.roomId, "delay" in delayOpts ? delayOpts.delay : undefined, "parent_delay_id" in delayOpts ? delayOpts.parent_delay_id : undefined);
|
|
362
|
+
var _response = yield _this4.widgetApi.sendRoomEvent(event.getType(), content, room.roomId, "delay" in delayOpts ? delayOpts.delay : undefined, "parent_delay_id" in delayOpts ? delayOpts.parent_delay_id : undefined).catch(timeoutToConnectionError);
|
|
363
363
|
return _this4.validateSendDelayedEventResponse(_response);
|
|
364
364
|
}
|
|
365
365
|
var txId = event.getTxnId();
|
|
@@ -371,7 +371,7 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
371
371
|
});
|
|
372
372
|
var response;
|
|
373
373
|
try {
|
|
374
|
-
response = yield _this4.widgetApi.sendRoomEvent(event.getType(), content, room.roomId);
|
|
374
|
+
response = yield _this4.widgetApi.sendRoomEvent(event.getType(), content, room.roomId).catch(timeoutToConnectionError);
|
|
375
375
|
} catch (e) {
|
|
376
376
|
_this4.updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
|
|
377
377
|
throw e;
|
|
@@ -394,7 +394,7 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
394
394
|
_this5 = this;
|
|
395
395
|
return _asyncToGenerator(function* () {
|
|
396
396
|
var stateKey = _arguments2.length > 3 && _arguments2[3] !== undefined ? _arguments2[3] : "";
|
|
397
|
-
var response = yield _this5.widgetApi.sendStateEvent(eventType, stateKey, content, roomId);
|
|
397
|
+
var response = yield _this5.widgetApi.sendStateEvent(eventType, stateKey, content, roomId).catch(timeoutToConnectionError);
|
|
398
398
|
if (response.event_id === undefined) {
|
|
399
399
|
throw new Error("'event_id' absent from response to an event request");
|
|
400
400
|
}
|
|
@@ -414,9 +414,9 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
414
414
|
return _asyncToGenerator(function* () {
|
|
415
415
|
var stateKey = _arguments3.length > 4 && _arguments3[4] !== undefined ? _arguments3[4] : "";
|
|
416
416
|
if (!(yield _this6.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
|
|
417
|
-
throw
|
|
417
|
+
throw new UnsupportedDelayedEventsEndpointError("Server does not support the delayed events API", "sendDelayedStateEvent");
|
|
418
418
|
}
|
|
419
|
-
var response = yield _this6.widgetApi.sendStateEvent(eventType, stateKey, content, roomId, "delay" in delayOpts ? delayOpts.delay : undefined, "parent_delay_id" in delayOpts ? delayOpts.parent_delay_id : undefined);
|
|
419
|
+
var response = yield _this6.widgetApi.sendStateEvent(eventType, stateKey, content, roomId, "delay" in delayOpts ? delayOpts.delay : undefined, "parent_delay_id" in delayOpts ? delayOpts.parent_delay_id : undefined).catch(timeoutToConnectionError);
|
|
420
420
|
return _this6.validateSendDelayedEventResponse(response);
|
|
421
421
|
})();
|
|
422
422
|
}
|
|
@@ -437,23 +437,23 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
437
437
|
var _this7 = this;
|
|
438
438
|
return _asyncToGenerator(function* () {
|
|
439
439
|
if (!(yield _this7.doesServerSupportUnstableFeature(UNSTABLE_MSC4140_DELAYED_EVENTS))) {
|
|
440
|
-
throw
|
|
440
|
+
throw new UnsupportedDelayedEventsEndpointError("Server does not support the delayed events API", "updateDelayedEvent");
|
|
441
441
|
}
|
|
442
|
-
yield _this7.widgetApi.updateDelayedEvent(delayId, action);
|
|
442
|
+
yield _this7.widgetApi.updateDelayedEvent(delayId, action).catch(timeoutToConnectionError);
|
|
443
443
|
return {};
|
|
444
444
|
})();
|
|
445
445
|
}
|
|
446
446
|
sendToDevice(eventType, contentMap) {
|
|
447
447
|
var _this8 = this;
|
|
448
448
|
return _asyncToGenerator(function* () {
|
|
449
|
-
yield _this8.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap));
|
|
449
|
+
yield _this8.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap)).catch(timeoutToConnectionError);
|
|
450
450
|
return {};
|
|
451
451
|
})();
|
|
452
452
|
}
|
|
453
453
|
getOpenIdToken() {
|
|
454
454
|
var _this9 = this;
|
|
455
455
|
return _asyncToGenerator(function* () {
|
|
456
|
-
var token = yield _this9.widgetApi.requestOpenIDConnectToken();
|
|
456
|
+
var token = yield _this9.widgetApi.requestOpenIDConnectToken().catch(timeoutToConnectionError);
|
|
457
457
|
// the IOpenIDCredentials from the widget-api and IOpenIDToken form the matrix-js-sdk are compatible.
|
|
458
458
|
// we still recreate the token to make this transparent and catch'able by the linter in case the types change in the future.
|
|
459
459
|
return {
|
|
@@ -480,7 +480,7 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
480
480
|
} of batch) {
|
|
481
481
|
contentMap.getOrCreate(userId).set(deviceId, payload);
|
|
482
482
|
}
|
|
483
|
-
yield _this10.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap));
|
|
483
|
+
yield _this10.widgetApi.sendToDevice(eventType, false, recursiveMapToObject(contentMap)).catch(timeoutToConnectionError);
|
|
484
484
|
})();
|
|
485
485
|
}
|
|
486
486
|
encryptAndSendToDevices(userDeviceInfoArr, payload) {
|
|
@@ -494,7 +494,7 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
494
494
|
} of userDeviceInfoArr) {
|
|
495
495
|
contentMap.getOrCreate(userId).set(deviceId, payload);
|
|
496
496
|
}
|
|
497
|
-
yield _this11.widgetApi.sendToDevice(payload.type, true, recursiveMapToObject(contentMap));
|
|
497
|
+
yield _this11.widgetApi.sendToDevice(payload.type, true, recursiveMapToObject(contentMap)).catch(timeoutToConnectionError);
|
|
498
498
|
})();
|
|
499
499
|
}
|
|
500
500
|
|
|
@@ -514,7 +514,7 @@ export class RoomWidgetClient extends MatrixClient {
|
|
|
514
514
|
sendToDeviceViaWidgetApi(eventType, encrypted, contentMap) {
|
|
515
515
|
var _this12 = this;
|
|
516
516
|
return _asyncToGenerator(function* () {
|
|
517
|
-
yield _this12.widgetApi.sendToDevice(eventType, encrypted, recursiveMapToObject(contentMap));
|
|
517
|
+
yield _this12.widgetApi.sendToDevice(eventType, encrypted, recursiveMapToObject(contentMap)).catch(timeoutToConnectionError);
|
|
518
518
|
})();
|
|
519
519
|
}
|
|
520
520
|
|
|
@@ -596,4 +596,17 @@ function processAndThrow(error) {
|
|
|
596
596
|
throw error;
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* This converts an "Request timed out" error from the PostmessageTransport into a ConnectionError.
|
|
602
|
+
* It either throws the original error or a new ConnectionError.
|
|
603
|
+
**/
|
|
604
|
+
function timeoutToConnectionError(error) {
|
|
605
|
+
// TODO: this should not check on error.message but instead it should be a specific type
|
|
606
|
+
// error instanceof WidgetTimeoutError
|
|
607
|
+
if (error instanceof Error && error.message === "Request timed out") {
|
|
608
|
+
throw new ConnectionError("widget api timeout");
|
|
609
|
+
}
|
|
610
|
+
throw error;
|
|
611
|
+
}
|
|
599
612
|
//# sourceMappingURL=embedded.js.map
|