* first cut poll model
* process incoming poll relations
* allow alt event types in relations model
* allow alt event types in relations model
* remove unneccesary checks on remove relation
* comment
* Revert "allow alt event types in relations model"
This reverts commit e578d84464.
* Revert "Revert "allow alt event types in relations model""
This reverts commit 515db7a8bc.
* basic handling for new poll relations
* tests
* test room.processPollEvents
* join processBeaconEvents and poll events in client
* tidy and set 23 copyrights
* use rooms instance of matrixClient
* tidy
* more copyright
* simplify processPollEvent code
* throw when poll start event has no roomId
* updates for events-sdk move
* more type changes for events-sdk changes
* comment
I introduced a flaky test to confirm that `MegolmEncryption#prepareToEncrypt`
didn't block the main thread too much, but it turns out that, when run in
varying environments, it tends to fail.
The same behavior is guaranteed by the following cancellation test - if the
thread is blocked, it can't be cancelled.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* refactor: sliding sync: swap to lists-as-keys
Update the request/response API shape to match the latest
MSC3575 version, which converts `lists` from being an array
of list objects to being a map of list objects.
* Linting
* prettier
* add extra setListRanges test
* Default to right type
* refactor: sliding sync: swap to lists-as-keys
Update the request/response API shape to match the latest
MSC3575 version, which converts `lists` from being an array
of list objects to being a map of list objects.
* Linting
* prettier
* add extra setListRanges test
* Default to right type
* `matrix-client-crypto.spec.ts` only tested a very specific bit of crypto (olm
encryption). It goes back to the very early days, before Megolm was invented.
I've renamed it to `olm-encryption-spec.ts`.
* `megolm-integ.spec.ts` is more of a general crypto test; it was just called
`megolm` to distinguish it from the Olm tests above. Renamed to
`crypto.spec.ts`.
These are all called by the react-sdk when showing an encrypted event:
* `getEventEncryptionInfo`
* `checkUserTrust`
* `checkDeviceTrust`
I don't particularly want to keep this API, but as a rapid means to an end,
let's stub them for now.
This test seemed to be testing the behaviour of decrypting redacted events, but
that seems... strange. A redaction event cannot be encrypted (at least, there
is no spec for it), and it should be impossible to decrypt a (correctly)
redacted event, because such an event will lack a `ciphertext` property.
This test is just sticking a "redacted_because" property into a regular event,
which is a bit of a nonsense.
NOTE: This commit introduces a backwards-compatible API change.
Adds the ability to cancel `MegolmEncryption#prepareToEncrypt` by returning
a cancellation function. The bulk of the processing happens in
`getDevicesInRoom`, which now accepts a 'getter' that allows the caller to
indicate cancellation.
See https://github.com/matrix-org/matrix-js-sdk/issues/1255Closes#1255
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Adds an async/promise-based version of `setImmediate`. Note that, despite being
poorly adopted, `setImmediate` is polyfilled, and should be more performant
than `sleep(0)`.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
The megolm tests were making a few assumptions which they really shouldn't; in
particular:
* They were creating mock events with event_ids not starting `$`, and lacking
`sender`, `origin_server_ts` and `unsigned` properties
* They were not including the (now) required `keys.ed25519` property inside
the ciphertext of an olm message.
These work ok currently, but they aren't really correct, and they cause
problems when testing the new rust implementation.
* Use a PrefixedLogger throughout `megolm.ts`
Rather than manually adding `in ${this.roomId}` to each log line, use a
PrefixedLogger to achieve the same effect more consistently.
* Clean up logging in megolm.ts
Where we log a list of devices, we don't need the whole deviceinfo, just the
device id. All that noise makes it very hard to read the logs.
* Log users that we find in the room when encrypting
* Reduce log verbosity on decryption retries
* Remove extensible events v1 field population on legacy events
With extensible events v2, affected events are now gated by a room version, so we don't need this code anymore.
The proposal has generally moved away from mixing m.room.message with extensible fields as well.
* Run prettier
* Remove unstable identifier from tests too
* Run prettier again