@unwanted/matrix-sdk-mini 34.12.0-2 → 34.12.0-3
Sign up to get free protection for your applications and to get access to all the features.
- package/git-revision.txt +1 -1
- package/lib/@types/global.d.js +0 -2
- package/lib/@types/global.d.js.map +1 -1
- package/lib/browser-index.d.ts.map +1 -1
- package/lib/browser-index.js +0 -11
- package/lib/browser-index.js.map +1 -1
- package/lib/client.d.ts +2 -1176
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +346 -2717
- package/lib/client.js.map +1 -1
- package/lib/embedded.d.ts +0 -22
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +24 -166
- package/lib/embedded.js.map +1 -1
- package/lib/event-mapper.d.ts.map +1 -1
- package/lib/event-mapper.js +0 -4
- package/lib/event-mapper.js.map +1 -1
- package/lib/matrix.d.ts +0 -19
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +1 -26
- package/lib/matrix.js.map +1 -1
- package/lib/models/MSC3089Branch.d.ts.map +1 -1
- package/lib/models/MSC3089Branch.js +0 -3
- package/lib/models/MSC3089Branch.js.map +1 -1
- package/lib/models/event.d.ts +0 -94
- package/lib/models/event.d.ts.map +1 -1
- package/lib/models/event.js +0 -274
- package/lib/models/event.js.map +1 -1
- package/lib/models/poll.d.ts.map +1 -1
- package/lib/models/poll.js +1 -5
- package/lib/models/poll.js.map +1 -1
- package/lib/models/relations-container.d.ts.map +1 -1
- package/lib/models/relations-container.js +1 -7
- package/lib/models/relations-container.js.map +1 -1
- package/lib/models/relations.d.ts +0 -1
- package/lib/models/relations.d.ts.map +1 -1
- package/lib/models/relations.js +0 -8
- package/lib/models/relations.js.map +1 -1
- package/lib/models/room-state.d.ts.map +1 -1
- package/lib/models/room-state.js +10 -26
- package/lib/models/room-state.js.map +1 -1
- package/lib/models/room.d.ts +0 -18
- package/lib/models/room.d.ts.map +1 -1
- package/lib/models/room.js +94 -148
- package/lib/models/room.js.map +1 -1
- package/lib/models/thread.d.ts.map +1 -1
- package/lib/models/thread.js +0 -1
- package/lib/models/thread.js.map +1 -1
- package/lib/sliding-sync-sdk.d.ts +2 -3
- package/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/lib/sliding-sync-sdk.js +41 -90
- package/lib/sliding-sync-sdk.js.map +1 -1
- package/lib/sync.d.ts +0 -12
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +1 -73
- package/lib/sync.js.map +1 -1
- package/lib/testing.d.ts +0 -48
- package/lib/testing.d.ts.map +1 -1
- package/lib/testing.js +0 -105
- package/lib/testing.js.map +1 -1
- package/package.json +1 -3
- package/src/@types/global.d.ts +0 -3
- package/src/browser-index.ts +0 -11
- package/src/client.ts +57 -2732
- package/src/embedded.ts +3 -130
- package/src/event-mapper.ts +0 -4
- package/src/matrix.ts +0 -28
- package/src/models/MSC3089Branch.ts +0 -3
- package/src/models/event.ts +0 -289
- package/src/models/poll.ts +0 -6
- package/src/models/relations-container.ts +1 -8
- package/src/models/relations.ts +0 -8
- package/src/models/room-state.ts +2 -8
- package/src/models/room.ts +0 -62
- package/src/models/thread.ts +0 -1
- package/src/sliding-sync-sdk.ts +2 -72
- package/src/sync.ts +1 -98
- package/src/testing.ts +0 -108
- package/lib/@types/crypto.d.ts +0 -47
- package/lib/@types/crypto.d.ts.map +0 -1
- package/lib/@types/crypto.js +0 -1
- package/lib/@types/crypto.js.map +0 -1
- package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
- package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
- package/lib/common-crypto/CryptoBackend.d.ts +0 -240
- package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
- package/lib/common-crypto/CryptoBackend.js +0 -73
- package/lib/common-crypto/CryptoBackend.js.map +0 -1
- package/lib/common-crypto/key-passphrase.d.ts +0 -14
- package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
- package/lib/common-crypto/key-passphrase.js +0 -33
- package/lib/common-crypto/key-passphrase.js.map +0 -1
- package/lib/crypto/CrossSigning.d.ts +0 -184
- package/lib/crypto/CrossSigning.d.ts.map +0 -1
- package/lib/crypto/CrossSigning.js +0 -718
- package/lib/crypto/CrossSigning.js.map +0 -1
- package/lib/crypto/DeviceList.d.ts +0 -216
- package/lib/crypto/DeviceList.d.ts.map +0 -1
- package/lib/crypto/DeviceList.js +0 -892
- package/lib/crypto/DeviceList.js.map +0 -1
- package/lib/crypto/EncryptionSetup.d.ts +0 -152
- package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
- package/lib/crypto/EncryptionSetup.js +0 -356
- package/lib/crypto/EncryptionSetup.js.map +0 -1
- package/lib/crypto/OlmDevice.d.ts +0 -457
- package/lib/crypto/OlmDevice.d.ts.map +0 -1
- package/lib/crypto/OlmDevice.js +0 -1241
- package/lib/crypto/OlmDevice.js.map +0 -1
- package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
- package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
- package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
- package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
- package/lib/crypto/RoomList.d.ts +0 -26
- package/lib/crypto/RoomList.d.ts.map +0 -1
- package/lib/crypto/RoomList.js +0 -71
- package/lib/crypto/RoomList.js.map +0 -1
- package/lib/crypto/SecretSharing.d.ts +0 -24
- package/lib/crypto/SecretSharing.d.ts.map +0 -1
- package/lib/crypto/SecretSharing.js +0 -194
- package/lib/crypto/SecretSharing.js.map +0 -1
- package/lib/crypto/SecretStorage.d.ts +0 -55
- package/lib/crypto/SecretStorage.d.ts.map +0 -1
- package/lib/crypto/SecretStorage.js +0 -118
- package/lib/crypto/SecretStorage.js.map +0 -1
- package/lib/crypto/aes.d.ts +0 -6
- package/lib/crypto/aes.d.ts.map +0 -1
- package/lib/crypto/aes.js +0 -24
- package/lib/crypto/aes.js.map +0 -1
- package/lib/crypto/algorithms/base.d.ts +0 -156
- package/lib/crypto/algorithms/base.d.ts.map +0 -1
- package/lib/crypto/algorithms/base.js +0 -187
- package/lib/crypto/algorithms/base.js.map +0 -1
- package/lib/crypto/algorithms/index.d.ts +0 -4
- package/lib/crypto/algorithms/index.d.ts.map +0 -1
- package/lib/crypto/algorithms/index.js +0 -20
- package/lib/crypto/algorithms/index.js.map +0 -1
- package/lib/crypto/algorithms/megolm.d.ts +0 -385
- package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
- package/lib/crypto/algorithms/megolm.js +0 -1822
- package/lib/crypto/algorithms/megolm.js.map +0 -1
- package/lib/crypto/algorithms/olm.d.ts +0 -5
- package/lib/crypto/algorithms/olm.d.ts.map +0 -1
- package/lib/crypto/algorithms/olm.js +0 -299
- package/lib/crypto/algorithms/olm.js.map +0 -1
- package/lib/crypto/api.d.ts +0 -32
- package/lib/crypto/api.d.ts.map +0 -1
- package/lib/crypto/api.js +0 -22
- package/lib/crypto/api.js.map +0 -1
- package/lib/crypto/backup.d.ts +0 -227
- package/lib/crypto/backup.d.ts.map +0 -1
- package/lib/crypto/backup.js +0 -824
- package/lib/crypto/backup.js.map +0 -1
- package/lib/crypto/crypto.d.ts +0 -3
- package/lib/crypto/crypto.d.ts.map +0 -1
- package/lib/crypto/crypto.js +0 -19
- package/lib/crypto/crypto.js.map +0 -1
- package/lib/crypto/dehydration.d.ts +0 -34
- package/lib/crypto/dehydration.d.ts.map +0 -1
- package/lib/crypto/dehydration.js +0 -252
- package/lib/crypto/dehydration.js.map +0 -1
- package/lib/crypto/device-converter.d.ts +0 -9
- package/lib/crypto/device-converter.d.ts.map +0 -1
- package/lib/crypto/device-converter.js +0 -42
- package/lib/crypto/device-converter.js.map +0 -1
- package/lib/crypto/deviceinfo.d.ts +0 -99
- package/lib/crypto/deviceinfo.d.ts.map +0 -1
- package/lib/crypto/deviceinfo.js +0 -148
- package/lib/crypto/deviceinfo.js.map +0 -1
- package/lib/crypto/index.d.ts +0 -1209
- package/lib/crypto/index.d.ts.map +0 -1
- package/lib/crypto/index.js +0 -4097
- package/lib/crypto/index.js.map +0 -1
- package/lib/crypto/key_passphrase.d.ts +0 -14
- package/lib/crypto/key_passphrase.d.ts.map +0 -1
- package/lib/crypto/key_passphrase.js +0 -44
- package/lib/crypto/key_passphrase.js.map +0 -1
- package/lib/crypto/keybackup.d.ts +0 -18
- package/lib/crypto/keybackup.d.ts.map +0 -1
- package/lib/crypto/keybackup.js +0 -1
- package/lib/crypto/keybackup.js.map +0 -1
- package/lib/crypto/olmlib.d.ts +0 -129
- package/lib/crypto/olmlib.d.ts.map +0 -1
- package/lib/crypto/olmlib.js +0 -492
- package/lib/crypto/olmlib.js.map +0 -1
- package/lib/crypto/recoverykey.d.ts +0 -2
- package/lib/crypto/recoverykey.d.ts.map +0 -1
- package/lib/crypto/recoverykey.js +0 -19
- package/lib/crypto/recoverykey.js.map +0 -1
- package/lib/crypto/store/base.d.ts +0 -252
- package/lib/crypto/store/base.d.ts.map +0 -1
- package/lib/crypto/store/base.js +0 -64
- package/lib/crypto/store/base.js.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
- package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
- package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
- package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
- package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
- package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
- package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
- package/lib/crypto/store/localStorage-crypto-store.js +0 -531
- package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
- package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
- package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
- package/lib/crypto/store/memory-crypto-store.js +0 -622
- package/lib/crypto/store/memory-crypto-store.js.map +0 -1
- package/lib/crypto/verification/Base.d.ts +0 -105
- package/lib/crypto/verification/Base.d.ts.map +0 -1
- package/lib/crypto/verification/Base.js +0 -372
- package/lib/crypto/verification/Base.js.map +0 -1
- package/lib/crypto/verification/Error.d.ts +0 -35
- package/lib/crypto/verification/Error.d.ts.map +0 -1
- package/lib/crypto/verification/Error.js +0 -86
- package/lib/crypto/verification/Error.js.map +0 -1
- package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
- package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
- package/lib/crypto/verification/IllegalMethod.js +0 -43
- package/lib/crypto/verification/IllegalMethod.js.map +0 -1
- package/lib/crypto/verification/QRCode.d.ts +0 -51
- package/lib/crypto/verification/QRCode.d.ts.map +0 -1
- package/lib/crypto/verification/QRCode.js +0 -277
- package/lib/crypto/verification/QRCode.js.map +0 -1
- package/lib/crypto/verification/SAS.d.ts +0 -27
- package/lib/crypto/verification/SAS.d.ts.map +0 -1
- package/lib/crypto/verification/SAS.js +0 -485
- package/lib/crypto/verification/SAS.js.map +0 -1
- package/lib/crypto/verification/SASDecimal.d.ts +0 -8
- package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
- package/lib/crypto/verification/SASDecimal.js +0 -34
- package/lib/crypto/verification/SASDecimal.js.map +0 -1
- package/lib/crypto/verification/request/Channel.d.ts +0 -18
- package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
- package/lib/crypto/verification/request/Channel.js +0 -1
- package/lib/crypto/verification/request/Channel.js.map +0 -1
- package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
- package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
- package/lib/crypto/verification/request/InRoomChannel.js +0 -351
- package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
- package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
- package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
- package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
- package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
- package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
- package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
- package/lib/crypto/verification/request/VerificationRequest.js +0 -937
- package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
- package/lib/crypto-api/CryptoEvent.d.ts +0 -69
- package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
- package/lib/crypto-api/CryptoEvent.js +0 -33
- package/lib/crypto-api/CryptoEvent.js.map +0 -1
- package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
- package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
- package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
- package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
- package/lib/crypto-api/index.d.ts +0 -978
- package/lib/crypto-api/index.d.ts.map +0 -1
- package/lib/crypto-api/index.js +0 -304
- package/lib/crypto-api/index.js.map +0 -1
- package/lib/crypto-api/key-passphrase.d.ts +0 -11
- package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
- package/lib/crypto-api/key-passphrase.js +0 -51
- package/lib/crypto-api/key-passphrase.js.map +0 -1
- package/lib/crypto-api/keybackup.d.ts +0 -88
- package/lib/crypto-api/keybackup.d.ts.map +0 -1
- package/lib/crypto-api/keybackup.js +0 -1
- package/lib/crypto-api/keybackup.js.map +0 -1
- package/lib/crypto-api/recovery-key.d.ts +0 -11
- package/lib/crypto-api/recovery-key.d.ts.map +0 -1
- package/lib/crypto-api/recovery-key.js +0 -65
- package/lib/crypto-api/recovery-key.js.map +0 -1
- package/lib/crypto-api/verification.d.ts +0 -344
- package/lib/crypto-api/verification.d.ts.map +0 -1
- package/lib/crypto-api/verification.js +0 -91
- package/lib/crypto-api/verification.js.map +0 -1
- package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
- package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
- package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
- package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
- package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
- package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousChannel.js +0 -1
- package/lib/rendezvous/RendezvousChannel.js.map +0 -1
- package/lib/rendezvous/RendezvousCode.d.ts +0 -9
- package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousCode.js +0 -1
- package/lib/rendezvous/RendezvousCode.js.map +0 -1
- package/lib/rendezvous/RendezvousError.d.ts +0 -6
- package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousError.js +0 -23
- package/lib/rendezvous/RendezvousError.js.map +0 -1
- package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
- package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousFailureReason.js +0 -38
- package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
- package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
- package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousIntent.js +0 -22
- package/lib/rendezvous/RendezvousIntent.js.map +0 -1
- package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
- package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousTransport.js +0 -1
- package/lib/rendezvous/RendezvousTransport.js.map +0 -1
- package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
- package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
- package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
- package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
- package/lib/rendezvous/channels/index.d.ts +0 -2
- package/lib/rendezvous/channels/index.d.ts.map +0 -1
- package/lib/rendezvous/channels/index.js +0 -18
- package/lib/rendezvous/channels/index.js.map +0 -1
- package/lib/rendezvous/index.d.ts +0 -10
- package/lib/rendezvous/index.d.ts.map +0 -1
- package/lib/rendezvous/index.js +0 -23
- package/lib/rendezvous/index.js.map +0 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
- package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
- package/lib/rendezvous/transports/index.d.ts +0 -2
- package/lib/rendezvous/transports/index.d.ts.map +0 -1
- package/lib/rendezvous/transports/index.js +0 -18
- package/lib/rendezvous/transports/index.js.map +0 -1
- package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
- package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
- package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
- package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
- package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
- package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
- package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
- package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
- package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
- package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
- package/lib/rust-crypto/KeyClaimManager.js +0 -82
- package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
- package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
- package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
- package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
- package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
- package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
- package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
- package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
- package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
- package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
- package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
- package/lib/rust-crypto/RoomEncryptor.js +0 -299
- package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
- package/lib/rust-crypto/backup.d.ts +0 -254
- package/lib/rust-crypto/backup.d.ts.map +0 -1
- package/lib/rust-crypto/backup.js +0 -837
- package/lib/rust-crypto/backup.js.map +0 -1
- package/lib/rust-crypto/constants.d.ts +0 -3
- package/lib/rust-crypto/constants.d.ts.map +0 -1
- package/lib/rust-crypto/constants.js +0 -19
- package/lib/rust-crypto/constants.js.map +0 -1
- package/lib/rust-crypto/device-converter.d.ts +0 -28
- package/lib/rust-crypto/device-converter.d.ts.map +0 -1
- package/lib/rust-crypto/device-converter.js +0 -123
- package/lib/rust-crypto/device-converter.js.map +0 -1
- package/lib/rust-crypto/index.d.ts +0 -61
- package/lib/rust-crypto/index.d.ts.map +0 -1
- package/lib/rust-crypto/index.js +0 -152
- package/lib/rust-crypto/index.js.map +0 -1
- package/lib/rust-crypto/libolm_migration.d.ts +0 -81
- package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
- package/lib/rust-crypto/libolm_migration.js +0 -459
- package/lib/rust-crypto/libolm_migration.js.map +0 -1
- package/lib/rust-crypto/rust-crypto.d.ts +0 -556
- package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
- package/lib/rust-crypto/rust-crypto.js +0 -2016
- package/lib/rust-crypto/rust-crypto.js.map +0 -1
- package/lib/rust-crypto/secret-storage.d.ts +0 -22
- package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
- package/lib/rust-crypto/secret-storage.js +0 -63
- package/lib/rust-crypto/secret-storage.js.map +0 -1
- package/lib/rust-crypto/verification.d.ts +0 -319
- package/lib/rust-crypto/verification.d.ts.map +0 -1
- package/lib/rust-crypto/verification.js +0 -816
- package/lib/rust-crypto/verification.js.map +0 -1
- package/lib/secret-storage.d.ts +0 -370
- package/lib/secret-storage.d.ts.map +0 -1
- package/lib/secret-storage.js +0 -466
- package/lib/secret-storage.js.map +0 -1
- package/src/@types/crypto.ts +0 -73
- package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
- package/src/common-crypto/CryptoBackend.ts +0 -302
- package/src/common-crypto/README.md +0 -4
- package/src/common-crypto/key-passphrase.ts +0 -43
- package/src/crypto/CrossSigning.ts +0 -773
- package/src/crypto/DeviceList.ts +0 -989
- package/src/crypto/EncryptionSetup.ts +0 -351
- package/src/crypto/OlmDevice.ts +0 -1500
- package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
- package/src/crypto/RoomList.ts +0 -70
- package/src/crypto/SecretSharing.ts +0 -240
- package/src/crypto/SecretStorage.ts +0 -136
- package/src/crypto/aes.ts +0 -23
- package/src/crypto/algorithms/base.ts +0 -236
- package/src/crypto/algorithms/index.ts +0 -20
- package/src/crypto/algorithms/megolm.ts +0 -2216
- package/src/crypto/algorithms/olm.ts +0 -381
- package/src/crypto/api.ts +0 -70
- package/src/crypto/backup.ts +0 -922
- package/src/crypto/crypto.ts +0 -18
- package/src/crypto/dehydration.ts +0 -272
- package/src/crypto/device-converter.ts +0 -45
- package/src/crypto/deviceinfo.ts +0 -158
- package/src/crypto/index.ts +0 -4414
- package/src/crypto/key_passphrase.ts +0 -42
- package/src/crypto/keybackup.ts +0 -47
- package/src/crypto/olmlib.ts +0 -539
- package/src/crypto/recoverykey.ts +0 -18
- package/src/crypto/store/base.ts +0 -348
- package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
- package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
- package/src/crypto/store/localStorage-crypto-store.ts +0 -579
- package/src/crypto/store/memory-crypto-store.ts +0 -680
- package/src/crypto/verification/Base.ts +0 -409
- package/src/crypto/verification/Error.ts +0 -76
- package/src/crypto/verification/IllegalMethod.ts +0 -50
- package/src/crypto/verification/QRCode.ts +0 -310
- package/src/crypto/verification/SAS.ts +0 -494
- package/src/crypto/verification/SASDecimal.ts +0 -37
- package/src/crypto/verification/request/Channel.ts +0 -34
- package/src/crypto/verification/request/InRoomChannel.ts +0 -371
- package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
- package/src/crypto/verification/request/VerificationRequest.ts +0 -976
- package/src/crypto-api/CryptoEvent.ts +0 -93
- package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
- package/src/crypto-api/index.ts +0 -1175
- package/src/crypto-api/key-passphrase.ts +0 -58
- package/src/crypto-api/keybackup.ts +0 -115
- package/src/crypto-api/recovery-key.ts +0 -69
- package/src/crypto-api/verification.ts +0 -408
- package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
- package/src/rendezvous/RendezvousChannel.ts +0 -48
- package/src/rendezvous/RendezvousCode.ts +0 -25
- package/src/rendezvous/RendezvousError.ts +0 -26
- package/src/rendezvous/RendezvousFailureReason.ts +0 -49
- package/src/rendezvous/RendezvousIntent.ts +0 -20
- package/src/rendezvous/RendezvousTransport.ts +0 -58
- package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
- package/src/rendezvous/channels/index.ts +0 -17
- package/src/rendezvous/index.ts +0 -25
- package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
- package/src/rendezvous/transports/index.ts +0 -17
- package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
- package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
- package/src/rust-crypto/KeyClaimManager.ts +0 -86
- package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
- package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
- package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
- package/src/rust-crypto/RoomEncryptor.ts +0 -352
- package/src/rust-crypto/backup.ts +0 -881
- package/src/rust-crypto/constants.ts +0 -18
- package/src/rust-crypto/device-converter.ts +0 -128
- package/src/rust-crypto/index.ts +0 -237
- package/src/rust-crypto/libolm_migration.ts +0 -530
- package/src/rust-crypto/rust-crypto.ts +0 -2205
- package/src/rust-crypto/secret-storage.ts +0 -60
- package/src/rust-crypto/verification.ts +0 -830
- package/src/secret-storage.ts +0 -693
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"OlmDevice.js","names":["logger","IndexedDBCryptoStore","DecryptionFailureCode","DecryptionError","MAX_PLAINTEXT_LENGTH","PayloadTooLargeError","Error","constructor","arguments","_defineProperty","errcode","error","checkPayloadLength","payloadString","undefined","length","concat","OlmDevice","cryptoStore","Promise","resolve","getOlmVersion","globalThis","Olm","get_library_version","init","_arguments","_this","_asyncToGenerator","pickleKey","fromExportedDevice","e2eKeys","account","Account","warn","initialiseFromExportedDevice","initialiseAccount","JSON","parse","identity_keys","maxOneTimeKeys","max_number_of_one_time_keys","free","deviceCurve25519Key","curve25519","deviceEd25519Key","ed25519","exportedData","_this2","doTxn","STORE_ACCOUNT","STORE_SESSIONS","txn","storeAccount","pickledAccount","sessions","forEach","session","deviceKey","sessionId","sessionInfo","lastReceivedMessageTs","storeEndToEndSession","unpickle","_this3","getAccount","create","pickle","func","export","_this4","result","getAllEndToEndSessions","pickledSession","push","getSession","getEndToEndSession","unpickleSession","Session","unpickledSessInfo","Object","assign","saveSession","session_id","debug","describe","pickledSessionInfo","getUtility","utility","Utility","sign","message","_this5","getOneTimeKeys","_this6","one_time_keys","maxNumberOfOneTimeKeys","_this$maxOneTimeKeys","markKeysAsPublished","_this7","mark_keys_as_published","generateOneTimeKeys","numKeys","generate_one_time_keys","generateFallbackKey","_this8","generate_fallback_key","getFallbackKey","_this9","unpublished_fallback_key","forgetOldFallbackKey","_this10","forget_old_fallback_key","createOutboundSession","theirIdentityKey","theirOneTimeKey","_this11","newSessionId","create_outbound","Date","now","getChild","createInboundSession","theirDeviceIdentityKey","messageType","ciphertext","_this12","create_inbound_from","remove_one_time_keys","decrypt","payload","getSessionIdsForDevice","_this13","log","sessionsInProgress","_unused","sessionIds","getEndToEndSessions","keys","getSessionIdForDevice","_arguments2","_this14","nowait","sessionInfos","getSessionInfoForDevice","idxOfBest","i","thisSessInfo","thisLastReceived","bestSessInfo","bestLastReceived","deviceIdentityKey","_arguments3","_this15","_unused2","info","sort","_loop","sessInfo","hasReceivedMessage","has_received_message","encryptMessage","_this16","res","sessionDesc","encrypt","decryptMessage","_this17","matchesSession","_this18","matches","matches_inbound","recordSessionProblem","type","fixed","_this19","storeEndToEndSessionProblem","sessionMayHaveProblems","timestamp","getEndToEndSessionProblem","filterOutNotifiedErrorDevices","devices","saveOutboundGroupSession","outboundGroupSessionStore","getOutboundGroupSession","pickled","OutboundGroupSession","createOutboundGroupSession","encryptGroupMessage","getOutboundGroupSessionKey","chain_index","message_index","key","session_key","unpickleInboundGroupSession","sessionData","InboundGroupSession","getInboundGroupSession","roomId","senderKey","getEndToEndInboundGroupSession","withheld","room_id","addInboundGroupSession","forwardingCurve25519KeyChain","sessionKey","keysClaimed","exportFormat","_arguments4","_this20","extraSessionData","STORE_INBOUND_GROUP_SESSIONS","STORE_INBOUND_GROUP_SESSIONS_WITHHELD","STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS","existingSession","existingSessionData","import_session","first_known_index","untrusted","export_session","storeEndToEndInboundGroupSession","sharedHistory","addSharedHistoryInboundGroupSession","addInboundGroupSessionWithheld","code","reason","_this21","storeEndToEndInboundGroupSessionWithheld","decryptGroupMessage","body","eventId","_this22","failureCode","MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE","MEGOLM_KEY_WITHHELD","calculateWithheldMessage","e","plaintext","messageIndexKey","inboundGroupSessionMessageIndexes","msgInfo","id","hasInboundSessionKeys","_this23","getInboundGroupSessionKey","chainIndex","_this24","exportedSession","claimedKeys","senderEd25519Key","forwardingKeyChain","forwarding_curve25519_key_chain","sender_claimed_ed25519_key","shared_history","exportInboundGroupSession","messageIndex","getSharedHistoryInboundGroupSessions","_this25","verifySignature","signature","util","ed25519_verify","WITHHELD_MESSAGES"],"sources":["../../src/crypto/OlmDevice.ts"],"sourcesContent":["/*\nCopyright 2016 - 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 { Account, InboundGroupSession, OutboundGroupSession, Session, Utility } from \"@matrix-org/olm\";\n\nimport { logger, Logger } from \"../logger.ts\";\nimport { IndexedDBCryptoStore } from \"./store/indexeddb-crypto-store.ts\";\nimport { CryptoStore, IProblem, ISessionInfo, IWithheld } from \"./store/base.ts\";\nimport { IOlmDevice, IOutboundGroupSessionKey } from \"./algorithms/megolm.ts\";\nimport { IMegolmSessionData, OlmGroupSessionExtraData } from \"../@types/crypto.ts\";\nimport { IMessage } from \"./algorithms/olm.ts\";\nimport { DecryptionFailureCode } from \"../crypto-api/index.ts\";\nimport { DecryptionError } from \"../common-crypto/CryptoBackend.ts\";\n\n// The maximum size of an event is 65K, and we base64 the content, so this is a\n// reasonable approximation to the biggest plaintext we can encrypt.\nconst MAX_PLAINTEXT_LENGTH = (65536 * 3) / 4;\n\nexport class PayloadTooLargeError extends Error {\n public readonly data = {\n errcode: \"M_TOO_LARGE\",\n error: \"Payload too large for encrypted message\",\n };\n}\n\nfunction checkPayloadLength(payloadString: string): void {\n if (payloadString === undefined) {\n throw new Error(\"payloadString undefined\");\n }\n\n if (payloadString.length > MAX_PLAINTEXT_LENGTH) {\n // might as well fail early here rather than letting the olm library throw\n // a cryptic memory allocation error.\n //\n // Note that even if we manage to do the encryption, the message send may fail,\n // because by the time we've wrapped the ciphertext in the event object, it may\n // exceed 65K. But at least we won't just fail with \"abort()\" in that case.\n throw new PayloadTooLargeError(\n `Message too long (${payloadString.length} bytes). ` +\n `The maximum for an encrypted message is ${MAX_PLAINTEXT_LENGTH} bytes.`,\n );\n }\n}\n\ninterface IInitOpts {\n /**\n * (Optional) data from exported device that must be re-created.\n * If present, opts.pickleKey is ignored (exported data already provides a pickle key)\n */\n fromExportedDevice?: IExportedDevice;\n /**\n * (Optional) pickle key to set instead of default one\n */\n pickleKey?: string;\n}\n\n/** data stored in the session store about an inbound group session */\nexport interface InboundGroupSessionData {\n room_id: string; // eslint-disable-line camelcase\n /** pickled Olm.InboundGroupSession */\n session: string;\n keysClaimed?: Record<string, string>;\n /** Devices involved in forwarding this session to us (normally empty). */\n forwardingCurve25519KeyChain: string[];\n /** whether this session is untrusted. */\n untrusted?: boolean;\n /** whether this session exists during the room being set to shared history. */\n sharedHistory?: boolean;\n}\n\nexport interface IDecryptedGroupMessage {\n result: string;\n keysClaimed: Record<string, string>;\n senderKey: string;\n forwardingCurve25519KeyChain: string[];\n untrusted: boolean;\n}\n\nexport interface IInboundSession {\n payload: string;\n session_id: string;\n}\n\nexport interface IExportedDevice {\n pickleKey: string;\n pickledAccount: string;\n sessions: ISessionInfo[];\n}\n\ninterface IUnpickledSessionInfo extends Omit<ISessionInfo, \"session\"> {\n session: Session;\n}\n\n/* eslint-disable camelcase */\ninterface IInboundGroupSessionKey {\n chain_index: number;\n key: string;\n forwarding_curve25519_key_chain: string[];\n sender_claimed_ed25519_key: string | null;\n shared_history: boolean;\n untrusted?: boolean;\n}\n/* eslint-enable camelcase */\n\ntype OneTimeKeys = { curve25519: { [keyId: string]: string } };\n\n/**\n * Manages the olm cryptography functions. Each OlmDevice has a single\n * OlmAccount and a number of OlmSessions.\n *\n * Accounts and sessions are kept pickled in the cryptoStore.\n */\nexport class OlmDevice {\n public pickleKey = \"DEFAULT_KEY\"; // set by consumers\n\n /** Curve25519 key for the account, unknown until we load the account from storage in init() */\n public deviceCurve25519Key: string | null = null;\n /** Ed25519 key for the account, unknown until we load the account from storage in init() */\n public deviceEd25519Key: string | null = null;\n private maxOneTimeKeys: number | null = null;\n\n // we don't bother stashing outboundgroupsessions in the cryptoStore -\n // instead we keep them here.\n private outboundGroupSessionStore: Record<string, string> = {};\n\n // Store a set of decrypted message indexes for each group session.\n // This partially mitigates a replay attack where a MITM resends a group\n // message into the room.\n //\n // When we decrypt a message and the message index matches a previously\n // decrypted message, one possible cause of that is that we are decrypting\n // the same event, and may not indicate an actual replay attack. For\n // example, this could happen if we receive events, forget about them, and\n // then re-fetch them when we backfill. So we store the event ID and\n // timestamp corresponding to each message index when we first decrypt it,\n // and compare these against the event ID and timestamp every time we use\n // that same index. If they match, then we're probably decrypting the same\n // event and we don't consider it a replay attack.\n //\n // Keys are strings of form \"<senderKey>|<session_id>|<message_index>\"\n // Values are objects of the form \"{id: <event id>, timestamp: <ts>}\"\n private inboundGroupSessionMessageIndexes: Record<string, { id: string; timestamp: number }> = {};\n\n // Keep track of sessions that we're starting, so that we don't start\n // multiple sessions for the same device at the same time.\n public sessionsInProgress: Record<string, Promise<void>> = {}; // set by consumers\n\n // Used by olm to serialise prekey message decryptions\n public olmPrekeyPromise: Promise<any> = Promise.resolve(); // set by consumers\n\n public constructor(private readonly cryptoStore: CryptoStore) {}\n\n /**\n * @returns The version of Olm.\n */\n public static getOlmVersion(): [number, number, number] {\n return globalThis.Olm.get_library_version();\n }\n\n /**\n * Initialise the OlmAccount. This must be called before any other operations\n * on the OlmDevice.\n *\n * Data from an exported Olm device can be provided\n * in order to re-create this device.\n *\n * Attempts to load the OlmAccount from the crypto store, or creates one if none is\n * found.\n *\n * Reads the device keys from the OlmAccount object.\n *\n * @param IInitOpts - opts to initialise the OlmAccount with\n */\n public async init({ pickleKey, fromExportedDevice }: IInitOpts = {}): Promise<void> {\n let e2eKeys;\n const account = new globalThis.Olm.Account();\n\n try {\n if (fromExportedDevice) {\n if (pickleKey) {\n logger.warn(\"ignoring opts.pickleKey\" + \" because opts.fromExportedDevice is present.\");\n }\n this.pickleKey = fromExportedDevice.pickleKey;\n await this.initialiseFromExportedDevice(fromExportedDevice, account);\n } else {\n if (pickleKey) {\n this.pickleKey = pickleKey;\n }\n await this.initialiseAccount(account);\n }\n e2eKeys = JSON.parse(account.identity_keys());\n\n this.maxOneTimeKeys = account.max_number_of_one_time_keys();\n } finally {\n account.free();\n }\n\n this.deviceCurve25519Key = e2eKeys.curve25519;\n this.deviceEd25519Key = e2eKeys.ed25519;\n }\n\n /**\n * Populates the crypto store using data that was exported from an existing device.\n * Note that for now only the “account” and “sessions” stores are populated;\n * Other stores will be as with a new device.\n *\n * @param exportedData - Data exported from another device\n * through the “export” method.\n * @param account - an olm account to initialize\n */\n private async initialiseFromExportedDevice(exportedData: IExportedDevice, account: Account): Promise<void> {\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [IndexedDBCryptoStore.STORE_ACCOUNT, IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.cryptoStore.storeAccount(txn, exportedData.pickledAccount);\n exportedData.sessions.forEach((session) => {\n const { deviceKey, sessionId } = session;\n const sessionInfo = {\n session: session.session,\n lastReceivedMessageTs: session.lastReceivedMessageTs,\n };\n this.cryptoStore.storeEndToEndSession(deviceKey!, sessionId!, sessionInfo, txn);\n });\n },\n );\n account.unpickle(this.pickleKey, exportedData.pickledAccount);\n }\n\n private async initialiseAccount(account: Account): Promise<void> {\n await this.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.cryptoStore.getAccount(txn, (pickledAccount) => {\n if (pickledAccount !== null) {\n account.unpickle(this.pickleKey, pickledAccount);\n } else {\n account.create();\n pickledAccount = account.pickle(this.pickleKey);\n this.cryptoStore.storeAccount(txn, pickledAccount);\n }\n });\n });\n }\n\n /**\n * extract our OlmAccount from the crypto store and call the given function\n * with the account object\n * The `account` object is usable only within the callback passed to this\n * function and will be freed as soon the callback returns. It is *not*\n * usable for the rest of the lifetime of the transaction.\n * This function requires a live transaction object from cryptoStore.doTxn()\n * and therefore may only be called in a doTxn() callback.\n *\n * @param txn - Opaque transaction object from cryptoStore.doTxn()\n * @internal\n */\n private getAccount(txn: unknown, func: (account: Account) => void): void {\n this.cryptoStore.getAccount(txn, (pickledAccount: string | null) => {\n const account = new globalThis.Olm.Account();\n try {\n account.unpickle(this.pickleKey, pickledAccount!);\n func(account);\n } finally {\n account.free();\n }\n });\n }\n\n /*\n * Saves an account to the crypto store.\n * This function requires a live transaction object from cryptoStore.doTxn()\n * and therefore may only be called in a doTxn() callback.\n *\n * @param txn - Opaque transaction object from cryptoStore.doTxn()\n * @param Olm.Account object\n * @internal\n */\n private storeAccount(txn: unknown, account: Account): void {\n this.cryptoStore.storeAccount(txn, account.pickle(this.pickleKey));\n }\n\n /**\n * Export data for re-creating the Olm device later.\n * TODO export data other than just account and (P2P) sessions.\n *\n * @returns The exported data\n */\n public async export(): Promise<IExportedDevice> {\n const result: Partial<IExportedDevice> = {\n pickleKey: this.pickleKey,\n };\n\n await this.cryptoStore.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_ACCOUNT, IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.cryptoStore.getAccount(txn, (pickledAccount: string | null) => {\n result.pickledAccount = pickledAccount!;\n });\n result.sessions = [];\n // Note that the pickledSession object we get in the callback\n // is not exactly the same thing you get in method _getSession\n // see documentation of IndexedDBCryptoStore.getAllEndToEndSessions\n this.cryptoStore.getAllEndToEndSessions(txn, (pickledSession) => {\n result.sessions!.push(pickledSession!);\n });\n },\n );\n return result as IExportedDevice;\n }\n\n /**\n * extract an OlmSession from the session store and call the given function\n * The session is usable only within the callback passed to this\n * function and will be freed as soon the callback returns. It is *not*\n * usable for the rest of the lifetime of the transaction.\n *\n * @param txn - Opaque transaction object from cryptoStore.doTxn()\n * @internal\n */\n private getSession(\n deviceKey: string,\n sessionId: string,\n txn: unknown,\n func: (unpickledSessionInfo: IUnpickledSessionInfo) => void,\n ): void {\n this.cryptoStore.getEndToEndSession(deviceKey, sessionId, txn, (sessionInfo: ISessionInfo | null) => {\n this.unpickleSession(sessionInfo!, func);\n });\n }\n\n /**\n * Creates a session object from a session pickle and executes the given\n * function with it. The session object is destroyed once the function\n * returns.\n *\n * @internal\n */\n private unpickleSession(\n sessionInfo: ISessionInfo,\n func: (unpickledSessionInfo: IUnpickledSessionInfo) => void,\n ): void {\n const session = new globalThis.Olm.Session();\n try {\n session.unpickle(this.pickleKey, sessionInfo.session!);\n const unpickledSessInfo: IUnpickledSessionInfo = Object.assign({}, sessionInfo, { session });\n\n func(unpickledSessInfo);\n } finally {\n session.free();\n }\n }\n\n /**\n * store our OlmSession in the session store\n *\n * @param sessionInfo - `{session: OlmSession, lastReceivedMessageTs: int}`\n * @param txn - Opaque transaction object from cryptoStore.doTxn()\n * @internal\n */\n private saveSession(deviceKey: string, sessionInfo: IUnpickledSessionInfo, txn: unknown): void {\n const sessionId = sessionInfo.session.session_id();\n logger.debug(`Saving Olm session ${sessionId} with device ${deviceKey}: ${sessionInfo.session.describe()}`);\n\n // Why do we re-use the input object for this, overwriting the same key with a different\n // type? Is it because we want to erase the unpickled session to enforce that it's no longer\n // used? A comment would be great.\n const pickledSessionInfo = Object.assign(sessionInfo, {\n session: sessionInfo.session.pickle(this.pickleKey),\n });\n this.cryptoStore.storeEndToEndSession(deviceKey, sessionId, pickledSessionInfo, txn);\n }\n\n /**\n * get an OlmUtility and call the given function\n *\n * @returns result of func\n * @internal\n */\n private getUtility<T>(func: (utility: Utility) => T): T {\n const utility = new globalThis.Olm.Utility();\n try {\n return func(utility);\n } finally {\n utility.free();\n }\n }\n\n /**\n * Signs a message with the ed25519 key for this account.\n *\n * @param message - message to be signed\n * @returns base64-encoded signature\n */\n public async sign(message: string): Promise<string> {\n let result: string;\n await this.cryptoStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account: Account) => {\n result = account.sign(message);\n });\n });\n return result!;\n }\n\n /**\n * Get the current (unused, unpublished) one-time keys for this account.\n *\n * @returns one time keys; an object with the single property\n * <tt>curve25519</tt>, which is itself an object mapping key id to Curve25519\n * key.\n */\n public async getOneTimeKeys(): Promise<OneTimeKeys> {\n let result: OneTimeKeys;\n await this.cryptoStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account) => {\n result = JSON.parse(account.one_time_keys());\n });\n });\n\n return result!;\n }\n\n /**\n * Get the maximum number of one-time keys we can store.\n *\n * @returns number of keys\n */\n public maxNumberOfOneTimeKeys(): number {\n return this.maxOneTimeKeys ?? -1;\n }\n\n /**\n * Marks all of the one-time keys as published.\n */\n public async markKeysAsPublished(): Promise<void> {\n await this.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account: Account) => {\n account.mark_keys_as_published();\n this.storeAccount(txn, account);\n });\n });\n }\n\n /**\n * Generate some new one-time keys\n *\n * @param numKeys - number of keys to generate\n * @returns Resolved once the account is saved back having generated the keys\n */\n public generateOneTimeKeys(numKeys: number): Promise<void> {\n return this.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account) => {\n account.generate_one_time_keys(numKeys);\n this.storeAccount(txn, account);\n });\n });\n }\n\n /**\n * Generate a new fallback keys\n *\n * @returns Resolved once the account is saved back having generated the key\n */\n public async generateFallbackKey(): Promise<void> {\n await this.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account) => {\n account.generate_fallback_key();\n this.storeAccount(txn, account);\n });\n });\n }\n\n public async getFallbackKey(): Promise<Record<string, Record<string, string>>> {\n let result: Record<string, Record<string, string>>;\n await this.cryptoStore.doTxn(\"readonly\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account: Account) => {\n result = JSON.parse(account.unpublished_fallback_key());\n });\n });\n return result!;\n }\n\n public async forgetOldFallbackKey(): Promise<void> {\n await this.cryptoStore.doTxn(\"readwrite\", [IndexedDBCryptoStore.STORE_ACCOUNT], (txn) => {\n this.getAccount(txn, (account: Account) => {\n account.forget_old_fallback_key();\n this.storeAccount(txn, account);\n });\n });\n }\n\n /**\n * Generate a new outbound session\n *\n * The new session will be stored in the cryptoStore.\n *\n * @param theirIdentityKey - remote user's Curve25519 identity key\n * @param theirOneTimeKey - remote user's one-time Curve25519 key\n * @returns sessionId for the outbound session.\n */\n public async createOutboundSession(theirIdentityKey: string, theirOneTimeKey: string): Promise<string> {\n let newSessionId: string;\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [IndexedDBCryptoStore.STORE_ACCOUNT, IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.getAccount(txn, (account: Account) => {\n const session = new globalThis.Olm.Session();\n try {\n session.create_outbound(account, theirIdentityKey, theirOneTimeKey);\n newSessionId = session.session_id();\n this.storeAccount(txn, account);\n const sessionInfo: IUnpickledSessionInfo = {\n session,\n // Pretend we've received a message at this point, otherwise\n // if we try to send a message to the device, it won't use\n // this session\n lastReceivedMessageTs: Date.now(),\n };\n this.saveSession(theirIdentityKey, sessionInfo, txn);\n } finally {\n session.free();\n }\n });\n },\n logger.getChild(\"[createOutboundSession]\"),\n );\n return newSessionId!;\n }\n\n /**\n * Generate a new inbound session, given an incoming message\n *\n * @param theirDeviceIdentityKey - remote user's Curve25519 identity key\n * @param messageType - messageType field from the received message (must be 0)\n * @param ciphertext - base64-encoded body from the received message\n *\n * @returns decrypted payload, and\n * session id of new session\n *\n * @throws Error if the received message was not valid (for instance, it didn't use a valid one-time key).\n */\n public async createInboundSession(\n theirDeviceIdentityKey: string,\n messageType: number,\n ciphertext: string,\n ): Promise<IInboundSession> {\n if (messageType !== 0) {\n throw new Error(\"Need messageType == 0 to create inbound session\");\n }\n\n let result: { payload: string; session_id: string }; // eslint-disable-line camelcase\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [IndexedDBCryptoStore.STORE_ACCOUNT, IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.getAccount(txn, (account: Account) => {\n const session = new globalThis.Olm.Session();\n try {\n session.create_inbound_from(account, theirDeviceIdentityKey, ciphertext);\n account.remove_one_time_keys(session);\n this.storeAccount(txn, account);\n\n const payloadString = session.decrypt(messageType, ciphertext);\n\n const sessionInfo: IUnpickledSessionInfo = {\n session,\n // this counts as a received message: set last received message time\n // to now\n lastReceivedMessageTs: Date.now(),\n };\n this.saveSession(theirDeviceIdentityKey, sessionInfo, txn);\n\n result = {\n payload: payloadString,\n session_id: session.session_id(),\n };\n } finally {\n session.free();\n }\n });\n },\n logger.getChild(\"[createInboundSession]\"),\n );\n\n return result!;\n }\n\n /**\n * Get a list of known session IDs for the given device\n *\n * @param theirDeviceIdentityKey - Curve25519 identity key for the\n * remote device\n * @returns a list of known session ids for the device\n */\n public async getSessionIdsForDevice(theirDeviceIdentityKey: string): Promise<string[]> {\n const log = logger.getChild(\"[getSessionIdsForDevice]\");\n\n if (theirDeviceIdentityKey in this.sessionsInProgress) {\n log.debug(`Waiting for Olm session for ${theirDeviceIdentityKey} to be created`);\n try {\n await this.sessionsInProgress[theirDeviceIdentityKey];\n } catch {\n // if the session failed to be created, just fall through and\n // return an empty result\n }\n }\n let sessionIds: string[];\n await this.cryptoStore.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.cryptoStore.getEndToEndSessions(theirDeviceIdentityKey, txn, (sessions) => {\n sessionIds = Object.keys(sessions);\n });\n },\n log,\n );\n\n return sessionIds!;\n }\n\n /**\n * Get the right olm session id for encrypting messages to the given identity key\n *\n * @param theirDeviceIdentityKey - Curve25519 identity key for the\n * remote device\n * @param nowait - Don't wait for an in-progress session to complete.\n * This should only be set to true of the calling function is the function\n * that marked the session as being in-progress.\n * @param log - A possibly customised log\n * @returns session id, or null if no established session\n */\n public async getSessionIdForDevice(\n theirDeviceIdentityKey: string,\n nowait = false,\n log?: Logger,\n ): Promise<string | null> {\n const sessionInfos = await this.getSessionInfoForDevice(theirDeviceIdentityKey, nowait, log);\n\n if (sessionInfos.length === 0) {\n return null;\n }\n // Use the session that has most recently received a message\n let idxOfBest = 0;\n for (let i = 1; i < sessionInfos.length; i++) {\n const thisSessInfo = sessionInfos[i];\n const thisLastReceived =\n thisSessInfo.lastReceivedMessageTs === undefined ? 0 : thisSessInfo.lastReceivedMessageTs;\n\n const bestSessInfo = sessionInfos[idxOfBest];\n const bestLastReceived =\n bestSessInfo.lastReceivedMessageTs === undefined ? 0 : bestSessInfo.lastReceivedMessageTs;\n if (\n thisLastReceived > bestLastReceived ||\n (thisLastReceived === bestLastReceived && thisSessInfo.sessionId < bestSessInfo.sessionId)\n ) {\n idxOfBest = i;\n }\n }\n return sessionInfos[idxOfBest].sessionId;\n }\n\n /**\n * Get information on the active Olm sessions for a device.\n * <p>\n * Returns an array, with an entry for each active session. The first entry in\n * the result will be the one used for outgoing messages. Each entry contains\n * the keys 'hasReceivedMessage' (true if the session has received an incoming\n * message and is therefore past the pre-key stage), and 'sessionId'.\n *\n * @param deviceIdentityKey - Curve25519 identity key for the device\n * @param nowait - Don't wait for an in-progress session to complete.\n * This should only be set to true of the calling function is the function\n * that marked the session as being in-progress.\n * @param log - A possibly customised log\n */\n public async getSessionInfoForDevice(\n deviceIdentityKey: string,\n nowait = false,\n log: Logger = logger,\n ): Promise<{ sessionId: string; lastReceivedMessageTs: number; hasReceivedMessage: boolean }[]> {\n log = log.getChild(\"[getSessionInfoForDevice]\");\n\n if (deviceIdentityKey in this.sessionsInProgress && !nowait) {\n log.debug(`Waiting for Olm session for ${deviceIdentityKey} to be created`);\n try {\n await this.sessionsInProgress[deviceIdentityKey];\n } catch {\n // if the session failed to be created, then just fall through and\n // return an empty result\n }\n }\n const info: {\n lastReceivedMessageTs: number;\n hasReceivedMessage: boolean;\n sessionId: string;\n }[] = [];\n\n await this.cryptoStore.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.cryptoStore.getEndToEndSessions(deviceIdentityKey, txn, (sessions) => {\n const sessionIds = Object.keys(sessions).sort();\n for (const sessionId of sessionIds) {\n this.unpickleSession(sessions[sessionId], (sessInfo: IUnpickledSessionInfo) => {\n info.push({\n lastReceivedMessageTs: sessInfo.lastReceivedMessageTs!,\n hasReceivedMessage: sessInfo.session.has_received_message(),\n sessionId,\n });\n });\n }\n });\n },\n log,\n );\n\n return info;\n }\n\n /**\n * Encrypt an outgoing message using an existing session\n *\n * @param theirDeviceIdentityKey - Curve25519 identity key for the\n * remote device\n * @param sessionId - the id of the active session\n * @param payloadString - payload to be encrypted and sent\n *\n * @returns ciphertext\n */\n public async encryptMessage(\n theirDeviceIdentityKey: string,\n sessionId: string,\n payloadString: string,\n ): Promise<IMessage> {\n checkPayloadLength(payloadString);\n\n let res: IMessage;\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.getSession(theirDeviceIdentityKey, sessionId, txn, (sessionInfo) => {\n const sessionDesc = sessionInfo.session.describe();\n logger.log(\n \"encryptMessage: Olm Session ID \" +\n sessionId +\n \" to \" +\n theirDeviceIdentityKey +\n \": \" +\n sessionDesc,\n );\n res = sessionInfo.session.encrypt(payloadString);\n this.saveSession(theirDeviceIdentityKey, sessionInfo, txn);\n });\n },\n logger.getChild(\"[encryptMessage]\"),\n );\n return res!;\n }\n\n /**\n * Decrypt an incoming message using an existing session\n *\n * @param theirDeviceIdentityKey - Curve25519 identity key for the\n * remote device\n * @param sessionId - the id of the active session\n * @param messageType - messageType field from the received message\n * @param ciphertext - base64-encoded body from the received message\n *\n * @returns decrypted payload.\n */\n public async decryptMessage(\n theirDeviceIdentityKey: string,\n sessionId: string,\n messageType: number,\n ciphertext: string,\n ): Promise<string> {\n let payloadString: string;\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.getSession(theirDeviceIdentityKey, sessionId, txn, (sessionInfo: IUnpickledSessionInfo) => {\n const sessionDesc = sessionInfo.session.describe();\n logger.log(\n \"decryptMessage: Olm Session ID \" +\n sessionId +\n \" from \" +\n theirDeviceIdentityKey +\n \": \" +\n sessionDesc,\n );\n payloadString = sessionInfo.session.decrypt(messageType, ciphertext);\n sessionInfo.lastReceivedMessageTs = Date.now();\n this.saveSession(theirDeviceIdentityKey, sessionInfo, txn);\n });\n },\n logger.getChild(\"[decryptMessage]\"),\n );\n return payloadString!;\n }\n\n /**\n * Determine if an incoming messages is a prekey message matching an existing session\n *\n * @param theirDeviceIdentityKey - Curve25519 identity key for the\n * remote device\n * @param sessionId - the id of the active session\n * @param messageType - messageType field from the received message\n * @param ciphertext - base64-encoded body from the received message\n *\n * @returns true if the received message is a prekey message which matches\n * the given session.\n */\n public async matchesSession(\n theirDeviceIdentityKey: string,\n sessionId: string,\n messageType: number,\n ciphertext: string,\n ): Promise<boolean> {\n if (messageType !== 0) {\n return false;\n }\n\n let matches: boolean;\n await this.cryptoStore.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_SESSIONS],\n (txn) => {\n this.getSession(theirDeviceIdentityKey, sessionId, txn, (sessionInfo) => {\n matches = sessionInfo.session.matches_inbound(ciphertext);\n });\n },\n logger.getChild(\"[matchesSession]\"),\n );\n return matches!;\n }\n\n public async recordSessionProblem(deviceKey: string, type: string, fixed: boolean): Promise<void> {\n logger.info(`Recording problem on olm session with ${deviceKey} of type ${type}. Recreating: ${fixed}`);\n await this.cryptoStore.storeEndToEndSessionProblem(deviceKey, type, fixed);\n }\n\n public sessionMayHaveProblems(deviceKey: string, timestamp: number): Promise<IProblem | null> {\n return this.cryptoStore.getEndToEndSessionProblem(deviceKey, timestamp);\n }\n\n public filterOutNotifiedErrorDevices(devices: IOlmDevice[]): Promise<IOlmDevice[]> {\n return this.cryptoStore.filterOutNotifiedErrorDevices(devices);\n }\n\n // Outbound group session\n // ======================\n\n /**\n * store an OutboundGroupSession in outboundGroupSessionStore\n *\n * @internal\n */\n private saveOutboundGroupSession(session: OutboundGroupSession): void {\n this.outboundGroupSessionStore[session.session_id()] = session.pickle(this.pickleKey);\n }\n\n /**\n * extract an OutboundGroupSession from outboundGroupSessionStore and call the\n * given function\n *\n * @returns result of func\n * @internal\n */\n private getOutboundGroupSession<T>(sessionId: string, func: (session: OutboundGroupSession) => T): T {\n const pickled = this.outboundGroupSessionStore[sessionId];\n if (pickled === undefined) {\n throw new Error(\"Unknown outbound group session \" + sessionId);\n }\n\n const session = new globalThis.Olm.OutboundGroupSession();\n try {\n session.unpickle(this.pickleKey, pickled);\n return func(session);\n } finally {\n session.free();\n }\n }\n\n /**\n * Generate a new outbound group session\n *\n * @returns sessionId for the outbound session.\n */\n public createOutboundGroupSession(): string {\n const session = new globalThis.Olm.OutboundGroupSession();\n try {\n session.create();\n this.saveOutboundGroupSession(session);\n return session.session_id();\n } finally {\n session.free();\n }\n }\n\n /**\n * Encrypt an outgoing message with an outbound group session\n *\n * @param sessionId - the id of the outboundgroupsession\n * @param payloadString - payload to be encrypted and sent\n *\n * @returns ciphertext\n */\n public encryptGroupMessage(sessionId: string, payloadString: string): string {\n logger.log(`encrypting msg with megolm session ${sessionId}`);\n\n checkPayloadLength(payloadString);\n\n return this.getOutboundGroupSession(sessionId, (session: OutboundGroupSession) => {\n const res = session.encrypt(payloadString);\n this.saveOutboundGroupSession(session);\n return res;\n });\n }\n\n /**\n * Get the session keys for an outbound group session\n *\n * @param sessionId - the id of the outbound group session\n *\n * @returns current chain index, and\n * base64-encoded secret key.\n */\n public getOutboundGroupSessionKey(sessionId: string): IOutboundGroupSessionKey {\n return this.getOutboundGroupSession(sessionId, function (session: OutboundGroupSession) {\n return {\n chain_index: session.message_index(),\n key: session.session_key(),\n };\n });\n }\n\n // Inbound group session\n // =====================\n\n /**\n * Unpickle a session from a sessionData object and invoke the given function.\n * The session is valid only until func returns.\n *\n * @param sessionData - Object describing the session.\n * @param func - Invoked with the unpickled session\n * @returns result of func\n */\n private unpickleInboundGroupSession<T>(\n sessionData: InboundGroupSessionData,\n func: (session: InboundGroupSession) => T,\n ): T {\n const session = new globalThis.Olm.InboundGroupSession();\n try {\n session.unpickle(this.pickleKey, sessionData.session);\n return func(session);\n } finally {\n session.free();\n }\n }\n\n /**\n * extract an InboundGroupSession from the crypto store and call the given function\n *\n * @param roomId - The room ID to extract the session for, or null to fetch\n * sessions for any room.\n * @param txn - Opaque transaction object from cryptoStore.doTxn()\n * @param func - function to call.\n *\n * @internal\n */\n private getInboundGroupSession(\n roomId: string,\n senderKey: string,\n sessionId: string,\n txn: unknown,\n func: (\n session: InboundGroupSession | null,\n data: InboundGroupSessionData | null,\n withheld: IWithheld | null,\n ) => void,\n ): void {\n this.cryptoStore.getEndToEndInboundGroupSession(\n senderKey,\n sessionId,\n txn,\n (sessionData: InboundGroupSessionData | null, withheld: IWithheld | null) => {\n if (sessionData === null) {\n func(null, null, withheld);\n return;\n }\n\n // if we were given a room ID, check that the it matches the original one for the session. This stops\n // the HS pretending a message was targeting a different room.\n if (roomId !== null && roomId !== sessionData.room_id) {\n throw new Error(\n \"Mismatched room_id for inbound group session (expected \" +\n sessionData.room_id +\n \", was \" +\n roomId +\n \")\",\n );\n }\n\n this.unpickleInboundGroupSession(sessionData, (session: InboundGroupSession) => {\n func(session, sessionData, withheld);\n });\n },\n );\n }\n\n /**\n * Add an inbound group session to the session store\n *\n * @param roomId - room in which this session will be used\n * @param senderKey - base64-encoded curve25519 key of the sender\n * @param forwardingCurve25519KeyChain - Devices involved in forwarding\n * this session to us.\n * @param sessionId - session identifier\n * @param sessionKey - base64-encoded secret key\n * @param keysClaimed - Other keys the sender claims.\n * @param exportFormat - true if the megolm keys are in export format\n * (ie, they lack an ed25519 signature)\n * @param extraSessionData - any other data to be include with the session\n */\n public async addInboundGroupSession(\n roomId: string,\n senderKey: string,\n forwardingCurve25519KeyChain: string[],\n sessionId: string,\n sessionKey: string,\n keysClaimed: Record<string, string>,\n exportFormat: boolean,\n extraSessionData: OlmGroupSessionExtraData = {},\n ): Promise<void> {\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS,\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS_WITHHELD,\n IndexedDBCryptoStore.STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS,\n ],\n (txn) => {\n /* if we already have this session, consider updating it */\n this.getInboundGroupSession(\n roomId,\n senderKey,\n sessionId,\n txn,\n (\n existingSession: InboundGroupSession | null,\n existingSessionData: InboundGroupSessionData | null,\n ) => {\n // new session.\n const session = new globalThis.Olm.InboundGroupSession();\n try {\n if (exportFormat) {\n session.import_session(sessionKey);\n } else {\n session.create(sessionKey);\n }\n if (sessionId != session.session_id()) {\n throw new Error(\"Mismatched group session ID from senderKey: \" + senderKey);\n }\n\n if (existingSession) {\n logger.log(`Update for megolm session ${senderKey}|${sessionId}`);\n if (existingSession.first_known_index() <= session.first_known_index()) {\n if (!existingSessionData!.untrusted || extraSessionData.untrusted) {\n // existing session has less-than-or-equal index\n // (i.e. can decrypt at least as much), and the\n // new session's trust does not win over the old\n // session's trust, so keep it\n logger.log(`Keeping existing megolm session ${senderKey}|${sessionId}`);\n return;\n }\n if (existingSession.first_known_index() < session.first_known_index()) {\n // We want to upgrade the existing session's trust,\n // but we can't just use the new session because we'll\n // lose the lower index. Check that the sessions connect\n // properly, and then manually set the existing session\n // as trusted.\n if (\n existingSession.export_session(session.first_known_index()) ===\n session.export_session(session.first_known_index())\n ) {\n logger.info(\n \"Upgrading trust of existing megolm session \" +\n `${senderKey}|${sessionId} based on newly-received trusted session`,\n );\n existingSessionData!.untrusted = false;\n this.cryptoStore.storeEndToEndInboundGroupSession(\n senderKey,\n sessionId,\n existingSessionData!,\n txn,\n );\n } else {\n logger.warn(\n `Newly-received megolm session ${senderKey}|$sessionId}` +\n \" does not match existing session! Keeping existing session\",\n );\n }\n return;\n }\n // If the sessions have the same index, go ahead and store the new trusted one.\n }\n }\n\n logger.debug(\n `Storing megolm session ${senderKey}|${sessionId} with first index ` +\n session.first_known_index(),\n );\n\n const sessionData = Object.assign({}, extraSessionData, {\n room_id: roomId,\n session: session.pickle(this.pickleKey),\n keysClaimed: keysClaimed,\n forwardingCurve25519KeyChain: forwardingCurve25519KeyChain,\n });\n\n this.cryptoStore.storeEndToEndInboundGroupSession(senderKey, sessionId, sessionData, txn);\n\n if (!existingSession && extraSessionData.sharedHistory) {\n this.cryptoStore.addSharedHistoryInboundGroupSession(roomId, senderKey, sessionId, txn);\n }\n } finally {\n session.free();\n }\n },\n );\n },\n logger.getChild(\"[addInboundGroupSession]\"),\n );\n }\n\n /**\n * Record in the data store why an inbound group session was withheld.\n *\n * @param roomId - room that the session belongs to\n * @param senderKey - base64-encoded curve25519 key of the sender\n * @param sessionId - session identifier\n * @param code - reason code\n * @param reason - human-readable version of `code`\n */\n public async addInboundGroupSessionWithheld(\n roomId: string,\n senderKey: string,\n sessionId: string,\n code: string,\n reason: string,\n ): Promise<void> {\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS_WITHHELD],\n (txn) => {\n this.cryptoStore.storeEndToEndInboundGroupSessionWithheld(\n senderKey,\n sessionId,\n {\n room_id: roomId,\n code: code,\n reason: reason,\n },\n txn,\n );\n },\n );\n }\n\n /**\n * Decrypt a received message with an inbound group session\n *\n * @param roomId - room in which the message was received\n * @param senderKey - base64-encoded curve25519 key of the sender\n * @param sessionId - session identifier\n * @param body - base64-encoded body of the encrypted message\n * @param eventId - ID of the event being decrypted\n * @param timestamp - timestamp of the event being decrypted\n *\n * @returns null if the sessionId is unknown\n */\n public async decryptGroupMessage(\n roomId: string,\n senderKey: string,\n sessionId: string,\n body: string,\n eventId: string,\n timestamp: number,\n ): Promise<IDecryptedGroupMessage | null> {\n let result: IDecryptedGroupMessage | null = null;\n // when the localstorage crypto store is used as an indexeddb backend,\n // exceptions thrown from within the inner function are not passed through\n // to the top level, so we store exceptions in a variable and raise them at\n // the end\n let error: Error;\n\n await this.cryptoStore.doTxn(\n \"readwrite\",\n [\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS,\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS_WITHHELD,\n ],\n (txn) => {\n this.getInboundGroupSession(roomId, senderKey, sessionId, txn, (session, sessionData, withheld) => {\n if (session === null || sessionData === null) {\n if (withheld) {\n const failureCode =\n withheld.code === \"m.unverified\"\n ? DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE\n : DecryptionFailureCode.MEGOLM_KEY_WITHHELD;\n error = new DecryptionError(failureCode, calculateWithheldMessage(withheld), {\n session: senderKey + \"|\" + sessionId,\n });\n }\n result = null;\n return;\n }\n let res: ReturnType<InboundGroupSession[\"decrypt\"]>;\n try {\n res = session.decrypt(body);\n } catch (e) {\n if ((<Error>e)?.message === \"OLM.UNKNOWN_MESSAGE_INDEX\" && withheld) {\n const failureCode =\n withheld.code === \"m.unverified\"\n ? DecryptionFailureCode.MEGOLM_KEY_WITHHELD_FOR_UNVERIFIED_DEVICE\n : DecryptionFailureCode.MEGOLM_KEY_WITHHELD;\n error = new DecryptionError(failureCode, calculateWithheldMessage(withheld), {\n session: senderKey + \"|\" + sessionId,\n });\n } else {\n error = <Error>e;\n }\n return;\n }\n\n let plaintext: string = res.plaintext;\n if (plaintext === undefined) {\n // @ts-ignore - Compatibility for older olm versions.\n plaintext = res as string;\n } else {\n // Check if we have seen this message index before to detect replay attacks.\n // If the event ID and timestamp are specified, and the match the event ID\n // and timestamp from the last time we used this message index, then we\n // don't consider it a replay attack.\n const messageIndexKey = senderKey + \"|\" + sessionId + \"|\" + res.message_index;\n if (messageIndexKey in this.inboundGroupSessionMessageIndexes) {\n const msgInfo = this.inboundGroupSessionMessageIndexes[messageIndexKey];\n if (msgInfo.id !== eventId || msgInfo.timestamp !== timestamp) {\n error = new Error(\n \"Duplicate message index, possible replay attack: \" + messageIndexKey,\n );\n return;\n }\n }\n this.inboundGroupSessionMessageIndexes[messageIndexKey] = {\n id: eventId,\n timestamp: timestamp,\n };\n }\n\n sessionData.session = session.pickle(this.pickleKey);\n this.cryptoStore.storeEndToEndInboundGroupSession(senderKey, sessionId, sessionData, txn);\n result = {\n result: plaintext,\n keysClaimed: sessionData.keysClaimed || {},\n senderKey: senderKey,\n forwardingCurve25519KeyChain: sessionData.forwardingCurve25519KeyChain || [],\n untrusted: !!sessionData.untrusted,\n };\n });\n },\n logger.getChild(\"[decryptGroupMessage]\"),\n );\n\n if (error!) {\n throw error;\n }\n return result!;\n }\n\n /**\n * Determine if we have the keys for a given megolm session\n *\n * @param roomId - room in which the message was received\n * @param senderKey - base64-encoded curve25519 key of the sender\n * @param sessionId - session identifier\n *\n * @returns true if we have the keys to this session\n */\n public async hasInboundSessionKeys(roomId: string, senderKey: string, sessionId: string): Promise<boolean> {\n let result: boolean;\n await this.cryptoStore.doTxn(\n \"readonly\",\n [\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS,\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS_WITHHELD,\n ],\n (txn) => {\n this.cryptoStore.getEndToEndInboundGroupSession(senderKey, sessionId, txn, (sessionData) => {\n if (sessionData === null) {\n result = false;\n return;\n }\n\n if (roomId !== sessionData.room_id) {\n logger.warn(\n `requested keys for inbound group session ${senderKey}|` +\n `${sessionId}, with incorrect room_id ` +\n `(expected ${sessionData.room_id}, ` +\n `was ${roomId})`,\n );\n result = false;\n } else {\n result = true;\n }\n });\n },\n logger.getChild(\"[hasInboundSessionKeys]\"),\n );\n\n return result!;\n }\n\n /**\n * Extract the keys to a given megolm session, for sharing\n *\n * @param roomId - room in which the message was received\n * @param senderKey - base64-encoded curve25519 key of the sender\n * @param sessionId - session identifier\n * @param chainIndex - The chain index at which to export the session.\n * If omitted, export at the first index we know about.\n *\n * @returns\n * details of the session key. The key is a base64-encoded megolm key in\n * export format.\n *\n * @throws Error If the given chain index could not be obtained from the known\n * index (ie. the given chain index is before the first we have).\n */\n public async getInboundGroupSessionKey(\n roomId: string,\n senderKey: string,\n sessionId: string,\n chainIndex?: number,\n ): Promise<IInboundGroupSessionKey | null> {\n let result: IInboundGroupSessionKey | null = null;\n await this.cryptoStore.doTxn(\n \"readonly\",\n [\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS,\n IndexedDBCryptoStore.STORE_INBOUND_GROUP_SESSIONS_WITHHELD,\n ],\n (txn) => {\n this.getInboundGroupSession(roomId, senderKey, sessionId, txn, (session, sessionData) => {\n if (session === null || sessionData === null) {\n result = null;\n return;\n }\n\n if (chainIndex === undefined) {\n chainIndex = session.first_known_index();\n }\n\n const exportedSession = session.export_session(chainIndex);\n\n const claimedKeys = sessionData.keysClaimed || {};\n const senderEd25519Key = claimedKeys.ed25519 || null;\n\n const forwardingKeyChain = sessionData.forwardingCurve25519KeyChain || [];\n // older forwarded keys didn't set the \"untrusted\"\n // property, but can be identified by having a\n // non-empty forwarding key chain. These keys should\n // be marked as untrusted since we don't know that they\n // can be trusted\n const untrusted =\n \"untrusted\" in sessionData ? sessionData.untrusted : forwardingKeyChain.length > 0;\n\n result = {\n chain_index: chainIndex,\n key: exportedSession,\n forwarding_curve25519_key_chain: forwardingKeyChain,\n sender_claimed_ed25519_key: senderEd25519Key,\n shared_history: sessionData.sharedHistory || false,\n untrusted: untrusted,\n };\n });\n },\n logger.getChild(\"[getInboundGroupSessionKey]\"),\n );\n\n return result;\n }\n\n /**\n * Export an inbound group session\n *\n * @param senderKey - base64-encoded curve25519 key of the sender\n * @param sessionId - session identifier\n * @param sessionData - The session object from the store\n * @returns exported session data\n */\n public exportInboundGroupSession(\n senderKey: string,\n sessionId: string,\n sessionData: InboundGroupSessionData,\n ): IMegolmSessionData {\n return this.unpickleInboundGroupSession(sessionData, (session) => {\n const messageIndex = session.first_known_index();\n\n return {\n \"sender_key\": senderKey,\n \"sender_claimed_keys\": sessionData.keysClaimed,\n \"room_id\": sessionData.room_id,\n \"session_id\": sessionId,\n \"session_key\": session.export_session(messageIndex),\n \"forwarding_curve25519_key_chain\": sessionData.forwardingCurve25519KeyChain || [],\n \"first_known_index\": session.first_known_index(),\n \"org.matrix.msc3061.shared_history\": sessionData.sharedHistory || false,\n } as IMegolmSessionData;\n });\n }\n\n public async getSharedHistoryInboundGroupSessions(\n roomId: string,\n ): Promise<[senderKey: string, sessionId: string][]> {\n let result: Promise<[senderKey: string, sessionId: string][]>;\n await this.cryptoStore.doTxn(\n \"readonly\",\n [IndexedDBCryptoStore.STORE_SHARED_HISTORY_INBOUND_GROUP_SESSIONS],\n (txn) => {\n result = this.cryptoStore.getSharedHistoryInboundGroupSessions(roomId, txn);\n },\n logger.getChild(\"[getSharedHistoryInboundGroupSessionsForRoom]\"),\n );\n return result!;\n }\n\n // Utilities\n // =========\n\n /**\n * Verify an ed25519 signature.\n *\n * @param key - ed25519 key\n * @param message - message which was signed\n * @param signature - base64-encoded signature to be checked\n *\n * @throws Error if there is a problem with the verification. If the key was\n * too small then the message will be \"OLM.INVALID_BASE64\". If the signature\n * was invalid then the message will be \"OLM.BAD_MESSAGE_MAC\".\n */\n public verifySignature(key: string, message: string, signature: string): void {\n this.getUtility(function (util: Utility) {\n util.ed25519_verify(key, message, signature);\n });\n }\n}\n\nexport const WITHHELD_MESSAGES: Record<string, string> = {\n \"m.unverified\": \"The sender has disabled encrypting to unverified devices.\",\n \"m.blacklisted\": \"The sender has blocked you.\",\n \"m.unauthorised\": \"You are not authorised to read the message.\",\n \"m.no_olm\": \"Unable to establish a secure channel.\",\n};\n\n/**\n * Calculate the message to use for the exception when a session key is withheld.\n *\n * @param withheld - An object that describes why the key was withheld.\n *\n * @returns the message\n *\n * @internal\n */\nfunction calculateWithheldMessage(withheld: IWithheld): string {\n if (withheld.code && withheld.code in WITHHELD_MESSAGES) {\n return WITHHELD_MESSAGES[withheld.code];\n } else if (withheld.reason) {\n return withheld.reason;\n } else {\n return \"decryption key withheld\";\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,MAAM,QAAgB,cAAc;AAC7C,SAASC,oBAAoB,QAAQ,mCAAmC;AAKxE,SAASC,qBAAqB,QAAQ,wBAAwB;AAC9D,SAASC,eAAe,QAAQ,mCAAmC;;AAEnE;AACA;AACA,IAAMC,oBAAoB,GAAI,KAAK,GAAG,CAAC,GAAI,CAAC;AAE5C,OAAO,MAAMC,oBAAoB,SAASC,KAAK,CAAC;EAAAC,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA,eACrB;MACnBC,OAAO,EAAE,aAAa;MACtBC,KAAK,EAAE;IACX,CAAC;EAAA;AACL;AAEA,SAASC,kBAAkBA,CAACC,aAAqB,EAAQ;EACrD,IAAIA,aAAa,KAAKC,SAAS,EAAE;IAC7B,MAAM,IAAIR,KAAK,CAAC,yBAAyB,CAAC;EAC9C;EAEA,IAAIO,aAAa,CAACE,MAAM,GAAGX,oBAAoB,EAAE;IAC7C;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,IAAIC,oBAAoB,CAC1B,qBAAAW,MAAA,CAAqBH,aAAa,CAACE,MAAM,4DAAAC,MAAA,CACMZ,oBAAoB,YACvE,CAAC;EACL;AACJ;;AAcA;;AAqCA;;AASA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMa,SAAS,CAAC;EAoCwC;;EAEpDV,WAAWA,CAAkBW,WAAwB,EAAE;IAAA,KAA1BA,WAAwB,GAAxBA,WAAwB;IAAAT,eAAA,oBArCzC,aAAa;IAAE;IAElC;IAAAA,eAAA,8BAC4C,IAAI;IAChD;IAAAA,eAAA,2BACyC,IAAI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yRequestBody, IRoomKeyRequestRecipient } from "./index.ts";
|
3
|
-
import { CryptoStore, OutgoingRoomKeyRequest } from "./store/base.ts";
|
4
|
-
/**
|
5
|
-
* possible states for a room key request
|
6
|
-
*
|
7
|
-
* The state machine looks like:
|
8
|
-
* ```
|
9
|
-
*
|
10
|
-
* | (cancellation sent)
|
11
|
-
* | .-------------------------------------------------.
|
12
|
-
* | | |
|
13
|
-
* V V (cancellation requested) |
|
14
|
-
* UNSENT -----------------------------+ |
|
15
|
-
* | | |
|
16
|
-
* | | |
|
17
|
-
* | (send successful) | CANCELLATION_PENDING_AND_WILL_RESEND
|
18
|
-
* V | Λ
|
19
|
-
* SENT | |
|
20
|
-
* |-------------------------------- | --------------'
|
21
|
-
* | | (cancellation requested with intent
|
22
|
-
* | | to resend the original request)
|
23
|
-
* | |
|
24
|
-
* | (cancellation requested) |
|
25
|
-
* V |
|
26
|
-
* CANCELLATION_PENDING |
|
27
|
-
* | |
|
28
|
-
* | (cancellation sent) |
|
29
|
-
* V |
|
30
|
-
* (deleted) <---------------------------+
|
31
|
-
* ```
|
32
|
-
*/
|
33
|
-
export declare enum RoomKeyRequestState {
|
34
|
-
/** request not yet sent */
|
35
|
-
Unsent = 0,
|
36
|
-
/** request sent, awaiting reply */
|
37
|
-
Sent = 1,
|
38
|
-
/** reply received, cancellation not yet sent */
|
39
|
-
CancellationPending = 2,
|
40
|
-
/**
|
41
|
-
* Cancellation not yet sent and will transition to UNSENT instead of
|
42
|
-
* being deleted once the cancellation has been sent.
|
43
|
-
*/
|
44
|
-
CancellationPendingAndWillResend = 3
|
45
|
-
}
|
46
|
-
export declare class OutgoingRoomKeyRequestManager {
|
47
|
-
private readonly baseApis;
|
48
|
-
private readonly deviceId;
|
49
|
-
private readonly cryptoStore;
|
50
|
-
private sendOutgoingRoomKeyRequestsTimer?;
|
51
|
-
private sendOutgoingRoomKeyRequestsRunning;
|
52
|
-
private clientRunning;
|
53
|
-
constructor(baseApis: MatrixClient, deviceId: string, cryptoStore: CryptoStore);
|
54
|
-
/**
|
55
|
-
* Called when the client is stopped. Stops any running background processes.
|
56
|
-
*/
|
57
|
-
stop(): void;
|
58
|
-
/**
|
59
|
-
* Send any requests that have been queued
|
60
|
-
*/
|
61
|
-
sendQueuedRequests(): void;
|
62
|
-
/**
|
63
|
-
* Queue up a room key request, if we haven't already queued or sent one.
|
64
|
-
*
|
65
|
-
* The `requestBody` is compared (with a deep-equality check) against
|
66
|
-
* previous queued or sent requests and if it matches, no change is made.
|
67
|
-
* Otherwise, a request is added to the pending list, and a job is started
|
68
|
-
* in the background to send it.
|
69
|
-
*
|
70
|
-
* @param resend - whether to resend the key request if there is
|
71
|
-
* already one
|
72
|
-
*
|
73
|
-
* @returns resolves when the request has been added to the
|
74
|
-
* pending list (or we have established that a similar request already
|
75
|
-
* exists)
|
76
|
-
*/
|
77
|
-
queueRoomKeyRequest(requestBody: IRoomKeyRequestBody, recipients: IRoomKeyRequestRecipient[], resend?: boolean): Promise<void>;
|
78
|
-
/**
|
79
|
-
* Cancel room key requests, if any match the given requestBody
|
80
|
-
*
|
81
|
-
*
|
82
|
-
* @returns resolves when the request has been updated in our
|
83
|
-
* pending list.
|
84
|
-
*/
|
85
|
-
cancelRoomKeyRequest(requestBody: IRoomKeyRequestBody): Promise<unknown>;
|
86
|
-
/**
|
87
|
-
* Look for room key requests by target device and state
|
88
|
-
*
|
89
|
-
* @param userId - Target user ID
|
90
|
-
* @param deviceId - Target device ID
|
91
|
-
*
|
92
|
-
* @returns resolves to a list of all the {@link OutgoingRoomKeyRequest}
|
93
|
-
*/
|
94
|
-
getOutgoingSentRoomKeyRequest(userId: string, deviceId: string): Promise<OutgoingRoomKeyRequest[]>;
|
95
|
-
/**
|
96
|
-
* Find anything in `sent` state, and kick it around the loop again.
|
97
|
-
* This is intended for situations where something substantial has changed, and we
|
98
|
-
* don't really expect the other end to even care about the cancellation.
|
99
|
-
* For example, after initialization or self-verification.
|
100
|
-
* @returns An array of `queueRoomKeyRequest` outputs.
|
101
|
-
*/
|
102
|
-
cancelAndResendAllOutgoingRequests(): Promise<void[]>;
|
103
|
-
private startTimer;
|
104
|
-
private sendOutgoingRoomKeyRequests;
|
105
|
-
private sendOutgoingRoomKeyRequest;
|
106
|
-
private sendOutgoingRoomKeyRequestCancellation;
|
107
|
-
private sendMessageToDevices;
|
108
|
-
}
|
109
|
-
//# sourceMappingURL=OutgoingRoomKeyRequestManager.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"OutgoingRoomKeyRequestManager.d.ts","sourceRoot":"","sources":["../../src/crypto/OutgoingRoomKeyRequestManager.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAetE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,oBAAY,mBAAmB;IAC3B,2BAA2B;IAC3B,MAAM,IAAA;IACN,mCAAmC;IACnC,IAAI,IAAA;IACJ,gDAAgD;IAChD,mBAAmB,IAAA;IACnB;;;OAGG;IACH,gCAAgC,IAAA;CACnC;AAkBD,qBAAa,6BAA6B;IAYlC,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAXhC,OAAO,CAAC,gCAAgC,CAAC,CAAgC;IAIzE,OAAO,CAAC,kCAAkC,CAAS;IAEnD,OAAO,CAAC,aAAa,CAAQ;gBAGR,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,WAAW;IAG7C;;OAEG;IACI,IAAI,IAAI,IAAI;IAMnB;;OAEG;IACI,kBAAkB,IAAI,IAAI;IAIjC;;;;;;;;;;;;;;OAcG;IACU,mBAAmB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