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
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
3
|
/*
|
|
6
4
|
Copyright 2024 The Matrix.org Foundation C.I.C.
|
|
7
5
|
|
|
@@ -29,7 +27,7 @@ import { generateScope, OAuthGrantType, startDeviceAuthorization, waitForDeviceA
|
|
|
29
27
|
* secure channels.
|
|
30
28
|
* @experimental Note that this is UNSTABLE and may have breaking changes without notice.
|
|
31
29
|
*/
|
|
32
|
-
export
|
|
30
|
+
export let PayloadType = /*#__PURE__*/function (PayloadType) {
|
|
33
31
|
PayloadType["Protocols"] = "m.login.protocols";
|
|
34
32
|
PayloadType["Protocol"] = "m.login.protocol";
|
|
35
33
|
PayloadType["Failure"] = "m.login.failure";
|
|
@@ -59,8 +57,7 @@ export class MSC4108SignInWithQR {
|
|
|
59
57
|
* Returns the check code for the secure channel or undefined if not generated yet.
|
|
60
58
|
*/
|
|
61
59
|
get checkCode() {
|
|
62
|
-
|
|
63
|
-
return (_this$channel = this.channel) === null || _this$channel === void 0 ? void 0 : _this$channel.getCheckCode();
|
|
60
|
+
return this.channel?.getCheckCode();
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
/**
|
|
@@ -70,15 +67,15 @@ export class MSC4108SignInWithQR {
|
|
|
70
67
|
* @param onFailure - Callback for when the rendezvous fails
|
|
71
68
|
*/
|
|
72
69
|
constructor(channel, didScanCode, client, onFailure) {
|
|
73
|
-
this.channel = channel;
|
|
74
|
-
this.didScanCode = didScanCode;
|
|
75
|
-
this.client = client;
|
|
76
|
-
this.onFailure = onFailure;
|
|
77
70
|
_defineProperty(this, "ourIntent", void 0);
|
|
78
71
|
_defineProperty(this, "_code", void 0);
|
|
79
72
|
_defineProperty(this, "expectingNewDeviceId", void 0);
|
|
80
73
|
_defineProperty(this, "metadata", void 0);
|
|
81
74
|
_defineProperty(this, "grantInProgress", void 0);
|
|
75
|
+
this.channel = channel;
|
|
76
|
+
this.didScanCode = didScanCode;
|
|
77
|
+
this.client = client;
|
|
78
|
+
this.onFailure = onFailure;
|
|
82
79
|
this.ourIntent = client ? QrCodeIntent.Reciprocate : QrCodeIntent.Login;
|
|
83
80
|
}
|
|
84
81
|
|
|
@@ -92,18 +89,15 @@ export class MSC4108SignInWithQR {
|
|
|
92
89
|
/**
|
|
93
90
|
* Generate the code including doing partial set up of the channel where required.
|
|
94
91
|
*/
|
|
95
|
-
generateCode() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_this._code = yield _this.channel.generateCode(_this.ourIntent);
|
|
105
|
-
}
|
|
106
|
-
})();
|
|
92
|
+
async generateCode() {
|
|
93
|
+
if (this._code) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (this.ourIntent === QrCodeIntent.Reciprocate && this.client) {
|
|
97
|
+
this._code = await this.channel.generateCode(this.ourIntent, this.client.getDomain());
|
|
98
|
+
} else if (this.ourIntent === QrCodeIntent.Login) {
|
|
99
|
+
this._code = await this.channel.generateCode(this.ourIntent);
|
|
100
|
+
}
|
|
107
101
|
}
|
|
108
102
|
|
|
109
103
|
/**
|
|
@@ -126,61 +120,57 @@ export class MSC4108SignInWithQR {
|
|
|
126
120
|
* The scanning device has to discover the homeserver details, if they scanned the code then they already have it.
|
|
127
121
|
* If the new device is the one rendering the QR code then it has to wait be sent the homeserver details via the rendezvous channel.
|
|
128
122
|
*/
|
|
129
|
-
negotiateProtocols() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (_this2.didScanCode) {
|
|
135
|
-
// Secure Channel step 6 completed, we trust the channel
|
|
123
|
+
async negotiateProtocols() {
|
|
124
|
+
logger.info(`negotiateProtocols(isNewDevice=${this.isNewDevice} didScanCode=${this.didScanCode})`);
|
|
125
|
+
await this.channel.connect();
|
|
126
|
+
if (this.didScanCode) {
|
|
127
|
+
// Secure Channel step 6 completed, we trust the channel
|
|
136
128
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
logger.error("Failed to discover OIDC metadata", e);
|
|
147
|
-
}
|
|
148
|
-
if ((_oidcClientConfig = oidcClientConfig) !== null && _oidcClientConfig !== void 0 && _oidcClientConfig.grant_types_supported.includes(OAuthGrantType.DeviceAuthorization)) {
|
|
149
|
-
yield _this2.send({
|
|
150
|
-
type: PayloadType.Protocols,
|
|
151
|
-
protocols: ["device_authorization_grant"],
|
|
152
|
-
homeserver: _this2.client.getDomain()
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
yield _this2.send({
|
|
156
|
-
type: PayloadType.Failure,
|
|
157
|
-
reason: MSC4108FailureReason.UnsupportedProtocol
|
|
158
|
-
});
|
|
159
|
-
throw new RendezvousError("Device code grant unsupported", MSC4108FailureReason.UnsupportedProtocol);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
} else if (_this2.isNewDevice) {
|
|
163
|
-
// MSC4108-Flow: ExistingScanned - wait for protocols message
|
|
164
|
-
logger.info("Waiting for protocols message");
|
|
165
|
-
var payload = yield _this2.receive();
|
|
166
|
-
if ((payload === null || payload === void 0 ? void 0 : payload.type) === PayloadType.Failure) {
|
|
167
|
-
throw new RendezvousError("Failed", payload.reason);
|
|
129
|
+
if (this.isNewDevice) {
|
|
130
|
+
// MSC4108-Flow: ExistingScanned - take homeserver from QR code which should already be set
|
|
131
|
+
} else {
|
|
132
|
+
// MSC4108-Flow: NewScanned -send protocols message
|
|
133
|
+
let oidcClientConfig;
|
|
134
|
+
try {
|
|
135
|
+
oidcClientConfig = await this.client.getAuthMetadata();
|
|
136
|
+
} catch (e) {
|
|
137
|
+
logger.error("Failed to discover OIDC metadata", e);
|
|
168
138
|
}
|
|
169
|
-
if ((
|
|
170
|
-
|
|
139
|
+
if (oidcClientConfig?.grant_types_supported.includes(OAuthGrantType.DeviceAuthorization)) {
|
|
140
|
+
await this.send({
|
|
141
|
+
type: PayloadType.Protocols,
|
|
142
|
+
protocols: ["device_authorization_grant"],
|
|
143
|
+
homeserver: this.client.getDomain()
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
await this.send({
|
|
171
147
|
type: PayloadType.Failure,
|
|
172
|
-
reason: MSC4108FailureReason.
|
|
148
|
+
reason: MSC4108FailureReason.UnsupportedProtocol
|
|
173
149
|
});
|
|
174
|
-
throw new RendezvousError("
|
|
150
|
+
throw new RendezvousError("Device code grant unsupported", MSC4108FailureReason.UnsupportedProtocol);
|
|
175
151
|
}
|
|
176
|
-
return {
|
|
177
|
-
serverName: payload.homeserver
|
|
178
|
-
};
|
|
179
|
-
} else {
|
|
180
|
-
// MSC4108-Flow: NewScanned - nothing to do
|
|
181
152
|
}
|
|
182
|
-
|
|
183
|
-
|
|
153
|
+
} else if (this.isNewDevice) {
|
|
154
|
+
// MSC4108-Flow: ExistingScanned - wait for protocols message
|
|
155
|
+
logger.info("Waiting for protocols message");
|
|
156
|
+
const payload = await this.receive();
|
|
157
|
+
if (payload?.type === PayloadType.Failure) {
|
|
158
|
+
throw new RendezvousError("Failed", payload.reason);
|
|
159
|
+
}
|
|
160
|
+
if (payload?.type !== PayloadType.Protocols) {
|
|
161
|
+
await this.send({
|
|
162
|
+
type: PayloadType.Failure,
|
|
163
|
+
reason: MSC4108FailureReason.UnexpectedMessageReceived
|
|
164
|
+
});
|
|
165
|
+
throw new RendezvousError("Unexpected message received", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
serverName: payload.homeserver
|
|
169
|
+
};
|
|
170
|
+
} else {
|
|
171
|
+
// MSC4108-Flow: NewScanned - nothing to do
|
|
172
|
+
}
|
|
173
|
+
return {};
|
|
184
174
|
}
|
|
185
175
|
|
|
186
176
|
/**
|
|
@@ -190,90 +180,91 @@ export class MSC4108SignInWithQR {
|
|
|
190
180
|
*
|
|
191
181
|
* @param input - Required for the new device to start the device authorization grant, not required for the existing device reciprocating the login
|
|
192
182
|
*/
|
|
193
|
-
deviceAuthorizationGrant(input) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
var scope = generateScope(deviceId);
|
|
183
|
+
async deviceAuthorizationGrant(input) {
|
|
184
|
+
if (this.isNewDevice) {
|
|
185
|
+
if (!input) {
|
|
186
|
+
throw new Error("Input must be provided for new device");
|
|
187
|
+
}
|
|
188
|
+
const {
|
|
189
|
+
metadata,
|
|
190
|
+
clientId,
|
|
191
|
+
deviceId
|
|
192
|
+
} = input;
|
|
193
|
+
const scope = generateScope(deviceId);
|
|
205
194
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
195
|
+
// MSC4108-Flow: NewDevice - start device authorization grant
|
|
196
|
+
const dagResponse = await startDeviceAuthorization({
|
|
197
|
+
clientId,
|
|
198
|
+
scope,
|
|
199
|
+
metadata
|
|
200
|
+
});
|
|
201
|
+
this.metadata = metadata;
|
|
202
|
+
this.grantInProgress = dagResponse;
|
|
203
|
+
const protocol = {
|
|
204
|
+
type: PayloadType.Protocol,
|
|
205
|
+
protocol: "device_authorization_grant",
|
|
206
|
+
device_id: deviceId,
|
|
207
|
+
device_authorization_grant: {
|
|
208
|
+
verification_uri: dagResponse.verification_uri,
|
|
209
|
+
verification_uri_complete: dagResponse.verification_uri_complete
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
await this.send(protocol);
|
|
213
|
+
return {
|
|
214
|
+
verificationUri: dagResponse.verification_uri_complete ?? dagResponse.verification_uri,
|
|
215
|
+
userCode: dagResponse.user_code
|
|
216
|
+
};
|
|
217
|
+
} else {
|
|
218
|
+
// The user needs to do step 7 for the out-of-band confirmation
|
|
219
|
+
// but, first we receive the protocol chosen by the other device so that
|
|
220
|
+
// the confirmation_uri is ready to go
|
|
221
|
+
logger.info("Waiting for protocol message");
|
|
222
|
+
const payload = await this.receive();
|
|
223
|
+
if (payload?.type === PayloadType.Failure) {
|
|
224
|
+
throw new RendezvousError("Failed", payload.reason);
|
|
225
|
+
}
|
|
226
|
+
if (payload?.type !== PayloadType.Protocol) {
|
|
227
|
+
await this.send({
|
|
228
|
+
type: PayloadType.Failure,
|
|
229
|
+
reason: MSC4108FailureReason.UnexpectedMessageReceived
|
|
211
230
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
device_id:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
231
|
+
throw new RendezvousError("Unexpected message received", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
232
|
+
}
|
|
233
|
+
if (isDeviceAuthorizationGrantProtocolPayload(payload)) {
|
|
234
|
+
const {
|
|
235
|
+
device_authorization_grant: dag,
|
|
236
|
+
device_id: expectingNewDeviceId
|
|
237
|
+
} = payload;
|
|
238
|
+
const {
|
|
239
|
+
verification_uri: verificationUri,
|
|
240
|
+
verification_uri_complete: verificationUriComplete
|
|
241
|
+
} = dag;
|
|
242
|
+
let deviceAlreadyExists = true;
|
|
243
|
+
try {
|
|
244
|
+
await this.client?.getDevice(expectingNewDeviceId);
|
|
245
|
+
} catch (err) {
|
|
246
|
+
if (err instanceof MatrixError && err.httpStatus === 404) {
|
|
247
|
+
deviceAlreadyExists = false;
|
|
221
248
|
}
|
|
222
|
-
};
|
|
223
|
-
yield _this3.send(protocol);
|
|
224
|
-
return {
|
|
225
|
-
verificationUri: (_dagResponse$verifica = dagResponse.verification_uri_complete) !== null && _dagResponse$verifica !== void 0 ? _dagResponse$verifica : dagResponse.verification_uri,
|
|
226
|
-
userCode: dagResponse.user_code
|
|
227
|
-
};
|
|
228
|
-
} else {
|
|
229
|
-
// The user needs to do step 7 for the out-of-band confirmation
|
|
230
|
-
// but, first we receive the protocol chosen by the other device so that
|
|
231
|
-
// the confirmation_uri is ready to go
|
|
232
|
-
logger.info("Waiting for protocol message");
|
|
233
|
-
var payload = yield _this3.receive();
|
|
234
|
-
if ((payload === null || payload === void 0 ? void 0 : payload.type) === PayloadType.Failure) {
|
|
235
|
-
throw new RendezvousError("Failed", payload.reason);
|
|
236
249
|
}
|
|
237
|
-
if (
|
|
238
|
-
|
|
250
|
+
if (deviceAlreadyExists) {
|
|
251
|
+
await this.send({
|
|
239
252
|
type: PayloadType.Failure,
|
|
240
|
-
reason: MSC4108FailureReason.
|
|
253
|
+
reason: MSC4108FailureReason.DeviceAlreadyExists
|
|
241
254
|
});
|
|
242
|
-
throw new RendezvousError("
|
|
243
|
-
}
|
|
244
|
-
if (isDeviceAuthorizationGrantProtocolPayload(payload)) {
|
|
245
|
-
var dag = payload.device_authorization_grant,
|
|
246
|
-
expectingNewDeviceId = payload.device_id;
|
|
247
|
-
var verificationUri = dag.verification_uri,
|
|
248
|
-
verificationUriComplete = dag.verification_uri_complete;
|
|
249
|
-
var deviceAlreadyExists = true;
|
|
250
|
-
try {
|
|
251
|
-
var _this3$client;
|
|
252
|
-
yield (_this3$client = _this3.client) === null || _this3$client === void 0 ? void 0 : _this3$client.getDevice(expectingNewDeviceId);
|
|
253
|
-
} catch (err) {
|
|
254
|
-
if (err instanceof MatrixError && err.httpStatus === 404) {
|
|
255
|
-
deviceAlreadyExists = false;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (deviceAlreadyExists) {
|
|
259
|
-
yield _this3.send({
|
|
260
|
-
type: PayloadType.Failure,
|
|
261
|
-
reason: MSC4108FailureReason.DeviceAlreadyExists
|
|
262
|
-
});
|
|
263
|
-
throw new RendezvousError("Specified device ID already exists", MSC4108FailureReason.DeviceAlreadyExists);
|
|
264
|
-
}
|
|
265
|
-
_this3.expectingNewDeviceId = expectingNewDeviceId;
|
|
266
|
-
return {
|
|
267
|
-
verificationUri: verificationUriComplete !== null && verificationUriComplete !== void 0 ? verificationUriComplete : verificationUri
|
|
268
|
-
};
|
|
255
|
+
throw new RendezvousError("Specified device ID already exists", MSC4108FailureReason.DeviceAlreadyExists);
|
|
269
256
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
}
|
|
274
|
-
throw new RendezvousError("Received a request for an unsupported protocol", MSC4108FailureReason.UnsupportedProtocol);
|
|
257
|
+
this.expectingNewDeviceId = expectingNewDeviceId;
|
|
258
|
+
return {
|
|
259
|
+
verificationUri: verificationUriComplete ?? verificationUri
|
|
260
|
+
};
|
|
275
261
|
}
|
|
276
|
-
|
|
262
|
+
await this.send({
|
|
263
|
+
type: PayloadType.Failure,
|
|
264
|
+
reason: MSC4108FailureReason.UnsupportedProtocol
|
|
265
|
+
});
|
|
266
|
+
throw new RendezvousError("Received a request for an unsupported protocol", MSC4108FailureReason.UnsupportedProtocol);
|
|
267
|
+
}
|
|
277
268
|
}
|
|
278
269
|
|
|
279
270
|
/**
|
|
@@ -281,191 +272,169 @@ export class MSC4108SignInWithQR {
|
|
|
281
272
|
* The reciprocating device must perform step 5 for this method to resolve.
|
|
282
273
|
* To be called after {@link deviceAuthorizationGrant} only on the new device.
|
|
283
274
|
*/
|
|
284
|
-
completeLoginOnNewDevice(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
275
|
+
async completeLoginOnNewDevice({
|
|
276
|
+
clientId
|
|
277
|
+
}) {
|
|
278
|
+
if (!this.isNewDevice || !this.grantInProgress || !this.metadata) {
|
|
279
|
+
throw new Error("Can only complete login on new device");
|
|
280
|
+
}
|
|
281
|
+
logger.info("Waiting for protocol accepted message");
|
|
282
|
+
// wait for accepted message
|
|
283
|
+
const payload = await this.receive();
|
|
284
|
+
if (!payload) {
|
|
285
|
+
throw new RendezvousError("No response from existing device", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
286
|
+
}
|
|
287
|
+
if (payload.type === PayloadType.Failure) {
|
|
288
|
+
throw new RendezvousError("Failed", payload.reason);
|
|
289
|
+
}
|
|
290
|
+
if (payload.type !== PayloadType.ProtocolAccepted) {
|
|
291
|
+
throw new RendezvousError("Unexpected message received", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
292
|
+
}
|
|
303
293
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
294
|
+
// poll for DAG
|
|
295
|
+
const res = await waitForDeviceAuthorization({
|
|
296
|
+
session: this.grantInProgress,
|
|
297
|
+
metadata: this.metadata,
|
|
298
|
+
clientId
|
|
299
|
+
});
|
|
300
|
+
if (!res) {
|
|
301
|
+
throw new RendezvousError("No response from device authorization endpoint", ClientRendezvousFailureReason.Unknown);
|
|
302
|
+
}
|
|
303
|
+
if ("error" in res) {
|
|
304
|
+
let reason = MSC4108FailureReason.UnexpectedMessageReceived;
|
|
305
|
+
if (res.error === "expired_token") {
|
|
306
|
+
reason = MSC4108FailureReason.AuthorizationExpired;
|
|
307
|
+
} else if (res.error === "access_denied") {
|
|
308
|
+
reason = MSC4108FailureReason.UserCancelled;
|
|
312
309
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
type: PayloadType.Failure,
|
|
322
|
-
reason
|
|
323
|
-
};
|
|
324
|
-
yield _this4.send(_payload);
|
|
325
|
-
throw new RendezvousError("Rejection from device authorization endpoint", reason);
|
|
326
|
-
}
|
|
327
|
-
return res;
|
|
328
|
-
})();
|
|
310
|
+
const payload = {
|
|
311
|
+
type: PayloadType.Failure,
|
|
312
|
+
reason
|
|
313
|
+
};
|
|
314
|
+
await this.send(payload);
|
|
315
|
+
throw new RendezvousError("Rejection from device authorization endpoint", reason);
|
|
316
|
+
}
|
|
317
|
+
return res;
|
|
329
318
|
}
|
|
330
319
|
|
|
331
320
|
/**
|
|
332
321
|
* The fifth (and final) step in the OIDC QR login process.
|
|
333
322
|
* To be called after the new device has completed authentication.
|
|
334
323
|
*/
|
|
335
|
-
shareSecrets() {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
type: PayloadType.Failure,
|
|
351
|
-
reason: MSC4108FailureReason.UnexpectedMessageReceived
|
|
352
|
-
});
|
|
353
|
-
throw new RendezvousError("Unexpected message received", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
354
|
-
}
|
|
355
|
-
return {
|
|
356
|
-
secrets: payload
|
|
357
|
-
};
|
|
358
|
-
// then done?
|
|
359
|
-
} else {
|
|
360
|
-
if (!_this5.expectingNewDeviceId) {
|
|
361
|
-
throw new Error("No new device ID expected");
|
|
362
|
-
}
|
|
363
|
-
yield _this5.send({
|
|
364
|
-
type: PayloadType.ProtocolAccepted
|
|
324
|
+
async shareSecrets() {
|
|
325
|
+
if (this.isNewDevice) {
|
|
326
|
+
await this.send({
|
|
327
|
+
type: PayloadType.Success
|
|
328
|
+
});
|
|
329
|
+
// then wait for secrets
|
|
330
|
+
logger.info("Waiting for secrets message");
|
|
331
|
+
const payload = await this.receive();
|
|
332
|
+
if (payload?.type === PayloadType.Failure) {
|
|
333
|
+
throw new RendezvousError("Failed", payload.reason);
|
|
334
|
+
}
|
|
335
|
+
if (payload?.type !== PayloadType.Secrets) {
|
|
336
|
+
await this.send({
|
|
337
|
+
type: PayloadType.Failure,
|
|
338
|
+
reason: MSC4108FailureReason.UnexpectedMessageReceived
|
|
365
339
|
});
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
var secretsBundle = yield _this5.client.getCrypto().exportSecretsBundle();
|
|
390
|
-
if (_this5.channel.cancelled) {
|
|
391
|
-
throw new RendezvousError("User cancelled", MSC4108FailureReason.UserCancelled);
|
|
392
|
-
}
|
|
393
|
-
// send secrets
|
|
394
|
-
yield _this5.send(_objectSpread({
|
|
395
|
-
type: PayloadType.Secrets
|
|
396
|
-
}, secretsBundle));
|
|
397
|
-
return {
|
|
398
|
-
secrets: secretsBundle
|
|
399
|
-
};
|
|
400
|
-
// let the other side close the rendezvous session
|
|
401
|
-
}
|
|
402
|
-
} catch (err) {
|
|
403
|
-
if (err instanceof MatrixError && err.httpStatus === 404) {
|
|
404
|
-
// not found, so keep waiting until timeout
|
|
405
|
-
} else {
|
|
406
|
-
throw err;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
yield sleep(1000);
|
|
410
|
-
} while (Date.now() < timeout);
|
|
411
|
-
yield _this5.send({
|
|
340
|
+
throw new RendezvousError("Unexpected message received", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
341
|
+
}
|
|
342
|
+
return {
|
|
343
|
+
secrets: payload
|
|
344
|
+
};
|
|
345
|
+
// then done?
|
|
346
|
+
} else {
|
|
347
|
+
if (!this.expectingNewDeviceId) {
|
|
348
|
+
throw new Error("No new device ID expected");
|
|
349
|
+
}
|
|
350
|
+
await this.send({
|
|
351
|
+
type: PayloadType.ProtocolAccepted
|
|
352
|
+
});
|
|
353
|
+
logger.info("Waiting for outcome message");
|
|
354
|
+
const payload = await this.receive();
|
|
355
|
+
if (payload?.type === PayloadType.Failure) {
|
|
356
|
+
throw new RendezvousError("Failed", payload.reason);
|
|
357
|
+
}
|
|
358
|
+
if (payload?.type === PayloadType.Declined) {
|
|
359
|
+
throw new RendezvousError("User declined", ClientRendezvousFailureReason.UserDeclined);
|
|
360
|
+
}
|
|
361
|
+
if (payload?.type !== PayloadType.Success) {
|
|
362
|
+
await this.send({
|
|
412
363
|
type: PayloadType.Failure,
|
|
413
|
-
reason: MSC4108FailureReason.
|
|
364
|
+
reason: MSC4108FailureReason.UnexpectedMessageReceived
|
|
414
365
|
});
|
|
415
|
-
throw new RendezvousError("
|
|
366
|
+
throw new RendezvousError("Unexpected message", MSC4108FailureReason.UnexpectedMessageReceived);
|
|
416
367
|
}
|
|
417
|
-
|
|
368
|
+
const timeout = Date.now() + 10000; // wait up to 10 seconds
|
|
369
|
+
do {
|
|
370
|
+
// is the device visible via the Homeserver?
|
|
371
|
+
try {
|
|
372
|
+
const device = await this.client?.getDevice(this.expectingNewDeviceId);
|
|
373
|
+
if (device) {
|
|
374
|
+
// if so, return the secrets
|
|
375
|
+
const secretsBundle = await this.client.getCrypto().exportSecretsBundle();
|
|
376
|
+
if (this.channel.cancelled) {
|
|
377
|
+
throw new RendezvousError("User cancelled", MSC4108FailureReason.UserCancelled);
|
|
378
|
+
}
|
|
379
|
+
// send secrets
|
|
380
|
+
await this.send(_objectSpread({
|
|
381
|
+
type: PayloadType.Secrets
|
|
382
|
+
}, secretsBundle));
|
|
383
|
+
return {
|
|
384
|
+
secrets: secretsBundle
|
|
385
|
+
};
|
|
386
|
+
// let the other side close the rendezvous session
|
|
387
|
+
}
|
|
388
|
+
} catch (err) {
|
|
389
|
+
if (err instanceof MatrixError && err.httpStatus === 404) {
|
|
390
|
+
// not found, so keep waiting until timeout
|
|
391
|
+
} else {
|
|
392
|
+
throw err;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
await sleep(1000);
|
|
396
|
+
} while (Date.now() < timeout);
|
|
397
|
+
await this.send({
|
|
398
|
+
type: PayloadType.Failure,
|
|
399
|
+
reason: MSC4108FailureReason.DeviceNotFound
|
|
400
|
+
});
|
|
401
|
+
throw new RendezvousError("New device not found", MSC4108FailureReason.DeviceNotFound);
|
|
402
|
+
}
|
|
418
403
|
}
|
|
419
|
-
receive() {
|
|
420
|
-
|
|
421
|
-
return _asyncToGenerator(function* () {
|
|
422
|
-
return yield _this6.channel.secureReceive();
|
|
423
|
-
})();
|
|
404
|
+
async receive() {
|
|
405
|
+
return await this.channel.secureReceive();
|
|
424
406
|
}
|
|
425
|
-
send(payload) {
|
|
426
|
-
|
|
427
|
-
return _asyncToGenerator(function* () {
|
|
428
|
-
yield _this7.channel.secureSend(payload);
|
|
429
|
-
})();
|
|
407
|
+
async send(payload) {
|
|
408
|
+
await this.channel.secureSend(payload);
|
|
430
409
|
}
|
|
431
410
|
|
|
432
411
|
/**
|
|
433
412
|
* Decline the login on the existing device.
|
|
434
413
|
*/
|
|
435
|
-
declineLoginOnExistingDevice() {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
reason: MSC4108FailureReason.UserCancelled
|
|
444
|
-
});
|
|
445
|
-
})();
|
|
414
|
+
async declineLoginOnExistingDevice() {
|
|
415
|
+
if (!this.isExistingDevice) {
|
|
416
|
+
throw new Error("Can only decline login on existing device");
|
|
417
|
+
}
|
|
418
|
+
await this.send({
|
|
419
|
+
type: PayloadType.Failure,
|
|
420
|
+
reason: MSC4108FailureReason.UserCancelled
|
|
421
|
+
});
|
|
446
422
|
}
|
|
447
423
|
|
|
448
424
|
/**
|
|
449
425
|
* Cancels the rendezvous session.
|
|
450
426
|
* @param reason the reason for the cancellation
|
|
451
427
|
*/
|
|
452
|
-
cancel(reason) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
var _this9$onFailure;
|
|
456
|
-
(_this9$onFailure = _this9.onFailure) === null || _this9$onFailure === void 0 || _this9$onFailure.call(_this9, reason);
|
|
457
|
-
yield _this9.channel.cancel(reason);
|
|
458
|
-
})();
|
|
428
|
+
async cancel(reason) {
|
|
429
|
+
this.onFailure?.(reason);
|
|
430
|
+
await this.channel.cancel(reason);
|
|
459
431
|
}
|
|
460
432
|
|
|
461
433
|
/**
|
|
462
434
|
* Closes the rendezvous session.
|
|
463
435
|
*/
|
|
464
|
-
close() {
|
|
465
|
-
|
|
466
|
-
return _asyncToGenerator(function* () {
|
|
467
|
-
yield _this0.channel.close();
|
|
468
|
-
})();
|
|
436
|
+
async close() {
|
|
437
|
+
await this.channel.close();
|
|
469
438
|
}
|
|
470
439
|
}
|
|
471
440
|
//# sourceMappingURL=MSC4108SignInWithQR.js.map
|