Implement MSC3819: Allowing widgets to send/receive to-device messages (#8885)

* Implement MSC3819: Allowing widgets to send/receive to-device messages

* Don't change the room events and state events drivers

* Update to latest matrix-widget-api changes

* Support sending encrypted to-device messages

* Use queueToDevice for better reliability

* Update types for latest WidgetDriver changes

* Upgrade matrix-widget-api

* Add tests

* Test StopGapWidget

* Fix a potential memory leak
This commit is contained in:
Robin 2022-08-10 08:57:56 -04:00 committed by GitHub
parent 3d0982e9a6
commit 103b60dfb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 322 additions and 24 deletions

View file

@ -0,0 +1,82 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StopGapWidgetDriver sendToDevice sends encrypted messages 1`] = `
Array [
Array [
Array [
Object {
"deviceInfo": DeviceInfo {
"algorithms": undefined,
"deviceId": "aliceWeb",
"keys": Object {},
"known": false,
"signatures": Object {},
"unsigned": Object {},
"verified": 0,
},
"userId": "@alice:example.org",
},
Object {
"deviceInfo": DeviceInfo {
"algorithms": undefined,
"deviceId": "aliceMobile",
"keys": Object {},
"known": false,
"signatures": Object {},
"unsigned": Object {},
"verified": 0,
},
"userId": "@alice:example.org",
},
],
Object {
"hello": "alice",
},
],
Array [
Array [
Object {
"deviceInfo": DeviceInfo {
"algorithms": undefined,
"deviceId": "bobDesktop",
"keys": Object {},
"known": false,
"signatures": Object {},
"unsigned": Object {},
"verified": 0,
},
"userId": "@bob:example.org",
},
],
Object {
"hello": "bob",
},
],
]
`;
exports[`StopGapWidgetDriver sendToDevice sends unencrypted messages 1`] = `
Array [
Array [
Object {
"batch": Array [
Object {
"deviceId": "*",
"payload": Object {
"hello": "alice",
},
"userId": "@alice:example.org",
},
Object {
"deviceId": "bobDesktop",
"payload": Object {
"hello": "bob",
},
"userId": "@bob:example.org",
},
],
"eventType": "org.example.foo",
},
],
]
`;