* Refactor how token refreshing works to be more resilient
1. ensure we do use the new token if it is not explicitly inhibited by the caller
2. eagerly refresh token if we know it is expired
3. allow refreshing a token multiple times if e.g. on bad connection or the environment has been slept and sufficient time has passed since the last refresh attempt
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add exponential backoff
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Ensure no timing effects on `authedRequest` method call
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Stabilise MSC3765
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* Remove unstable content and hardcode property name
---------
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
* use methodFactory extensions from the rootLogger in child loggers.
* use simple method factory copy AND `childLogger.setLevel(childLogger.getLevel());`
This is the important part that actually registers the new methods.
* add comments and find a way to make it clearer that the types are correct.
* review
* additionally fix MatrixRTCSessionManager being initialized before the extension is in place.
* Add comment to clarify order of log extensions and creating childs.
* review
* Set "loglevel" min version to guarantee access to `logger.rebuild`
* Fix token refresh racing with other requests and not using new token
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* MatrixRTC: ToDevice distribution for media stream keys
* test: Add RTC to device transport test
* lint
* fix key indexing
* fix indexing take two
- use correct value for: `onEncryptionKeysChanged`
- only update `latestGeneratedKeyIndex` for "this user" key
* test: add test for join config `useExperimentalToDeviceTransport`
* update test to fail without the fixed encryption key index
* review
* review (dave)
---------
Co-authored-by: Timo <toger5@hotmail.de>
* refactor: extract RoomKeyTransport class for key distribution
* refact: Call key transport, pass the target recipients to sendKey
* update IKeyTransport interface to event emitter.
* fix not subscribing to KeyTransportEvents in the EncryptionManager + cleanup
* fix one test and broken bits needed for the test (mostly statistics wrangling)
* fix tests
* add back decryptEventIfNeeded
* move and fix room transport tests
* dedupe isMyMembership
* move type declarations around to be at more reasonable places
* remove deprecated `onMembershipUpdate`
* fix imports
* only start keytransport when session is joined
* use makeKey to reduce test loc
* fix todo comment -> note comment
---------
Co-authored-by: Timo <toger5@hotmail.de>
* Remove redundant sendDelayedEventAction
We do already have the state `hasMemberEvent` that allows to distinguish the two cases. No need to create two dedicated actions.
* fix missing return
* Make membership manager an event emitter to inform about status updates.
- deprecate isJoined (replaced by isActivated)
- move Interface types to types.ts
* add tests for status updates.
* lint
* test "reschedules delayed leave event" in case the delayed event gets canceled
* review
* fix types
* prettier
* fix legacy membership manager
* Abstract logout-causing error type from tokenRefreshFunction calls
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve PushProcessor::getPushRuleGlobRegex
Fix cache key not taking non-pattern parameters into account
Use lookarounds to ensure the word boundary isn't treated as part of the match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Export push processor method for converting matrix glob to regexp
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Export pushProcessor from MatrixClient
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add capturing group around pattern match
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve comment
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Switch sliding sync support to simplified sliding sync
Experimental PR to test js-sdk with simlified sliding sync.
This does not maintain support for regulaer sliding sync.
* Remove txn_id handling, ensure we always resend when req params change
* Fix some tests
* Fix remaining tests
* Mark TODOs on tests which need to die
* Linting
* Make comments lie less
* void
* Always sent full extension request
* Fix test
* Remove usage of deprecated field
* Hopefully fix DM names
* Refactor how heroes are handled in Room
* Fix how heroes work
* Linting
* Ensure that when SSS omits heroes we don't forget we had heroes
Otherwise when the room next appears the name/avatar reset to
'Empty Room' with no avatar.
* Check the right flag when doing timeline trickling
* Also change when the backpagination token is set
* Remove list ops and server-provided sort positions
SSS doesn't have them.
* Linting
* Add Room.bumpStamp
* Update crypto wasm lib
For new functions
* Add performance logging
* Fix breaking change in crypto wasm v8
* Update crypto wasm for breaking changes
See https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/releases/tag/v8.0.0
for how this was mapped from the previous API.
* Mark all tracked users as dirty on expired SSS connections
See https://github.com/matrix-org/matrix-rust-sdk/pull/3965 for
more information. Requires `Extension.onRequest` to be `async`.
* add ts extension
* Fix typedoc ref
* Add method to interface
* Don't force membership to invite
The membership was set correctly from the stripped state anyway so
this was redundant and was breaking rooms where we'd knocked.
* Missed merge
* Type import
* Make coverage happier
* More test coverage
* Grammar & formatting
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove markAllTrackedUsersAsDirty from crypto API
Not sure why this was in there, seems like it just needed to be in
crypto sync callbacks, which it already was.
* Remove I from interface
* API doc
* Move Hero definition to room-summary
* make comment more specific
* Move internal details into room.ts
and make the comment a proper tsdoc comment
* Use terser arrow function syntax
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Move comment to where we do the lookup
* Clarify comment
also prettier says hi
* Add comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add tsdoc
explaining that the summary event will be modified
* more comment
* Remove unrelated changes
* Add docs & make fields optional
* Type import
* Clarify sync versions
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Make tsdoc comment & add info on when it's used.
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Rephrase comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Prettier
* Only fetch member for hero in legacy sync mode
* Split out a separate method to set SSS room summary
Rather than trying to fudge up an object that looked enough like the
old one that we could pass it in.
* Type import
* Make link work
* Nope, linter treats it as an unused import
* Add link the other way
* Add more detail to doc
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove unnecessary cast
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove length > 0 check
as it wasn't really necessary and may cause heroes not to be cleared?
* Doc params
* Remove unnecessary undefined comparison
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Put the comparison back
as it's necessary to stop typescript complaining
* Fix comment
* Fix comment
---------
Co-authored-by: Kegan Dougal <7190048+kegsay@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Update all non-major dependencies
* Hold back eslint-plugin-matrix-org
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>