matrix-js-sdk 41.8.0 → 41.9.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 +11 -0
- package/README.md +1 -1
- package/lib/@types/AESEncryptedSecretStoragePayload.js +3 -1
- package/lib/@types/IIdentityServerProvider.js +3 -1
- package/lib/@types/PushRules.js +7 -7
- package/lib/@types/PushRules.js.map +1 -1
- package/lib/@types/auth.js +4 -4
- package/lib/@types/auth.js.map +1 -1
- package/lib/@types/beacon.js +2 -2
- package/lib/@types/beacon.js.map +1 -1
- package/lib/@types/common.js +3 -1
- package/lib/@types/crypto.js +3 -1
- package/lib/@types/event.js +20 -20
- package/lib/@types/event.js.map +1 -1
- package/lib/@types/events.js +3 -1
- package/lib/@types/extensible_events.js +6 -6
- package/lib/@types/extensible_events.js.map +1 -1
- package/lib/@types/global.d.js.map +1 -1
- package/lib/@types/json.js +3 -1
- package/lib/@types/local_notifications.js +3 -1
- package/lib/@types/location.js +4 -4
- package/lib/@types/location.js.map +1 -1
- package/lib/@types/matrix-sdk-crypto-wasm.d.js +3 -1
- package/lib/@types/media.js +3 -1
- package/lib/@types/membership.js +1 -1
- package/lib/@types/membership.js.map +1 -1
- package/lib/@types/partials.js +6 -6
- package/lib/@types/partials.js.map +1 -1
- package/lib/@types/polls.js +5 -5
- package/lib/@types/polls.js.map +1 -1
- package/lib/@types/read_receipts.js +2 -2
- package/lib/@types/read_receipts.js.map +1 -1
- package/lib/@types/registration.js +3 -1
- package/lib/@types/requests.js +1 -1
- package/lib/@types/requests.js.map +1 -1
- package/lib/@types/retention.js +1 -1
- package/lib/@types/retention.js.map +1 -1
- package/lib/@types/search.js +1 -1
- package/lib/@types/search.js.map +1 -1
- package/lib/@types/signed.js +3 -1
- package/lib/@types/spaces.js +3 -1
- package/lib/@types/state_events.js +3 -1
- package/lib/@types/synapse.js +3 -1
- package/lib/@types/sync.js +1 -1
- package/lib/@types/sync.js.map +1 -1
- package/lib/@types/threepids.js +1 -1
- package/lib/@types/threepids.js.map +1 -1
- package/lib/@types/topic.js +1 -1
- package/lib/@types/topic.js.map +1 -1
- package/lib/@types/uia.js +3 -1
- package/lib/NamespacedValue.js +8 -8
- package/lib/NamespacedValue.js.map +1 -1
- package/lib/ReEmitter.js +9 -16
- package/lib/ReEmitter.js.map +1 -1
- package/lib/ToDeviceMessageQueue.js +49 -57
- package/lib/ToDeviceMessageQueue.js.map +1 -1
- package/lib/autodiscovery.js +232 -247
- package/lib/autodiscovery.js.map +1 -1
- package/lib/base64.js +1 -1
- package/lib/base64.js.map +1 -1
- package/lib/browser-index.d.ts +2 -2
- package/lib/browser-index.d.ts.map +1 -1
- package/lib/browser-index.js +5 -5
- package/lib/browser-index.js.map +1 -1
- package/lib/capabilityPoller.js +19 -22
- package/lib/capabilityPoller.js.map +1 -1
- package/lib/client.d.ts +2 -8
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +2043 -2487
- package/lib/client.js.map +1 -1
- package/lib/common-crypto/CryptoBackend.js +2 -2
- package/lib/common-crypto/CryptoBackend.js.map +1 -1
- package/lib/common-crypto/key-passphrase.js.map +1 -1
- package/lib/content-helpers.js +43 -48
- package/lib/content-helpers.js.map +1 -1
- package/lib/content-repo.js +14 -24
- package/lib/content-repo.js.map +1 -1
- package/lib/crypto/store/base.js +6 -6
- package/lib/crypto/store/base.js.map +1 -1
- package/lib/crypto/store/indexeddb-crypto-store-backend.js +190 -238
- package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +1 -1
- package/lib/crypto/store/indexeddb-crypto-store.js +25 -30
- package/lib/crypto/store/indexeddb-crypto-store.js.map +1 -1
- package/lib/crypto/store/localStorage-crypto-store.js +113 -145
- package/lib/crypto/store/localStorage-crypto-store.js.map +1 -1
- package/lib/crypto/store/memory-crypto-store.js +74 -105
- package/lib/crypto/store/memory-crypto-store.js.map +1 -1
- package/lib/crypto-api/CryptoEvent.js +1 -1
- package/lib/crypto-api/CryptoEvent.js.map +1 -1
- package/lib/crypto-api/CryptoEventHandlerMap.js +3 -1
- package/lib/crypto-api/index.d.ts +15 -6
- package/lib/crypto-api/index.d.ts.map +1 -1
- package/lib/crypto-api/index.js +22 -22
- package/lib/crypto-api/index.js.map +1 -1
- package/lib/crypto-api/key-passphrase.js +15 -23
- package/lib/crypto-api/key-passphrase.js.map +1 -1
- package/lib/crypto-api/keybackup.js +3 -1
- package/lib/crypto-api/recovery-key.js +11 -12
- package/lib/crypto-api/recovery-key.js.map +1 -1
- package/lib/crypto-api/verification.js +3 -3
- package/lib/crypto-api/verification.js.map +1 -1
- package/lib/digest.js +7 -14
- package/lib/digest.js.map +1 -1
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +380 -505
- package/lib/embedded.js.map +1 -1
- package/lib/errors.js +2 -2
- package/lib/errors.js.map +1 -1
- package/lib/event-mapper.js +10 -12
- package/lib/event-mapper.js.map +1 -1
- package/lib/extensible_events_v1/ExtensibleEvent.js.map +1 -1
- package/lib/extensible_events_v1/InvalidEventError.js.map +1 -1
- package/lib/extensible_events_v1/MessageEvent.js +11 -13
- package/lib/extensible_events_v1/MessageEvent.js.map +1 -1
- package/lib/extensible_events_v1/PollEndEvent.js +3 -4
- package/lib/extensible_events_v1/PollEndEvent.js.map +1 -1
- package/lib/extensible_events_v1/PollResponseEvent.js +5 -6
- package/lib/extensible_events_v1/PollResponseEvent.js.map +1 -1
- package/lib/extensible_events_v1/PollStartEvent.js +8 -10
- package/lib/extensible_events_v1/PollStartEvent.js.map +1 -1
- package/lib/extensible_events_v1/utilities.js.map +1 -1
- package/lib/feature.js +18 -31
- package/lib/feature.js.map +1 -1
- package/lib/filter-component.d.ts.map +1 -1
- package/lib/filter-component.js +20 -26
- package/lib/filter-component.js.map +1 -1
- package/lib/filter.js +14 -17
- package/lib/filter.js.map +1 -1
- package/lib/http-api/errors.js +28 -43
- package/lib/http-api/errors.js.map +1 -1
- package/lib/http-api/fetch.js +141 -159
- package/lib/http-api/fetch.js.map +1 -1
- package/lib/http-api/index.js +17 -20
- package/lib/http-api/index.js.map +1 -1
- package/lib/http-api/interface.js +1 -1
- package/lib/http-api/interface.js.map +1 -1
- package/lib/http-api/method.js +1 -1
- package/lib/http-api/method.js.map +1 -1
- package/lib/http-api/prefix.js +3 -3
- package/lib/http-api/prefix.js.map +1 -1
- package/lib/http-api/refresh.js +74 -94
- package/lib/http-api/refresh.js.map +1 -1
- package/lib/http-api/utils.d.ts +1 -1
- package/lib/http-api/utils.d.ts.map +1 -1
- package/lib/http-api/utils.js +34 -42
- package/lib/http-api/utils.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/indexeddb-helpers.js +3 -3
- package/lib/indexeddb-helpers.js.map +1 -1
- package/lib/indexeddb-worker.js.map +1 -1
- package/lib/interactive-auth.d.ts +5 -5
- package/lib/interactive-auth.d.ts.map +1 -1
- package/lib/interactive-auth.js +172 -204
- package/lib/interactive-auth.js.map +1 -1
- package/lib/logger.js +21 -57
- package/lib/logger.js.map +1 -1
- package/lib/matrix.js +7 -11
- package/lib/matrix.js.map +1 -1
- package/lib/matrixrtc/CallMembership.js +80 -74
- package/lib/matrixrtc/CallMembership.js.map +1 -1
- package/lib/matrixrtc/EncryptionManager.js +1 -1
- package/lib/matrixrtc/EncryptionManager.js.map +1 -1
- package/lib/matrixrtc/IKeyTransport.js +1 -1
- package/lib/matrixrtc/IKeyTransport.js.map +1 -1
- package/lib/matrixrtc/IMembershipManager.js +1 -1
- package/lib/matrixrtc/IMembershipManager.js.map +1 -1
- package/lib/matrixrtc/LivekitTransport.d.ts +1 -1
- package/lib/matrixrtc/LivekitTransport.js +4 -4
- package/lib/matrixrtc/LivekitTransport.js.map +1 -1
- package/lib/matrixrtc/MatrixRTCSession.js +137 -187
- package/lib/matrixrtc/MatrixRTCSession.js.map +1 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.js +36 -41
- package/lib/matrixrtc/MatrixRTCSessionManager.js.map +1 -1
- package/lib/matrixrtc/MembershipManager.js +332 -378
- package/lib/matrixrtc/MembershipManager.js.map +1 -1
- package/lib/matrixrtc/MembershipManagerActionScheduler.js +54 -63
- package/lib/matrixrtc/MembershipManagerActionScheduler.js.map +1 -1
- package/lib/matrixrtc/RTCEncryptionManager.js +119 -143
- package/lib/matrixrtc/RTCEncryptionManager.js.map +1 -1
- package/lib/matrixrtc/ToDeviceKeyTransport.js +53 -58
- package/lib/matrixrtc/ToDeviceKeyTransport.js.map +1 -1
- package/lib/matrixrtc/index.js.map +1 -1
- package/lib/matrixrtc/membershipData/common.js +1 -1
- package/lib/matrixrtc/membershipData/common.js.map +1 -1
- package/lib/matrixrtc/membershipData/index.js.map +1 -1
- package/lib/matrixrtc/membershipData/rtc.js +15 -23
- package/lib/matrixrtc/membershipData/rtc.js.map +1 -1
- package/lib/matrixrtc/membershipData/session.js +4 -5
- package/lib/matrixrtc/membershipData/session.js.map +1 -1
- package/lib/matrixrtc/types.js +4 -6
- package/lib/matrixrtc/types.js.map +1 -1
- package/lib/matrixrtc/utils.js +4 -11
- package/lib/matrixrtc/utils.js.map +1 -1
- package/lib/models/MSC3089Branch.js +91 -116
- package/lib/models/MSC3089Branch.js.map +1 -1
- package/lib/models/MSC3089TreeSpace.js +209 -245
- package/lib/models/MSC3089TreeSpace.js.map +1 -1
- package/lib/models/ToDeviceMessage.js +3 -1
- package/lib/models/beacon.js +14 -13
- package/lib/models/beacon.js.map +1 -1
- package/lib/models/compare-event-ordering.js +13 -13
- package/lib/models/compare-event-ordering.js.map +1 -1
- package/lib/models/device.js +3 -3
- package/lib/models/device.js.map +1 -1
- package/lib/models/event-context.js +5 -8
- package/lib/models/event-context.js.map +1 -1
- package/lib/models/event-status.js +1 -1
- package/lib/models/event-status.js.map +1 -1
- package/lib/models/event-timeline-set.js +88 -94
- package/lib/models/event-timeline-set.js.map +1 -1
- package/lib/models/event-timeline.js +28 -30
- package/lib/models/event-timeline.js.map +1 -1
- package/lib/models/event.js +182 -226
- package/lib/models/event.js.map +1 -1
- package/lib/models/invites-ignorer-types.js +4 -4
- package/lib/models/invites-ignorer-types.js.map +1 -1
- package/lib/models/invites-ignorer.js +159 -179
- package/lib/models/invites-ignorer.js.map +1 -1
- package/lib/models/poll.js +71 -81
- package/lib/models/poll.js.map +1 -1
- package/lib/models/profile-keys.js +2 -2
- package/lib/models/profile-keys.js.map +1 -1
- package/lib/models/read-receipt.js +40 -56
- package/lib/models/read-receipt.js.map +1 -1
- package/lib/models/related-relations.js.map +1 -1
- package/lib/models/relations-container.js +22 -23
- package/lib/models/relations-container.js.map +1 -1
- package/lib/models/relations.js +133 -159
- package/lib/models/relations.js.map +1 -1
- package/lib/models/room-member.js +24 -29
- package/lib/models/room-member.js.map +1 -1
- package/lib/models/room-receipts.js +29 -43
- package/lib/models/room-receipts.js.map +1 -1
- package/lib/models/room-retention.js +74 -83
- package/lib/models/room-retention.js.map +1 -1
- package/lib/models/room-state.js +143 -172
- package/lib/models/room-state.js.map +1 -1
- package/lib/models/room-sticky-events.d.ts +1 -0
- package/lib/models/room-sticky-events.d.ts.map +1 -1
- package/lib/models/room-sticky-events.js +45 -65
- package/lib/models/room-sticky-events.js.map +1 -1
- package/lib/models/room-summary.js.map +1 -1
- package/lib/models/room.d.ts.map +1 -1
- package/lib/models/room.js +765 -909
- package/lib/models/room.js.map +1 -1
- package/lib/models/search-result.js +5 -5
- package/lib/models/search-result.js.map +1 -1
- package/lib/models/thread.js +225 -285
- package/lib/models/thread.js.map +1 -1
- package/lib/models/typed-event-emitter.js +7 -18
- package/lib/models/typed-event-emitter.js.map +1 -1
- package/lib/models/user.js +8 -8
- package/lib/models/user.js.map +1 -1
- package/lib/oidc/authorize.js +208 -241
- package/lib/oidc/authorize.js.map +1 -1
- package/lib/oidc/discovery.js +23 -36
- package/lib/oidc/discovery.js.map +1 -1
- package/lib/oidc/error.js +1 -1
- package/lib/oidc/error.js.map +1 -1
- package/lib/oidc/index.js +1 -0
- package/lib/oidc/index.js.map +1 -1
- package/lib/oidc/register.js +60 -66
- package/lib/oidc/register.js.map +1 -1
- package/lib/oidc/tokenRefresher.js +77 -91
- package/lib/oidc/tokenRefresher.js.map +1 -1
- package/lib/oidc/validate.js +18 -18
- package/lib/oidc/validate.js.map +1 -1
- package/lib/pushprocessor.js +71 -82
- package/lib/pushprocessor.js.map +1 -1
- package/lib/randomstring.js +9 -9
- package/lib/randomstring.js.map +1 -1
- package/lib/realtime-callbacks.js +25 -28
- package/lib/realtime-callbacks.js.map +1 -1
- package/lib/receipt-accumulator.d.ts +2 -0
- package/lib/receipt-accumulator.d.ts.map +1 -1
- package/lib/receipt-accumulator.js +14 -22
- package/lib/receipt-accumulator.js.map +1 -1
- package/lib/rendezvous/MSC4108SignInWithQR.js +271 -302
- package/lib/rendezvous/MSC4108SignInWithQR.js.map +1 -1
- package/lib/rendezvous/RendezvousChannel.js +3 -1
- package/lib/rendezvous/RendezvousCode.js +3 -1
- package/lib/rendezvous/RendezvousError.js.map +1 -1
- package/lib/rendezvous/RendezvousFailureReason.js +2 -2
- package/lib/rendezvous/RendezvousFailureReason.js.map +1 -1
- package/lib/rendezvous/RendezvousIntent.js +1 -1
- package/lib/rendezvous/RendezvousIntent.js.map +1 -1
- package/lib/rendezvous/RendezvousTransport.js +3 -1
- package/lib/rendezvous/channels/MSC4108SecureChannel.js +123 -147
- package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +1 -1
- package/lib/rendezvous/index.js +44 -69
- package/lib/rendezvous/index.js.map +1 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +1 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js +134 -152
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +1 -1
- package/lib/retentionPolicy.js +6 -9
- package/lib/retentionPolicy.js.map +1 -1
- package/lib/room-hierarchy.js +52 -60
- package/lib/room-hierarchy.js.map +1 -1
- package/lib/rust-crypto/CrossSigningIdentity.js +94 -104
- package/lib/rust-crypto/CrossSigningIdentity.js.map +1 -1
- package/lib/rust-crypto/DehydratedDeviceManager.js +157 -190
- package/lib/rust-crypto/DehydratedDeviceManager.js.map +1 -1
- package/lib/rust-crypto/KeyClaimManager.js +18 -22
- package/lib/rust-crypto/KeyClaimManager.js.map +1 -1
- package/lib/rust-crypto/OutgoingRequestProcessor.js +109 -139
- package/lib/rust-crypto/OutgoingRequestProcessor.js.map +1 -1
- package/lib/rust-crypto/OutgoingRequestsManager.js +66 -80
- package/lib/rust-crypto/OutgoingRequestsManager.js.map +1 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +1 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +196 -224
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +1 -1
- package/lib/rust-crypto/RoomEncryptor.js +127 -143
- package/lib/rust-crypto/RoomEncryptor.js.map +1 -1
- package/lib/rust-crypto/backup.js +453 -549
- package/lib/rust-crypto/backup.js.map +1 -1
- package/lib/rust-crypto/constants.js +1 -1
- package/lib/rust-crypto/constants.js.map +1 -1
- package/lib/rust-crypto/device-converter.js +15 -28
- package/lib/rust-crypto/device-converter.js.map +1 -1
- package/lib/rust-crypto/index.js +103 -116
- package/lib/rust-crypto/index.js.map +1 -1
- package/lib/rust-crypto/libolm_migration.js +303 -365
- package/lib/rust-crypto/libolm_migration.js.map +1 -1
- package/lib/rust-crypto/rust-crypto.d.ts +5 -1
- package/lib/rust-crypto/rust-crypto.d.ts.map +1 -1
- package/lib/rust-crypto/rust-crypto.js +1067 -1332
- package/lib/rust-crypto/rust-crypto.js.map +1 -1
- package/lib/rust-crypto/secret-storage.js +12 -25
- package/lib/rust-crypto/secret-storage.js.map +1 -1
- package/lib/rust-crypto/verification.js +137 -189
- package/lib/rust-crypto/verification.js.map +1 -1
- package/lib/scheduler.js +44 -19
- package/lib/scheduler.js.map +1 -1
- package/lib/secret-storage.js +179 -213
- package/lib/secret-storage.js.map +1 -1
- package/lib/serverCapabilities.js +6 -9
- package/lib/serverCapabilities.js.map +1 -1
- package/lib/service-types.js +1 -1
- package/lib/service-types.js.map +1 -1
- package/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/lib/sliding-sync-sdk.js +368 -424
- package/lib/sliding-sync-sdk.js.map +1 -1
- package/lib/sliding-sync.js +135 -171
- package/lib/sliding-sync.js.map +1 -1
- package/lib/store/index.js +3 -1
- package/lib/store/indexeddb-backend.js +3 -1
- package/lib/store/indexeddb-local-backend.js +194 -253
- package/lib/store/indexeddb-local-backend.js.map +1 -1
- package/lib/store/indexeddb-remote-backend.js +33 -63
- package/lib/store/indexeddb-remote-backend.js.map +1 -1
- package/lib/store/indexeddb-store-worker.js +22 -23
- package/lib/store/indexeddb-store-worker.js.map +1 -1
- package/lib/store/indexeddb.js +44 -71
- package/lib/store/indexeddb.js.map +1 -1
- package/lib/store/local-storage-events-emitter.js +2 -2
- package/lib/store/local-storage-events-emitter.js.map +1 -1
- package/lib/store/memory.js +34 -57
- package/lib/store/memory.js.map +1 -1
- package/lib/store/stub.js +22 -35
- package/lib/store/stub.js.map +1 -1
- package/lib/sync-accumulator.js +54 -66
- package/lib/sync-accumulator.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +905 -998
- package/lib/sync.js.map +1 -1
- package/lib/testing.js +63 -105
- package/lib/testing.js.map +1 -1
- package/lib/thread-utils.js +1 -4
- package/lib/thread-utils.js.map +1 -1
- package/lib/timeline-window.js +89 -102
- package/lib/timeline-window.js.map +1 -1
- package/lib/types.js +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/decryptAESSecretStorageItem.js +14 -25
- package/lib/utils/decryptAESSecretStorageItem.js.map +1 -1
- package/lib/utils/encryptAESSecretStorageItem.js +27 -38
- package/lib/utils/encryptAESSecretStorageItem.js.map +1 -1
- package/lib/utils/internal/deriveKeys.js +25 -32
- package/lib/utils/internal/deriveKeys.js.map +1 -1
- package/lib/utils/roomVersion.js +1 -1
- package/lib/utils/roomVersion.js.map +1 -1
- package/lib/utils.js +83 -135
- package/lib/utils.js.map +1 -1
- package/lib/version-support.js +3 -3
- package/lib/version-support.js.map +1 -1
- package/lib/webrtc/audioContext.js +5 -6
- package/lib/webrtc/audioContext.js.map +1 -1
- package/lib/webrtc/call.js +1081 -1250
- package/lib/webrtc/call.js.map +1 -1
- package/lib/webrtc/callEventHandler.js +202 -214
- package/lib/webrtc/callEventHandler.js.map +1 -1
- package/lib/webrtc/callEventTypes.js +2 -2
- package/lib/webrtc/callEventTypes.js.map +1 -1
- package/lib/webrtc/callFeed.js +18 -20
- package/lib/webrtc/callFeed.js.map +1 -1
- package/lib/webrtc/groupCall.js +513 -602
- package/lib/webrtc/groupCall.js.map +1 -1
- package/lib/webrtc/groupCallEventHandler.js +59 -62
- package/lib/webrtc/groupCallEventHandler.js.map +1 -1
- package/lib/webrtc/mediaHandler.js +198 -232
- package/lib/webrtc/mediaHandler.js.map +1 -1
- package/lib/webrtc/stats/callFeedStatsReporter.js +16 -20
- package/lib/webrtc/stats/callFeedStatsReporter.js.map +1 -1
- package/lib/webrtc/stats/callStatsReportGatherer.js +67 -75
- package/lib/webrtc/stats/callStatsReportGatherer.js.map +1 -1
- package/lib/webrtc/stats/callStatsReportSummary.js +3 -1
- package/lib/webrtc/stats/connectionStats.js.map +1 -1
- package/lib/webrtc/stats/connectionStatsBuilder.js +2 -2
- package/lib/webrtc/stats/connectionStatsBuilder.js.map +1 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.js +20 -24
- package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +1 -1
- package/lib/webrtc/stats/groupCallStats.js +6 -8
- package/lib/webrtc/stats/groupCallStats.js.map +1 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.js +7 -8
- package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +1 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.js +7 -9
- package/lib/webrtc/stats/media/mediaTrackHandler.js.map +1 -1
- package/lib/webrtc/stats/media/mediaTrackStats.js +3 -3
- package/lib/webrtc/stats/media/mediaTrackStats.js.map +1 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +7 -7
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +1 -1
- package/lib/webrtc/stats/statsReport.js +1 -1
- package/lib/webrtc/stats/statsReport.js.map +1 -1
- package/lib/webrtc/stats/statsReportEmitter.js.map +1 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.js +14 -14
- package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +1 -1
- package/lib/webrtc/stats/trackStatsBuilder.js +32 -34
- package/lib/webrtc/stats/trackStatsBuilder.js.map +1 -1
- package/lib/webrtc/stats/transportStats.js +3 -1
- package/lib/webrtc/stats/transportStatsBuilder.js +9 -9
- package/lib/webrtc/stats/transportStatsBuilder.js.map +1 -1
- package/lib/webrtc/stats/valueFormatter.js +1 -1
- package/lib/webrtc/stats/valueFormatter.js.map +1 -1
- package/package.json +18 -33
- package/src/@types/global.d.ts +2 -2
- package/src/ToDeviceMessageQueue.ts +2 -2
- package/src/browser-index.ts +4 -4
- package/src/client.ts +15 -20
- package/src/crypto-api/index.ts +17 -6
- package/src/embedded.ts +4 -6
- package/src/filter-component.ts +1 -0
- package/src/http-api/utils.ts +1 -1
- package/src/interactive-auth.ts +11 -5
- package/src/matrixrtc/LivekitTransport.ts +1 -1
- package/src/matrixrtc/MatrixRTCSession.ts +1 -1
- package/src/models/MSC3089Branch.ts +1 -1
- package/src/models/room-sticky-events.ts +1 -0
- package/src/models/room.ts +9 -11
- package/src/receipt-accumulator.ts +2 -0
- package/src/rendezvous/index.ts +1 -1
- package/src/rendezvous/transports/MSC4108RendezvousSession.ts +2 -2
- package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +1 -1
- package/src/rust-crypto/index.ts +6 -6
- package/src/rust-crypto/rust-crypto.ts +31 -7
- package/src/rust-crypto/verification.ts +1 -1
- package/src/sliding-sync-sdk.ts +5 -7
- package/src/store/indexeddb-local-backend.ts +3 -3
- package/src/sync.ts +6 -8
package/lib/models/event.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
2
|
/*
|
|
5
3
|
Copyright 2015 - 2023 The Matrix.org Foundation C.I.C.
|
|
@@ -56,11 +54,11 @@ export { EventStatus } from "./event-status.js";
|
|
|
56
54
|
*/
|
|
57
55
|
|
|
58
56
|
// A singleton implementing `IMessageVisibilityVisible`.
|
|
59
|
-
|
|
57
|
+
const MESSAGE_VISIBLE = Object.freeze({
|
|
60
58
|
visible: true
|
|
61
59
|
});
|
|
62
|
-
export
|
|
63
|
-
export
|
|
60
|
+
export const MAX_STICKY_DURATION_MS = 3600000;
|
|
61
|
+
export let MatrixEventEvent = /*#__PURE__*/function (MatrixEventEvent) {
|
|
64
62
|
/**
|
|
65
63
|
* An event has been decrypted, or we have failed to decrypt it.
|
|
66
64
|
*
|
|
@@ -89,23 +87,22 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
89
87
|
* @internal
|
|
90
88
|
*/
|
|
91
89
|
setMetadata(stateContext, toStartOfTimeline) {
|
|
92
|
-
var _this$sender, _this$target;
|
|
93
90
|
// If an event is an m.room.member state event then we should set the sentinels again in case setEventMetadata
|
|
94
91
|
// was already called before the state was applied and thus the sentinel points at the member from before this event.
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
const affectsSelf = this.isState() && this.getType() === EventType.RoomMember && this.getSender() === this.getStateKey();
|
|
93
|
+
let changed = false;
|
|
97
94
|
// When we try to generate a sentinel member before we have that member
|
|
98
95
|
// in the members object, we still generate a sentinel but it doesn't
|
|
99
96
|
// have a membership event, so test to see if events.member is set. We
|
|
100
97
|
// check this to avoid overriding non-sentinel members by sentinel ones
|
|
101
98
|
// when adding the event to a filtered timeline
|
|
102
|
-
if (affectsSelf || !
|
|
103
|
-
|
|
99
|
+
if (affectsSelf || !this.sender?.events?.member) {
|
|
100
|
+
const newSender = stateContext.getSentinelMember(this.getSender());
|
|
104
101
|
if (newSender !== this.sender) changed = true;
|
|
105
102
|
this.sender = newSender;
|
|
106
103
|
}
|
|
107
|
-
if (affectsSelf || !
|
|
108
|
-
|
|
104
|
+
if (affectsSelf || !this.target?.events?.member && this.getType() === EventType.RoomMember) {
|
|
105
|
+
const newTarget = stateContext.getSentinelMember(this.getStateKey());
|
|
109
106
|
if (newTarget !== this.target) changed = true;
|
|
110
107
|
this.target = newTarget;
|
|
111
108
|
}
|
|
@@ -137,9 +134,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
137
134
|
* methods defined on this class. Using the getter methods shields your app
|
|
138
135
|
* from changes to event JSON between Matrix versions.
|
|
139
136
|
*/
|
|
140
|
-
constructor() {
|
|
141
|
-
var _this$getTs;
|
|
142
|
-
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
137
|
+
constructor(event = {}) {
|
|
143
138
|
super();
|
|
144
139
|
|
|
145
140
|
// intern the values of matrix events to force share strings and reduce the
|
|
@@ -148,7 +143,6 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
148
143
|
// 'membership' at the event level (rather than the content level) is a legacy
|
|
149
144
|
// field that Element never otherwise looks at, but it will still take up a lot
|
|
150
145
|
// of space if we don't intern it.
|
|
151
|
-
this.event = event;
|
|
152
146
|
// applied push rule and action for this event
|
|
153
147
|
_defineProperty(this, "pushDetails", {});
|
|
154
148
|
_defineProperty(this, "_replacingEvent", null);
|
|
@@ -248,18 +242,17 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
248
242
|
* then this returns `undefined`.
|
|
249
243
|
*/
|
|
250
244
|
_defineProperty(this, "unstableStickyExpiresAt", void 0);
|
|
245
|
+
this.event = event;
|
|
251
246
|
["state_key", "type", "sender", "room_id", "membership"].forEach(prop => {
|
|
252
247
|
if (typeof event[prop] !== "string") return;
|
|
253
248
|
event[prop] = internaliseString(event[prop]);
|
|
254
249
|
});
|
|
255
250
|
["membership", "avatar_url", "displayname"].forEach(prop => {
|
|
256
|
-
|
|
257
|
-
if (typeof ((_event$content = event.content) === null || _event$content === void 0 ? void 0 : _event$content[prop]) !== "string") return;
|
|
251
|
+
if (typeof event.content?.[prop] !== "string") return;
|
|
258
252
|
event.content[prop] = internaliseString(event.content[prop]);
|
|
259
253
|
});
|
|
260
254
|
["rel_type"].forEach(prop => {
|
|
261
|
-
|
|
262
|
-
if (typeof ((_event$content2 = event.content) === null || _event$content2 === void 0 || (_event$content2 = _event$content2["m.relates_to"]) === null || _event$content2 === void 0 ? void 0 : _event$content2[prop]) !== "string") return;
|
|
255
|
+
if (typeof event.content?.["m.relates_to"]?.[prop] !== "string") return;
|
|
263
256
|
event.content["m.relates_to"][prop] = internaliseString(event.content["m.relates_to"][prop]);
|
|
264
257
|
});
|
|
265
258
|
this.txnId = event.txn_id;
|
|
@@ -268,9 +261,9 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
268
261
|
// or due to server-side bugs such as https://github.com/matrix-org/synapse/issues/8429.
|
|
269
262
|
// The fallback in these cases will be to use the origin_server_ts.
|
|
270
263
|
// For EDUs, the origin_server_ts also is not defined so we use Date.now().
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
this.localTimestamp = age !== undefined ? now - age :
|
|
264
|
+
const age = this.getAge();
|
|
265
|
+
const now = Date.now();
|
|
266
|
+
this.localTimestamp = age !== undefined ? now - age : this.getTs() ?? now;
|
|
274
267
|
this.reEmitter = new TypedReEmitter(this);
|
|
275
268
|
if (this.unstableStickyInfo) {
|
|
276
269
|
if (this.unstableStickyInfo.duration_ttl_ms) {
|
|
@@ -291,8 +284,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
291
284
|
*/
|
|
292
285
|
get unstableExtensibleEvent() {
|
|
293
286
|
if (!this._hasCachedExtEv) {
|
|
294
|
-
|
|
295
|
-
this._cachedExtEv = (_ExtensibleEvents$par = ExtensibleEvents.parse(this.getEffectiveEvent())) !== null && _ExtensibleEvents$par !== void 0 ? _ExtensibleEvents$par : undefined;
|
|
287
|
+
this._cachedExtEv = ExtensibleEvents.parse(this.getEffectiveEvent()) ?? undefined;
|
|
296
288
|
}
|
|
297
289
|
return this._cachedExtEv;
|
|
298
290
|
}
|
|
@@ -310,7 +302,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
310
302
|
* @returns A shallow copy of the event, in wire format, as it would have been had it not been encrypted.
|
|
311
303
|
*/
|
|
312
304
|
getEffectiveEvent() {
|
|
313
|
-
|
|
305
|
+
const content = Object.assign({}, this.getContent()); // clone for mutation
|
|
314
306
|
|
|
315
307
|
if (this.getWireType() === EventType.RoomMessageEncrypted) {
|
|
316
308
|
// Encrypted events sometimes aren't symmetrical on the `content` so we'll copy
|
|
@@ -318,16 +310,13 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
318
310
|
// between the plain and decrypted copies of `content` because we assume that the
|
|
319
311
|
// app is relying on the decrypted version, so we want to expose that as a source
|
|
320
312
|
// of truth here too.
|
|
321
|
-
for (
|
|
322
|
-
var _ref2 = _slicedToArray(_ref3, 2);
|
|
323
|
-
var _key = _ref2[0];
|
|
324
|
-
var value = _ref2[1];
|
|
313
|
+
for (const [key, value] of Object.entries(this.getWireContent())) {
|
|
325
314
|
// Skip fields from the encrypted event schema though - we don't want to leak
|
|
326
315
|
// these.
|
|
327
|
-
if (["algorithm", "ciphertext", "device_id", "sender_key", "session_id"].includes(
|
|
316
|
+
if (["algorithm", "ciphertext", "device_id", "sender_key", "session_id"].includes(key)) {
|
|
328
317
|
continue;
|
|
329
318
|
}
|
|
330
|
-
if (content[
|
|
319
|
+
if (content[key] === undefined) content[key] = value;
|
|
331
320
|
}
|
|
332
321
|
}
|
|
333
322
|
|
|
@@ -415,15 +404,14 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
415
404
|
* ```
|
|
416
405
|
*/
|
|
417
406
|
getDetails() {
|
|
418
|
-
|
|
407
|
+
const room = this.getRoomId();
|
|
419
408
|
if (room) {
|
|
420
|
-
var _this$getDate;
|
|
421
409
|
// in-room event
|
|
422
|
-
return
|
|
410
|
+
return `id=${this.getId()} type=${this.getWireType()} sender=${this.getSender()} room=${room} ts=${this.getDate()?.toISOString()}`;
|
|
423
411
|
} else {
|
|
424
412
|
// to-device event
|
|
425
|
-
|
|
426
|
-
return
|
|
413
|
+
const msgid = this.getContent()[ToDeviceMessageId];
|
|
414
|
+
return `msgid=${msgid} type=${this.getWireType()} sender=${this.getSender()}`;
|
|
427
415
|
}
|
|
428
416
|
}
|
|
429
417
|
|
|
@@ -434,15 +422,13 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
434
422
|
* @returns The event content JSON, or an empty object.
|
|
435
423
|
*/
|
|
436
424
|
getOriginalContent() {
|
|
437
|
-
var _this$event$content;
|
|
438
425
|
if (this._localRedactionEvent) {
|
|
439
426
|
return {};
|
|
440
427
|
}
|
|
441
428
|
if (this.clearEvent) {
|
|
442
|
-
|
|
443
|
-
return (_this$clearEvent$cont = this.clearEvent.content) !== null && _this$clearEvent$cont !== void 0 ? _this$clearEvent$cont : {};
|
|
429
|
+
return this.clearEvent.content ?? {};
|
|
444
430
|
}
|
|
445
|
-
return
|
|
431
|
+
return this.event.content ?? {};
|
|
446
432
|
}
|
|
447
433
|
|
|
448
434
|
/**
|
|
@@ -456,8 +442,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
456
442
|
if (this._localRedactionEvent) {
|
|
457
443
|
return {};
|
|
458
444
|
} else if (this._replacingEvent) {
|
|
459
|
-
|
|
460
|
-
return (_this$_replacingEvent = this._replacingEvent.getContent()["m.new_content"]) !== null && _this$_replacingEvent !== void 0 ? _this$_replacingEvent : {};
|
|
445
|
+
return this._replacingEvent.getContent()["m.new_content"] ?? {};
|
|
461
446
|
} else {
|
|
462
447
|
return this.getOriginalContent();
|
|
463
448
|
}
|
|
@@ -477,13 +462,12 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
477
462
|
* Get the event ID of the thread head
|
|
478
463
|
*/
|
|
479
464
|
get threadRootId() {
|
|
480
|
-
var _this$getWireContent;
|
|
481
465
|
// don't allow state events to be threaded as per the spec
|
|
482
466
|
if (this.isState()) {
|
|
483
467
|
return undefined;
|
|
484
468
|
}
|
|
485
|
-
|
|
486
|
-
if (
|
|
469
|
+
const relatesTo = this.getWireContent()?.["m.relates_to"];
|
|
470
|
+
if (relatesTo?.rel_type === THREAD_RELATION_TYPE.name) {
|
|
487
471
|
return relatesTo.event_id;
|
|
488
472
|
}
|
|
489
473
|
if (this.thread) {
|
|
@@ -492,7 +476,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
492
476
|
if (this.threadId !== undefined) {
|
|
493
477
|
return this.threadId;
|
|
494
478
|
}
|
|
495
|
-
|
|
479
|
+
const unsigned = this.getUnsigned();
|
|
496
480
|
if (typeof unsigned[UNSIGNED_THREAD_ID_FIELD.name] === "string") {
|
|
497
481
|
return unsigned[UNSIGNED_THREAD_ID_FIELD.name];
|
|
498
482
|
}
|
|
@@ -507,7 +491,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
507
491
|
if (this.isState()) {
|
|
508
492
|
return false;
|
|
509
493
|
}
|
|
510
|
-
|
|
494
|
+
const threadDetails = this.getServerAggregatedRelation(THREAD_RELATION_TYPE.name);
|
|
511
495
|
|
|
512
496
|
// Bundled relationships only returned when the sync response is limited
|
|
513
497
|
// hence us having to check both bundled relation and inspect the thread
|
|
@@ -515,12 +499,10 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
515
499
|
return !!threadDetails || this.threadRootId === this.getId();
|
|
516
500
|
}
|
|
517
501
|
get replyEventId() {
|
|
518
|
-
|
|
519
|
-
return (_this$getWireContent$ = this.getWireContent()["m.relates_to"]) === null || _this$getWireContent$ === void 0 || (_this$getWireContent$ = _this$getWireContent$["m.in_reply_to"]) === null || _this$getWireContent$ === void 0 ? void 0 : _this$getWireContent$.event_id;
|
|
502
|
+
return this.getWireContent()["m.relates_to"]?.["m.in_reply_to"]?.event_id;
|
|
520
503
|
}
|
|
521
504
|
get relationEventId() {
|
|
522
|
-
|
|
523
|
-
return (_this$getWireContent2 = this.getWireContent()) === null || _this$getWireContent2 === void 0 || (_this$getWireContent2 = _this$getWireContent2["m.relates_to"]) === null || _this$getWireContent2 === void 0 ? void 0 : _this$getWireContent2.event_id;
|
|
505
|
+
return this.getWireContent()?.["m.relates_to"]?.event_id;
|
|
524
506
|
}
|
|
525
507
|
|
|
526
508
|
/**
|
|
@@ -606,7 +588,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
606
588
|
* not report it.
|
|
607
589
|
*/
|
|
608
590
|
getMembershipAtEvent() {
|
|
609
|
-
|
|
591
|
+
const unsigned = this.getUnsigned();
|
|
610
592
|
return UNSIGNED_MEMBERSHIP_FIELD.findIn(unsigned);
|
|
611
593
|
}
|
|
612
594
|
|
|
@@ -643,7 +625,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
643
625
|
|
|
644
626
|
// if this is a state event, pack cleartext type and statekey
|
|
645
627
|
if (this.isState()) {
|
|
646
|
-
this.event.state_key =
|
|
628
|
+
this.event.state_key = `${this.clearEvent.type}:${this.clearEvent.state_key}`;
|
|
647
629
|
}
|
|
648
630
|
}
|
|
649
631
|
|
|
@@ -695,35 +677,30 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
695
677
|
* @returns promise which resolves (to undefined) when the decryption
|
|
696
678
|
* attempt is completed.
|
|
697
679
|
*/
|
|
698
|
-
attemptDecryption(crypto) {
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
if (alreadyDecrypted) {
|
|
709
|
-
// we may want to just ignore this? let's start with rejecting it.
|
|
710
|
-
throw new Error("Attempt to decrypt event which has already been decrypted");
|
|
711
|
-
}
|
|
680
|
+
async attemptDecryption(crypto, options = {}) {
|
|
681
|
+
// start with a couple of sanity checks.
|
|
682
|
+
if (!this.isEncrypted()) {
|
|
683
|
+
throw new Error("Attempt to decrypt event which isn't encrypted");
|
|
684
|
+
}
|
|
685
|
+
const alreadyDecrypted = this.clearEvent && !this.isDecryptionFailure();
|
|
686
|
+
if (alreadyDecrypted) {
|
|
687
|
+
// we may want to just ignore this? let's start with rejecting it.
|
|
688
|
+
throw new Error("Attempt to decrypt event which has already been decrypted");
|
|
689
|
+
}
|
|
712
690
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
})();
|
|
691
|
+
// if we already have a decryption attempt in progress, then it may
|
|
692
|
+
// fail because it was using outdated info. We now have reason to
|
|
693
|
+
// succeed where it failed before, but we don't want to have multiple
|
|
694
|
+
// attempts going at the same time, so just set a flag that says we have
|
|
695
|
+
// new info.
|
|
696
|
+
//
|
|
697
|
+
if (this.decryptionPromise) {
|
|
698
|
+
logger.log(`Event ${this.getId()} already being decrypted; queueing a retry`);
|
|
699
|
+
this.retryDecryption = true;
|
|
700
|
+
return this.decryptionPromise;
|
|
701
|
+
}
|
|
702
|
+
this.decryptionPromise = this.decryptionLoop(crypto, options);
|
|
703
|
+
return this.decryptionPromise;
|
|
727
704
|
}
|
|
728
705
|
|
|
729
706
|
/**
|
|
@@ -735,90 +712,85 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
735
712
|
*/
|
|
736
713
|
getKeyRequestRecipients(userId) {
|
|
737
714
|
// send the request to all of our own devices
|
|
738
|
-
|
|
715
|
+
const recipients = [{
|
|
739
716
|
userId,
|
|
740
717
|
deviceId: "*"
|
|
741
718
|
}];
|
|
742
719
|
return recipients;
|
|
743
720
|
}
|
|
744
|
-
decryptionLoop(crypto) {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
try {
|
|
760
|
-
var res = yield crypto.decryptEvent(_this2);
|
|
761
|
-
if (options.isRetry === true) {
|
|
762
|
-
logger.info("Decrypted event on retry (".concat(_this2.getDetails(), ")"));
|
|
763
|
-
}
|
|
764
|
-
_this2.setClearData(res);
|
|
765
|
-
_this2._decryptionFailureReason = null;
|
|
766
|
-
} catch (e) {
|
|
767
|
-
var detailedError = e instanceof DecryptionError ? e.detailedString : String(e);
|
|
768
|
-
err = e;
|
|
769
|
-
|
|
770
|
-
// see if we have a retry queued.
|
|
771
|
-
//
|
|
772
|
-
// NB: make sure to keep this check in the same tick of the
|
|
773
|
-
// event loop as `decryptionPromise = null` below - otherwise we
|
|
774
|
-
// risk a race:
|
|
775
|
-
//
|
|
776
|
-
// * A: we check retryDecryption here and see that it is
|
|
777
|
-
// false
|
|
778
|
-
// * B: we get a second call to attemptDecryption, which sees
|
|
779
|
-
// that decryptionPromise is set so sets
|
|
780
|
-
// retryDecryption
|
|
781
|
-
// * A: we continue below, clear decryptionPromise, and
|
|
782
|
-
// never do the retry.
|
|
783
|
-
//
|
|
784
|
-
if (_this2.retryDecryption) {
|
|
785
|
-
// decryption error, but we have a retry queued.
|
|
786
|
-
logger.log("Error decrypting event (".concat(_this2.getDetails(), "), but retrying: ").concat(detailedError));
|
|
787
|
-
continue;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
// decryption error, no retries queued. Warn about the error and
|
|
791
|
-
// set it to m.bad.encrypted.
|
|
792
|
-
//
|
|
793
|
-
// the detailedString already includes the name and message of the error, and the stack isn't much use,
|
|
794
|
-
// so we don't bother to log `e` separately.
|
|
795
|
-
logger.warn("Error decrypting event (".concat(_this2.getDetails(), "): ").concat(detailedError));
|
|
796
|
-
_this2.setClearDataForDecryptionFailure(String(e));
|
|
797
|
-
_this2._decryptionFailureReason = e instanceof DecryptionError ? e.code : DecryptionFailureCode.UNKNOWN_ERROR;
|
|
721
|
+
async decryptionLoop(crypto, options = {}) {
|
|
722
|
+
// make sure that this method never runs completely synchronously.
|
|
723
|
+
// (doing so would mean that we would clear decryptionPromise *before*
|
|
724
|
+
// it is set in attemptDecryption - and hence end up with a stuck
|
|
725
|
+
// `decryptionPromise`).
|
|
726
|
+
await Promise.resolve();
|
|
727
|
+
|
|
728
|
+
// eslint-disable-next-line no-constant-condition
|
|
729
|
+
while (true) {
|
|
730
|
+
this.retryDecryption = false;
|
|
731
|
+
let err = undefined;
|
|
732
|
+
try {
|
|
733
|
+
const res = await crypto.decryptEvent(this);
|
|
734
|
+
if (options.isRetry === true) {
|
|
735
|
+
logger.info(`Decrypted event on retry (${this.getDetails()})`);
|
|
798
736
|
}
|
|
737
|
+
this.setClearData(res);
|
|
738
|
+
this._decryptionFailureReason = null;
|
|
739
|
+
} catch (e) {
|
|
740
|
+
const detailedError = e instanceof DecryptionError ? e.detailedString : String(e);
|
|
741
|
+
err = e;
|
|
799
742
|
|
|
800
|
-
//
|
|
801
|
-
//
|
|
802
|
-
//
|
|
743
|
+
// see if we have a retry queued.
|
|
744
|
+
//
|
|
745
|
+
// NB: make sure to keep this check in the same tick of the
|
|
746
|
+
// event loop as `decryptionPromise = null` below - otherwise we
|
|
747
|
+
// risk a race:
|
|
803
748
|
//
|
|
804
|
-
//
|
|
749
|
+
// * A: we check retryDecryption here and see that it is
|
|
750
|
+
// false
|
|
751
|
+
// * B: we get a second call to attemptDecryption, which sees
|
|
752
|
+
// that decryptionPromise is set so sets
|
|
753
|
+
// retryDecryption
|
|
754
|
+
// * A: we continue below, clear decryptionPromise, and
|
|
755
|
+
// never do the retry.
|
|
805
756
|
//
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
// by relevant code. We do this because the clear event has now changed, making it
|
|
811
|
-
// so that existing rules can be re-run over the applicable properties. Stuff like
|
|
812
|
-
// highlighting when the user's name is mentioned rely on this happening. We also want
|
|
813
|
-
// to set the push actions before emitting so that any notification listeners don't
|
|
814
|
-
// pick up the wrong contents.
|
|
815
|
-
_this2.setPushDetails();
|
|
816
|
-
if (options.emit !== false) {
|
|
817
|
-
_this2.emit(MatrixEventEvent.Decrypted, _this2, err);
|
|
757
|
+
if (this.retryDecryption) {
|
|
758
|
+
// decryption error, but we have a retry queued.
|
|
759
|
+
logger.log(`Error decrypting event (${this.getDetails()}), but retrying: ${detailedError}`);
|
|
760
|
+
continue;
|
|
818
761
|
}
|
|
819
|
-
|
|
762
|
+
|
|
763
|
+
// decryption error, no retries queued. Warn about the error and
|
|
764
|
+
// set it to m.bad.encrypted.
|
|
765
|
+
//
|
|
766
|
+
// the detailedString already includes the name and message of the error, and the stack isn't much use,
|
|
767
|
+
// so we don't bother to log `e` separately.
|
|
768
|
+
logger.warn(`Error decrypting event (${this.getDetails()}): ${detailedError}`);
|
|
769
|
+
this.setClearDataForDecryptionFailure(String(e));
|
|
770
|
+
this._decryptionFailureReason = e instanceof DecryptionError ? e.code : DecryptionFailureCode.UNKNOWN_ERROR;
|
|
820
771
|
}
|
|
821
|
-
|
|
772
|
+
|
|
773
|
+
// Make sure we clear 'decryptionPromise' before sending the 'Event.decrypted' event,
|
|
774
|
+
// otherwise the app will be confused to see `isBeingDecrypted` still set when
|
|
775
|
+
// there isn't an `Event.decrypted` on the way.
|
|
776
|
+
//
|
|
777
|
+
// see also notes on retryDecryption above.
|
|
778
|
+
//
|
|
779
|
+
this.decryptionPromise = null;
|
|
780
|
+
this.retryDecryption = false;
|
|
781
|
+
|
|
782
|
+
// Before we emit the event, clear the push actions so that they can be recalculated
|
|
783
|
+
// by relevant code. We do this because the clear event has now changed, making it
|
|
784
|
+
// so that existing rules can be re-run over the applicable properties. Stuff like
|
|
785
|
+
// highlighting when the user's name is mentioned rely on this happening. We also want
|
|
786
|
+
// to set the push actions before emitting so that any notification listeners don't
|
|
787
|
+
// pick up the wrong contents.
|
|
788
|
+
this.setPushDetails();
|
|
789
|
+
if (options.emit !== false) {
|
|
790
|
+
this.emit(MatrixEventEvent.Decrypted, this, err);
|
|
791
|
+
}
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
822
794
|
}
|
|
823
795
|
|
|
824
796
|
/**
|
|
@@ -831,10 +803,9 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
831
803
|
* @param decryptionResult - the decryption result, including the plaintext and some key info
|
|
832
804
|
*/
|
|
833
805
|
setClearData(decryptionResult) {
|
|
834
|
-
var _decryptionResult$sen, _decryptionResult$cla;
|
|
835
806
|
this.clearEvent = decryptionResult.clearEvent;
|
|
836
|
-
this.senderCurve25519Key =
|
|
837
|
-
this.claimedEd25519Key =
|
|
807
|
+
this.senderCurve25519Key = decryptionResult.senderCurve25519Key ?? null;
|
|
808
|
+
this.claimedEd25519Key = decryptionResult.claimedEd25519Key ?? null;
|
|
838
809
|
this.keyForwardedBy = decryptionResult.keyForwardedBy;
|
|
839
810
|
this.invalidateExtensibleEvent();
|
|
840
811
|
}
|
|
@@ -849,7 +820,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
849
820
|
type: EventType.RoomMessage,
|
|
850
821
|
content: {
|
|
851
822
|
msgtype: "m.bad.encrypted",
|
|
852
|
-
body:
|
|
823
|
+
body: `** Unable to decrypt: ${reason} **`
|
|
853
824
|
}
|
|
854
825
|
};
|
|
855
826
|
this.senderCurve25519Key = null;
|
|
@@ -958,7 +929,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
958
929
|
this.event.unsigned = unsigned;
|
|
959
930
|
}
|
|
960
931
|
unmarkLocallyRedacted() {
|
|
961
|
-
|
|
932
|
+
const value = this._localRedactionEvent;
|
|
962
933
|
this._localRedactionEvent = null;
|
|
963
934
|
if (this.event.unsigned) {
|
|
964
935
|
this.event.unsigned.redacted_because = undefined;
|
|
@@ -989,10 +960,9 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
989
960
|
* changing the reason (if it was hidden).
|
|
990
961
|
*/
|
|
991
962
|
applyVisibilityEvent(visibilityChange) {
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
var change = false;
|
|
963
|
+
const visible = visibilityChange?.visible ?? true;
|
|
964
|
+
const reason = visibilityChange?.reason ?? null;
|
|
965
|
+
let change = false;
|
|
996
966
|
if (this.visibility.visible !== visible) {
|
|
997
967
|
change = true;
|
|
998
968
|
} else if (!this.visibility.visible && this.visibility["reason"] !== reason) {
|
|
@@ -1048,9 +1018,9 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1048
1018
|
this.event.unsigned = {};
|
|
1049
1019
|
}
|
|
1050
1020
|
this.event.unsigned.redacted_because = redactionEvent.event;
|
|
1051
|
-
for (
|
|
1052
|
-
if (this.event.hasOwnProperty(
|
|
1053
|
-
delete this.event[
|
|
1021
|
+
for (const key in this.event) {
|
|
1022
|
+
if (this.event.hasOwnProperty(key) && !REDACT_KEEP_KEYS.has(key)) {
|
|
1023
|
+
delete this.event[key];
|
|
1054
1024
|
}
|
|
1055
1025
|
}
|
|
1056
1026
|
|
|
@@ -1058,11 +1028,11 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1058
1028
|
if (this.isEncrypted()) {
|
|
1059
1029
|
this.clearEvent = undefined;
|
|
1060
1030
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
for (
|
|
1064
|
-
if (content.hasOwnProperty(
|
|
1065
|
-
delete content[
|
|
1031
|
+
const keeps = this.getType() in REDACT_KEEP_CONTENT_MAP ? REDACT_KEEP_CONTENT_MAP[this.getType()] : {};
|
|
1032
|
+
const content = this.getContent();
|
|
1033
|
+
for (const key in content) {
|
|
1034
|
+
if (content.hasOwnProperty(key) && !keeps[key]) {
|
|
1035
|
+
delete content[key];
|
|
1066
1036
|
}
|
|
1067
1037
|
}
|
|
1068
1038
|
|
|
@@ -1075,28 +1045,26 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1075
1045
|
this.invalidateExtensibleEvent();
|
|
1076
1046
|
}
|
|
1077
1047
|
moveAllRelatedToMainTimeline(room) {
|
|
1078
|
-
|
|
1048
|
+
const thread = this.thread;
|
|
1079
1049
|
this.moveToMainTimeline(room);
|
|
1080
1050
|
|
|
1081
1051
|
// If we dont have access to the thread, we can only move this
|
|
1082
1052
|
// event, not things related to it.
|
|
1083
1053
|
if (thread) {
|
|
1084
|
-
for (
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
_event.moveAllRelatedToMainTimeline(room);
|
|
1054
|
+
for (const event of thread.events) {
|
|
1055
|
+
if (event.getRelation()?.event_id === this.getId()) {
|
|
1056
|
+
event.moveAllRelatedToMainTimeline(room);
|
|
1088
1057
|
}
|
|
1089
1058
|
}
|
|
1090
1059
|
}
|
|
1091
1060
|
}
|
|
1092
1061
|
moveToMainTimeline(room) {
|
|
1093
|
-
var _this$thread;
|
|
1094
1062
|
// Remove it from its thread
|
|
1095
|
-
|
|
1063
|
+
this.thread?.timelineSet.removeEvent(this.getId());
|
|
1096
1064
|
this.setThread(undefined);
|
|
1097
1065
|
|
|
1098
1066
|
// And insert it into the main timeline
|
|
1099
|
-
|
|
1067
|
+
const timeline = room.getLiveTimeline();
|
|
1100
1068
|
// We use insertEventIntoTimeline to insert it in timestamp order,
|
|
1101
1069
|
// because we don't know where it should go (until we have MSC4033).
|
|
1102
1070
|
timeline.getTimelineSet().insertEventIntoTimeline(this, timeline, timeline.getState(EventTimeline.FORWARDS), false);
|
|
@@ -1132,19 +1100,19 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1132
1100
|
// Not a visibility change event.
|
|
1133
1101
|
return null;
|
|
1134
1102
|
}
|
|
1135
|
-
|
|
1103
|
+
const relation = this.getRelation();
|
|
1136
1104
|
if (!relation || relation.rel_type != "m.reference") {
|
|
1137
1105
|
// Ill-formed, ignore this event.
|
|
1138
1106
|
return null;
|
|
1139
1107
|
}
|
|
1140
|
-
|
|
1108
|
+
const eventId = relation.event_id;
|
|
1141
1109
|
if (!eventId) {
|
|
1142
1110
|
// Ill-formed, ignore this event.
|
|
1143
1111
|
return null;
|
|
1144
1112
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1113
|
+
const content = this.getWireContent();
|
|
1114
|
+
const visible = !!content.visible;
|
|
1115
|
+
const reason = content.reason;
|
|
1148
1116
|
if (reason && typeof reason != "string") {
|
|
1149
1117
|
// Ill-formed, ignore this event.
|
|
1150
1118
|
return null;
|
|
@@ -1175,12 +1143,10 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1175
1143
|
* @returns The redaction event JSON, or an empty object
|
|
1176
1144
|
*/
|
|
1177
1145
|
getRedactionEvent() {
|
|
1178
|
-
var _this$clearEvent, _this$event$unsigned;
|
|
1179
1146
|
if (!this.isRedacted()) return null;
|
|
1180
|
-
if (
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
} else if ((_this$event$unsigned = this.event.unsigned) !== null && _this$event$unsigned !== void 0 && _this$event$unsigned.redacted_because) {
|
|
1147
|
+
if (this.clearEvent?.unsigned) {
|
|
1148
|
+
return this.clearEvent?.unsigned.redacted_because ?? null;
|
|
1149
|
+
} else if (this.event.unsigned?.redacted_because) {
|
|
1184
1150
|
return this.event.unsigned.redacted_because;
|
|
1185
1151
|
} else {
|
|
1186
1152
|
return {};
|
|
@@ -1223,9 +1189,8 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1223
1189
|
* @param event - the object to assign to the `event` property
|
|
1224
1190
|
*/
|
|
1225
1191
|
handleRemoteEcho(event) {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
var oldId = this.getId();
|
|
1192
|
+
const oldUnsigned = this.getUnsigned();
|
|
1193
|
+
const oldId = this.getId();
|
|
1229
1194
|
this.event = event;
|
|
1230
1195
|
// if this event was redacted before it was sent, it's locally marked as redacted.
|
|
1231
1196
|
// At this point, we've received the remote echo for the event, but not yet for
|
|
@@ -1244,7 +1209,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1244
1209
|
// emit the event if it changed
|
|
1245
1210
|
this.emit(MatrixEventEvent.LocalEventIdReplaced, this);
|
|
1246
1211
|
}
|
|
1247
|
-
this.localTimestamp = Date.now() - (
|
|
1212
|
+
this.localTimestamp = Date.now() - (this.getAge() ?? 0);
|
|
1248
1213
|
}
|
|
1249
1214
|
|
|
1250
1215
|
/**
|
|
@@ -1277,26 +1242,24 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1277
1242
|
* given type
|
|
1278
1243
|
*/
|
|
1279
1244
|
isRelation(relType) {
|
|
1280
|
-
var _this$getWireContent3;
|
|
1281
1245
|
// Relation info is lifted out of the encrypted content when sent to
|
|
1282
1246
|
// encrypted rooms, so we have to check `getWireContent` for this.
|
|
1283
|
-
|
|
1284
|
-
if (this.isState() && !!
|
|
1247
|
+
const relation = this.getWireContent()?.["m.relates_to"];
|
|
1248
|
+
if (this.isState() && !!relation?.rel_type && [RelationType.Replace, RelationType.Thread].includes(relation.rel_type)) {
|
|
1285
1249
|
// State events cannot be m.replace or m.thread relations
|
|
1286
1250
|
return false;
|
|
1287
1251
|
}
|
|
1288
|
-
return !!(relation
|
|
1252
|
+
return !!(relation?.rel_type && relation.event_id && (relType ? relation.rel_type === relType : true));
|
|
1289
1253
|
}
|
|
1290
1254
|
|
|
1291
1255
|
/**
|
|
1292
1256
|
* Get relation info for the event, if any.
|
|
1293
1257
|
*/
|
|
1294
1258
|
getRelation() {
|
|
1295
|
-
var _this$getWireContent$2;
|
|
1296
1259
|
if (!this.isRelation()) {
|
|
1297
1260
|
return null;
|
|
1298
1261
|
}
|
|
1299
|
-
return
|
|
1262
|
+
return this.getWireContent()["m.relates_to"] ?? null;
|
|
1300
1263
|
}
|
|
1301
1264
|
|
|
1302
1265
|
/**
|
|
@@ -1320,7 +1283,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1320
1283
|
return;
|
|
1321
1284
|
}
|
|
1322
1285
|
if (this._replacingEvent !== newEvent) {
|
|
1323
|
-
this._replacingEvent = newEvent
|
|
1286
|
+
this._replacingEvent = newEvent ?? null;
|
|
1324
1287
|
this.emit(MatrixEventEvent.Replaced, this);
|
|
1325
1288
|
this.invalidateExtensibleEvent();
|
|
1326
1289
|
}
|
|
@@ -1340,15 +1303,14 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1340
1303
|
return this.status;
|
|
1341
1304
|
}
|
|
1342
1305
|
getServerAggregatedRelation(relType) {
|
|
1343
|
-
|
|
1344
|
-
return (_this$getUnsigned$mR = this.getUnsigned()["m.relations"]) === null || _this$getUnsigned$mR === void 0 ? void 0 : _this$getUnsigned$mR[relType];
|
|
1306
|
+
return this.getUnsigned()["m.relations"]?.[relType];
|
|
1345
1307
|
}
|
|
1346
1308
|
|
|
1347
1309
|
/**
|
|
1348
1310
|
* Returns the event ID of the event replacing the content of this event, if any.
|
|
1349
1311
|
*/
|
|
1350
1312
|
replacingEventId() {
|
|
1351
|
-
|
|
1313
|
+
const replaceRelation = this.getServerAggregatedRelation(RelationType.Replace);
|
|
1352
1314
|
if (replaceRelation) {
|
|
1353
1315
|
return replaceRelation.event_id;
|
|
1354
1316
|
} else if (this._replacingEvent) {
|
|
@@ -1369,15 +1331,14 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1369
1331
|
* Returns the origin_server_ts of the event replacing the content of this event, if any.
|
|
1370
1332
|
*/
|
|
1371
1333
|
replacingEventDate() {
|
|
1372
|
-
|
|
1334
|
+
const replaceRelation = this.getServerAggregatedRelation(RelationType.Replace);
|
|
1373
1335
|
if (replaceRelation) {
|
|
1374
|
-
|
|
1336
|
+
const ts = replaceRelation.origin_server_ts;
|
|
1375
1337
|
if (Number.isFinite(ts)) {
|
|
1376
1338
|
return new Date(ts);
|
|
1377
1339
|
}
|
|
1378
1340
|
} else if (this._replacingEvent) {
|
|
1379
|
-
|
|
1380
|
-
return (_this$_replacingEvent2 = this._replacingEvent.getDate()) !== null && _this$_replacingEvent2 !== void 0 ? _this$_replacingEvent2 : undefined;
|
|
1341
|
+
return this._replacingEvent.getDate() ?? undefined;
|
|
1381
1342
|
}
|
|
1382
1343
|
}
|
|
1383
1344
|
|
|
@@ -1393,7 +1354,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1393
1354
|
* For relations and redactions, returns the event_id this event is referring to.
|
|
1394
1355
|
*/
|
|
1395
1356
|
getAssociatedId() {
|
|
1396
|
-
|
|
1357
|
+
const relation = this.getRelation();
|
|
1397
1358
|
if (this.replyEventId) {
|
|
1398
1359
|
return this.replyEventId;
|
|
1399
1360
|
} else if (relation) {
|
|
@@ -1419,7 +1380,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1419
1380
|
* @param eventId - the new event id
|
|
1420
1381
|
*/
|
|
1421
1382
|
updateAssociatedId(eventId) {
|
|
1422
|
-
|
|
1383
|
+
const relation = this.getRelation();
|
|
1423
1384
|
if (relation) {
|
|
1424
1385
|
relation.event_id = eventId;
|
|
1425
1386
|
} else if (this.isRedaction()) {
|
|
@@ -1433,8 +1394,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1433
1394
|
* listeners that a cancellation event is coming down the same pipe shortly.
|
|
1434
1395
|
* @param cancelled - Whether the event is to be cancelled or not.
|
|
1435
1396
|
*/
|
|
1436
|
-
flagCancelled() {
|
|
1437
|
-
var cancelled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1397
|
+
flagCancelled(cancelled = true) {
|
|
1438
1398
|
this._isCancelled = cancelled;
|
|
1439
1399
|
}
|
|
1440
1400
|
|
|
@@ -1462,11 +1422,8 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1462
1422
|
* @returns A snapshot of this event.
|
|
1463
1423
|
*/
|
|
1464
1424
|
toSnapshot() {
|
|
1465
|
-
|
|
1466
|
-
for (
|
|
1467
|
-
var _ref5 = _slicedToArray(_ref6, 2);
|
|
1468
|
-
var p = _ref5[0];
|
|
1469
|
-
var v = _ref5[1];
|
|
1425
|
+
const ev = new MatrixEvent(JSON.parse(JSON.stringify(this.event)));
|
|
1426
|
+
for (const [p, v] of Object.entries(this)) {
|
|
1470
1427
|
if (p !== "event") {
|
|
1471
1428
|
// exclude the thing we just cloned
|
|
1472
1429
|
// @ts-ignore - XXX: this is just nasty
|
|
@@ -1486,8 +1443,8 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1486
1443
|
isEquivalentTo(otherEvent) {
|
|
1487
1444
|
if (!otherEvent) return false;
|
|
1488
1445
|
if (otherEvent === this) return true;
|
|
1489
|
-
|
|
1490
|
-
|
|
1446
|
+
const myProps = deepSortedObjectEntries(this.event);
|
|
1447
|
+
const theirProps = deepSortedObjectEntries(otherEvent.event);
|
|
1491
1448
|
return JSON.stringify(myProps) === JSON.stringify(theirProps);
|
|
1492
1449
|
}
|
|
1493
1450
|
|
|
@@ -1509,7 +1466,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1509
1466
|
* In any case, the value it returns is not a faithful serialization of the object.
|
|
1510
1467
|
*/
|
|
1511
1468
|
toJSON() {
|
|
1512
|
-
|
|
1469
|
+
const event = this.getEffectiveEvent();
|
|
1513
1470
|
if (!this.isEncrypted()) {
|
|
1514
1471
|
return event;
|
|
1515
1472
|
}
|
|
@@ -1538,7 +1495,7 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1538
1495
|
this.reEmitter.stopReEmitting(this.thread, [ThreadEvent.Update]);
|
|
1539
1496
|
}
|
|
1540
1497
|
this.thread = thread;
|
|
1541
|
-
this.setThreadId(thread
|
|
1498
|
+
this.setThreadId(thread?.id);
|
|
1542
1499
|
if (thread) {
|
|
1543
1500
|
this.reEmitter.reEmit(thread, [ThreadEvent.Update]);
|
|
1544
1501
|
}
|
|
@@ -1562,14 +1519,13 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1562
1519
|
* `duration_ms` is safely bounded to a hour.
|
|
1563
1520
|
*/
|
|
1564
1521
|
get unstableStickyInfo() {
|
|
1565
|
-
|
|
1566
|
-
if (!((_this$event$msc4354_s = this.event.msc4354_sticky) !== null && _this$event$msc4354_s !== void 0 && _this$event$msc4354_s.duration_ms)) {
|
|
1522
|
+
if (!this.event.msc4354_sticky?.duration_ms) {
|
|
1567
1523
|
return undefined;
|
|
1568
1524
|
}
|
|
1569
1525
|
return {
|
|
1570
1526
|
duration_ms: Math.min(MAX_STICKY_DURATION_MS, this.event.msc4354_sticky.duration_ms),
|
|
1571
1527
|
// This is assumed to be bounded server-side.
|
|
1572
|
-
duration_ttl_ms:
|
|
1528
|
+
duration_ttl_ms: this.event.unsigned?.msc4354_sticky_duration_ttl_ms
|
|
1573
1529
|
};
|
|
1574
1530
|
}
|
|
1575
1531
|
}
|
|
@@ -1583,10 +1539,10 @@ export class MatrixEvent extends TypedEventEmitter {
|
|
|
1583
1539
|
* - We keep 'unsigned' since that is created by the local server
|
|
1584
1540
|
* - We keep user_id for backwards-compat with v1
|
|
1585
1541
|
*/
|
|
1586
|
-
|
|
1542
|
+
const REDACT_KEEP_KEYS = new Set(["event_id", "type", "room_id", "user_id", "sender", "state_key", "prev_state", "content", "unsigned", "origin_server_ts"]);
|
|
1587
1543
|
|
|
1588
1544
|
// a map from state event type to the .content keys we keep when an event is redacted
|
|
1589
|
-
|
|
1545
|
+
const REDACT_KEEP_CONTENT_MAP = {
|
|
1590
1546
|
[EventType.RoomMember]: {
|
|
1591
1547
|
membership: 1
|
|
1592
1548
|
},
|