@unwanted/matrix-sdk-mini 34.12.0 → 36.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/git-revision.txt +1 -1
- package/lib/@types/event.d.ts +25 -19
- package/lib/@types/event.d.ts.map +1 -1
- package/lib/@types/event.js +5 -0
- package/lib/@types/event.js.map +1 -1
- package/lib/@types/global.d.js +0 -2
- package/lib/@types/global.d.js.map +1 -1
- package/lib/autodiscovery.d.ts +1 -1
- package/lib/autodiscovery.d.ts.map +1 -1
- package/lib/autodiscovery.js.map +1 -1
- package/lib/base64.d.ts +3 -6
- package/lib/base64.d.ts.map +1 -1
- package/lib/base64.js +43 -36
- package/lib/base64.js.map +1 -1
- package/lib/browser-index.d.ts.map +1 -1
- package/lib/browser-index.js +0 -11
- package/lib/browser-index.js.map +1 -1
- package/lib/client.d.ts +45 -1306
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +406 -2963
- package/lib/client.js.map +1 -1
- package/lib/digest.d.ts +2 -2
- package/lib/digest.d.ts.map +1 -1
- package/lib/digest.js +2 -2
- package/lib/digest.js.map +1 -1
- package/lib/embedded.d.ts +2 -23
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +82 -209
- package/lib/embedded.js.map +1 -1
- package/lib/event-mapper.d.ts.map +1 -1
- package/lib/event-mapper.js +0 -4
- package/lib/event-mapper.js.map +1 -1
- package/lib/feature.d.ts.map +1 -1
- package/lib/feature.js +2 -1
- package/lib/feature.js.map +1 -1
- package/lib/http-api/errors.d.ts +3 -3
- package/lib/http-api/errors.js +3 -3
- package/lib/http-api/errors.js.map +1 -1
- package/lib/http-api/utils.js +2 -2
- package/lib/http-api/utils.js.map +1 -1
- package/lib/matrix.d.ts +0 -25
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +1 -30
- package/lib/matrix.js.map +1 -1
- package/lib/models/MSC3089Branch.d.ts.map +1 -1
- package/lib/models/MSC3089Branch.js +0 -3
- package/lib/models/MSC3089Branch.js.map +1 -1
- package/lib/models/event-timeline-set.d.ts +6 -10
- package/lib/models/event-timeline-set.d.ts.map +1 -1
- package/lib/models/event-timeline-set.js +28 -36
- package/lib/models/event-timeline-set.js.map +1 -1
- package/lib/models/event-timeline.d.ts +7 -2
- package/lib/models/event-timeline.d.ts.map +1 -1
- package/lib/models/event-timeline.js +9 -30
- package/lib/models/event-timeline.js.map +1 -1
- package/lib/models/event.d.ts +12 -96
- package/lib/models/event.d.ts.map +1 -1
- package/lib/models/event.js +59 -286
- package/lib/models/event.js.map +1 -1
- package/lib/models/invites-ignorer-types.d.ts +27 -0
- package/lib/models/invites-ignorer-types.d.ts.map +1 -0
- package/lib/models/invites-ignorer-types.js +36 -0
- package/lib/models/invites-ignorer-types.js.map +1 -0
- package/lib/models/invites-ignorer.d.ts +2 -26
- package/lib/models/invites-ignorer.d.ts.map +1 -1
- package/lib/models/invites-ignorer.js +2 -27
- package/lib/models/invites-ignorer.js.map +1 -1
- package/lib/models/poll.d.ts.map +1 -1
- package/lib/models/poll.js +1 -5
- package/lib/models/poll.js.map +1 -1
- package/lib/models/relations-container.d.ts.map +1 -1
- package/lib/models/relations-container.js +1 -7
- package/lib/models/relations-container.js.map +1 -1
- package/lib/models/relations.d.ts +0 -1
- package/lib/models/relations.d.ts.map +1 -1
- package/lib/models/relations.js +0 -8
- package/lib/models/relations.js.map +1 -1
- package/lib/models/room-member.d.ts +6 -1
- package/lib/models/room-member.d.ts.map +1 -1
- package/lib/models/room-member.js +7 -1
- package/lib/models/room-member.js.map +1 -1
- package/lib/models/room-state.d.ts +2 -13
- package/lib/models/room-state.d.ts.map +1 -1
- package/lib/models/room-state.js +12 -56
- package/lib/models/room-state.js.map +1 -1
- package/lib/models/room.d.ts +8 -21
- package/lib/models/room.d.ts.map +1 -1
- package/lib/models/room.js +128 -163
- package/lib/models/room.js.map +1 -1
- package/lib/models/thread.d.ts.map +1 -1
- package/lib/models/thread.js +5 -4
- package/lib/models/thread.js.map +1 -1
- package/lib/oidc/authorize.d.ts +2 -2
- package/lib/oidc/authorize.d.ts.map +1 -1
- package/lib/oidc/authorize.js +5 -5
- package/lib/oidc/authorize.js.map +1 -1
- package/lib/oidc/discovery.d.ts +8 -0
- package/lib/oidc/discovery.d.ts.map +1 -1
- package/lib/oidc/discovery.js +22 -11
- package/lib/oidc/discovery.js.map +1 -1
- package/lib/oidc/index.d.ts +3 -4
- package/lib/oidc/index.d.ts.map +1 -1
- package/lib/oidc/index.js.map +1 -1
- package/lib/oidc/register.js +3 -3
- package/lib/oidc/register.js.map +1 -1
- package/lib/oidc/tokenRefresher.d.ts.map +1 -1
- package/lib/oidc/tokenRefresher.js +6 -5
- package/lib/oidc/tokenRefresher.js.map +1 -1
- package/lib/oidc/validate.d.ts +9 -23
- package/lib/oidc/validate.d.ts.map +1 -1
- package/lib/oidc/validate.js +13 -28
- package/lib/oidc/validate.js.map +1 -1
- package/lib/randomstring.d.ts +30 -3
- package/lib/randomstring.d.ts.map +1 -1
- package/lib/randomstring.js +68 -16
- package/lib/randomstring.js.map +1 -1
- package/lib/sliding-sync-sdk.d.ts +3 -4
- package/lib/sliding-sync-sdk.d.ts.map +1 -1
- package/lib/sliding-sync-sdk.js +55 -102
- package/lib/sliding-sync-sdk.js.map +1 -1
- package/lib/sliding-sync.js +9 -6
- package/lib/sliding-sync.js.map +1 -1
- package/lib/store/indexeddb-local-backend.js +4 -2
- package/lib/store/indexeddb-local-backend.js.map +1 -1
- package/lib/store/indexeddb.d.ts +1 -1
- package/lib/store/indexeddb.d.ts.map +1 -1
- package/lib/store/indexeddb.js.map +1 -1
- package/lib/sync-accumulator.d.ts +6 -4
- package/lib/sync-accumulator.d.ts.map +1 -1
- package/lib/sync-accumulator.js +23 -12
- package/lib/sync-accumulator.js.map +1 -1
- package/lib/sync.d.ts +10 -13
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +94 -115
- package/lib/sync.js.map +1 -1
- package/lib/testing.d.ts +13 -44
- package/lib/testing.d.ts.map +1 -1
- package/lib/testing.js +36 -99
- package/lib/testing.js.map +1 -1
- package/lib/types.d.ts +0 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/package.json +14 -15
- package/src/@types/event.ts +19 -36
- package/src/@types/global.d.ts +21 -4
- package/src/autodiscovery.ts +1 -1
- package/src/base64.ts +38 -40
- package/src/browser-index.ts +0 -11
- package/src/client.ts +175 -3136
- package/src/digest.ts +3 -3
- package/src/embedded.ts +43 -149
- package/src/event-mapper.ts +0 -4
- package/src/feature.ts +1 -0
- package/src/http-api/errors.ts +3 -3
- package/src/http-api/utils.ts +2 -2
- package/src/matrix.ts +0 -41
- package/src/models/MSC3089Branch.ts +0 -3
- package/src/models/event-timeline-set.ts +17 -38
- package/src/models/event-timeline.ts +11 -26
- package/src/models/event.ts +54 -295
- package/src/models/invites-ignorer-types.ts +48 -0
- package/src/models/invites-ignorer.ts +7 -42
- package/src/models/poll.ts +0 -6
- package/src/models/relations-container.ts +1 -8
- package/src/models/relations.ts +0 -8
- package/src/models/room-member.ts +16 -1
- package/src/models/room-state.ts +4 -37
- package/src/models/room.ts +34 -69
- package/src/models/thread.ts +4 -3
- package/src/oidc/authorize.ts +7 -7
- package/src/oidc/discovery.ts +16 -10
- package/src/oidc/index.ts +3 -4
- package/src/oidc/register.ts +3 -3
- package/src/oidc/tokenRefresher.ts +3 -2
- package/src/oidc/validate.ts +40 -63
- package/src/randomstring.ts +65 -19
- package/src/sliding-sync-sdk.ts +10 -83
- package/src/sliding-sync.ts +6 -6
- package/src/store/indexeddb-local-backend.ts +2 -2
- package/src/store/indexeddb.ts +1 -1
- package/src/sync-accumulator.ts +33 -16
- package/src/sync.ts +112 -143
- package/src/testing.ts +36 -103
- package/src/types.ts +0 -1
- package/CHANGELOG.md +0 -5910
- package/lib/@types/AESEncryptedSecretStoragePayload.d.ts +0 -14
- package/lib/@types/AESEncryptedSecretStoragePayload.d.ts.map +0 -1
- package/lib/@types/AESEncryptedSecretStoragePayload.js +0 -1
- package/lib/@types/AESEncryptedSecretStoragePayload.js.map +0 -1
- package/lib/@types/crypto.d.ts +0 -47
- package/lib/@types/crypto.d.ts.map +0 -1
- package/lib/@types/crypto.js +0 -1
- package/lib/@types/crypto.js.map +0 -1
- package/lib/@types/matrix-sdk-crypto-wasm.d.js +0 -1
- package/lib/@types/matrix-sdk-crypto-wasm.d.js.map +0 -1
- package/lib/common-crypto/CryptoBackend.d.ts +0 -240
- package/lib/common-crypto/CryptoBackend.d.ts.map +0 -1
- package/lib/common-crypto/CryptoBackend.js +0 -73
- package/lib/common-crypto/CryptoBackend.js.map +0 -1
- package/lib/common-crypto/key-passphrase.d.ts +0 -14
- package/lib/common-crypto/key-passphrase.d.ts.map +0 -1
- package/lib/common-crypto/key-passphrase.js +0 -33
- package/lib/common-crypto/key-passphrase.js.map +0 -1
- package/lib/crypto/CrossSigning.d.ts +0 -184
- package/lib/crypto/CrossSigning.d.ts.map +0 -1
- package/lib/crypto/CrossSigning.js +0 -718
- package/lib/crypto/CrossSigning.js.map +0 -1
- package/lib/crypto/DeviceList.d.ts +0 -216
- package/lib/crypto/DeviceList.d.ts.map +0 -1
- package/lib/crypto/DeviceList.js +0 -892
- package/lib/crypto/DeviceList.js.map +0 -1
- package/lib/crypto/EncryptionSetup.d.ts +0 -152
- package/lib/crypto/EncryptionSetup.d.ts.map +0 -1
- package/lib/crypto/EncryptionSetup.js +0 -356
- package/lib/crypto/EncryptionSetup.js.map +0 -1
- package/lib/crypto/OlmDevice.d.ts +0 -457
- package/lib/crypto/OlmDevice.d.ts.map +0 -1
- package/lib/crypto/OlmDevice.js +0 -1241
- package/lib/crypto/OlmDevice.js.map +0 -1
- package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts +0 -109
- package/lib/crypto/OutgoingRoomKeyRequestManager.d.ts.map +0 -1
- package/lib/crypto/OutgoingRoomKeyRequestManager.js +0 -415
- package/lib/crypto/OutgoingRoomKeyRequestManager.js.map +0 -1
- package/lib/crypto/RoomList.d.ts +0 -26
- package/lib/crypto/RoomList.d.ts.map +0 -1
- package/lib/crypto/RoomList.js +0 -71
- package/lib/crypto/RoomList.js.map +0 -1
- package/lib/crypto/SecretSharing.d.ts +0 -24
- package/lib/crypto/SecretSharing.d.ts.map +0 -1
- package/lib/crypto/SecretSharing.js +0 -194
- package/lib/crypto/SecretSharing.js.map +0 -1
- package/lib/crypto/SecretStorage.d.ts +0 -55
- package/lib/crypto/SecretStorage.d.ts.map +0 -1
- package/lib/crypto/SecretStorage.js +0 -118
- package/lib/crypto/SecretStorage.js.map +0 -1
- package/lib/crypto/aes.d.ts +0 -6
- package/lib/crypto/aes.d.ts.map +0 -1
- package/lib/crypto/aes.js +0 -24
- package/lib/crypto/aes.js.map +0 -1
- package/lib/crypto/algorithms/base.d.ts +0 -156
- package/lib/crypto/algorithms/base.d.ts.map +0 -1
- package/lib/crypto/algorithms/base.js +0 -187
- package/lib/crypto/algorithms/base.js.map +0 -1
- package/lib/crypto/algorithms/index.d.ts +0 -4
- package/lib/crypto/algorithms/index.d.ts.map +0 -1
- package/lib/crypto/algorithms/index.js +0 -20
- package/lib/crypto/algorithms/index.js.map +0 -1
- package/lib/crypto/algorithms/megolm.d.ts +0 -385
- package/lib/crypto/algorithms/megolm.d.ts.map +0 -1
- package/lib/crypto/algorithms/megolm.js +0 -1822
- package/lib/crypto/algorithms/megolm.js.map +0 -1
- package/lib/crypto/algorithms/olm.d.ts +0 -5
- package/lib/crypto/algorithms/olm.d.ts.map +0 -1
- package/lib/crypto/algorithms/olm.js +0 -299
- package/lib/crypto/algorithms/olm.js.map +0 -1
- package/lib/crypto/api.d.ts +0 -32
- package/lib/crypto/api.d.ts.map +0 -1
- package/lib/crypto/api.js +0 -22
- package/lib/crypto/api.js.map +0 -1
- package/lib/crypto/backup.d.ts +0 -227
- package/lib/crypto/backup.d.ts.map +0 -1
- package/lib/crypto/backup.js +0 -824
- package/lib/crypto/backup.js.map +0 -1
- package/lib/crypto/crypto.d.ts +0 -3
- package/lib/crypto/crypto.d.ts.map +0 -1
- package/lib/crypto/crypto.js +0 -19
- package/lib/crypto/crypto.js.map +0 -1
- package/lib/crypto/dehydration.d.ts +0 -34
- package/lib/crypto/dehydration.d.ts.map +0 -1
- package/lib/crypto/dehydration.js +0 -252
- package/lib/crypto/dehydration.js.map +0 -1
- package/lib/crypto/device-converter.d.ts +0 -9
- package/lib/crypto/device-converter.d.ts.map +0 -1
- package/lib/crypto/device-converter.js +0 -42
- package/lib/crypto/device-converter.js.map +0 -1
- package/lib/crypto/deviceinfo.d.ts +0 -99
- package/lib/crypto/deviceinfo.d.ts.map +0 -1
- package/lib/crypto/deviceinfo.js +0 -148
- package/lib/crypto/deviceinfo.js.map +0 -1
- package/lib/crypto/index.d.ts +0 -1210
- package/lib/crypto/index.d.ts.map +0 -1
- package/lib/crypto/index.js +0 -4101
- package/lib/crypto/index.js.map +0 -1
- package/lib/crypto/key_passphrase.d.ts +0 -14
- package/lib/crypto/key_passphrase.d.ts.map +0 -1
- package/lib/crypto/key_passphrase.js +0 -44
- package/lib/crypto/key_passphrase.js.map +0 -1
- package/lib/crypto/keybackup.d.ts +0 -18
- package/lib/crypto/keybackup.d.ts.map +0 -1
- package/lib/crypto/keybackup.js +0 -1
- package/lib/crypto/keybackup.js.map +0 -1
- package/lib/crypto/olmlib.d.ts +0 -129
- package/lib/crypto/olmlib.d.ts.map +0 -1
- package/lib/crypto/olmlib.js +0 -492
- package/lib/crypto/olmlib.js.map +0 -1
- package/lib/crypto/recoverykey.d.ts +0 -2
- package/lib/crypto/recoverykey.d.ts.map +0 -1
- package/lib/crypto/recoverykey.js +0 -19
- package/lib/crypto/recoverykey.js.map +0 -1
- package/lib/crypto/store/base.d.ts +0 -252
- package/lib/crypto/store/base.d.ts.map +0 -1
- package/lib/crypto/store/base.js +0 -64
- package/lib/crypto/store/base.js.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts +0 -187
- package/lib/crypto/store/indexeddb-crypto-store-backend.d.ts.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store-backend.js +0 -1145
- package/lib/crypto/store/indexeddb-crypto-store-backend.js.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store.d.ts +0 -432
- package/lib/crypto/store/indexeddb-crypto-store.d.ts.map +0 -1
- package/lib/crypto/store/indexeddb-crypto-store.js +0 -728
- package/lib/crypto/store/indexeddb-crypto-store.js.map +0 -1
- package/lib/crypto/store/localStorage-crypto-store.d.ts +0 -119
- package/lib/crypto/store/localStorage-crypto-store.d.ts.map +0 -1
- package/lib/crypto/store/localStorage-crypto-store.js +0 -531
- package/lib/crypto/store/localStorage-crypto-store.js.map +0 -1
- package/lib/crypto/store/memory-crypto-store.d.ts +0 -215
- package/lib/crypto/store/memory-crypto-store.d.ts.map +0 -1
- package/lib/crypto/store/memory-crypto-store.js +0 -622
- package/lib/crypto/store/memory-crypto-store.js.map +0 -1
- package/lib/crypto/verification/Base.d.ts +0 -105
- package/lib/crypto/verification/Base.d.ts.map +0 -1
- package/lib/crypto/verification/Base.js +0 -372
- package/lib/crypto/verification/Base.js.map +0 -1
- package/lib/crypto/verification/Error.d.ts +0 -35
- package/lib/crypto/verification/Error.d.ts.map +0 -1
- package/lib/crypto/verification/Error.js +0 -86
- package/lib/crypto/verification/Error.js.map +0 -1
- package/lib/crypto/verification/IllegalMethod.d.ts +0 -15
- package/lib/crypto/verification/IllegalMethod.d.ts.map +0 -1
- package/lib/crypto/verification/IllegalMethod.js +0 -43
- package/lib/crypto/verification/IllegalMethod.js.map +0 -1
- package/lib/crypto/verification/QRCode.d.ts +0 -51
- package/lib/crypto/verification/QRCode.d.ts.map +0 -1
- package/lib/crypto/verification/QRCode.js +0 -277
- package/lib/crypto/verification/QRCode.js.map +0 -1
- package/lib/crypto/verification/SAS.d.ts +0 -27
- package/lib/crypto/verification/SAS.d.ts.map +0 -1
- package/lib/crypto/verification/SAS.js +0 -485
- package/lib/crypto/verification/SAS.js.map +0 -1
- package/lib/crypto/verification/SASDecimal.d.ts +0 -8
- package/lib/crypto/verification/SASDecimal.d.ts.map +0 -1
- package/lib/crypto/verification/SASDecimal.js +0 -34
- package/lib/crypto/verification/SASDecimal.js.map +0 -1
- package/lib/crypto/verification/request/Channel.d.ts +0 -18
- package/lib/crypto/verification/request/Channel.d.ts.map +0 -1
- package/lib/crypto/verification/request/Channel.js +0 -1
- package/lib/crypto/verification/request/Channel.js.map +0 -1
- package/lib/crypto/verification/request/InRoomChannel.d.ts +0 -113
- package/lib/crypto/verification/request/InRoomChannel.d.ts.map +0 -1
- package/lib/crypto/verification/request/InRoomChannel.js +0 -351
- package/lib/crypto/verification/request/InRoomChannel.js.map +0 -1
- package/lib/crypto/verification/request/ToDeviceChannel.d.ts +0 -105
- package/lib/crypto/verification/request/ToDeviceChannel.d.ts.map +0 -1
- package/lib/crypto/verification/request/ToDeviceChannel.js +0 -328
- package/lib/crypto/verification/request/ToDeviceChannel.js.map +0 -1
- package/lib/crypto/verification/request/VerificationRequest.d.ts +0 -227
- package/lib/crypto/verification/request/VerificationRequest.d.ts.map +0 -1
- package/lib/crypto/verification/request/VerificationRequest.js +0 -937
- package/lib/crypto/verification/request/VerificationRequest.js.map +0 -1
- package/lib/crypto-api/CryptoEvent.d.ts +0 -69
- package/lib/crypto-api/CryptoEvent.d.ts.map +0 -1
- package/lib/crypto-api/CryptoEvent.js +0 -33
- package/lib/crypto-api/CryptoEvent.js.map +0 -1
- package/lib/crypto-api/CryptoEventHandlerMap.d.ts +0 -16
- package/lib/crypto-api/CryptoEventHandlerMap.d.ts.map +0 -1
- package/lib/crypto-api/CryptoEventHandlerMap.js +0 -22
- package/lib/crypto-api/CryptoEventHandlerMap.js.map +0 -1
- package/lib/crypto-api/index.d.ts +0 -978
- package/lib/crypto-api/index.d.ts.map +0 -1
- package/lib/crypto-api/index.js +0 -304
- package/lib/crypto-api/index.js.map +0 -1
- package/lib/crypto-api/key-passphrase.d.ts +0 -11
- package/lib/crypto-api/key-passphrase.d.ts.map +0 -1
- package/lib/crypto-api/key-passphrase.js +0 -51
- package/lib/crypto-api/key-passphrase.js.map +0 -1
- package/lib/crypto-api/keybackup.d.ts +0 -88
- package/lib/crypto-api/keybackup.d.ts.map +0 -1
- package/lib/crypto-api/keybackup.js +0 -1
- package/lib/crypto-api/keybackup.js.map +0 -1
- package/lib/crypto-api/recovery-key.d.ts +0 -11
- package/lib/crypto-api/recovery-key.d.ts.map +0 -1
- package/lib/crypto-api/recovery-key.js +0 -65
- package/lib/crypto-api/recovery-key.js.map +0 -1
- package/lib/crypto-api/verification.d.ts +0 -344
- package/lib/crypto-api/verification.d.ts.map +0 -1
- package/lib/crypto-api/verification.js +0 -91
- package/lib/crypto-api/verification.js.map +0 -1
- package/lib/matrixrtc/CallMembership.d.ts +0 -66
- package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
- package/lib/matrixrtc/CallMembership.js +0 -197
- package/lib/matrixrtc/CallMembership.js.map +0 -1
- package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
- package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
- package/lib/matrixrtc/LivekitFocus.js +0 -20
- package/lib/matrixrtc/LivekitFocus.js.map +0 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
- package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
- package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
- package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
- package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
- package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
- package/lib/matrixrtc/focus.d.ts +0 -10
- package/lib/matrixrtc/focus.d.ts.map +0 -1
- package/lib/matrixrtc/focus.js +0 -1
- package/lib/matrixrtc/focus.js.map +0 -1
- package/lib/matrixrtc/index.d.ts +0 -7
- package/lib/matrixrtc/index.d.ts.map +0 -1
- package/lib/matrixrtc/index.js +0 -21
- package/lib/matrixrtc/index.js.map +0 -1
- package/lib/matrixrtc/types.d.ts +0 -19
- package/lib/matrixrtc/types.d.ts.map +0 -1
- package/lib/matrixrtc/types.js +0 -1
- package/lib/matrixrtc/types.js.map +0 -1
- package/lib/rendezvous/MSC4108SignInWithQR.d.ts +0 -112
- package/lib/rendezvous/MSC4108SignInWithQR.d.ts.map +0 -1
- package/lib/rendezvous/MSC4108SignInWithQR.js +0 -392
- package/lib/rendezvous/MSC4108SignInWithQR.js.map +0 -1
- package/lib/rendezvous/RendezvousChannel.d.ts +0 -27
- package/lib/rendezvous/RendezvousChannel.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousChannel.js +0 -1
- package/lib/rendezvous/RendezvousChannel.js.map +0 -1
- package/lib/rendezvous/RendezvousCode.d.ts +0 -9
- package/lib/rendezvous/RendezvousCode.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousCode.js +0 -1
- package/lib/rendezvous/RendezvousCode.js.map +0 -1
- package/lib/rendezvous/RendezvousError.d.ts +0 -6
- package/lib/rendezvous/RendezvousError.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousError.js +0 -23
- package/lib/rendezvous/RendezvousError.js.map +0 -1
- package/lib/rendezvous/RendezvousFailureReason.d.ts +0 -31
- package/lib/rendezvous/RendezvousFailureReason.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousFailureReason.js +0 -38
- package/lib/rendezvous/RendezvousFailureReason.js.map +0 -1
- package/lib/rendezvous/RendezvousIntent.d.ts +0 -5
- package/lib/rendezvous/RendezvousIntent.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousIntent.js +0 -22
- package/lib/rendezvous/RendezvousIntent.js.map +0 -1
- package/lib/rendezvous/RendezvousTransport.d.ts +0 -36
- package/lib/rendezvous/RendezvousTransport.d.ts.map +0 -1
- package/lib/rendezvous/RendezvousTransport.js +0 -1
- package/lib/rendezvous/RendezvousTransport.js.map +0 -1
- package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts +0 -58
- package/lib/rendezvous/channels/MSC4108SecureChannel.d.ts.map +0 -1
- package/lib/rendezvous/channels/MSC4108SecureChannel.js +0 -246
- package/lib/rendezvous/channels/MSC4108SecureChannel.js.map +0 -1
- package/lib/rendezvous/channels/index.d.ts +0 -2
- package/lib/rendezvous/channels/index.d.ts.map +0 -1
- package/lib/rendezvous/channels/index.js +0 -18
- package/lib/rendezvous/channels/index.js.map +0 -1
- package/lib/rendezvous/index.d.ts +0 -10
- package/lib/rendezvous/index.d.ts.map +0 -1
- package/lib/rendezvous/index.js +0 -23
- package/lib/rendezvous/index.js.map +0 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts +0 -61
- package/lib/rendezvous/transports/MSC4108RendezvousSession.d.ts.map +0 -1
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js +0 -253
- package/lib/rendezvous/transports/MSC4108RendezvousSession.js.map +0 -1
- package/lib/rendezvous/transports/index.d.ts +0 -2
- package/lib/rendezvous/transports/index.d.ts.map +0 -1
- package/lib/rendezvous/transports/index.js +0 -18
- package/lib/rendezvous/transports/index.js.map +0 -1
- package/lib/rust-crypto/CrossSigningIdentity.d.ts +0 -33
- package/lib/rust-crypto/CrossSigningIdentity.d.ts.map +0 -1
- package/lib/rust-crypto/CrossSigningIdentity.js +0 -157
- package/lib/rust-crypto/CrossSigningIdentity.js.map +0 -1
- package/lib/rust-crypto/DehydratedDeviceManager.d.ts +0 -98
- package/lib/rust-crypto/DehydratedDeviceManager.d.ts.map +0 -1
- package/lib/rust-crypto/DehydratedDeviceManager.js +0 -285
- package/lib/rust-crypto/DehydratedDeviceManager.js.map +0 -1
- package/lib/rust-crypto/KeyClaimManager.d.ts +0 -33
- package/lib/rust-crypto/KeyClaimManager.d.ts.map +0 -1
- package/lib/rust-crypto/KeyClaimManager.js +0 -82
- package/lib/rust-crypto/KeyClaimManager.js.map +0 -1
- package/lib/rust-crypto/OutgoingRequestProcessor.d.ts +0 -43
- package/lib/rust-crypto/OutgoingRequestProcessor.d.ts.map +0 -1
- package/lib/rust-crypto/OutgoingRequestProcessor.js +0 -195
- package/lib/rust-crypto/OutgoingRequestProcessor.js.map +0 -1
- package/lib/rust-crypto/OutgoingRequestsManager.d.ts +0 -47
- package/lib/rust-crypto/OutgoingRequestsManager.d.ts.map +0 -1
- package/lib/rust-crypto/OutgoingRequestsManager.js +0 -148
- package/lib/rust-crypto/OutgoingRequestsManager.js.map +0 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts +0 -120
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.d.ts.map +0 -1
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js +0 -467
- package/lib/rust-crypto/PerSessionKeyBackupDownloader.js.map +0 -1
- package/lib/rust-crypto/RoomEncryptor.d.ts +0 -98
- package/lib/rust-crypto/RoomEncryptor.d.ts.map +0 -1
- package/lib/rust-crypto/RoomEncryptor.js +0 -299
- package/lib/rust-crypto/RoomEncryptor.js.map +0 -1
- package/lib/rust-crypto/backup.d.ts +0 -254
- package/lib/rust-crypto/backup.d.ts.map +0 -1
- package/lib/rust-crypto/backup.js +0 -837
- package/lib/rust-crypto/backup.js.map +0 -1
- package/lib/rust-crypto/constants.d.ts +0 -3
- package/lib/rust-crypto/constants.d.ts.map +0 -1
- package/lib/rust-crypto/constants.js +0 -19
- package/lib/rust-crypto/constants.js.map +0 -1
- package/lib/rust-crypto/device-converter.d.ts +0 -28
- package/lib/rust-crypto/device-converter.d.ts.map +0 -1
- package/lib/rust-crypto/device-converter.js +0 -123
- package/lib/rust-crypto/device-converter.js.map +0 -1
- package/lib/rust-crypto/index.d.ts +0 -61
- package/lib/rust-crypto/index.d.ts.map +0 -1
- package/lib/rust-crypto/index.js +0 -152
- package/lib/rust-crypto/index.js.map +0 -1
- package/lib/rust-crypto/libolm_migration.d.ts +0 -81
- package/lib/rust-crypto/libolm_migration.d.ts.map +0 -1
- package/lib/rust-crypto/libolm_migration.js +0 -459
- package/lib/rust-crypto/libolm_migration.js.map +0 -1
- package/lib/rust-crypto/rust-crypto.d.ts +0 -556
- package/lib/rust-crypto/rust-crypto.d.ts.map +0 -1
- package/lib/rust-crypto/rust-crypto.js +0 -2016
- package/lib/rust-crypto/rust-crypto.js.map +0 -1
- package/lib/rust-crypto/secret-storage.d.ts +0 -22
- package/lib/rust-crypto/secret-storage.d.ts.map +0 -1
- package/lib/rust-crypto/secret-storage.js +0 -63
- package/lib/rust-crypto/secret-storage.js.map +0 -1
- package/lib/rust-crypto/verification.d.ts +0 -319
- package/lib/rust-crypto/verification.d.ts.map +0 -1
- package/lib/rust-crypto/verification.js +0 -816
- package/lib/rust-crypto/verification.js.map +0 -1
- package/lib/secret-storage.d.ts +0 -370
- package/lib/secret-storage.d.ts.map +0 -1
- package/lib/secret-storage.js +0 -466
- package/lib/secret-storage.js.map +0 -1
- package/lib/utils/decryptAESSecretStorageItem.d.ts +0 -12
- package/lib/utils/decryptAESSecretStorageItem.d.ts.map +0 -1
- package/lib/utils/decryptAESSecretStorageItem.js +0 -50
- package/lib/utils/decryptAESSecretStorageItem.js.map +0 -1
- package/lib/utils/encryptAESSecretStorageItem.d.ts +0 -16
- package/lib/utils/encryptAESSecretStorageItem.d.ts.map +0 -1
- package/lib/utils/encryptAESSecretStorageItem.js +0 -68
- package/lib/utils/encryptAESSecretStorageItem.js.map +0 -1
- package/lib/utils/internal/deriveKeys.d.ts +0 -10
- package/lib/utils/internal/deriveKeys.d.ts.map +0 -1
- package/lib/utils/internal/deriveKeys.js +0 -60
- package/lib/utils/internal/deriveKeys.js.map +0 -1
- package/lib/webrtc/audioContext.d.ts +0 -15
- package/lib/webrtc/audioContext.d.ts.map +0 -1
- package/lib/webrtc/audioContext.js +0 -46
- package/lib/webrtc/audioContext.js.map +0 -1
- package/lib/webrtc/call.d.ts +0 -560
- package/lib/webrtc/call.d.ts.map +0 -1
- package/lib/webrtc/call.js +0 -2541
- package/lib/webrtc/call.js.map +0 -1
- package/lib/webrtc/callEventHandler.d.ts +0 -37
- package/lib/webrtc/callEventHandler.d.ts.map +0 -1
- package/lib/webrtc/callEventHandler.js +0 -344
- package/lib/webrtc/callEventHandler.js.map +0 -1
- package/lib/webrtc/callEventTypes.d.ts +0 -73
- package/lib/webrtc/callEventTypes.d.ts.map +0 -1
- package/lib/webrtc/callEventTypes.js +0 -13
- package/lib/webrtc/callEventTypes.js.map +0 -1
- package/lib/webrtc/callFeed.d.ts +0 -128
- package/lib/webrtc/callFeed.d.ts.map +0 -1
- package/lib/webrtc/callFeed.js +0 -289
- package/lib/webrtc/callFeed.js.map +0 -1
- package/lib/webrtc/groupCall.d.ts +0 -323
- package/lib/webrtc/groupCall.d.ts.map +0 -1
- package/lib/webrtc/groupCall.js +0 -1337
- package/lib/webrtc/groupCall.js.map +0 -1
- package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
- package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
- package/lib/webrtc/groupCallEventHandler.js +0 -178
- package/lib/webrtc/groupCallEventHandler.js.map +0 -1
- package/lib/webrtc/mediaHandler.d.ts +0 -89
- package/lib/webrtc/mediaHandler.d.ts.map +0 -1
- package/lib/webrtc/mediaHandler.js +0 -437
- package/lib/webrtc/mediaHandler.js.map +0 -1
- package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
- package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
- package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
- package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
- package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
- package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
- package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
- package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
- package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
- package/lib/webrtc/stats/connectionStats.d.ts +0 -28
- package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStats.js +0 -26
- package/lib/webrtc/stats/connectionStats.js.map +0 -1
- package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
- package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
- package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
- package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
- package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
- package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
- package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
- package/lib/webrtc/stats/groupCallStats.js +0 -78
- package/lib/webrtc/stats/groupCallStats.js.map +0 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
- package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
- package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
- package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
- package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
- package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
- package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
- package/lib/webrtc/stats/statsReport.d.ts +0 -99
- package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
- package/lib/webrtc/stats/statsReport.js +0 -32
- package/lib/webrtc/stats/statsReport.js.map +0 -1
- package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
- package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
- package/lib/webrtc/stats/statsReportEmitter.js +0 -33
- package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
- package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
- package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
- package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
- package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
- package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/transportStats.d.ts +0 -11
- package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
- package/lib/webrtc/stats/transportStats.js +0 -1
- package/lib/webrtc/stats/transportStats.js.map +0 -1
- package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
- package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
- package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
- package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
- package/lib/webrtc/stats/valueFormatter.js +0 -25
- package/lib/webrtc/stats/valueFormatter.js.map +0 -1
- package/src/@types/AESEncryptedSecretStoragePayload.ts +0 -29
- package/src/@types/crypto.ts +0 -73
- package/src/@types/matrix-sdk-crypto-wasm.d.ts +0 -44
- package/src/common-crypto/CryptoBackend.ts +0 -302
- package/src/common-crypto/README.md +0 -4
- package/src/common-crypto/key-passphrase.ts +0 -43
- package/src/crypto/CrossSigning.ts +0 -773
- package/src/crypto/DeviceList.ts +0 -989
- package/src/crypto/EncryptionSetup.ts +0 -351
- package/src/crypto/OlmDevice.ts +0 -1500
- package/src/crypto/OutgoingRoomKeyRequestManager.ts +0 -485
- package/src/crypto/RoomList.ts +0 -70
- package/src/crypto/SecretSharing.ts +0 -240
- package/src/crypto/SecretStorage.ts +0 -136
- package/src/crypto/aes.ts +0 -23
- package/src/crypto/algorithms/base.ts +0 -236
- package/src/crypto/algorithms/index.ts +0 -20
- package/src/crypto/algorithms/megolm.ts +0 -2216
- package/src/crypto/algorithms/olm.ts +0 -381
- package/src/crypto/api.ts +0 -70
- package/src/crypto/backup.ts +0 -922
- package/src/crypto/crypto.ts +0 -18
- package/src/crypto/dehydration.ts +0 -272
- package/src/crypto/device-converter.ts +0 -45
- package/src/crypto/deviceinfo.ts +0 -158
- package/src/crypto/index.ts +0 -4418
- package/src/crypto/key_passphrase.ts +0 -42
- package/src/crypto/keybackup.ts +0 -47
- package/src/crypto/olmlib.ts +0 -539
- package/src/crypto/recoverykey.ts +0 -18
- package/src/crypto/store/base.ts +0 -348
- package/src/crypto/store/indexeddb-crypto-store-backend.ts +0 -1250
- package/src/crypto/store/indexeddb-crypto-store.ts +0 -845
- package/src/crypto/store/localStorage-crypto-store.ts +0 -579
- package/src/crypto/store/memory-crypto-store.ts +0 -680
- package/src/crypto/verification/Base.ts +0 -409
- package/src/crypto/verification/Error.ts +0 -76
- package/src/crypto/verification/IllegalMethod.ts +0 -50
- package/src/crypto/verification/QRCode.ts +0 -310
- package/src/crypto/verification/SAS.ts +0 -494
- package/src/crypto/verification/SASDecimal.ts +0 -37
- package/src/crypto/verification/request/Channel.ts +0 -34
- package/src/crypto/verification/request/InRoomChannel.ts +0 -371
- package/src/crypto/verification/request/ToDeviceChannel.ts +0 -354
- package/src/crypto/verification/request/VerificationRequest.ts +0 -976
- package/src/crypto-api/CryptoEvent.ts +0 -93
- package/src/crypto-api/CryptoEventHandlerMap.ts +0 -32
- package/src/crypto-api/index.ts +0 -1175
- package/src/crypto-api/key-passphrase.ts +0 -58
- package/src/crypto-api/keybackup.ts +0 -115
- package/src/crypto-api/recovery-key.ts +0 -69
- package/src/crypto-api/verification.ts +0 -408
- package/src/matrixrtc/CallMembership.ts +0 -247
- package/src/matrixrtc/LivekitFocus.ts +0 -39
- package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
- package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
- package/src/matrixrtc/focus.ts +0 -25
- package/src/matrixrtc/index.ts +0 -22
- package/src/matrixrtc/types.ts +0 -36
- package/src/rendezvous/MSC4108SignInWithQR.ts +0 -444
- package/src/rendezvous/RendezvousChannel.ts +0 -48
- package/src/rendezvous/RendezvousCode.ts +0 -25
- package/src/rendezvous/RendezvousError.ts +0 -26
- package/src/rendezvous/RendezvousFailureReason.ts +0 -49
- package/src/rendezvous/RendezvousIntent.ts +0 -20
- package/src/rendezvous/RendezvousTransport.ts +0 -58
- package/src/rendezvous/channels/MSC4108SecureChannel.ts +0 -270
- package/src/rendezvous/channels/index.ts +0 -17
- package/src/rendezvous/index.ts +0 -25
- package/src/rendezvous/transports/MSC4108RendezvousSession.ts +0 -270
- package/src/rendezvous/transports/index.ts +0 -17
- package/src/rust-crypto/CrossSigningIdentity.ts +0 -183
- package/src/rust-crypto/DehydratedDeviceManager.ts +0 -306
- package/src/rust-crypto/KeyClaimManager.ts +0 -86
- package/src/rust-crypto/OutgoingRequestProcessor.ts +0 -236
- package/src/rust-crypto/OutgoingRequestsManager.ts +0 -143
- package/src/rust-crypto/PerSessionKeyBackupDownloader.ts +0 -501
- package/src/rust-crypto/RoomEncryptor.ts +0 -352
- package/src/rust-crypto/backup.ts +0 -881
- package/src/rust-crypto/constants.ts +0 -18
- package/src/rust-crypto/device-converter.ts +0 -128
- package/src/rust-crypto/index.ts +0 -237
- package/src/rust-crypto/libolm_migration.ts +0 -530
- package/src/rust-crypto/rust-crypto.ts +0 -2205
- package/src/rust-crypto/secret-storage.ts +0 -60
- package/src/rust-crypto/verification.ts +0 -830
- package/src/secret-storage.ts +0 -693
- package/src/utils/decryptAESSecretStorageItem.ts +0 -54
- package/src/utils/encryptAESSecretStorageItem.ts +0 -73
- package/src/utils/internal/deriveKeys.ts +0 -63
- package/src/webrtc/audioContext.ts +0 -44
- package/src/webrtc/call.ts +0 -3074
- package/src/webrtc/callEventHandler.ts +0 -425
- package/src/webrtc/callEventTypes.ts +0 -93
- package/src/webrtc/callFeed.ts +0 -364
- package/src/webrtc/groupCall.ts +0 -1735
- package/src/webrtc/groupCallEventHandler.ts +0 -234
- package/src/webrtc/mediaHandler.ts +0 -484
- package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
- package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
- package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
- package/src/webrtc/stats/connectionStats.ts +0 -47
- package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
- package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
- package/src/webrtc/stats/groupCallStats.ts +0 -93
- package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
- package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
- package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
- package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
- package/src/webrtc/stats/statsReport.ts +0 -133
- package/src/webrtc/stats/statsReportEmitter.ts +0 -49
- package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
- package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
- package/src/webrtc/stats/transportStats.ts +0 -26
- package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
- package/src/webrtc/stats/valueFormatter.ts +0 -27
package/git-revision.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
7965381b15955f696af9f9e1a5c3414caf57a5f3
|
package/lib/@types/event.d.ts
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
import { NamespacedValue, UnstableValue } from "../NamespacedValue.ts";
|
2
2
|
import { PolicyRuleEventContent, RoomAvatarEventContent, RoomCanonicalAliasEventContent, RoomCreateEventContent, RoomEncryptionEventContent, RoomGuestAccessEventContent, RoomHistoryVisibilityEventContent, RoomJoinRulesEventContent, RoomMemberEventContent, RoomNameEventContent, RoomPinnedEventsEventContent, RoomPowerLevelsEventContent, RoomServerAclEventContent, RoomThirdPartyInviteEventContent, RoomTombstoneEventContent, RoomTopicEventContent, SpaceChildEventContent, SpaceParentEventContent } from "./state_events.ts";
|
3
|
-
import { ExperimentalGroupCallRoomMemberState, IGroupCallRoomMemberState, IGroupCallRoomState } from "../webrtc/groupCall.ts";
|
4
3
|
import { MSC3089EventContent } from "../models/MSC3089Branch.ts";
|
5
4
|
import { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from "./beacon.ts";
|
6
5
|
import { XOR } from "./common.ts";
|
7
6
|
import { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from "./events.ts";
|
8
|
-
import { MCallAnswer, MCallBase, MCallCandidates, MCallHangupReject, MCallInviteNegotiate, MCallReplacesEvent, MCallSelectAnswer, SDPStreamMetadata, SDPStreamMetadataKey } from "../webrtc/callEventTypes.ts";
|
9
|
-
import { EncryptionKeysEventContent, ICallNotifyContent } from "../matrixrtc/types.ts";
|
10
7
|
import { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from "./polls.ts";
|
11
|
-
import {
|
8
|
+
import { LocalNotificationSettings } from "./local_notifications.ts";
|
9
|
+
import { IPushRules } from "./PushRules.ts";
|
10
|
+
import { POLICIES_ACCOUNT_EVENT_TYPE } from "../models/invites-ignorer-types.ts";
|
12
11
|
export declare enum EventType {
|
13
12
|
RoomCanonicalAlias = "m.room.canonical_alias",
|
14
13
|
RoomCreate = "m.room.create",
|
@@ -209,19 +208,6 @@ export interface TimelineEvents {
|
|
209
208
|
[EventType.RoomMessage]: RoomMessageEventContent;
|
210
209
|
[EventType.Sticker]: StickerEventContent;
|
211
210
|
[EventType.Reaction]: ReactionEventContent;
|
212
|
-
[EventType.CallReplaces]: MCallReplacesEvent;
|
213
|
-
[EventType.CallAnswer]: MCallAnswer;
|
214
|
-
[EventType.CallSelectAnswer]: MCallSelectAnswer;
|
215
|
-
[EventType.CallNegotiate]: Omit<MCallInviteNegotiate, "offer">;
|
216
|
-
[EventType.CallInvite]: MCallInviteNegotiate;
|
217
|
-
[EventType.CallCandidates]: MCallCandidates;
|
218
|
-
[EventType.CallHangup]: MCallHangupReject;
|
219
|
-
[EventType.CallReject]: MCallHangupReject;
|
220
|
-
[EventType.CallSDPStreamMetadataChangedPrefix]: MCallBase & {
|
221
|
-
[SDPStreamMetadataKey]: SDPStreamMetadata;
|
222
|
-
};
|
223
|
-
[EventType.CallEncryptionKeysPrefix]: EncryptionKeysEventContent;
|
224
|
-
[EventType.CallNotify]: ICallNotifyContent;
|
225
211
|
[M_BEACON.name]: MBeaconEventContent;
|
226
212
|
[M_POLL_START.name]: PollStartEventContent;
|
227
213
|
[M_POLL_END.name]: PollEndEventContent;
|
@@ -250,9 +236,29 @@ export interface StateEvents {
|
|
250
236
|
[EventType.PolicyRuleUser]: XOR<PolicyRuleEventContent, {}>;
|
251
237
|
[EventType.PolicyRuleRoom]: XOR<PolicyRuleEventContent, {}>;
|
252
238
|
[EventType.PolicyRuleServer]: XOR<PolicyRuleEventContent, {}>;
|
253
|
-
[EventType.GroupCallPrefix]: IGroupCallRoomState;
|
254
|
-
[EventType.GroupCallMemberPrefix]: XOR<XOR<IGroupCallRoomMemberState, ExperimentalGroupCallRoomMemberState>, XOR<SessionMembershipData, {}>>;
|
255
239
|
[UNSTABLE_MSC3089_BRANCH.name]: MSC3089EventContent;
|
256
240
|
[M_BEACON_INFO.name]: MBeaconInfoEventContent;
|
257
241
|
}
|
242
|
+
/**
|
243
|
+
* Mapped type from event type to content type for all specified global account_data events.
|
244
|
+
*/
|
245
|
+
export interface AccountDataEvents {
|
246
|
+
[EventType.PushRules]: IPushRules;
|
247
|
+
[EventType.Direct]: {
|
248
|
+
[userId: string]: string[];
|
249
|
+
};
|
250
|
+
[EventType.IgnoredUserList]: {
|
251
|
+
[userId: string]: {};
|
252
|
+
};
|
253
|
+
"m.identity_server": {
|
254
|
+
base_url: string | null;
|
255
|
+
};
|
256
|
+
[key: `${typeof LOCAL_NOTIFICATION_SETTINGS_PREFIX.name}.${string}`]: LocalNotificationSettings;
|
257
|
+
[POLICIES_ACCOUNT_EVENT_TYPE.name]: {
|
258
|
+
[key: string]: any;
|
259
|
+
};
|
260
|
+
[POLICIES_ACCOUNT_EVENT_TYPE.altName]: {
|
261
|
+
[key: string]: any;
|
262
|
+
};
|
263
|
+
}
|
258
264
|
//# sourceMappingURL=event.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/@types/event.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACH,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,iCAAiC,EACjC,yBAAyB,EACzB,sBAAsB,EACtB,oBAAoB,EACpB,4BAA4B,EAC5B,2BAA2B,EAC3B,yBAAyB,EACzB,gCAAgC,EAChC,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/@types/event.ts"],"names":[],"mappings":"AAgBA,OAAO,EAA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
import { NamespacedValue, UnstableValue } from "../NamespacedValue.js";
|
18
18
|
import { M_BEACON, M_BEACON_INFO } from "./beacon.js";
|
19
19
|
import { M_POLL_END, M_POLL_START } from "./polls.js";
|
20
|
+
import { POLICIES_ACCOUNT_EVENT_TYPE } from "../models/invites-ignorer-types.js";
|
20
21
|
export var EventType = /*#__PURE__*/function (EventType) {
|
21
22
|
EventType["RoomCanonicalAlias"] = "m.room.canonical_alias";
|
22
23
|
EventType["RoomCreate"] = "m.room.create";
|
@@ -236,4 +237,8 @@ export var UNSIGNED_MEMBERSHIP_FIELD = new NamespacedValue("membership", "io.ele
|
|
236
237
|
/**
|
237
238
|
* Mapped type from event type to content type for all specified room state events.
|
238
239
|
*/
|
240
|
+
|
241
|
+
/**
|
242
|
+
* Mapped type from event type to content type for all specified global account_data events.
|
243
|
+
*/
|
239
244
|
//# sourceMappingURL=event.js.map
|
package/lib/@types/event.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"event.js","names":["NamespacedValue","UnstableValue","M_BEACON","M_BEACON_INFO","M_POLL_END","M_POLL_START","EventType","RelationType","MsgType","RoomCreateTypeField","RoomType","ToDeviceMessageId","UNSTABLE_MSC3088_PURPOSE","UNSTABLE_MSC3088_ENABLED","UNSTABLE_MSC3089_TREE_SUBTYPE","UNSTABLE_MSC3089_LEAF","UNSTABLE_MSC3089_BRANCH","UNSTABLE_MSC2716_MARKER","MSC3912_RELATION_BASED_REDACTIONS_PROP","UNSTABLE_ELEMENT_FUNCTIONAL_USERS","EVENT_VISIBILITY_CHANGE_TYPE","PUSHER_ENABLED","PUSHER_DEVICE_ID","LOCAL_NOTIFICATION_SETTINGS_PREFIX","UNSIGNED_THREAD_ID_FIELD","UNSIGNED_MEMBERSHIP_FIELD"],"sources":["../../src/@types/event.ts"],"sourcesContent":["/*\nCopyright 2020 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { NamespacedValue, UnstableValue } from \"../NamespacedValue.ts\";\nimport {\n PolicyRuleEventContent,\n RoomAvatarEventContent,\n RoomCanonicalAliasEventContent,\n RoomCreateEventContent,\n RoomEncryptionEventContent,\n RoomGuestAccessEventContent,\n RoomHistoryVisibilityEventContent,\n RoomJoinRulesEventContent,\n RoomMemberEventContent,\n RoomNameEventContent,\n RoomPinnedEventsEventContent,\n RoomPowerLevelsEventContent,\n RoomServerAclEventContent,\n RoomThirdPartyInviteEventContent,\n RoomTombstoneEventContent,\n RoomTopicEventContent,\n SpaceChildEventContent,\n SpaceParentEventContent,\n} from \"./state_events.ts\";\nimport {\n ExperimentalGroupCallRoomMemberState,\n IGroupCallRoomMemberState,\n IGroupCallRoomState,\n} from \"../webrtc/groupCall.ts\";\nimport { MSC3089EventContent } from \"../models/MSC3089Branch.ts\";\nimport { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from \"./beacon.ts\";\nimport { XOR } from \"./common.ts\";\nimport { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from \"./events.ts\";\nimport {\n MCallAnswer,\n MCallBase,\n MCallCandidates,\n MCallHangupReject,\n MCallInviteNegotiate,\n MCallReplacesEvent,\n MCallSelectAnswer,\n SDPStreamMetadata,\n SDPStreamMetadataKey,\n} from \"../webrtc/callEventTypes.ts\";\nimport { EncryptionKeysEventContent, ICallNotifyContent } from \"../matrixrtc/types.ts\";\nimport { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from \"./polls.ts\";\nimport { SessionMembershipData } from \"../matrixrtc/CallMembership.ts\";\n\nexport enum EventType {\n // Room state events\n RoomCanonicalAlias = \"m.room.canonical_alias\",\n RoomCreate = \"m.room.create\",\n RoomJoinRules = \"m.room.join_rules\",\n RoomMember = \"m.room.member\",\n RoomThirdPartyInvite = \"m.room.third_party_invite\",\n RoomPowerLevels = \"m.room.power_levels\",\n RoomName = \"m.room.name\",\n RoomTopic = \"m.room.topic\",\n RoomAvatar = \"m.room.avatar\",\n RoomPinnedEvents = \"m.room.pinned_events\",\n RoomEncryption = \"m.room.encryption\",\n RoomHistoryVisibility = \"m.room.history_visibility\",\n RoomGuestAccess = \"m.room.guest_access\",\n RoomServerAcl = \"m.room.server_acl\",\n RoomTombstone = \"m.room.tombstone\",\n RoomPredecessor = \"org.matrix.msc3946.room_predecessor\",\n\n // Moderation policy lists\n PolicyRuleUser = \"m.policy.rule.user\",\n PolicyRuleRoom = \"m.policy.rule.room\",\n PolicyRuleServer = \"m.policy.rule.server\",\n\n SpaceChild = \"m.space.child\",\n SpaceParent = \"m.space.parent\",\n\n // Room timeline events\n RoomRedaction = \"m.room.redaction\",\n RoomMessage = \"m.room.message\",\n RoomMessageEncrypted = \"m.room.encrypted\",\n Sticker = \"m.sticker\",\n CallInvite = \"m.call.invite\",\n CallCandidates = \"m.call.candidates\",\n CallAnswer = \"m.call.answer\",\n CallHangup = \"m.call.hangup\",\n CallReject = \"m.call.reject\",\n CallSelectAnswer = \"m.call.select_answer\",\n CallNegotiate = \"m.call.negotiate\",\n CallSDPStreamMetadataChanged = \"m.call.sdp_stream_metadata_changed\",\n CallSDPStreamMetadataChangedPrefix = \"org.matrix.call.sdp_stream_metadata_changed\",\n CallReplaces = \"m.call.replaces\",\n CallAssertedIdentity = \"m.call.asserted_identity\",\n CallAssertedIdentityPrefix = \"org.matrix.call.asserted_identity\",\n CallEncryptionKeysPrefix = \"io.element.call.encryption_keys\",\n KeyVerificationRequest = \"m.key.verification.request\",\n KeyVerificationStart = \"m.key.verification.start\",\n KeyVerificationCancel = \"m.key.verification.cancel\",\n KeyVerificationMac = \"m.key.verification.mac\",\n KeyVerificationDone = \"m.key.verification.done\",\n KeyVerificationKey = \"m.key.verification.key\",\n KeyVerificationAccept = \"m.key.verification.accept\",\n // Not used directly - see READY_TYPE in VerificationRequest.\n KeyVerificationReady = \"m.key.verification.ready\",\n // use of this is discouraged https://matrix.org/docs/spec/client_server/r0.6.1#m-room-message-feedback\n RoomMessageFeedback = \"m.room.message.feedback\",\n Reaction = \"m.reaction\",\n PollStart = \"org.matrix.msc3381.poll.start\",\n\n // Room ephemeral events\n Typing = \"m.typing\",\n Receipt = \"m.receipt\",\n Presence = \"m.presence\",\n\n // Room account_data events\n FullyRead = \"m.fully_read\",\n Tag = \"m.tag\",\n SpaceOrder = \"org.matrix.msc3230.space_order\", // MSC3230\n\n // User account_data events\n PushRules = \"m.push_rules\",\n Direct = \"m.direct\",\n IgnoredUserList = \"m.ignored_user_list\",\n\n // to_device events\n RoomKey = \"m.room_key\",\n RoomKeyRequest = \"m.room_key_request\",\n ForwardedRoomKey = \"m.forwarded_room_key\",\n Dummy = \"m.dummy\",\n\n // Group call events\n GroupCallPrefix = \"org.matrix.msc3401.call\",\n GroupCallMemberPrefix = \"org.matrix.msc3401.call.member\",\n\n // MatrixRTC events\n CallNotify = \"org.matrix.msc4075.call.notify\",\n}\n\nexport enum RelationType {\n Annotation = \"m.annotation\",\n Replace = \"m.replace\",\n Reference = \"m.reference\",\n\n // Don't use this yet: it's only the stable version. The code still assumes we support the unstable prefix and,\n // moreover, our tests currently use the unstable prefix. Use THREAD_RELATION_TYPE.name.\n // Once we support *only* the stable prefix, THREAD_RELATION_TYPE can die and we can switch to this.\n Thread = \"m.thread\",\n}\n\nexport enum MsgType {\n Text = \"m.text\",\n Emote = \"m.emote\",\n Notice = \"m.notice\",\n Image = \"m.image\",\n File = \"m.file\",\n Audio = \"m.audio\",\n Location = \"m.location\",\n Video = \"m.video\",\n KeyVerificationRequest = \"m.key.verification.request\",\n}\n\nexport const RoomCreateTypeField = \"type\";\n\nexport enum RoomType {\n Space = \"m.space\",\n UnstableCall = \"org.matrix.msc3417.call\",\n ElementVideo = \"io.element.video\",\n}\n\nexport const ToDeviceMessageId = \"org.matrix.msgid\";\n\n/**\n * Identifier for an [MSC3088](https://github.com/matrix-org/matrix-doc/pull/3088)\n * room purpose. Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport const UNSTABLE_MSC3088_PURPOSE = new UnstableValue(\"m.room.purpose\", \"org.matrix.msc3088.purpose\");\n\n/**\n * Enabled flag for an [MSC3088](https://github.com/matrix-org/matrix-doc/pull/3088)\n * room purpose. Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport const UNSTABLE_MSC3088_ENABLED = new UnstableValue(\"m.enabled\", \"org.matrix.msc3088.enabled\");\n\n/**\n * Subtype for an [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room.\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n */\nexport const UNSTABLE_MSC3089_TREE_SUBTYPE = new UnstableValue(\"m.data_tree\", \"org.matrix.msc3089.data_tree\");\n\n/**\n * Leaf type for an event in a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room.\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n */\nexport const UNSTABLE_MSC3089_LEAF = new UnstableValue(\"m.leaf\", \"org.matrix.msc3089.leaf\");\n\n/**\n * Branch (Leaf Reference) type for the index approach in a\n * [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room. Note that this reference is\n * UNSTABLE and subject to breaking changes, including its eventual removal.\n */\nexport const UNSTABLE_MSC3089_BRANCH = new UnstableValue(\"m.branch\", \"org.matrix.msc3089.branch\");\n\n/**\n * Marker event type to point back at imported historical content in a room. See\n * [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716).\n * Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport const UNSTABLE_MSC2716_MARKER = new UnstableValue(\"m.room.marker\", \"org.matrix.msc2716.marker\");\n\n/**\n * Name of the request property for relation based redactions.\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/3912}\n */\nexport const MSC3912_RELATION_BASED_REDACTIONS_PROP = new UnstableValue(\n \"with_rel_types\",\n \"org.matrix.msc3912.with_relations\",\n);\n\n/**\n * Functional members type for declaring a purpose of room members (e.g. helpful bots).\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n *\n * Schema (TypeScript):\n * ```\n * {\n * service_members?: string[]\n * }\n * ```\n *\n * @example\n * ```\n * {\n * \"service_members\": [\n * \"@helperbot:localhost\",\n * \"@reminderbot:alice.tdl\"\n * ]\n * }\n * ```\n */\nexport const UNSTABLE_ELEMENT_FUNCTIONAL_USERS = new UnstableValue(\n \"io.element.functional_members\",\n \"io.element.functional_members\",\n);\n\n/**\n * A type of message that affects visibility of a message,\n * as per https://github.com/matrix-org/matrix-doc/pull/3531\n *\n * @experimental\n */\nexport const EVENT_VISIBILITY_CHANGE_TYPE = new UnstableValue(\"m.visibility\", \"org.matrix.msc3531.visibility\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3881\n *\n * @experimental\n */\nexport const PUSHER_ENABLED = new UnstableValue(\"enabled\", \"org.matrix.msc3881.enabled\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3881\n *\n * @experimental\n */\nexport const PUSHER_DEVICE_ID = new UnstableValue(\"device_id\", \"org.matrix.msc3881.device_id\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3890\n *\n * @experimental\n */\nexport const LOCAL_NOTIFICATION_SETTINGS_PREFIX = new UnstableValue(\n \"m.local_notification_settings\",\n \"org.matrix.msc3890.local_notification_settings\",\n);\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/4023\n *\n * @experimental\n */\nexport const UNSIGNED_THREAD_ID_FIELD = new UnstableValue(\"thread_id\", \"org.matrix.msc4023.thread_id\");\n\n/**\n * https://github.com/matrix-org/matrix-spec-proposals/pull/4115\n *\n * @experimental\n */\nexport const UNSIGNED_MEMBERSHIP_FIELD = new NamespacedValue(\"membership\", \"io.element.msc4115.membership\");\n\n/**\n * Mapped type from event type to content type for all specified non-state room events.\n */\nexport interface TimelineEvents {\n [EventType.RoomMessage]: RoomMessageEventContent;\n [EventType.Sticker]: StickerEventContent;\n [EventType.Reaction]: ReactionEventContent;\n [EventType.CallReplaces]: MCallReplacesEvent;\n [EventType.CallAnswer]: MCallAnswer;\n [EventType.CallSelectAnswer]: MCallSelectAnswer;\n [EventType.CallNegotiate]: Omit<MCallInviteNegotiate, \"offer\">;\n [EventType.CallInvite]: MCallInviteNegotiate;\n [EventType.CallCandidates]: MCallCandidates;\n [EventType.CallHangup]: MCallHangupReject;\n [EventType.CallReject]: MCallHangupReject;\n [EventType.CallSDPStreamMetadataChangedPrefix]: MCallBase & { [SDPStreamMetadataKey]: SDPStreamMetadata };\n [EventType.CallEncryptionKeysPrefix]: EncryptionKeysEventContent;\n [EventType.CallNotify]: ICallNotifyContent;\n [M_BEACON.name]: MBeaconEventContent;\n [M_POLL_START.name]: PollStartEventContent;\n [M_POLL_END.name]: PollEndEventContent;\n}\n\n/**\n * Mapped type from event type to content type for all specified room state events.\n */\nexport interface StateEvents {\n [EventType.RoomCanonicalAlias]: RoomCanonicalAliasEventContent;\n [EventType.RoomCreate]: RoomCreateEventContent;\n [EventType.RoomJoinRules]: RoomJoinRulesEventContent;\n [EventType.RoomMember]: RoomMemberEventContent;\n // XXX: Spec says this event has 3 required fields but kicking such an invitation requires sending `{}`\n [EventType.RoomThirdPartyInvite]: XOR<RoomThirdPartyInviteEventContent, {}>;\n [EventType.RoomPowerLevels]: RoomPowerLevelsEventContent;\n [EventType.RoomName]: RoomNameEventContent;\n [EventType.RoomTopic]: RoomTopicEventContent;\n [EventType.RoomAvatar]: RoomAvatarEventContent;\n [EventType.RoomPinnedEvents]: RoomPinnedEventsEventContent;\n [EventType.RoomEncryption]: RoomEncryptionEventContent;\n [EventType.RoomHistoryVisibility]: RoomHistoryVisibilityEventContent;\n [EventType.RoomGuestAccess]: RoomGuestAccessEventContent;\n [EventType.RoomServerAcl]: RoomServerAclEventContent;\n [EventType.RoomTombstone]: RoomTombstoneEventContent;\n [EventType.SpaceChild]: SpaceChildEventContent;\n [EventType.SpaceParent]: SpaceParentEventContent;\n\n [EventType.PolicyRuleUser]: XOR<PolicyRuleEventContent, {}>;\n [EventType.PolicyRuleRoom]: XOR<PolicyRuleEventContent, {}>;\n [EventType.PolicyRuleServer]: XOR<PolicyRuleEventContent, {}>;\n\n // MSC3401\n [EventType.GroupCallPrefix]: IGroupCallRoomState;\n [EventType.GroupCallMemberPrefix]: XOR<\n XOR<IGroupCallRoomMemberState, ExperimentalGroupCallRoomMemberState>,\n XOR<SessionMembershipData, {}>\n >;\n\n // MSC3089\n [UNSTABLE_MSC3089_BRANCH.name]: MSC3089EventContent;\n\n // MSC3672\n [M_BEACON_INFO.name]: MBeaconInfoEventContent;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,EAAEC,aAAa,QAAQ,uBAAuB;AA2BtE,SAASC,QAAQ,EAAEC,aAAa,QAAsD,aAAa;AAenG,SAASC,UAAU,EAAEC,YAAY,QAAoD,YAAY;AAGjG,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS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C;;AAE3G;AACA;AACA;;AAqBA;AACA;AACA","ignoreList":[]}
|
1
|
+
{"version":3,"file":"event.js","names":["NamespacedValue","UnstableValue","M_BEACON","M_BEACON_INFO","M_POLL_END","M_POLL_START","POLICIES_ACCOUNT_EVENT_TYPE","EventType","RelationType","MsgType","RoomCreateTypeField","RoomType","ToDeviceMessageId","UNSTABLE_MSC3088_PURPOSE","UNSTABLE_MSC3088_ENABLED","UNSTABLE_MSC3089_TREE_SUBTYPE","UNSTABLE_MSC3089_LEAF","UNSTABLE_MSC3089_BRANCH","UNSTABLE_MSC2716_MARKER","MSC3912_RELATION_BASED_REDACTIONS_PROP","UNSTABLE_ELEMENT_FUNCTIONAL_USERS","EVENT_VISIBILITY_CHANGE_TYPE","PUSHER_ENABLED","PUSHER_DEVICE_ID","LOCAL_NOTIFICATION_SETTINGS_PREFIX","UNSIGNED_THREAD_ID_FIELD","UNSIGNED_MEMBERSHIP_FIELD"],"sources":["../../src/@types/event.ts"],"sourcesContent":["/*\nCopyright 2020 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { NamespacedValue, UnstableValue } from \"../NamespacedValue.ts\";\nimport {\n PolicyRuleEventContent,\n RoomAvatarEventContent,\n RoomCanonicalAliasEventContent,\n RoomCreateEventContent,\n RoomEncryptionEventContent,\n RoomGuestAccessEventContent,\n RoomHistoryVisibilityEventContent,\n RoomJoinRulesEventContent,\n RoomMemberEventContent,\n RoomNameEventContent,\n RoomPinnedEventsEventContent,\n RoomPowerLevelsEventContent,\n RoomServerAclEventContent,\n RoomThirdPartyInviteEventContent,\n RoomTombstoneEventContent,\n RoomTopicEventContent,\n SpaceChildEventContent,\n SpaceParentEventContent,\n} from \"./state_events.ts\";\n\nimport { MSC3089EventContent } from \"../models/MSC3089Branch.ts\";\nimport { M_BEACON, M_BEACON_INFO, MBeaconEventContent, MBeaconInfoEventContent } from \"./beacon.ts\";\nimport { XOR } from \"./common.ts\";\nimport { ReactionEventContent, RoomMessageEventContent, StickerEventContent } from \"./events.ts\";\n\nimport { M_POLL_END, M_POLL_START, PollEndEventContent, PollStartEventContent } from \"./polls.ts\";\nimport { LocalNotificationSettings } from \"./local_notifications.ts\";\nimport { IPushRules } from \"./PushRules.ts\";\nimport { POLICIES_ACCOUNT_EVENT_TYPE } from \"../models/invites-ignorer-types.ts\";\n\nexport enum EventType {\n // Room state events\n RoomCanonicalAlias = \"m.room.canonical_alias\",\n RoomCreate = \"m.room.create\",\n RoomJoinRules = \"m.room.join_rules\",\n RoomMember = \"m.room.member\",\n RoomThirdPartyInvite = \"m.room.third_party_invite\",\n RoomPowerLevels = \"m.room.power_levels\",\n RoomName = \"m.room.name\",\n RoomTopic = \"m.room.topic\",\n RoomAvatar = \"m.room.avatar\",\n RoomPinnedEvents = \"m.room.pinned_events\",\n RoomEncryption = \"m.room.encryption\",\n RoomHistoryVisibility = \"m.room.history_visibility\",\n RoomGuestAccess = \"m.room.guest_access\",\n RoomServerAcl = \"m.room.server_acl\",\n RoomTombstone = \"m.room.tombstone\",\n RoomPredecessor = \"org.matrix.msc3946.room_predecessor\",\n\n // Moderation policy lists\n PolicyRuleUser = \"m.policy.rule.user\",\n PolicyRuleRoom = \"m.policy.rule.room\",\n PolicyRuleServer = \"m.policy.rule.server\",\n\n SpaceChild = \"m.space.child\",\n SpaceParent = \"m.space.parent\",\n\n // Room timeline events\n RoomRedaction = \"m.room.redaction\",\n RoomMessage = \"m.room.message\",\n RoomMessageEncrypted = \"m.room.encrypted\",\n Sticker = \"m.sticker\",\n CallInvite = \"m.call.invite\",\n CallCandidates = \"m.call.candidates\",\n CallAnswer = \"m.call.answer\",\n CallHangup = \"m.call.hangup\",\n CallReject = \"m.call.reject\",\n CallSelectAnswer = \"m.call.select_answer\",\n CallNegotiate = \"m.call.negotiate\",\n CallSDPStreamMetadataChanged = \"m.call.sdp_stream_metadata_changed\",\n CallSDPStreamMetadataChangedPrefix = \"org.matrix.call.sdp_stream_metadata_changed\",\n CallReplaces = \"m.call.replaces\",\n CallAssertedIdentity = \"m.call.asserted_identity\",\n CallAssertedIdentityPrefix = \"org.matrix.call.asserted_identity\",\n CallEncryptionKeysPrefix = \"io.element.call.encryption_keys\",\n KeyVerificationRequest = \"m.key.verification.request\",\n KeyVerificationStart = \"m.key.verification.start\",\n KeyVerificationCancel = \"m.key.verification.cancel\",\n KeyVerificationMac = \"m.key.verification.mac\",\n KeyVerificationDone = \"m.key.verification.done\",\n KeyVerificationKey = \"m.key.verification.key\",\n KeyVerificationAccept = \"m.key.verification.accept\",\n // Not used directly - see READY_TYPE in VerificationRequest.\n KeyVerificationReady = \"m.key.verification.ready\",\n // use of this is discouraged https://matrix.org/docs/spec/client_server/r0.6.1#m-room-message-feedback\n RoomMessageFeedback = \"m.room.message.feedback\",\n Reaction = \"m.reaction\",\n PollStart = \"org.matrix.msc3381.poll.start\",\n\n // Room ephemeral events\n Typing = \"m.typing\",\n Receipt = \"m.receipt\",\n Presence = \"m.presence\",\n\n // Room account_data events\n FullyRead = \"m.fully_read\",\n Tag = \"m.tag\",\n SpaceOrder = \"org.matrix.msc3230.space_order\", // MSC3230\n\n // User account_data events\n PushRules = \"m.push_rules\",\n Direct = \"m.direct\",\n IgnoredUserList = \"m.ignored_user_list\",\n\n // to_device events\n RoomKey = \"m.room_key\",\n RoomKeyRequest = \"m.room_key_request\",\n ForwardedRoomKey = \"m.forwarded_room_key\",\n Dummy = \"m.dummy\",\n\n // Group call events\n GroupCallPrefix = \"org.matrix.msc3401.call\",\n GroupCallMemberPrefix = \"org.matrix.msc3401.call.member\",\n\n // MatrixRTC events\n CallNotify = \"org.matrix.msc4075.call.notify\",\n}\n\nexport enum RelationType {\n Annotation = \"m.annotation\",\n Replace = \"m.replace\",\n Reference = \"m.reference\",\n\n // Don't use this yet: it's only the stable version. The code still assumes we support the unstable prefix and,\n // moreover, our tests currently use the unstable prefix. Use THREAD_RELATION_TYPE.name.\n // Once we support *only* the stable prefix, THREAD_RELATION_TYPE can die and we can switch to this.\n Thread = \"m.thread\",\n}\n\nexport enum MsgType {\n Text = \"m.text\",\n Emote = \"m.emote\",\n Notice = \"m.notice\",\n Image = \"m.image\",\n File = \"m.file\",\n Audio = \"m.audio\",\n Location = \"m.location\",\n Video = \"m.video\",\n KeyVerificationRequest = \"m.key.verification.request\",\n}\n\nexport const RoomCreateTypeField = \"type\";\n\nexport enum RoomType {\n Space = \"m.space\",\n UnstableCall = \"org.matrix.msc3417.call\",\n ElementVideo = \"io.element.video\",\n}\n\nexport const ToDeviceMessageId = \"org.matrix.msgid\";\n\n/**\n * Identifier for an [MSC3088](https://github.com/matrix-org/matrix-doc/pull/3088)\n * room purpose. Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport const UNSTABLE_MSC3088_PURPOSE = new UnstableValue(\"m.room.purpose\", \"org.matrix.msc3088.purpose\");\n\n/**\n * Enabled flag for an [MSC3088](https://github.com/matrix-org/matrix-doc/pull/3088)\n * room purpose. Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport const UNSTABLE_MSC3088_ENABLED = new UnstableValue(\"m.enabled\", \"org.matrix.msc3088.enabled\");\n\n/**\n * Subtype for an [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room.\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n */\nexport const UNSTABLE_MSC3089_TREE_SUBTYPE = new UnstableValue(\"m.data_tree\", \"org.matrix.msc3089.data_tree\");\n\n/**\n * Leaf type for an event in a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room.\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n */\nexport const UNSTABLE_MSC3089_LEAF = new UnstableValue(\"m.leaf\", \"org.matrix.msc3089.leaf\");\n\n/**\n * Branch (Leaf Reference) type for the index approach in a\n * [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) space-room. Note that this reference is\n * UNSTABLE and subject to breaking changes, including its eventual removal.\n */\nexport const UNSTABLE_MSC3089_BRANCH = new UnstableValue(\"m.branch\", \"org.matrix.msc3089.branch\");\n\n/**\n * Marker event type to point back at imported historical content in a room. See\n * [MSC2716](https://github.com/matrix-org/matrix-spec-proposals/pull/2716).\n * Note that this reference is UNSTABLE and subject to breaking changes,\n * including its eventual removal.\n */\nexport const UNSTABLE_MSC2716_MARKER = new UnstableValue(\"m.room.marker\", \"org.matrix.msc2716.marker\");\n\n/**\n * Name of the request property for relation based redactions.\n * {@link https://github.com/matrix-org/matrix-spec-proposals/pull/3912}\n */\nexport const MSC3912_RELATION_BASED_REDACTIONS_PROP = new UnstableValue(\n \"with_rel_types\",\n \"org.matrix.msc3912.with_relations\",\n);\n\n/**\n * Functional members type for declaring a purpose of room members (e.g. helpful bots).\n * Note that this reference is UNSTABLE and subject to breaking changes, including its\n * eventual removal.\n *\n * Schema (TypeScript):\n * ```\n * {\n * service_members?: string[]\n * }\n * ```\n *\n * @example\n * ```\n * {\n * \"service_members\": [\n * \"@helperbot:localhost\",\n * \"@reminderbot:alice.tdl\"\n * ]\n * }\n * ```\n */\nexport const UNSTABLE_ELEMENT_FUNCTIONAL_USERS = new UnstableValue(\n \"io.element.functional_members\",\n \"io.element.functional_members\",\n);\n\n/**\n * A type of message that affects visibility of a message,\n * as per https://github.com/matrix-org/matrix-doc/pull/3531\n *\n * @experimental\n */\nexport const EVENT_VISIBILITY_CHANGE_TYPE = new UnstableValue(\"m.visibility\", \"org.matrix.msc3531.visibility\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3881\n *\n * @experimental\n */\nexport const PUSHER_ENABLED = new UnstableValue(\"enabled\", \"org.matrix.msc3881.enabled\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3881\n *\n * @experimental\n */\nexport const PUSHER_DEVICE_ID = new UnstableValue(\"device_id\", \"org.matrix.msc3881.device_id\");\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/3890\n *\n * @experimental\n */\nexport const LOCAL_NOTIFICATION_SETTINGS_PREFIX = new UnstableValue(\n \"m.local_notification_settings\",\n \"org.matrix.msc3890.local_notification_settings\",\n);\n\n/**\n * https://github.com/matrix-org/matrix-doc/pull/4023\n *\n * @experimental\n */\nexport const UNSIGNED_THREAD_ID_FIELD = new UnstableValue(\"thread_id\", \"org.matrix.msc4023.thread_id\");\n\n/**\n * https://github.com/matrix-org/matrix-spec-proposals/pull/4115\n *\n * @experimental\n */\nexport const UNSIGNED_MEMBERSHIP_FIELD = new NamespacedValue(\"membership\", \"io.element.msc4115.membership\");\n\n/**\n * Mapped type from event type to content type for all specified non-state room events.\n */\nexport interface TimelineEvents {\n [EventType.RoomMessage]: RoomMessageEventContent;\n [EventType.Sticker]: StickerEventContent;\n [EventType.Reaction]: ReactionEventContent;\n [M_BEACON.name]: MBeaconEventContent;\n [M_POLL_START.name]: PollStartEventContent;\n [M_POLL_END.name]: PollEndEventContent;\n}\n\n/**\n * Mapped type from event type to content type for all specified room state events.\n */\nexport interface StateEvents {\n [EventType.RoomCanonicalAlias]: RoomCanonicalAliasEventContent;\n [EventType.RoomCreate]: RoomCreateEventContent;\n [EventType.RoomJoinRules]: RoomJoinRulesEventContent;\n [EventType.RoomMember]: RoomMemberEventContent;\n // XXX: Spec says this event has 3 required fields but kicking such an invitation requires sending `{}`\n [EventType.RoomThirdPartyInvite]: XOR<RoomThirdPartyInviteEventContent, {}>;\n [EventType.RoomPowerLevels]: RoomPowerLevelsEventContent;\n [EventType.RoomName]: RoomNameEventContent;\n [EventType.RoomTopic]: RoomTopicEventContent;\n [EventType.RoomAvatar]: RoomAvatarEventContent;\n [EventType.RoomPinnedEvents]: RoomPinnedEventsEventContent;\n [EventType.RoomEncryption]: RoomEncryptionEventContent;\n [EventType.RoomHistoryVisibility]: RoomHistoryVisibilityEventContent;\n [EventType.RoomGuestAccess]: RoomGuestAccessEventContent;\n [EventType.RoomServerAcl]: RoomServerAclEventContent;\n [EventType.RoomTombstone]: RoomTombstoneEventContent;\n [EventType.SpaceChild]: SpaceChildEventContent;\n [EventType.SpaceParent]: SpaceParentEventContent;\n\n [EventType.PolicyRuleUser]: XOR<PolicyRuleEventContent, {}>;\n [EventType.PolicyRuleRoom]: XOR<PolicyRuleEventContent, {}>;\n [EventType.PolicyRuleServer]: XOR<PolicyRuleEventContent, {}>;\n\n // MSC3089\n [UNSTABLE_MSC3089_BRANCH.name]: MSC3089EventContent;\n\n // MSC3672\n [M_BEACON_INFO.name]: MBeaconInfoEventContent;\n}\n\n/**\n * Mapped type from event type to content type for all specified global account_data events.\n */\nexport interface AccountDataEvents {\n [EventType.PushRules]: IPushRules;\n [EventType.Direct]: { [userId: string]: string[] };\n [EventType.IgnoredUserList]: { [userId: string]: {} };\n \"m.identity_server\": { base_url: string | null };\n [key: `${typeof LOCAL_NOTIFICATION_SETTINGS_PREFIX.name}.${string}`]: LocalNotificationSettings;\n // Invites-ignorer events\n [POLICIES_ACCOUNT_EVENT_TYPE.name]: { [key: string]: any };\n [POLICIES_ACCOUNT_EVENT_TYPE.altName]: { [key: string]: any };\n}"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,eAAe,EAAEC,aAAa,QAAQ,uBAAuB;AAuBtE,SAASC,QAAQ,EAAEC,aAAa,QAAsD,aAAa;AAInG,SAASC,UAAU,EAAEC,YAAY,QAAoD,YAAY;AAGjG,SAASC,2BAA2B,QAAQ,oCAAoC;AAEhF,WAAYC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAT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A8B,CAAC;;AAE9F;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMuB,kCAAkC,GAAG,IAAIvB,aAAa,CAC/D,+BAA+B,EAC/B,gDACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMwB,wBAAwB,GAAG,IAAIxB,aAAa,CAAC,WAAW,EAAE,8BAA8B,CAAC;;AAEtG;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMyB,yBAAyB,GAAG,IAAI1B,eAAe,CAAC,YAAY,EAAE,+BAA+B,CAAC;;AAE3G;AACA;AACA;;AAUA;AACA;AACA;;AAgCA;AACA;AACA","ignoreList":[]}
|
package/lib/@types/global.d.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"global.d.js","names":[],"sources":["../../src/@types/global.d.ts"],"sourcesContent":["/*\nCopyright 2020 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\
|
1
|
+
{"version":3,"file":"global.d.js","names":[],"sources":["../../src/@types/global.d.ts"],"sourcesContent":["/*\nCopyright 2020 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nexport {};\n\ndeclare global {\n // use `number` as the return type in all cases for globalThis.set{Interval,Timeout},\n // so we don't accidentally use the methods on NodeJS.Timeout - they only exist in a subset of environments.\n // The overload for clear{Interval,Timeout} is resolved as expected.\n // We use `ReturnType<typeof setTimeout>` in the code to be agnostic of if this definition gets loaded.\n function setInterval(handler: TimerHandler, timeout: number, ...arguments: any[]): number;\n function setTimeout(handler: TimerHandler, timeout: number, ...arguments: any[]): number;\n\n namespace NodeJS {\n interface Global {\n // marker variable used to detect both the browser & node entrypoints being used at once\n __js_sdk_entrypoint: unknown;\n }\n }\n\n interface MediaDevices {\n // This is experimental and types don't know about it yet\n // https://github.com/microsoft/TypeScript/issues/33232\n getDisplayMedia(constraints: MediaStreamConstraints | DesktopCapturerConstraints): Promise<MediaStream>;\n getUserMedia(constraints: MediaStreamConstraints | DesktopCapturerConstraints): Promise<MediaStream>;\n }\n\n interface DesktopCapturerConstraints {\n audio:\n | boolean\n | {\n mandatory: {\n chromeMediaSource: string;\n chromeMediaSourceId: string;\n };\n };\n video:\n | boolean\n | {\n mandatory: {\n chromeMediaSource: string;\n chromeMediaSourceId: string;\n };\n };\n }\n\n interface DummyInterfaceWeShouldntBeUsingThis {}\n\n interface Navigator {\n // We check for the webkit-prefixed getUserMedia to detect if we're\n // on webkit: we should check if we still need to do this\n webkitGetUserMedia?: DummyInterfaceWeShouldntBeUsingThis;\n }\n\n export interface Uint8ArrayToBase64Options {\n alphabet?: \"base64\" | \"base64url\";\n omitPadding?: boolean;\n }\n\n interface Uint8Array {\n // https://tc39.es/proposal-arraybuffer-base64/spec/#sec-uint8array.prototype.tobase64\n toBase64?(options?: Uint8ArrayToBase64Options): string;\n }\n\n export interface Uint8ArrayFromBase64Options {\n alphabet?: \"base64\"; // Our fallback code only handles base64.\n lastChunkHandling?: \"loose\"; // Our fallback code doesn't support other handling at this time.\n }\n\n interface Uint8ArrayConstructor {\n // https://tc39.es/proposal-arraybuffer-base64/spec/#sec-uint8array.frombase64\n fromBase64?(base64: string, options?: Uint8ArrayFromBase64Options): Uint8Array;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA","ignoreList":[]}
|
package/lib/autodiscovery.d.ts
CHANGED
@@ -79,7 +79,7 @@ export declare class AutoDiscovery {
|
|
79
79
|
* configuration, which may include error states. Rejects on unexpected
|
80
80
|
* failure, not when verification fails.
|
81
81
|
*/
|
82
|
-
static fromDiscoveryConfig(wellknown
|
82
|
+
static fromDiscoveryConfig(wellknown?: IClientWellKnown): Promise<ClientConfig>;
|
83
83
|
/**
|
84
84
|
* Attempts to automatically discover client configuration information
|
85
85
|
* prior to logging in. Such information includes the homeserver URL
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"autodiscovery.d.ts","sourceRoot":"","sources":["../src/autodiscovery.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAmB,MAAM,aAAa,CAAC;AAQlF,oBAAY,mBAAmB;IAC3B,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,UAAU,eAAe;CAC5B;AAED,oBAAY,kBAAkB;IAC1B,OAAO,0CAA0C;IACjD,cAAc,0DAA0D;IACxE,gBAAgB,sCAAsC;IACtD,iBAAiB,mEAAmE;IACpF,gBAAgB,2CAA2C;IAC3D,qBAAqB,sEAAsE;IAC3F,SAAS,+CAA+C;IACxD,gBAAgB,mCAAmC;IACnD,WAAW,iBAAiB;IAC5B,gCAAgC,0DAA0D;CAI7F;AAED,UAAU,kBAAkB;IACxB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;CAC5C;AACD,UAAU,eAAgB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,EAAE,kBAAkB;CAAG;AAExF,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,mBAAmB,CAAC;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AAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAUlF;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IA2BnC,OAAO,CAAC,MAAM,CAAC,KAAK;IAOpB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAA0B;WAEnC,UAAU,CAAC,OAAO,EAAE,OAAO,UAAU,CAAC,KAAK,GAAG,IAAI;IAIhE;;;;;;;;;;;;;;;OAeG;mBACkB,oBAAoB;CA2D5C"}
|
package/lib/autodiscovery.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"autodiscovery.js","names":["logger","Method","timeoutSignal","SUPPORTED_MATRIX_VERSIONS","AutoDiscoveryAction","AutoDiscoveryError","AutoDiscovery","fromDiscoveryConfig","wellknown","_this","_asyncToGenerator","_hsVersions$raw","clientConfig","state","FAIL_ERROR","error","ERROR_INVALID","base_url","PROMPT","FAIL_PROMPT","Promise","resolve","ERROR_INVALID_HS_BASE_URL","hsUrl","sanitizeWellKnownUrl","hsVersions","fetchWellKnownObject","concat","Array","isArray","raw","ERROR_INVALID_HOMESERVER","hsVersionSet","Set","supportedVersionFound","version","has","ERROR_UNSUPPORTED_HOMESERVER_SPEC_VERSION","SUCCESS","isUrl","failingClientConfig","ERROR_INVALID_IS","ERROR_INVALID_IS_BASE_URL","isResponse","action","ERROR_INVALID_IDENTITY_SERVER","toString","length","Object","keys","forEach","k","notProps","prop","includes","findClientConfig","domain","_this2","Error","domainWithProtocol","reason","IGNORE","getRawClientConfig","_this3","_response$raw","response","url","_parsed","parsed","URL","e","hostname","protocol","port","path","pathname","saferUrl","endsWith","substring","fetch","resource","options","fetchFn","globalThis","setFetchFn","method","Get","signal","status","ERROR_MISSING_WELLKNOWN","ok","err","message","json","name","ERROR_INVALID_JSON","_defineProperty","Invalid","GenericFailure","InvalidHsBaseUrl","InvalidHomeserver","InvalidIsBaseUrl","InvalidIdentityServer","InvalidIs","MissingWellknown","InvalidJson","UnsupportedHomeserverSpecVersion"],"sources":["../src/autodiscovery.ts"],"sourcesContent":["/*\nCopyright 2018 New Vector Ltd\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IClientWellKnown, IWellKnownConfig, IServerVersions } from \"./client.ts\";\nimport { logger } from \"./logger.ts\";\nimport { MatrixError, Method, timeoutSignal } from \"./http-api/index.ts\";\nimport { SUPPORTED_MATRIX_VERSIONS } from \"./version-support.ts\";\n\n// Dev note: Auto discovery is part of the spec.\n// See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery\n\nexport enum AutoDiscoveryAction {\n SUCCESS = \"SUCCESS\",\n IGNORE = \"IGNORE\",\n PROMPT = \"PROMPT\",\n FAIL_PROMPT = \"FAIL_PROMPT\",\n FAIL_ERROR = \"FAIL_ERROR\",\n}\n\nexport enum AutoDiscoveryError {\n Invalid = \"Invalid homeserver discovery response\",\n GenericFailure = \"Failed to get autodiscovery configuration from server\",\n InvalidHsBaseUrl = \"Invalid base_url for m.homeserver\",\n InvalidHomeserver = \"Homeserver URL does not appear to be a valid Matrix homeserver\",\n InvalidIsBaseUrl = \"Invalid base_url for m.identity_server\",\n InvalidIdentityServer = \"Identity server URL does not appear to be a valid identity server\",\n InvalidIs = \"Invalid identity server discovery response\",\n MissingWellknown = \"No .well-known JSON file found\",\n InvalidJson = \"Invalid JSON\",\n UnsupportedHomeserverSpecVersion = \"The homeserver does not meet the version requirements\",\n\n // TODO: Implement when Sydent supports the `/versions` endpoint - https://github.com/matrix-org/sydent/issues/424\n //IdentityServerTooOld = \"The identity server does not meet the minimum version requirements\",\n}\n\ninterface AutoDiscoveryState {\n state: AutoDiscoveryAction;\n error?: IWellKnownConfig[\"error\"] | null;\n}\ninterface WellKnownConfig extends Omit<IWellKnownConfig, \"error\">, AutoDiscoveryState {}\n\nexport interface ClientConfig extends Omit<IClientWellKnown, \"m.homeserver\" | \"m.identity_server\"> {\n \"m.homeserver\": WellKnownConfig;\n \"m.identity_server\": WellKnownConfig;\n}\n\n/**\n * Utilities for automatically discovery resources, such as homeservers\n * for users to log in to.\n */\nexport class AutoDiscovery {\n // Dev note: the constants defined here are related to but not\n // exactly the same as those in the spec. This is to hopefully\n // translate the meaning of the states in the spec, but also\n // support our own if needed.\n\n public static readonly ERROR_INVALID = AutoDiscoveryError.Invalid;\n\n public static readonly ERROR_GENERIC_FAILURE = AutoDiscoveryError.GenericFailure;\n\n public static readonly ERROR_INVALID_HS_BASE_URL = AutoDiscoveryError.InvalidHsBaseUrl;\n\n public static readonly ERROR_INVALID_HOMESERVER = AutoDiscoveryError.InvalidHomeserver;\n\n public static readonly ERROR_INVALID_IS_BASE_URL = AutoDiscoveryError.InvalidIsBaseUrl;\n\n public static readonly ERROR_INVALID_IDENTITY_SERVER = AutoDiscoveryError.InvalidIdentityServer;\n\n public static readonly ERROR_INVALID_IS = AutoDiscoveryError.InvalidIs;\n\n public static readonly ERROR_MISSING_WELLKNOWN = AutoDiscoveryError.MissingWellknown;\n\n public static readonly ERROR_INVALID_JSON = AutoDiscoveryError.InvalidJson;\n\n public static readonly ERROR_UNSUPPORTED_HOMESERVER_SPEC_VERSION =\n AutoDiscoveryError.UnsupportedHomeserverSpecVersion;\n\n public static readonly ALL_ERRORS = Object.keys(AutoDiscoveryError) as AutoDiscoveryError[];\n\n /**\n * The auto discovery failed. The client is expected to communicate\n * the error to the user and refuse logging in.\n */\n public static readonly FAIL_ERROR = AutoDiscoveryAction.FAIL_ERROR;\n\n /**\n * The auto discovery failed, however the client may still recover\n * from the problem. The client is recommended to that the same\n * action it would for PROMPT while also warning the user about\n * what went wrong. The client may also treat this the same as\n * a FAIL_ERROR state.\n */\n public static readonly FAIL_PROMPT = AutoDiscoveryAction.FAIL_PROMPT;\n\n /**\n * The auto discovery didn't fail but did not find anything of\n * interest. The client is expected to prompt the user for more\n * information, or fail if it prefers.\n */\n public static readonly PROMPT = AutoDiscoveryAction.PROMPT;\n\n /**\n * The auto discovery was successful.\n */\n public static readonly SUCCESS = AutoDiscoveryAction.SUCCESS;\n\n /**\n * Validates and verifies client configuration information for purposes\n * of logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be included, and will be transparently brought into the\n * response object unaltered.\n * @param wellknown - The configuration object itself, as returned\n * by the .well-known auto-discovery endpoint.\n * @returns Promise which resolves to the verified\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when verification fails.\n */\n public static async fromDiscoveryConfig(wellknown: IClientWellKnown): Promise<ClientConfig> {\n // Step 1 is to get the config, which is provided to us here.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n if (!wellknown?.[\"m.homeserver\"]) {\n logger.error(\"No m.homeserver key in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n\n return Promise.resolve(clientConfig);\n }\n\n if (!wellknown[\"m.homeserver\"][\"base_url\"]) {\n logger.error(\"No m.homeserver base_url in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Make sure the homeserver URL is valid *looking*. We'll make\n // sure it points to a homeserver in Step 3.\n const hsUrl = this.sanitizeWellKnownUrl(wellknown[\"m.homeserver\"][\"base_url\"]);\n if (!hsUrl) {\n logger.error(\"Invalid base_url for m.homeserver\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n return Promise.resolve(clientConfig);\n }\n\n // Step 3: Make sure the homeserver URL points to a homeserver.\n const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}/_matrix/client/versions`);\n if (!hsVersions || !Array.isArray(hsVersions.raw?.[\"versions\"])) {\n logger.error(\"Invalid /versions response\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 3.1: Non-spec check to ensure the server will actually work for us. We need to check if\n // any of the versions in `SUPPORTED_MATRIX_VERSIONS` are listed in the /versions response.\n const hsVersionSet = new Set(hsVersions.raw![\"versions\"]);\n let supportedVersionFound = false;\n for (const version of SUPPORTED_MATRIX_VERSIONS) {\n if (hsVersionSet.has(version)) {\n supportedVersionFound = true;\n break;\n }\n }\n if (!supportedVersionFound) {\n logger.error(\"Homeserver does not meet version requirements\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_UNSUPPORTED_HOMESERVER_SPEC_VERSION;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 4: Now that the homeserver looks valid, update our client config.\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: hsUrl,\n };\n\n // Step 5: Try to pull out the identity server configuration\n let isUrl: string | boolean = \"\";\n if (wellknown[\"m.identity_server\"]) {\n // We prepare a failing identity server response to save lines later\n // in this branch.\n const failingClientConfig: ClientConfig = {\n \"m.homeserver\": clientConfig[\"m.homeserver\"],\n \"m.identity_server\": {\n state: AutoDiscovery.FAIL_PROMPT,\n error: AutoDiscovery.ERROR_INVALID_IS,\n base_url: null,\n },\n };\n\n // Step 5a: Make sure the URL is valid *looking*. We'll make sure it\n // points to an identity server in Step 5b.\n isUrl = this.sanitizeWellKnownUrl(wellknown[\"m.identity_server\"][\"base_url\"]);\n if (!isUrl) {\n logger.error(\"Invalid base_url for m.identity_server\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IS_BASE_URL;\n return Promise.resolve(failingClientConfig);\n }\n\n // Step 5b: Verify there is an identity server listening on the provided\n // URL.\n const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/v2`);\n if (!isResponse?.raw || isResponse.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"Invalid /v2 response\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER;\n\n // Supply the base_url to the caller because they may be ignoring\n // liveliness errors, like this one.\n failingClientConfig[\"m.identity_server\"].base_url = isUrl;\n\n return Promise.resolve(failingClientConfig);\n }\n }\n\n // Step 6: Now that the identity server is valid, or never existed,\n // populate the IS section.\n if (isUrl && isUrl.toString().length > 0) {\n clientConfig[\"m.identity_server\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: isUrl,\n };\n }\n\n // Step 7: Copy any other keys directly into the clientConfig. This is for\n // things like custom configuration of services.\n Object.keys(wellknown).forEach((k: keyof IClientWellKnown) => {\n if (k === \"m.homeserver\" || k === \"m.identity_server\") {\n // Only copy selected parts of the config to avoid overwriting\n // properties computed by the validation logic above.\n const notProps = [\"error\", \"state\", \"base_url\"];\n for (const prop of Object.keys(wellknown[k]!)) {\n if (notProps.includes(prop)) continue;\n type Prop = Exclude<keyof IWellKnownConfig, \"error\" | \"state\" | \"base_url\">;\n // @ts-ignore - ts gets unhappy as we're mixing types here\n clientConfig[k][prop as Prop] = wellknown[k]![prop as Prop];\n }\n } else {\n // Just copy the whole thing over otherwise\n clientConfig[k] = wellknown[k];\n }\n });\n\n // Step 8: Give the config to the caller (finally)\n return Promise.resolve(clientConfig);\n }\n\n /**\n * Attempts to automatically discover client configuration information\n * prior to logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be discovered, and will be transparently included in the\n * response object unaltered.\n * @param domain - The homeserver domain to perform discovery\n * on. For example, \"matrix.org\".\n * @returns Promise which resolves to the discovered\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when discovery fails.\n */\n public static async findClientConfig(domain: string): Promise<ClientConfig> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n // We use a .well-known lookup for all cases. According to the spec, we\n // can do other discovery mechanisms if we want such as custom lookups\n // however we won't bother with that here (mostly because the spec only\n // supports .well-known right now).\n //\n // By using .well-known, we need to ensure we at least pull out a URL\n // for the homeserver. We don't really need an identity server configuration\n // but will return one anyways (with state PROMPT) to make development\n // easier for clients. If we can't get a homeserver URL, all bets are\n // off on the rest of the config and we'll assume it is invalid too.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n // Step 1: Actually request the .well-known JSON file and make sure it\n // at least has a homeserver definition.\n const domainWithProtocol = domain.includes(\"://\") ? domain : `https://${domain}`;\n const wellknown = await this.fetchWellKnownObject(`${domainWithProtocol}/.well-known/matrix/client`);\n if (!wellknown || wellknown.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"No response or error when parsing .well-known\");\n if (wellknown.reason) logger.error(wellknown.reason);\n if (wellknown.action === AutoDiscoveryAction.IGNORE) {\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n };\n } else {\n // this can only ever be FAIL_PROMPT at this point.\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n }\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Validate and parse the config\n return AutoDiscovery.fromDiscoveryConfig(wellknown.raw!);\n }\n\n /**\n * Gets the raw discovery client configuration for the given domain name.\n * Should only be used if there's no validation to be done on the resulting\n * object, otherwise use findClientConfig().\n * @param domain - The domain to get the client config for.\n * @returns Promise which resolves to the domain's client config. Can\n * be an empty object.\n */\n public static async getRawClientConfig(domain?: string): Promise<IClientWellKnown> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n const response = await this.fetchWellKnownObject(`https://${domain}/.well-known/matrix/client`);\n if (!response) return {};\n return response.raw ?? {};\n }\n\n /**\n * Sanitizes a given URL to ensure it is either an HTTP or HTTP URL and\n * is suitable for the requirements laid out by .well-known auto discovery.\n * If valid, the URL will also be stripped of any trailing slashes.\n * @param url - The potentially invalid URL to sanitize.\n * @returns The sanitized URL or a falsey value if the URL is invalid.\n * @internal\n */\n private static sanitizeWellKnownUrl(url?: string | null): string | false {\n if (!url) return false;\n\n try {\n let parsed: URL | undefined;\n try {\n parsed = new URL(url);\n } catch (e) {\n logger.error(\"Could not parse url\", e);\n }\n\n if (!parsed?.hostname) return false;\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false;\n\n const port = parsed.port ? `:${parsed.port}` : \"\";\n const path = parsed.pathname ? parsed.pathname : \"\";\n let saferUrl = `${parsed.protocol}//${parsed.hostname}${port}${path}`;\n if (saferUrl.endsWith(\"/\")) {\n saferUrl = saferUrl.substring(0, saferUrl.length - 1);\n }\n return saferUrl;\n } catch (e) {\n logger.error(e);\n return false;\n }\n }\n\n private static fetch(resource: URL | string, options?: RequestInit): ReturnType<typeof globalThis.fetch> {\n if (this.fetchFn) {\n return this.fetchFn(resource, options);\n }\n return globalThis.fetch(resource, options);\n }\n\n private static fetchFn?: typeof globalThis.fetch;\n\n public static setFetchFn(fetchFn: typeof globalThis.fetch): void {\n AutoDiscovery.fetchFn = fetchFn;\n }\n\n /**\n * Fetches a JSON object from a given URL, as expected by all .well-known\n * related lookups. If the server gives a 404 then the `action` will be\n * IGNORE. If the server returns something that isn't JSON, the `action`\n * will be FAIL_PROMPT. For any other failure the `action` will be FAIL_PROMPT.\n *\n * The returned object will be a result of the call in object form with\n * the following properties:\n * raw: The JSON object returned by the server.\n * action: One of SUCCESS, IGNORE, or FAIL_PROMPT.\n * reason: Relatively human-readable description of what went wrong.\n * error: The actual Error, if one exists.\n * @param url - The URL to fetch a JSON object from.\n * @returns Promise which resolves to the returned state.\n * @internal\n */\n private static async fetchWellKnownObject<T = IWellKnownConfig>(\n url: string,\n ): Promise<IWellKnownConfig<Partial<T>>> {\n let response: Response;\n\n try {\n response = await AutoDiscovery.fetch(url, {\n method: Method.Get,\n signal: timeoutSignal(5000),\n });\n\n if (response.status === 404) {\n return {\n raw: {},\n action: AutoDiscoveryAction.IGNORE,\n reason: AutoDiscovery.ERROR_MISSING_WELLKNOWN,\n };\n }\n\n if (!response.ok) {\n return {\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: \"General failure\",\n };\n }\n } catch (err) {\n const error = err as AutoDiscoveryError | string | undefined;\n let reason = \"\";\n if (typeof error === \"object\") {\n reason = (<Error>error)?.message;\n }\n\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: reason || \"General failure\",\n };\n }\n\n try {\n return {\n raw: await response.json(),\n action: AutoDiscoveryAction.SUCCESS,\n };\n } catch (err) {\n const error = err as Error;\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason:\n (error as MatrixError)?.name === \"SyntaxError\"\n ? AutoDiscovery.ERROR_INVALID_JSON\n : AutoDiscovery.ERROR_INVALID,\n };\n }\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,MAAM,QAAQ,aAAa;AACpC,SAAsBC,MAAM,EAAEC,aAAa,QAAQ,qBAAqB;AACxE,SAASC,yBAAyB,QAAQ,sBAAsB;;AAEhE;AACA;;AAEA,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAQ/B,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA,OAY1B;AACA;AAcJ;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,CAAC;EAwDvB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACI,OAAoBC,mBAAmBA,CAACC,SAA2B,EAAyB;IAAA,IAAAC,KAAA;IAAA,OAAAC,iBAAA;MAAA,IAAAC,eAAA;MACxF;;MAEA;MACA;MACA;MACA,IAAMC,YAA0B,GAAG;QAC/B,cAAc,EAAE;UACZC,KAAK,EAAEP,aAAa,CAACQ,UAAU;UAC/BC,KAAK,EAAET,aAAa,CAACU,aAAa;UAClCC,QAAQ,EAAE;QACd,CAAC;QACD,mBAAmB,EAAE;UACjB;UACA;UACAJ,KAAK,EAAEP,aAAa,CAACY,MAAM;UAC3BH,KAAK,EAAE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kBAAkB,CAACiG,qBAAqB;AAAAN,eAAA,CAhBtF1F,aAAa,sBAkBoBD,kBAAkB,CAACkG,SAAS;AAAAP,eAAA,CAlB7D1F,aAAa,6BAoB2BD,kBAAkB,CAACmG,gBAAgB;AAAAR,eAAA,CApB3E1F,aAAa,wBAsBsBD,kBAAkB,CAACoG,WAAW;AAAAT,eAAA,CAtBjE1F,aAAa,+CAyBlBD,kBAAkB,CAACqG,gCAAgC;AAAAV,eAAA,CAzB9C1F,aAAa,gBA2Bc0C,MAAM,CAACC,IAAI,CAAC5C,kBAAkB,CAAC;AAEnE;AACJ;AACA;AACA;AAHI2F,eAAA,CA7BS1F,aAAa,gBAiCcF,mBAAmB,CAACU,UAAU;AAElE;AACJ;AACA;AACA;AACA;AACA;AACA;AANIkF,eAAA,CAnCS1F,aAAa,iBA0CeF,mBAAmB,CAACe,WAAW;AAEpE;AACJ;AACA;AACA;AACA;AAJI6E,eAAA,CA5CS1F,aAAa,YAiDUF,mBAAmB,CAACc,MAAM;AAE1D;AACJ;AACA;AAFI8E,eAAA,CAnDS1F,aAAa,aAsDWF,mBAAmB,CAACkC,OAAO;AAAA0D,eAAA,CAtDnD1F,aAAa","ignoreList":[]}
|
1
|
+
{"version":3,"file":"autodiscovery.js","names":["logger","Method","timeoutSignal","SUPPORTED_MATRIX_VERSIONS","AutoDiscoveryAction","AutoDiscoveryError","AutoDiscovery","fromDiscoveryConfig","wellknown","_this","_asyncToGenerator","_hsVersions$raw","clientConfig","state","FAIL_ERROR","error","ERROR_INVALID","base_url","PROMPT","FAIL_PROMPT","Promise","resolve","ERROR_INVALID_HS_BASE_URL","hsUrl","sanitizeWellKnownUrl","hsVersions","fetchWellKnownObject","concat","Array","isArray","raw","ERROR_INVALID_HOMESERVER","hsVersionSet","Set","supportedVersionFound","version","has","ERROR_UNSUPPORTED_HOMESERVER_SPEC_VERSION","SUCCESS","isUrl","failingClientConfig","ERROR_INVALID_IS","ERROR_INVALID_IS_BASE_URL","isResponse","action","ERROR_INVALID_IDENTITY_SERVER","toString","length","Object","keys","forEach","k","notProps","prop","includes","findClientConfig","domain","_this2","Error","domainWithProtocol","reason","IGNORE","getRawClientConfig","_this3","_response$raw","response","url","_parsed","parsed","URL","e","hostname","protocol","port","path","pathname","saferUrl","endsWith","substring","fetch","resource","options","fetchFn","globalThis","setFetchFn","method","Get","signal","status","ERROR_MISSING_WELLKNOWN","ok","err","message","json","name","ERROR_INVALID_JSON","_defineProperty","Invalid","GenericFailure","InvalidHsBaseUrl","InvalidHomeserver","InvalidIsBaseUrl","InvalidIdentityServer","InvalidIs","MissingWellknown","InvalidJson","UnsupportedHomeserverSpecVersion"],"sources":["../src/autodiscovery.ts"],"sourcesContent":["/*\nCopyright 2018 New Vector Ltd\nCopyright 2019 The Matrix.org Foundation C.I.C.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { IClientWellKnown, IWellKnownConfig, IServerVersions } from \"./client.ts\";\nimport { logger } from \"./logger.ts\";\nimport { MatrixError, Method, timeoutSignal } from \"./http-api/index.ts\";\nimport { SUPPORTED_MATRIX_VERSIONS } from \"./version-support.ts\";\n\n// Dev note: Auto discovery is part of the spec.\n// See: https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery\n\nexport enum AutoDiscoveryAction {\n SUCCESS = \"SUCCESS\",\n IGNORE = \"IGNORE\",\n PROMPT = \"PROMPT\",\n FAIL_PROMPT = \"FAIL_PROMPT\",\n FAIL_ERROR = \"FAIL_ERROR\",\n}\n\nexport enum AutoDiscoveryError {\n Invalid = \"Invalid homeserver discovery response\",\n GenericFailure = \"Failed to get autodiscovery configuration from server\",\n InvalidHsBaseUrl = \"Invalid base_url for m.homeserver\",\n InvalidHomeserver = \"Homeserver URL does not appear to be a valid Matrix homeserver\",\n InvalidIsBaseUrl = \"Invalid base_url for m.identity_server\",\n InvalidIdentityServer = \"Identity server URL does not appear to be a valid identity server\",\n InvalidIs = \"Invalid identity server discovery response\",\n MissingWellknown = \"No .well-known JSON file found\",\n InvalidJson = \"Invalid JSON\",\n UnsupportedHomeserverSpecVersion = \"The homeserver does not meet the version requirements\",\n\n // TODO: Implement when Sydent supports the `/versions` endpoint - https://github.com/matrix-org/sydent/issues/424\n //IdentityServerTooOld = \"The identity server does not meet the minimum version requirements\",\n}\n\ninterface AutoDiscoveryState {\n state: AutoDiscoveryAction;\n error?: IWellKnownConfig[\"error\"] | null;\n}\ninterface WellKnownConfig extends Omit<IWellKnownConfig, \"error\">, AutoDiscoveryState {}\n\nexport interface ClientConfig extends Omit<IClientWellKnown, \"m.homeserver\" | \"m.identity_server\"> {\n \"m.homeserver\": WellKnownConfig;\n \"m.identity_server\": WellKnownConfig;\n}\n\n/**\n * Utilities for automatically discovery resources, such as homeservers\n * for users to log in to.\n */\nexport class AutoDiscovery {\n // Dev note: the constants defined here are related to but not\n // exactly the same as those in the spec. This is to hopefully\n // translate the meaning of the states in the spec, but also\n // support our own if needed.\n\n public static readonly ERROR_INVALID = AutoDiscoveryError.Invalid;\n\n public static readonly ERROR_GENERIC_FAILURE = AutoDiscoveryError.GenericFailure;\n\n public static readonly ERROR_INVALID_HS_BASE_URL = AutoDiscoveryError.InvalidHsBaseUrl;\n\n public static readonly ERROR_INVALID_HOMESERVER = AutoDiscoveryError.InvalidHomeserver;\n\n public static readonly ERROR_INVALID_IS_BASE_URL = AutoDiscoveryError.InvalidIsBaseUrl;\n\n public static readonly ERROR_INVALID_IDENTITY_SERVER = AutoDiscoveryError.InvalidIdentityServer;\n\n public static readonly ERROR_INVALID_IS = AutoDiscoveryError.InvalidIs;\n\n public static readonly ERROR_MISSING_WELLKNOWN = AutoDiscoveryError.MissingWellknown;\n\n public static readonly ERROR_INVALID_JSON = AutoDiscoveryError.InvalidJson;\n\n public static readonly ERROR_UNSUPPORTED_HOMESERVER_SPEC_VERSION =\n AutoDiscoveryError.UnsupportedHomeserverSpecVersion;\n\n public static readonly ALL_ERRORS = Object.keys(AutoDiscoveryError) as AutoDiscoveryError[];\n\n /**\n * The auto discovery failed. The client is expected to communicate\n * the error to the user and refuse logging in.\n */\n public static readonly FAIL_ERROR = AutoDiscoveryAction.FAIL_ERROR;\n\n /**\n * The auto discovery failed, however the client may still recover\n * from the problem. The client is recommended to that the same\n * action it would for PROMPT while also warning the user about\n * what went wrong. The client may also treat this the same as\n * a FAIL_ERROR state.\n */\n public static readonly FAIL_PROMPT = AutoDiscoveryAction.FAIL_PROMPT;\n\n /**\n * The auto discovery didn't fail but did not find anything of\n * interest. The client is expected to prompt the user for more\n * information, or fail if it prefers.\n */\n public static readonly PROMPT = AutoDiscoveryAction.PROMPT;\n\n /**\n * The auto discovery was successful.\n */\n public static readonly SUCCESS = AutoDiscoveryAction.SUCCESS;\n\n /**\n * Validates and verifies client configuration information for purposes\n * of logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be included, and will be transparently brought into the\n * response object unaltered.\n * @param wellknown - The configuration object itself, as returned\n * by the .well-known auto-discovery endpoint.\n * @returns Promise which resolves to the verified\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when verification fails.\n */\n public static async fromDiscoveryConfig(wellknown?: IClientWellKnown): Promise<ClientConfig> {\n // Step 1 is to get the config, which is provided to us here.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n if (!wellknown?.[\"m.homeserver\"]) {\n logger.error(\"No m.homeserver key in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n\n return Promise.resolve(clientConfig);\n }\n\n if (!wellknown[\"m.homeserver\"][\"base_url\"]) {\n logger.error(\"No m.homeserver base_url in config\");\n\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Make sure the homeserver URL is valid *looking*. We'll make\n // sure it points to a homeserver in Step 3.\n const hsUrl = this.sanitizeWellKnownUrl(wellknown[\"m.homeserver\"][\"base_url\"]);\n if (!hsUrl) {\n logger.error(\"Invalid base_url for m.homeserver\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HS_BASE_URL;\n return Promise.resolve(clientConfig);\n }\n\n // Step 3: Make sure the homeserver URL points to a homeserver.\n const hsVersions = await this.fetchWellKnownObject<IServerVersions>(`${hsUrl}/_matrix/client/versions`);\n if (!hsVersions || !Array.isArray(hsVersions.raw?.[\"versions\"])) {\n logger.error(\"Invalid /versions response\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID_HOMESERVER;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 3.1: Non-spec check to ensure the server will actually work for us. We need to check if\n // any of the versions in `SUPPORTED_MATRIX_VERSIONS` are listed in the /versions response.\n const hsVersionSet = new Set(hsVersions.raw![\"versions\"]);\n let supportedVersionFound = false;\n for (const version of SUPPORTED_MATRIX_VERSIONS) {\n if (hsVersionSet.has(version)) {\n supportedVersionFound = true;\n break;\n }\n }\n if (!supportedVersionFound) {\n logger.error(\"Homeserver does not meet version requirements\");\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_UNSUPPORTED_HOMESERVER_SPEC_VERSION;\n\n // Supply the base_url to the caller because they may be ignoring liveliness\n // errors, like this one.\n clientConfig[\"m.homeserver\"].base_url = hsUrl;\n\n return Promise.resolve(clientConfig);\n }\n\n // Step 4: Now that the homeserver looks valid, update our client config.\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: hsUrl,\n };\n\n // Step 5: Try to pull out the identity server configuration\n let isUrl: string | boolean = \"\";\n if (wellknown[\"m.identity_server\"]) {\n // We prepare a failing identity server response to save lines later\n // in this branch.\n const failingClientConfig: ClientConfig = {\n \"m.homeserver\": clientConfig[\"m.homeserver\"],\n \"m.identity_server\": {\n state: AutoDiscovery.FAIL_PROMPT,\n error: AutoDiscovery.ERROR_INVALID_IS,\n base_url: null,\n },\n };\n\n // Step 5a: Make sure the URL is valid *looking*. We'll make sure it\n // points to an identity server in Step 5b.\n isUrl = this.sanitizeWellKnownUrl(wellknown[\"m.identity_server\"][\"base_url\"]);\n if (!isUrl) {\n logger.error(\"Invalid base_url for m.identity_server\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IS_BASE_URL;\n return Promise.resolve(failingClientConfig);\n }\n\n // Step 5b: Verify there is an identity server listening on the provided\n // URL.\n const isResponse = await this.fetchWellKnownObject(`${isUrl}/_matrix/identity/v2`);\n if (!isResponse?.raw || isResponse.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"Invalid /v2 response\");\n failingClientConfig[\"m.identity_server\"].error = AutoDiscovery.ERROR_INVALID_IDENTITY_SERVER;\n\n // Supply the base_url to the caller because they may be ignoring\n // liveliness errors, like this one.\n failingClientConfig[\"m.identity_server\"].base_url = isUrl;\n\n return Promise.resolve(failingClientConfig);\n }\n }\n\n // Step 6: Now that the identity server is valid, or never existed,\n // populate the IS section.\n if (isUrl && isUrl.toString().length > 0) {\n clientConfig[\"m.identity_server\"] = {\n state: AutoDiscovery.SUCCESS,\n error: null,\n base_url: isUrl,\n };\n }\n\n // Step 7: Copy any other keys directly into the clientConfig. This is for\n // things like custom configuration of services.\n Object.keys(wellknown).forEach((k: keyof IClientWellKnown) => {\n if (k === \"m.homeserver\" || k === \"m.identity_server\") {\n // Only copy selected parts of the config to avoid overwriting\n // properties computed by the validation logic above.\n const notProps = [\"error\", \"state\", \"base_url\"];\n for (const prop of Object.keys(wellknown[k]!)) {\n if (notProps.includes(prop)) continue;\n type Prop = Exclude<keyof IWellKnownConfig, \"error\" | \"state\" | \"base_url\">;\n // @ts-ignore - ts gets unhappy as we're mixing types here\n clientConfig[k][prop as Prop] = wellknown[k]![prop as Prop];\n }\n } else {\n // Just copy the whole thing over otherwise\n clientConfig[k] = wellknown[k];\n }\n });\n\n // Step 8: Give the config to the caller (finally)\n return Promise.resolve(clientConfig);\n }\n\n /**\n * Attempts to automatically discover client configuration information\n * prior to logging in. Such information includes the homeserver URL\n * and identity server URL the client would want. Additional details\n * may also be discovered, and will be transparently included in the\n * response object unaltered.\n * @param domain - The homeserver domain to perform discovery\n * on. For example, \"matrix.org\".\n * @returns Promise which resolves to the discovered\n * configuration, which may include error states. Rejects on unexpected\n * failure, not when discovery fails.\n */\n public static async findClientConfig(domain: string): Promise<ClientConfig> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n // We use a .well-known lookup for all cases. According to the spec, we\n // can do other discovery mechanisms if we want such as custom lookups\n // however we won't bother with that here (mostly because the spec only\n // supports .well-known right now).\n //\n // By using .well-known, we need to ensure we at least pull out a URL\n // for the homeserver. We don't really need an identity server configuration\n // but will return one anyways (with state PROMPT) to make development\n // easier for clients. If we can't get a homeserver URL, all bets are\n // off on the rest of the config and we'll assume it is invalid too.\n\n // We default to an error state to make the first few checks easier to\n // write. We'll update the properties of this object over the duration\n // of this function.\n const clientConfig: ClientConfig = {\n \"m.homeserver\": {\n state: AutoDiscovery.FAIL_ERROR,\n error: AutoDiscovery.ERROR_INVALID,\n base_url: null,\n },\n \"m.identity_server\": {\n // Technically, we don't have a problem with the identity server\n // config at this point.\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n },\n };\n\n // Step 1: Actually request the .well-known JSON file and make sure it\n // at least has a homeserver definition.\n const domainWithProtocol = domain.includes(\"://\") ? domain : `https://${domain}`;\n const wellknown = await this.fetchWellKnownObject(`${domainWithProtocol}/.well-known/matrix/client`);\n if (!wellknown || wellknown.action !== AutoDiscoveryAction.SUCCESS) {\n logger.error(\"No response or error when parsing .well-known\");\n if (wellknown.reason) logger.error(wellknown.reason);\n if (wellknown.action === AutoDiscoveryAction.IGNORE) {\n clientConfig[\"m.homeserver\"] = {\n state: AutoDiscovery.PROMPT,\n error: null,\n base_url: null,\n };\n } else {\n // this can only ever be FAIL_PROMPT at this point.\n clientConfig[\"m.homeserver\"].state = AutoDiscovery.FAIL_PROMPT;\n clientConfig[\"m.homeserver\"].error = AutoDiscovery.ERROR_INVALID;\n }\n return Promise.resolve(clientConfig);\n }\n\n // Step 2: Validate and parse the config\n return AutoDiscovery.fromDiscoveryConfig(wellknown.raw!);\n }\n\n /**\n * Gets the raw discovery client configuration for the given domain name.\n * Should only be used if there's no validation to be done on the resulting\n * object, otherwise use findClientConfig().\n * @param domain - The domain to get the client config for.\n * @returns Promise which resolves to the domain's client config. Can\n * be an empty object.\n */\n public static async getRawClientConfig(domain?: string): Promise<IClientWellKnown> {\n if (!domain || typeof domain !== \"string\" || domain.length === 0) {\n throw new Error(\"'domain' must be a string of non-zero length\");\n }\n\n const response = await this.fetchWellKnownObject(`https://${domain}/.well-known/matrix/client`);\n if (!response) return {};\n return response.raw ?? {};\n }\n\n /**\n * Sanitizes a given URL to ensure it is either an HTTP or HTTP URL and\n * is suitable for the requirements laid out by .well-known auto discovery.\n * If valid, the URL will also be stripped of any trailing slashes.\n * @param url - The potentially invalid URL to sanitize.\n * @returns The sanitized URL or a falsey value if the URL is invalid.\n * @internal\n */\n private static sanitizeWellKnownUrl(url?: string | null): string | false {\n if (!url) return false;\n\n try {\n let parsed: URL | undefined;\n try {\n parsed = new URL(url);\n } catch (e) {\n logger.error(\"Could not parse url\", e);\n }\n\n if (!parsed?.hostname) return false;\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false;\n\n const port = parsed.port ? `:${parsed.port}` : \"\";\n const path = parsed.pathname ? parsed.pathname : \"\";\n let saferUrl = `${parsed.protocol}//${parsed.hostname}${port}${path}`;\n if (saferUrl.endsWith(\"/\")) {\n saferUrl = saferUrl.substring(0, saferUrl.length - 1);\n }\n return saferUrl;\n } catch (e) {\n logger.error(e);\n return false;\n }\n }\n\n private static fetch(resource: URL | string, options?: RequestInit): ReturnType<typeof globalThis.fetch> {\n if (this.fetchFn) {\n return this.fetchFn(resource, options);\n }\n return globalThis.fetch(resource, options);\n }\n\n private static fetchFn?: typeof globalThis.fetch;\n\n public static setFetchFn(fetchFn: typeof globalThis.fetch): void {\n AutoDiscovery.fetchFn = fetchFn;\n }\n\n /**\n * Fetches a JSON object from a given URL, as expected by all .well-known\n * related lookups. If the server gives a 404 then the `action` will be\n * IGNORE. If the server returns something that isn't JSON, the `action`\n * will be FAIL_PROMPT. For any other failure the `action` will be FAIL_PROMPT.\n *\n * The returned object will be a result of the call in object form with\n * the following properties:\n * raw: The JSON object returned by the server.\n * action: One of SUCCESS, IGNORE, or FAIL_PROMPT.\n * reason: Relatively human-readable description of what went wrong.\n * error: The actual Error, if one exists.\n * @param url - The URL to fetch a JSON object from.\n * @returns Promise which resolves to the returned state.\n * @internal\n */\n private static async fetchWellKnownObject<T = IWellKnownConfig>(\n url: string,\n ): Promise<IWellKnownConfig<Partial<T>>> {\n let response: Response;\n\n try {\n response = await AutoDiscovery.fetch(url, {\n method: Method.Get,\n signal: timeoutSignal(5000),\n });\n\n if (response.status === 404) {\n return {\n raw: {},\n action: AutoDiscoveryAction.IGNORE,\n reason: AutoDiscovery.ERROR_MISSING_WELLKNOWN,\n };\n }\n\n if (!response.ok) {\n return {\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: \"General failure\",\n };\n }\n } catch (err) {\n const error = err as AutoDiscoveryError | string | undefined;\n let reason = \"\";\n if (typeof error === \"object\") {\n reason = (<Error>error)?.message;\n }\n\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason: reason || \"General failure\",\n };\n }\n\n try {\n return {\n raw: await response.json(),\n action: AutoDiscoveryAction.SUCCESS,\n };\n } catch (err) {\n const error = err as Error;\n return {\n error,\n raw: {},\n action: AutoDiscoveryAction.FAIL_PROMPT,\n reason:\n (error as MatrixError)?.name === \"SyntaxError\"\n ? AutoDiscovery.ERROR_INVALID_JSON\n : AutoDiscovery.ERROR_INVALID,\n };\n }\n }\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,MAAM,QAAQ,aAAa;AACpC,SAAsBC,MAAM,EAAEC,aAAa,QAAQ,qBAAqB;AACxE,SAASC,yBAAyB,QAAQ,sBAAsB;;AAEhE;AACA;;AAEA,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAQ/B,WAAYC,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA,OAY1B;AACA;AAcJ;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,CAAC;EAwDvB;AACJ;AACA;AACA;AACA;AACA;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
3
|
-
*/
|
4
1
|
/**
|
5
2
|
* Encode a typed array of uint8 as base64.
|
6
3
|
* @param uint8Array - The data to encode.
|
7
4
|
* @returns The base64.
|
8
5
|
*/
|
9
|
-
export declare function encodeBase64(uint8Array:
|
6
|
+
export declare function encodeBase64(uint8Array: Uint8Array): string;
|
10
7
|
/**
|
11
8
|
* Encode a typed array of uint8 as unpadded base64.
|
12
9
|
* @param uint8Array - The data to encode.
|
13
10
|
* @returns The unpadded base64.
|
14
11
|
*/
|
15
|
-
export declare function encodeUnpaddedBase64(uint8Array:
|
12
|
+
export declare function encodeUnpaddedBase64(uint8Array: Uint8Array): string;
|
16
13
|
/**
|
17
14
|
* Encode a typed array of uint8 as unpadded base64 using the URL-safe encoding.
|
18
15
|
* @param uint8Array - The data to encode.
|
19
16
|
* @returns The unpadded base64.
|
20
17
|
*/
|
21
|
-
export declare function encodeUnpaddedBase64Url(uint8Array:
|
18
|
+
export declare function encodeUnpaddedBase64Url(uint8Array: Uint8Array): string;
|
22
19
|
/**
|
23
20
|
* Decode a base64 (or base64url) string to a typed array of uint8.
|
24
21
|
* @param base64 - The base64 to decode.
|
package/lib/base64.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../src/base64.ts"],"names":[],"mappings":"AAuCA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEnE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEtE;AAaD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAGvD"}
|
package/lib/base64.js
CHANGED
@@ -18,30 +18,33 @@ limitations under the License.
|
|
18
18
|
* Base64 encoding and decoding utilities
|
19
19
|
*/
|
20
20
|
|
21
|
+
function toBase64(uint8Array, options) {
|
22
|
+
if (typeof uint8Array.toBase64 === "function") {
|
23
|
+
// Currently this is only supported in Firefox,
|
24
|
+
// but we match the options in the hope in the future we can rely on it for all environments.
|
25
|
+
// https://tc39.es/proposal-arraybuffer-base64/spec/#sec-uint8array.prototype.tobase64
|
26
|
+
return uint8Array.toBase64(options);
|
27
|
+
}
|
28
|
+
var base64 = btoa(uint8Array.reduce((acc, current) => acc + String.fromCharCode(current), ""));
|
29
|
+
if (options.omitPadding) {
|
30
|
+
base64 = base64.replace(/={1,2}$/, "");
|
31
|
+
}
|
32
|
+
if (options.alphabet === "base64url") {
|
33
|
+
base64 = base64.replace(/\+/g, "-").replace(/\//g, "_");
|
34
|
+
}
|
35
|
+
return base64;
|
36
|
+
}
|
37
|
+
|
21
38
|
/**
|
22
39
|
* Encode a typed array of uint8 as base64.
|
23
40
|
* @param uint8Array - The data to encode.
|
24
41
|
* @returns The base64.
|
25
42
|
*/
|
26
43
|
export function encodeBase64(uint8Array) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
// dependents at current count. Using this would probably be fine although it's
|
32
|
-
// a little under-docced and run by an individual. The node impl works fine,
|
33
|
-
// the browser impl works but predates Uint8Array and so only uses strings.
|
34
|
-
// Right now, switching between native (or polyfilled) impls like this feels
|
35
|
-
// like the least bad option, but... *shrugs*.
|
36
|
-
if (typeof Buffer === "function") {
|
37
|
-
return Buffer.from(uint8Array).toString("base64");
|
38
|
-
} else if (typeof btoa === "function" && uint8Array instanceof Uint8Array) {
|
39
|
-
// ArrayBuffer is a node concept so the param should always be a Uint8Array on
|
40
|
-
// the browser. We need to check because ArrayBuffers don't have reduce.
|
41
|
-
return btoa(uint8Array.reduce((acc, current) => acc + String.fromCharCode(current), ""));
|
42
|
-
} else {
|
43
|
-
throw new Error("No base64 impl found!");
|
44
|
-
}
|
44
|
+
return toBase64(uint8Array, {
|
45
|
+
alphabet: "base64",
|
46
|
+
omitPadding: false
|
47
|
+
});
|
45
48
|
}
|
46
49
|
|
47
50
|
/**
|
@@ -50,7 +53,10 @@ export function encodeBase64(uint8Array) {
|
|
50
53
|
* @returns The unpadded base64.
|
51
54
|
*/
|
52
55
|
export function encodeUnpaddedBase64(uint8Array) {
|
53
|
-
return
|
56
|
+
return toBase64(uint8Array, {
|
57
|
+
alphabet: "base64",
|
58
|
+
omitPadding: true
|
59
|
+
});
|
54
60
|
}
|
55
61
|
|
56
62
|
/**
|
@@ -59,7 +65,19 @@ export function encodeUnpaddedBase64(uint8Array) {
|
|
59
65
|
* @returns The unpadded base64.
|
60
66
|
*/
|
61
67
|
export function encodeUnpaddedBase64Url(uint8Array) {
|
62
|
-
return
|
68
|
+
return toBase64(uint8Array, {
|
69
|
+
alphabet: "base64url",
|
70
|
+
omitPadding: true
|
71
|
+
});
|
72
|
+
}
|
73
|
+
function fromBase64(base64, options) {
|
74
|
+
if (typeof Uint8Array.fromBase64 === "function") {
|
75
|
+
// Currently this is only supported in Firefox,
|
76
|
+
// but we match the options in the hope in the future we can rely on it for all environments.
|
77
|
+
// https://tc39.es/proposal-arraybuffer-base64/spec/#sec-uint8array.frombase64
|
78
|
+
return Uint8Array.fromBase64(base64, options);
|
79
|
+
}
|
80
|
+
return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
|
63
81
|
}
|
64
82
|
|
65
83
|
/**
|
@@ -68,21 +86,10 @@ export function encodeUnpaddedBase64Url(uint8Array) {
|
|
68
86
|
* @returns The decoded data.
|
69
87
|
*/
|
70
88
|
export function decodeBase64(base64) {
|
71
|
-
//
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
var decoded = atob(
|
77
|
-
// built-in atob doesn't support base64url: convert so we support either
|
78
|
-
base64.replace(/-/g, "+").replace(/_/g, "/"));
|
79
|
-
for (var i = 0; i < decoded.length; ++i) {
|
80
|
-
yield decoded.charCodeAt(i);
|
81
|
-
}
|
82
|
-
};
|
83
|
-
return Uint8Array.from(itFunc());
|
84
|
-
} else {
|
85
|
-
throw new Error("No base64 impl found!");
|
86
|
-
}
|
89
|
+
// The function requires us to select an alphabet, but we don't know if base64url was used so we convert.
|
90
|
+
return fromBase64(base64.replace(/-/g, "+").replace(/_/g, "/"), {
|
91
|
+
alphabet: "base64",
|
92
|
+
lastChunkHandling: "loose"
|
93
|
+
});
|
87
94
|
}
|
88
95
|
//# sourceMappingURL=base64.js.map
|