matrix-js-sdk 31.2.0 → 31.3.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/CHANGELOG.md +1 -0
- package/git-revision.txt +1 -1
- package/lib/@types/extensible_events.d.ts.map +1 -1
- package/lib/@types/extensible_events.js.map +1 -1
- package/lib/client.d.ts +22 -2
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +87 -55
- package/lib/client.js.map +1 -1
- package/lib/content-repo.d.ts +4 -1
- package/lib/content-repo.d.ts.map +1 -1
- package/lib/content-repo.js +8 -1
- package/lib/content-repo.js.map +1 -1
- package/lib/crypto/OlmDevice.d.ts +1 -1
- package/lib/crypto/OlmDevice.d.ts.map +1 -1
- package/lib/crypto/OlmDevice.js.map +1 -1
- package/lib/crypto/index.d.ts +4 -0
- package/lib/crypto/index.d.ts.map +1 -1
- package/lib/crypto/index.js +7 -0
- package/lib/crypto/index.js.map +1 -1
- package/lib/crypto/store/base.d.ts +3 -1
- package/lib/crypto/store/base.d.ts.map +1 -1
- package/lib/crypto/store/base.js +1 -0
- package/lib/crypto/store/base.js.map +1 -1
- package/lib/crypto-api.d.ts +12 -1
- package/lib/crypto-api.d.ts.map +1 -1
- package/lib/crypto-api.js.map +1 -1
- package/lib/matrixrtc/CallMembership.d.ts +2 -1
- package/lib/matrixrtc/CallMembership.d.ts.map +1 -1
- package/lib/matrixrtc/CallMembership.js +28 -5
- package/lib/matrixrtc/CallMembership.js.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.js +4 -0
- package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/lib/models/event-timeline-set.d.ts.map +1 -1
- package/lib/models/event-timeline-set.js.map +1 -1
- package/lib/models/event.d.ts +1 -1
- package/lib/models/event.js +1 -1
- package/lib/models/event.js.map +1 -1
- package/lib/models/read-receipt.d.ts +1 -1
- package/lib/models/read-receipt.d.ts.map +1 -1
- package/lib/models/read-receipt.js.map +1 -1
- package/lib/models/room.d.ts +17 -7
- package/lib/models/room.d.ts.map +1 -1
- package/lib/models/room.js +29 -7
- package/lib/models/room.js.map +1 -1
- package/lib/models/thread.d.ts +7 -1
- package/lib/models/thread.d.ts.map +1 -1
- package/lib/models/thread.js +10 -6
- package/lib/models/thread.js.map +1 -1
- package/lib/rendezvous/MSC3906Rendezvous.d.ts +3 -5
- package/lib/rendezvous/MSC3906Rendezvous.d.ts.map +1 -1
- package/lib/rendezvous/MSC3906Rendezvous.js +25 -22
- package/lib/rendezvous/MSC3906Rendezvous.js.map +1 -1
- package/lib/rust-crypto/RoomEncryptor.d.ts.map +1 -1
- package/lib/rust-crypto/RoomEncryptor.js +2 -1
- package/lib/rust-crypto/RoomEncryptor.js.map +1 -1
- package/lib/rust-crypto/backup.d.ts.map +1 -1
- package/lib/rust-crypto/backup.js +2 -2
- package/lib/rust-crypto/backup.js.map +1 -1
- package/lib/rust-crypto/index.d.ts.map +1 -1
- package/lib/rust-crypto/index.js +12 -2
- package/lib/rust-crypto/index.js.map +1 -1
- package/lib/rust-crypto/libolm_migration.d.ts +16 -0
- package/lib/rust-crypto/libolm_migration.d.ts.map +1 -1
- package/lib/rust-crypto/libolm_migration.js +102 -10
- package/lib/rust-crypto/libolm_migration.js.map +1 -1
- package/lib/rust-crypto/rust-crypto.d.ts +44 -2
- package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/lib/rust-crypto/rust-crypto.js +44 -1
- package/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/lib/rust-crypto/verification.d.ts +17 -4
- package/lib/rust-crypto/verification.d.ts.map +1 -1
- package/lib/rust-crypto/verification.js +64 -22
- package/lib/rust-crypto/verification.js.map +1 -1
- package/lib/sliding-sync-sdk.js +1 -1
- package/lib/sliding-sync-sdk.js.map +1 -1
- package/lib/store/indexeddb.d.ts +1 -1
- package/lib/store/indexeddb.d.ts.map +1 -1
- package/lib/store/indexeddb.js +2 -2
- package/lib/store/indexeddb.js.map +1 -1
- package/lib/sync.js +2 -2
- package/lib/sync.js.map +1 -1
- package/lib/webrtc/call.d.ts.map +1 -1
- package/lib/webrtc/call.js.map +1 -1
- package/package.json +5 -5
- package/src/@types/extensible_events.ts +2 -3
- package/src/client.ts +124 -90
- package/src/content-repo.ts +9 -0
- package/src/crypto/OlmDevice.ts +1 -1
- package/src/crypto/index.ts +7 -0
- package/src/crypto/store/base.ts +3 -0
- package/src/crypto-api.ts +13 -1
- package/src/matrixrtc/CallMembership.ts +31 -6
- package/src/matrixrtc/MatrixRTCSession.ts +3 -0
- package/src/models/event-timeline-set.ts +3 -2
- package/src/models/event.ts +1 -1
- package/src/models/read-receipt.ts +1 -1
- package/src/models/room.ts +30 -14
- package/src/models/thread.ts +10 -6
- package/src/rendezvous/MSC3906Rendezvous.ts +28 -34
- package/src/rust-crypto/RoomEncryptor.ts +2 -1
- package/src/rust-crypto/backup.ts +12 -9
- package/src/rust-crypto/index.ts +13 -1
- package/src/rust-crypto/libolm_migration.ts +118 -10
- package/src/rust-crypto/rust-crypto.ts +77 -1
- package/src/rust-crypto/verification.ts +74 -32
- package/src/sliding-sync-sdk.ts +1 -1
- package/src/store/indexeddb.ts +4 -2
- package/src/sync.ts +2 -2
- package/src/webrtc/call.ts +6 -4
|
@@ -231,7 +231,9 @@ export declare enum MigrationState {
|
|
|
231
231
|
/** INITIAL_DATA_MIGRATED, and in addition, we have migrated all the Olm sessions. */
|
|
232
232
|
OLM_SESSIONS_MIGRATED = 2,
|
|
233
233
|
/** OLM_SESSIONS_MIGRATED, and in addition, we have migrated all the Megolm sessions. */
|
|
234
|
-
MEGOLM_SESSIONS_MIGRATED = 3
|
|
234
|
+
MEGOLM_SESSIONS_MIGRATED = 3,
|
|
235
|
+
/** MEGOLM_SESSIONS_MIGRATED, and in addition, we have migrated all the room settings. */
|
|
236
|
+
ROOM_SETTINGS_MIGRATED = 4
|
|
235
237
|
}
|
|
236
238
|
/**
|
|
237
239
|
* The size of batches to be returned by {@link CryptoStore#getEndToEndSessionsBatch} and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/crypto/store/base.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C;;GAEG;AAEH,MAAM,WAAW,sBAAsB;IACnC,aAAa,EAAE;QACX,OAAO,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACvC,GAAG,EAAE,iBAAiB,CAAC;QACvB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,IAAI,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI,CAAC;IACT,oBAAoB,EAAE,iBAAiB,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB;;;;;;OAMG;IACH,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,OAAO,IAAI,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AW,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvD,4BAA4B,EAAE,MAAM,EAAE,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,oBAAY,cAAc;IACtB,kDAAkD;IAClD,WAAW,IAAA;IAEX,kEAAkE;IAClE,qBAAqB,IAAA;IAErB,qFAAqF;IACrF,qBAAqB,IAAA;IAErB,wFAAwF;IACxF,wBAAwB,IAAA;IAExB,yFAAyF;IACzF,sBAAsB,IAAA;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAC"}
|
package/lib/crypto/store/base.js
CHANGED
|
@@ -43,6 +43,7 @@ let MigrationState = exports.MigrationState = /*#__PURE__*/function (MigrationSt
|
|
|
43
43
|
MigrationState[MigrationState["INITIAL_DATA_MIGRATED"] = 1] = "INITIAL_DATA_MIGRATED";
|
|
44
44
|
MigrationState[MigrationState["OLM_SESSIONS_MIGRATED"] = 2] = "OLM_SESSIONS_MIGRATED";
|
|
45
45
|
MigrationState[MigrationState["MEGOLM_SESSIONS_MIGRATED"] = 3] = "MEGOLM_SESSIONS_MIGRATED";
|
|
46
|
+
MigrationState[MigrationState["ROOM_SETTINGS_MIGRATED"] = 4] = "ROOM_SETTINGS_MIGRATED";
|
|
46
47
|
return MigrationState;
|
|
47
48
|
}({});
|
|
48
49
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","names":["MigrationState","exports","SESSION_BATCH_SIZE"],"sources":["../../../src/crypto/store/base.ts"],"sourcesContent":["/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from \"../index\";\nimport { RoomKeyRequestState } from \"../OutgoingRoomKeyRequestManager\";\nimport { ICrossSigningKey } from \"../../client\";\nimport { IOlmDevice } from \"../algorithms/megolm\";\nimport { TrackingStatus } from \"../DeviceList\";\nimport { IRoomEncryption } from \"../RoomList\";\nimport { IDevice } from \"../deviceinfo\";\nimport { ICrossSigningInfo } from \"../CrossSigning\";\nimport { Logger } from \"../../logger\";\nimport { InboundGroupSessionData } from \"../OlmDevice\";\nimport { MatrixEvent } from \"../../models/event\";\nimport { DehydrationManager } from \"../dehydration\";\nimport { IEncryptedPayload } from \"../aes\";\n\n/**\n * Internal module. Definitions for storage for the crypto module\n */\n\nexport interface SecretStorePrivateKeys {\n \"dehydration\": {\n keyInfo: DehydrationManager[\"keyInfo\"];\n key: IEncryptedPayload;\n deviceDisplayName: string;\n time: number;\n } | null;\n \"m.megolm_backup.v1\": IEncryptedPayload;\n}\n\n/**\n * Abstraction of things that can store data required for end-to-end encryption\n */\nexport interface CryptoStore {\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Unlike the rest of the methods in this interface, can be called before {@link CryptoStore#startup}.\n *\n * @internal\n */\n containsData(): Promise<boolean>;\n\n /**\n * Initialise this crypto store.\n *\n * Typically, this involves provisioning storage, and migrating any existing data to the current version of the\n * storage schema where appropriate.\n *\n * Must be called before any of the rest of the methods in this interface.\n */\n startup(): Promise<CryptoStore>;\n\n deleteAllData(): Promise<void>;\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n getMigrationState(): Promise<MigrationState>;\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n setMigrationState(migrationState: MigrationState): Promise<void>;\n\n getOrAddOutgoingRoomKeyRequest(request: OutgoingRoomKeyRequest): Promise<OutgoingRoomKeyRequest>;\n getOutgoingRoomKeyRequest(requestBody: IRoomKeyRequestBody): Promise<OutgoingRoomKeyRequest | null>;\n getOutgoingRoomKeyRequestByState(wantedStates: number[]): Promise<OutgoingRoomKeyRequest | null>;\n getAllOutgoingRoomKeyRequestsByState(wantedState: number): Promise<OutgoingRoomKeyRequest[]>;\n getOutgoingRoomKeyRequestsByTarget(\n userId: string,\n deviceId: string,\n wantedStates: number[],\n ): Promise<OutgoingRoomKeyRequest[]>;\n updateOutgoingRoomKeyRequest(\n requestId: string,\n expectedState: number,\n updates: Partial<OutgoingRoomKeyRequest>,\n ): Promise<OutgoingRoomKeyRequest | null>;\n deleteOutgoingRoomKeyRequest(requestId: string, expectedState: number): Promise<OutgoingRoomKeyRequest | null>;\n\n // Olm Account\n getAccount(txn: unknown, func: (accountPickle: string | null) => void): void;\n storeAccount(txn: unknown, accountPickle: string): void;\n getCrossSigningKeys(txn: unknown, func: (keys: Record<string, ICrossSigningKey> | null) => void): void;\n getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void;\n storeCrossSigningKeys(txn: unknown, keys: Record<string, ICrossSigningKey>): void;\n storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void;\n\n // Olm Sessions\n countEndToEndSessions(txn: unknown, func: (count: number) => void): void;\n getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo | null) => void,\n ): void;\n getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void;\n getAllEndToEndSessions(txn: unknown, func: (session: ISessionInfo | null) => void): void;\n storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void;\n storeEndToEndSessionProblem(deviceKey: string, type: string, fixed: boolean): Promise<void>;\n getEndToEndSessionProblem(deviceKey: string, timestamp: number): Promise<IProblem | null>;\n filterOutNotifiedErrorDevices(devices: IOlmDevice[]): Promise<IOlmDevice[]>;\n\n /**\n * Get a batch of end-to-end sessions from the database.\n *\n * @returns A batch of Olm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndSessionsBatch(): Promise<ISessionInfo[] | null>;\n\n /**\n * Delete a batch of end-to-end sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions: { deviceKey?: string; sessionId?: string }[]): Promise<void>;\n\n // Inbound Group Sessions\n getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void;\n getAllEndToEndInboundGroupSessions(txn: unknown, func: (session: ISession | null) => void): void;\n addEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void;\n storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void;\n storeEndToEndInboundGroupSessionWithheld(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: IWithheld,\n txn: unknown,\n ): void;\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions(): Promise<number>;\n\n /**\n * Get a batch of Megolm sessions from the database.\n *\n * @returns A batch of Megolm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch(): Promise<SessionExtended[] | null>;\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions: { senderKey: string; sessionId: string }[]): Promise<void>;\n\n // Device Data\n getEndToEndDeviceData(txn: unknown, func: (deviceData: IDeviceData | null) => void): void;\n storeEndToEndDeviceData(deviceData: IDeviceData, txn: unknown): void;\n storeEndToEndRoom(roomId: string, roomInfo: IRoomEncryption, txn: unknown): void;\n getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void;\n getSessionsNeedingBackup(limit: number): Promise<ISession[]>;\n countSessionsNeedingBackup(txn?: unknown): Promise<number>;\n unmarkSessionsNeedingBackup(sessions: ISession[], txn?: unknown): Promise<void>;\n markSessionsNeedingBackup(sessions: ISession[], txn?: unknown): Promise<void>;\n addSharedHistoryInboundGroupSession(roomId: string, senderKey: string, sessionId: string, txn?: unknown): void;\n getSharedHistoryInboundGroupSessions(\n roomId: string,\n txn?: unknown,\n ): Promise<[senderKey: string, sessionId: string][]>;\n addParkedSharedHistory(roomId: string, data: ParkedSharedHistory, txn?: unknown): void;\n takeParkedSharedHistory(roomId: string, txn?: unknown): Promise<ParkedSharedHistory[]>;\n\n // Session key backups\n doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn: unknown) => T, log?: Logger): Promise<T>;\n}\n\nexport type Mode = \"readonly\" | \"readwrite\";\n\n/** Data on a Megolm session */\nexport interface ISession {\n senderKey: string;\n sessionId: string;\n sessionData?: InboundGroupSessionData;\n}\n\n/** Extended data on a Megolm session */\nexport interface SessionExtended extends ISession {\n needsBackup: boolean;\n}\n\n/** Data on an Olm session */\nexport interface ISessionInfo {\n deviceKey?: string;\n sessionId?: string;\n session?: string;\n lastReceivedMessageTs?: number;\n}\n\nexport interface IDeviceData {\n devices: {\n [userId: string]: {\n [deviceId: string]: IDevice;\n };\n };\n trackingStatus: {\n [userId: string]: TrackingStatus;\n };\n crossSigningInfo?: Record<string, ICrossSigningInfo>;\n syncToken?: string;\n}\n\nexport interface IProblem {\n type: string;\n fixed: boolean;\n time: number;\n}\n\nexport interface IWithheld {\n // eslint-disable-next-line camelcase\n room_id: string;\n code: string;\n reason: string;\n}\n\n/**\n * Represents an outgoing room key request\n */\nexport interface OutgoingRoomKeyRequest {\n /**\n * Unique id for this request. Used for both an id within the request for later pairing with a cancellation,\n * and for the transaction id when sending the to_device messages to our local server.\n */\n requestId: string;\n requestTxnId?: string;\n /**\n * Transaction id for the cancellation, if any\n */\n cancellationTxnId?: string;\n /**\n * List of recipients for the request\n */\n recipients: IRoomKeyRequestRecipient[];\n /**\n * Parameters for the request\n */\n requestBody: IRoomKeyRequestBody;\n /**\n * current state of this request\n */\n state: RoomKeyRequestState;\n}\n\nexport interface ParkedSharedHistory {\n senderId: string;\n senderKey: string;\n sessionId: string;\n sessionKey: string;\n keysClaimed: ReturnType<MatrixEvent[\"getKeysClaimed\"]>; // XXX: Less type dependence on MatrixEvent\n forwardingCurve25519KeyChain: string[];\n}\n\n/**\n * A record of which steps have been completed in the libolm to Rust Crypto migration.\n *\n * Used by {@link CryptoStore#getMigrationState} and {@link CryptoStore#setMigrationState}.\n *\n * @internal\n */\nexport enum MigrationState {\n /** No migration steps have yet been completed. */\n NOT_STARTED,\n\n /** We have migrated the account data, cross-signing keys, etc. */\n INITIAL_DATA_MIGRATED,\n\n /** INITIAL_DATA_MIGRATED, and in addition, we have migrated all the Olm sessions. */\n OLM_SESSIONS_MIGRATED,\n\n /** OLM_SESSIONS_MIGRATED, and in addition, we have migrated all the Megolm sessions. */\n MEGOLM_SESSIONS_MIGRATED,\n}\n\n/**\n * The size of batches to be returned by {@link CryptoStore#getEndToEndSessionsBatch} and\n * {@link CryptoStore#getEndToEndInboundGroupSessionsBatch}.\n */\nexport const SESSION_BATCH_SIZE = 50;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAYA;AACA;AACA;AAmLA;AAOA;AAKA;AAkCA;AACA;AACA;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOYA,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAc1B;AACA;AACA;AACA;AACO,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,EAAE"}
|
|
1
|
+
{"version":3,"file":"base.js","names":["MigrationState","exports","SESSION_BATCH_SIZE"],"sources":["../../../src/crypto/store/base.ts"],"sourcesContent":["/*\nCopyright 2021 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IRoomKeyRequestBody, IRoomKeyRequestRecipient } from \"../index\";\nimport { RoomKeyRequestState } from \"../OutgoingRoomKeyRequestManager\";\nimport { ICrossSigningKey } from \"../../client\";\nimport { IOlmDevice } from \"../algorithms/megolm\";\nimport { TrackingStatus } from \"../DeviceList\";\nimport { IRoomEncryption } from \"../RoomList\";\nimport { IDevice } from \"../deviceinfo\";\nimport { ICrossSigningInfo } from \"../CrossSigning\";\nimport { Logger } from \"../../logger\";\nimport { InboundGroupSessionData } from \"../OlmDevice\";\nimport { MatrixEvent } from \"../../models/event\";\nimport { DehydrationManager } from \"../dehydration\";\nimport { IEncryptedPayload } from \"../aes\";\n\n/**\n * Internal module. Definitions for storage for the crypto module\n */\n\nexport interface SecretStorePrivateKeys {\n \"dehydration\": {\n keyInfo: DehydrationManager[\"keyInfo\"];\n key: IEncryptedPayload;\n deviceDisplayName: string;\n time: number;\n } | null;\n \"m.megolm_backup.v1\": IEncryptedPayload;\n}\n\n/**\n * Abstraction of things that can store data required for end-to-end encryption\n */\nexport interface CryptoStore {\n /**\n * Returns true if this CryptoStore has ever been initialised (ie, it might contain data).\n *\n * Unlike the rest of the methods in this interface, can be called before {@link CryptoStore#startup}.\n *\n * @internal\n */\n containsData(): Promise<boolean>;\n\n /**\n * Initialise this crypto store.\n *\n * Typically, this involves provisioning storage, and migrating any existing data to the current version of the\n * storage schema where appropriate.\n *\n * Must be called before any of the rest of the methods in this interface.\n */\n startup(): Promise<CryptoStore>;\n\n deleteAllData(): Promise<void>;\n\n /**\n * Get data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n getMigrationState(): Promise<MigrationState>;\n\n /**\n * Set data on how much of the libolm to Rust Crypto migration has been done.\n *\n * @internal\n */\n setMigrationState(migrationState: MigrationState): Promise<void>;\n\n getOrAddOutgoingRoomKeyRequest(request: OutgoingRoomKeyRequest): Promise<OutgoingRoomKeyRequest>;\n getOutgoingRoomKeyRequest(requestBody: IRoomKeyRequestBody): Promise<OutgoingRoomKeyRequest | null>;\n getOutgoingRoomKeyRequestByState(wantedStates: number[]): Promise<OutgoingRoomKeyRequest | null>;\n getAllOutgoingRoomKeyRequestsByState(wantedState: number): Promise<OutgoingRoomKeyRequest[]>;\n getOutgoingRoomKeyRequestsByTarget(\n userId: string,\n deviceId: string,\n wantedStates: number[],\n ): Promise<OutgoingRoomKeyRequest[]>;\n updateOutgoingRoomKeyRequest(\n requestId: string,\n expectedState: number,\n updates: Partial<OutgoingRoomKeyRequest>,\n ): Promise<OutgoingRoomKeyRequest | null>;\n deleteOutgoingRoomKeyRequest(requestId: string, expectedState: number): Promise<OutgoingRoomKeyRequest | null>;\n\n // Olm Account\n getAccount(txn: unknown, func: (accountPickle: string | null) => void): void;\n storeAccount(txn: unknown, accountPickle: string): void;\n getCrossSigningKeys(txn: unknown, func: (keys: Record<string, ICrossSigningKey> | null) => void): void;\n getSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n func: (key: SecretStorePrivateKeys[K] | null) => void,\n type: K,\n ): void;\n storeCrossSigningKeys(txn: unknown, keys: Record<string, ICrossSigningKey>): void;\n storeSecretStorePrivateKey<K extends keyof SecretStorePrivateKeys>(\n txn: unknown,\n type: K,\n key: SecretStorePrivateKeys[K],\n ): void;\n\n // Olm Sessions\n countEndToEndSessions(txn: unknown, func: (count: number) => void): void;\n getEndToEndSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (session: ISessionInfo | null) => void,\n ): void;\n getEndToEndSessions(\n deviceKey: string,\n txn: unknown,\n func: (sessions: { [sessionId: string]: ISessionInfo }) => void,\n ): void;\n getAllEndToEndSessions(txn: unknown, func: (session: ISessionInfo | null) => void): void;\n storeEndToEndSession(deviceKey: string, sessionId: string, sessionInfo: ISessionInfo, txn: unknown): void;\n storeEndToEndSessionProblem(deviceKey: string, type: string, fixed: boolean): Promise<void>;\n getEndToEndSessionProblem(deviceKey: string, timestamp: number): Promise<IProblem | null>;\n filterOutNotifiedErrorDevices(devices: IOlmDevice[]): Promise<IOlmDevice[]>;\n\n /**\n * Get a batch of end-to-end sessions from the database.\n *\n * @returns A batch of Olm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndSessionsBatch(): Promise<ISessionInfo[] | null>;\n\n /**\n * Delete a batch of end-to-end sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndSessionsBatch(sessions: { deviceKey?: string; sessionId?: string }[]): Promise<void>;\n\n // Inbound Group Sessions\n getEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n txn: unknown,\n func: (groupSession: InboundGroupSessionData | null, groupSessionWithheld: IWithheld | null) => void,\n ): void;\n getAllEndToEndInboundGroupSessions(txn: unknown, func: (session: ISession | null) => void): void;\n addEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void;\n storeEndToEndInboundGroupSession(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n txn: unknown,\n ): void;\n storeEndToEndInboundGroupSessionWithheld(\n senderCurve25519Key: string,\n sessionId: string,\n sessionData: IWithheld,\n txn: unknown,\n ): void;\n\n /**\n * Count the number of Megolm sessions in the database.\n *\n * @internal\n */\n countEndToEndInboundGroupSessions(): Promise<number>;\n\n /**\n * Get a batch of Megolm sessions from the database.\n *\n * @returns A batch of Megolm Sessions, or `null` if no sessions are left.\n * @internal\n */\n getEndToEndInboundGroupSessionsBatch(): Promise<SessionExtended[] | null>;\n\n /**\n * Delete a batch of Megolm sessions from the database.\n *\n * Any sessions in the list which are not found are silently ignored.\n *\n * @internal\n */\n deleteEndToEndInboundGroupSessionsBatch(sessions: { senderKey: string; sessionId: string }[]): Promise<void>;\n\n // Device Data\n getEndToEndDeviceData(txn: unknown, func: (deviceData: IDeviceData | null) => void): void;\n storeEndToEndDeviceData(deviceData: IDeviceData, txn: unknown): void;\n storeEndToEndRoom(roomId: string, roomInfo: IRoomEncryption, txn: unknown): void;\n getEndToEndRooms(txn: unknown, func: (rooms: Record<string, IRoomEncryption>) => void): void;\n getSessionsNeedingBackup(limit: number): Promise<ISession[]>;\n countSessionsNeedingBackup(txn?: unknown): Promise<number>;\n unmarkSessionsNeedingBackup(sessions: ISession[], txn?: unknown): Promise<void>;\n markSessionsNeedingBackup(sessions: ISession[], txn?: unknown): Promise<void>;\n addSharedHistoryInboundGroupSession(roomId: string, senderKey: string, sessionId: string, txn?: unknown): void;\n getSharedHistoryInboundGroupSessions(\n roomId: string,\n txn?: unknown,\n ): Promise<[senderKey: string, sessionId: string][]>;\n addParkedSharedHistory(roomId: string, data: ParkedSharedHistory, txn?: unknown): void;\n takeParkedSharedHistory(roomId: string, txn?: unknown): Promise<ParkedSharedHistory[]>;\n\n // Session key backups\n doTxn<T>(mode: Mode, stores: Iterable<string>, func: (txn: unknown) => T, log?: Logger): Promise<T>;\n}\n\nexport type Mode = \"readonly\" | \"readwrite\";\n\n/** Data on a Megolm session */\nexport interface ISession {\n senderKey: string;\n sessionId: string;\n sessionData?: InboundGroupSessionData;\n}\n\n/** Extended data on a Megolm session */\nexport interface SessionExtended extends ISession {\n needsBackup: boolean;\n}\n\n/** Data on an Olm session */\nexport interface ISessionInfo {\n deviceKey?: string;\n sessionId?: string;\n session?: string;\n lastReceivedMessageTs?: number;\n}\n\nexport interface IDeviceData {\n devices: {\n [userId: string]: {\n [deviceId: string]: IDevice;\n };\n };\n trackingStatus: {\n [userId: string]: TrackingStatus;\n };\n crossSigningInfo?: Record<string, ICrossSigningInfo>;\n syncToken?: string;\n}\n\nexport interface IProblem {\n type: string;\n fixed: boolean;\n time: number;\n}\n\nexport interface IWithheld {\n // eslint-disable-next-line camelcase\n room_id: string;\n code: string;\n reason: string;\n}\n\n/**\n * Represents an outgoing room key request\n */\nexport interface OutgoingRoomKeyRequest {\n /**\n * Unique id for this request. Used for both an id within the request for later pairing with a cancellation,\n * and for the transaction id when sending the to_device messages to our local server.\n */\n requestId: string;\n requestTxnId?: string;\n /**\n * Transaction id for the cancellation, if any\n */\n cancellationTxnId?: string;\n /**\n * List of recipients for the request\n */\n recipients: IRoomKeyRequestRecipient[];\n /**\n * Parameters for the request\n */\n requestBody: IRoomKeyRequestBody;\n /**\n * current state of this request\n */\n state: RoomKeyRequestState;\n}\n\nexport interface ParkedSharedHistory {\n senderId: string;\n senderKey: string;\n sessionId: string;\n sessionKey: string;\n keysClaimed: ReturnType<MatrixEvent[\"getKeysClaimed\"]>; // XXX: Less type dependence on MatrixEvent\n forwardingCurve25519KeyChain: string[];\n}\n\n/**\n * A record of which steps have been completed in the libolm to Rust Crypto migration.\n *\n * Used by {@link CryptoStore#getMigrationState} and {@link CryptoStore#setMigrationState}.\n *\n * @internal\n */\nexport enum MigrationState {\n /** No migration steps have yet been completed. */\n NOT_STARTED,\n\n /** We have migrated the account data, cross-signing keys, etc. */\n INITIAL_DATA_MIGRATED,\n\n /** INITIAL_DATA_MIGRATED, and in addition, we have migrated all the Olm sessions. */\n OLM_SESSIONS_MIGRATED,\n\n /** OLM_SESSIONS_MIGRATED, and in addition, we have migrated all the Megolm sessions. */\n MEGOLM_SESSIONS_MIGRATED,\n\n /** MEGOLM_SESSIONS_MIGRATED, and in addition, we have migrated all the room settings. */\n ROOM_SETTINGS_MIGRATED,\n}\n\n/**\n * The size of batches to be returned by {@link CryptoStore#getEndToEndSessionsBatch} and\n * {@link CryptoStore#getEndToEndInboundGroupSessionsBatch}.\n */\nexport const SESSION_BATCH_SIZE = 50;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBA;AACA;AACA;AAYA;AACA;AACA;AAmLA;AAOA;AAKA;AAkCA;AACA;AACA;AAmCA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,IAOYA,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAiB1B;AACA;AACA;AACA;AACO,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,EAAE"}
|
package/lib/crypto-api.d.ts
CHANGED
|
@@ -33,6 +33,17 @@ export interface CryptoApi {
|
|
|
33
33
|
* @returns The public device keys.
|
|
34
34
|
*/
|
|
35
35
|
getOwnDeviceKeys(): Promise<OwnDeviceKeys>;
|
|
36
|
+
/**
|
|
37
|
+
* Check if we believe the given room to be encrypted.
|
|
38
|
+
*
|
|
39
|
+
* This method returns true if the room has been configured with encryption. The setting is persistent, so that
|
|
40
|
+
* even if the encryption event is removed from the room state, it still returns true. This helps to guard against
|
|
41
|
+
* a downgrade attack wherein a server admin attempts to remove encryption.
|
|
42
|
+
*
|
|
43
|
+
* @returns `true` if the room with the supplied ID is encrypted. `false` if the room is not encrypted, or is unknown to
|
|
44
|
+
* us.
|
|
45
|
+
*/
|
|
46
|
+
isEncryptionEnabledInRoom(roomId: string): Promise<boolean>;
|
|
36
47
|
/**
|
|
37
48
|
* Perform any background tasks that can be done before a message is ready to
|
|
38
49
|
* send, in order to speed up sending of the message.
|
|
@@ -158,7 +169,7 @@ export interface CryptoApi {
|
|
|
158
169
|
* Cross-signing a device indicates, to our other devices and to other users, that we have verified that it really
|
|
159
170
|
* belongs to us.
|
|
160
171
|
*
|
|
161
|
-
* Requires that cross-signing has been set up on this device (normally by calling {@link bootstrapCrossSigning}.
|
|
172
|
+
* Requires that cross-signing has been set up on this device (normally by calling {@link bootstrapCrossSigning}).
|
|
162
173
|
*
|
|
163
174
|
* *Note*: Do not call this unless you have verified, somehow, that the device is genuine!
|
|
164
175
|
*
|
package/lib/crypto-api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-api.d.ts","sourceRoot":"","sources":["../src/crypto-api.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB;;;;;;OAMG;IACH,gCAAgC,EAAE,OAAO,CAAC;IAE1C;;;;OAIG;IACH,UAAU,IAAI,MAAM,CAAC;IAErB;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,aAAa,C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AyF;IACzF,OAAO,EAAE,MAAM,CAAC;IAChB,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC"}
|
package/lib/crypto-api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto-api.js","names":["_verification","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_keybackup","UserVerificationStatus","constructor","crossSigningVerified","crossSigningVerifiedBefore","tofu","isVerified","isCrossSigningVerified","wasCrossSigningVerified","isTofu","DeviceVerificationStatus","opts","_opts$signedByOwner","_opts$crossSigningVer","_opts$tofu","_opts$localVerified","_opts$trustCrossSigne","signedByOwner","localVerified","trustCrossSignedDevices","CrossSigningKey","EventShieldColour","EventShieldReason"],"sources":["../src/crypto-api.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 { IMegolmSessionData } from \"./@types/crypto\";\nimport { Room } from \"./models/room\";\nimport { DeviceMap } from \"./models/device\";\nimport { UIAuthCallback } from \"./interactive-auth\";\nimport { PassphraseInfo, SecretStorageCallbacks, SecretStorageKeyDescription } from \"./secret-storage\";\nimport { VerificationRequest } from \"./crypto-api/verification\";\nimport { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo } from \"./crypto-api/keybackup\";\nimport { ISignatures } from \"./@types/signed\";\nimport { MatrixEvent } from \"./models/event\";\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 * 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 * 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 * 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 * 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 Crypto.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 * 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 * @remarks Fires {@link CryptoEvent#DeviceVerificationChanged}\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, 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 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.\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, 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 the secret storage by creating a new secret storage key, add it in the secret storage and\n * store the cross signing keys in the secret storage.\n *\n * - Generate a new key {@link GeneratedSecretStorageKey} with `createSecretStorageKey`.\n * Only if `setupNewSecretStorage` is set or if there is no AES key in the secret storage\n * - Store this key in the secret storage and set it as the default key.\n * - Call `cryptoCallbacks.cacheSecretStorageKey` if provided.\n * - Store the cross signing keys in the secret storage if\n * - the cross signing is ready\n * - a new key was created during the previous step\n * - or the secret storage already contains the cross signing keys\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 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 //\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 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 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 * 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 MatrixClient#getKeyBackupVersion}.\n */\n isKeyBackupTrusted(info: KeyBackupInfo): Promise<BackupTrustInfo>;\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 * The decryption key will be saved in Secret Storage (the {@link SecretStorageCallbacks.getSecretStorageKey} Crypto\n * callback will be called)\n * and the backup engine will be started.\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/**\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 public constructor(\n private readonly crossSigningVerified: boolean,\n private readonly crossSigningVerifiedBefore: boolean,\n private readonly tofu: boolean,\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 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 MatrixClient#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 Crypto.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 * Room key import progress report.\n * Used when calling {@link CryptoApi#importRoomKeys} as the parameter of\n * the progressCallback. Used to display feedback.\n */\nexport interface ImportRoomKeyProgressData {\n stage: string; // TODO: Enum\n successes?: number;\n failures?: number;\n total?: number;\n}\n\n/**\n * Options object for {@link CryptoApi#importRoomKeys}.\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 extends SecretStorageCallbacks {\n getCrossSigningKey?: (keyType: string, pubKey: string) => Promise<Uint8Array | null>;\n saveCrossSigningKeys?: (keys: Record<string, Uint8Array>) => void;\n shouldUpgradeDeviceVerifications?: (users: Record<string, any>) => Promise<string[]>;\n /**\n * Called by {@link CryptoApi#bootstrapSecretStorage}\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 onSecretRequested?: (\n userId: string,\n deviceId: string,\n requestId: string,\n secretName: string,\n deviceTrust: DeviceVerificationStatus,\n ) => Promise<string | undefined>;\n getDehydrationKey?: (\n keyInfo: SecretStorageKeyDescription,\n checkFunc: (key: Uint8Array) => void,\n ) => Promise<Uint8Array>;\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 */\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\n * current key backup passphrase. Should return a promise that resolves with a Uint8Array\n * containing the key, or rejects if the key cannot be obtained.\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 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 \"./crypto-api/verification\";\nexport * from \"./crypto-api/keybackup\";\n"],"mappings":";;;;;;;;;;;;;AAmxBA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,UAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AApxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAobA;AACA;AACA;;AAYA;AACA;AACA;AACO,MAAMU,sBAAsB,CAAC;EACzB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ach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_keybackup","UserVerificationStatus","constructor","crossSigningVerified","crossSigningVerifiedBefore","tofu","isVerified","isCrossSigningVerified","wasCrossSigningVerified","isTofu","DeviceVerificationStatus","opts","_opts$signedByOwner","_opts$crossSigningVer","_opts$tofu","_opts$localVerified","_opts$trustCrossSigne","signedByOwner","localVerified","trustCrossSignedDevices","CrossSigningKey","EventShieldColour","EventShieldReason"],"sources":["../src/crypto-api.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 { IMegolmSessionData } from \"./@types/crypto\";\nimport { Room } from \"./models/room\";\nimport { DeviceMap } from \"./models/device\";\nimport { UIAuthCallback } from \"./interactive-auth\";\nimport { PassphraseInfo, SecretStorageCallbacks, SecretStorageKeyDescription } from \"./secret-storage\";\nimport { VerificationRequest } from \"./crypto-api/verification\";\nimport { BackupTrustInfo, KeyBackupCheck, KeyBackupInfo } from \"./crypto-api/keybackup\";\nimport { ISignatures } from \"./@types/signed\";\nimport { MatrixEvent } from \"./models/event\";\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 * 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 * 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 * 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 Crypto.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 * 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 * @remarks Fires {@link CryptoEvent#DeviceVerificationChanged}\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, 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 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.\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, 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 the secret storage by creating a new secret storage key, add it in the secret storage and\n * store the cross signing keys in the secret storage.\n *\n * - Generate a new key {@link GeneratedSecretStorageKey} with `createSecretStorageKey`.\n * Only if `setupNewSecretStorage` is set or if there is no AES key in the secret storage\n * - Store this key in the secret storage and set it as the default key.\n * - Call `cryptoCallbacks.cacheSecretStorageKey` if provided.\n * - Store the cross signing keys in the secret storage if\n * - the cross signing is ready\n * - a new key was created during the previous step\n * - or the secret storage already contains the cross signing keys\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 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 //\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 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 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 * 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 MatrixClient#getKeyBackupVersion}.\n */\n isKeyBackupTrusted(info: KeyBackupInfo): Promise<BackupTrustInfo>;\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 * The decryption key will be saved in Secret Storage (the {@link SecretStorageCallbacks.getSecretStorageKey} Crypto\n * callback will be called)\n * and the backup engine will be started.\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/**\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 public constructor(\n private readonly crossSigningVerified: boolean,\n private readonly crossSigningVerifiedBefore: boolean,\n private readonly tofu: boolean,\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 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 MatrixClient#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 Crypto.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 * Room key import progress report.\n * Used when calling {@link CryptoApi#importRoomKeys} as the parameter of\n * the progressCallback. Used to display feedback.\n */\nexport interface ImportRoomKeyProgressData {\n stage: string; // TODO: Enum\n successes?: number;\n failures?: number;\n total?: number;\n}\n\n/**\n * Options object for {@link CryptoApi#importRoomKeys}.\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 extends SecretStorageCallbacks {\n getCrossSigningKey?: (keyType: string, pubKey: string) => Promise<Uint8Array | null>;\n saveCrossSigningKeys?: (keys: Record<string, Uint8Array>) => void;\n shouldUpgradeDeviceVerifications?: (users: Record<string, any>) => Promise<string[]>;\n /**\n * Called by {@link CryptoApi#bootstrapSecretStorage}\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 onSecretRequested?: (\n userId: string,\n deviceId: string,\n requestId: string,\n secretName: string,\n deviceTrust: DeviceVerificationStatus,\n ) => Promise<string | undefined>;\n getDehydrationKey?: (\n keyInfo: SecretStorageKeyDescription,\n checkFunc: (key: Uint8Array) => void,\n ) => Promise<Uint8Array>;\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 */\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\n * current key backup passphrase. Should return a promise that resolves with a Uint8Array\n * containing the key, or rejects if the key cannot be obtained.\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 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 \"./crypto-api/verification\";\nexport * from \"./crypto-api/keybackup\";\n"],"mappings":";;;;;;;;;;;;;AA+xBA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,UAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,UAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AAhyBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAgcA;AACA;AACA;;AAYA;AACA;AACA;AACO,MAAMU,sBAAsB,CAAC;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embership.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/CallMembership.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAGrC,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"CallMembership.d.ts","sourceRoot":"","sources":["../../src/matrixrtc/CallMembership.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,KAAK,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAGrC,MAAM,WAAW,kBAAkB;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,KAAK,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,cAAc;IAMnB,OAAO,CAAC,WAAW;IACnB,OAAO,CAAC,IAAI;WANF,KAAK,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,GAAG,OAAO;gBAKtD,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,kBAAkB;IAsBpC,IAAW,MAAM,IAAI,MAAM,GAAG,SAAS,CAEtC;IAED,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,IAAW,WAAW,IAAI,MAAM,GAAG,SAAS,CAE3C;IAED,IAAW,KAAK,IAAI,SAAS,CAE5B;IAED,IAAW,YAAY,IAAI,MAAM,CAEhC;IAEM,SAAS,IAAI,MAAM;IAInB,iBAAiB,IAAI,MAAM;IAU3B,cAAc,IAAI,MAAM;IAcxB,gBAAgB,IAAI,MAAM;IAI1B,SAAS,IAAI,OAAO;IAIpB,aAAa,IAAI,KAAK,EAAE;CAGlC"}
|
|
@@ -30,7 +30,19 @@ class CallMembership {
|
|
|
30
30
|
constructor(parentEvent, data) {
|
|
31
31
|
this.parentEvent = parentEvent;
|
|
32
32
|
this.data = data;
|
|
33
|
-
if (
|
|
33
|
+
if (!(data.expires || data.expires_ts)) {
|
|
34
|
+
throw new Error("Malformed membership: expires_ts or expires must be present");
|
|
35
|
+
}
|
|
36
|
+
if (data.expires) {
|
|
37
|
+
if (typeof data.expires !== "number") {
|
|
38
|
+
throw new Error("Malformed membership: expires must be numeric");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (data.expires_ts) {
|
|
42
|
+
if (typeof data.expires_ts !== "number") {
|
|
43
|
+
throw new Error("Malformed membership: expires_ts must be numeric");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
34
46
|
if (typeof data.device_id !== "string") throw new Error("Malformed membership event: device_id must be string");
|
|
35
47
|
if (typeof data.call_id !== "string") throw new Error("Malformed membership event: call_id must be string");
|
|
36
48
|
if (typeof data.scope !== "string") throw new Error("Malformed membership event: scope must be string");
|
|
@@ -59,14 +71,25 @@ class CallMembership {
|
|
|
59
71
|
return (_this$data$created_ts = this.data.created_ts) !== null && _this$data$created_ts !== void 0 ? _this$data$created_ts : this.parentEvent.getTs();
|
|
60
72
|
}
|
|
61
73
|
getAbsoluteExpiry() {
|
|
62
|
-
|
|
74
|
+
if (this.data.expires) {
|
|
75
|
+
return this.createdTs() + this.data.expires;
|
|
76
|
+
} else {
|
|
77
|
+
// We know it exists because we checked for this in the constructor.
|
|
78
|
+
return this.data.expires_ts;
|
|
79
|
+
}
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
// gets the expiry time of the event, converted into the device's local time
|
|
66
83
|
getLocalExpiry() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
if (this.data.expires) {
|
|
85
|
+
const relativeCreationTime = this.parentEvent.getTs() - this.createdTs();
|
|
86
|
+
const localCreationTs = this.parentEvent.localTimestamp - relativeCreationTime;
|
|
87
|
+
return localCreationTs + this.data.expires;
|
|
88
|
+
} else {
|
|
89
|
+
// With expires_ts we cannot convert to local time.
|
|
90
|
+
// TODO: Check the server timestamp and compute a diff to local time.
|
|
91
|
+
return this.data.expires_ts;
|
|
92
|
+
}
|
|
70
93
|
}
|
|
71
94
|
getMsUntilExpiry() {
|
|
72
95
|
return this.getLocalExpiry() - Date.now();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CallMembership.js","names":["_utils","require","CallMembership","equal","a","b","deepCompare","data","constructor","parentEvent","expires","Error","device_id","call_id","scope","getSender","sender","callId","deviceId","application","membershipID","createdTs","_this$data$created_ts","created_ts","getTs","getAbsoluteExpiry","getLocalExpiry","relativeCreationTime","localCreationTs","localTimestamp","getMsUntilExpiry","Date","now","isExpired","getActiveFoci","_this$data$foci_activ","foci_active","exports"],"sources":["../../src/matrixrtc/CallMembership.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 { MatrixEvent } from \"../matrix\";\nimport { deepCompare } from \"../utils\";\nimport { Focus } from \"./focus\";\n\ntype CallScope = \"m.room\" | \"m.user\";\n\n// Represents an entry in the memberships section of an m.call.member event as it is on the wire\nexport interface CallMembershipData {\n application?: string;\n call_id: string;\n scope: CallScope;\n device_id: string;\n created_ts?: number;\n expires
|
|
1
|
+
{"version":3,"file":"CallMembership.js","names":["_utils","require","CallMembership","equal","a","b","deepCompare","data","constructor","parentEvent","expires","expires_ts","Error","device_id","call_id","scope","getSender","sender","callId","deviceId","application","membershipID","createdTs","_this$data$created_ts","created_ts","getTs","getAbsoluteExpiry","getLocalExpiry","relativeCreationTime","localCreationTs","localTimestamp","getMsUntilExpiry","Date","now","isExpired","getActiveFoci","_this$data$foci_activ","foci_active","exports"],"sources":["../../src/matrixrtc/CallMembership.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 { MatrixEvent } from \"../matrix\";\nimport { deepCompare } from \"../utils\";\nimport { Focus } from \"./focus\";\n\ntype CallScope = \"m.room\" | \"m.user\";\n\n// Represents an entry in the memberships section of an m.call.member event as it is on the wire\nexport interface CallMembershipData {\n application?: string;\n call_id: string;\n scope: CallScope;\n device_id: string;\n created_ts?: number;\n expires?: number;\n expires_ts?: number;\n foci_active?: Focus[];\n membershipID: string;\n}\n\nexport class CallMembership {\n public static equal(a: CallMembership, b: CallMembership): boolean {\n return deepCompare(a.data, b.data);\n }\n\n public constructor(\n private parentEvent: MatrixEvent,\n private data: CallMembershipData,\n ) {\n if (!(data.expires || data.expires_ts)) {\n throw new Error(\"Malformed membership: expires_ts or expires must be present\");\n }\n if (data.expires) {\n if (typeof data.expires !== \"number\") {\n throw new Error(\"Malformed membership: expires must be numeric\");\n }\n }\n if (data.expires_ts) {\n if (typeof data.expires_ts !== \"number\") {\n throw new Error(\"Malformed membership: expires_ts must be numeric\");\n }\n }\n\n if (typeof data.device_id !== \"string\") throw new Error(\"Malformed membership event: device_id must be string\");\n if (typeof data.call_id !== \"string\") throw new Error(\"Malformed membership event: call_id must be string\");\n if (typeof data.scope !== \"string\") throw new Error(\"Malformed membership event: scope must be string\");\n if (!parentEvent.getSender()) throw new Error(\"Invalid parent event: sender is null\");\n }\n\n public get sender(): string | undefined {\n return this.parentEvent.getSender();\n }\n\n public get callId(): string {\n return this.data.call_id;\n }\n\n public get deviceId(): string {\n return this.data.device_id;\n }\n\n public get application(): string | undefined {\n return this.data.application;\n }\n\n public get scope(): CallScope {\n return this.data.scope;\n }\n\n public get membershipID(): string {\n return this.data.membershipID;\n }\n\n public createdTs(): number {\n return this.data.created_ts ?? this.parentEvent.getTs();\n }\n\n public getAbsoluteExpiry(): number {\n if (this.data.expires) {\n return this.createdTs() + this.data.expires;\n } else {\n // We know it exists because we checked for this in the constructor.\n return this.data.expires_ts!;\n }\n }\n\n // gets the expiry time of the event, converted into the device's local time\n public getLocalExpiry(): number {\n if (this.data.expires) {\n const relativeCreationTime = this.parentEvent.getTs() - this.createdTs();\n\n const localCreationTs = this.parentEvent.localTimestamp - relativeCreationTime;\n\n return localCreationTs + this.data.expires;\n } else {\n // With expires_ts we cannot convert to local time.\n // TODO: Check the server timestamp and compute a diff to local time.\n return this.data.expires_ts!;\n }\n }\n\n public getMsUntilExpiry(): number {\n return this.getLocalExpiry() - Date.now();\n }\n\n public isExpired(): boolean {\n return this.getMsUntilExpiry() <= 0;\n }\n\n public getActiveFoci(): Focus[] {\n return this.data.foci_active ?? [];\n }\n}\n"],"mappings":";;;;;;AAiBA,IAAAA,MAAA,G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-503,6 +503,7 @@ class MatrixRTCSession extends _typedEventEmitter.TypedEventEmitter {
|
|
|
503
503
|
* @param prevEvent - The previous version of our call membership, if any
|
|
504
504
|
*/
|
|
505
505
|
makeMyMembership(prevMembership) {
|
|
506
|
+
var _m$expires, _m$expires2;
|
|
506
507
|
if (this.relativeExpiry === undefined) {
|
|
507
508
|
throw new Error("Tried to create our own membership event when we're not joined!");
|
|
508
509
|
}
|
|
@@ -519,6 +520,9 @@ class MatrixRTCSession extends _typedEventEmitter.TypedEventEmitter {
|
|
|
519
520
|
membershipID: this.membershipId
|
|
520
521
|
};
|
|
521
522
|
if (prevMembership) m.created_ts = prevMembership.createdTs();
|
|
523
|
+
if (m.created_ts) m.expires_ts = m.created_ts + ((_m$expires = m.expires) !== null && _m$expires !== void 0 ? _m$expires : 0);
|
|
524
|
+
// TODO: Date.now() should be the origin_server_ts (now).
|
|
525
|
+
else m.expires_ts = Date.now() + ((_m$expires2 = m.expires) !== null && _m$expires2 !== void 0 ? _m$expires2 : 0);
|
|
522
526
|
return m;
|
|
523
527
|
}
|
|
524
528
|
|