|
| 1 | +# MSCXXXX - Sharing ephemeral streams of location data |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +[MSC3489](https://github.com/matrix-org/matrix-doc/blob/matthew/location-streaming/proposals/3489-location-streaming.md) |
| 6 | +focuses on streaming persistent location data for applications that require |
| 7 | +historical knowledge. |
| 8 | + |
| 9 | +We also need the ability to share this data in a non-persistent way for cases in |
| 10 | +which privacy is a concern, like user locations. |
| 11 | + |
| 12 | +## Proposal |
| 13 | + |
| 14 | +This MSC adds the ability to publish short-lived location beacons through the |
| 15 | +the use of custom Ephemeral Data Units (EDUs) by building on top of [MSC2476](https://github.com/ananace/matrix-doc/blob/user-defined-edus/proposals/2477-user-defined-ephemeral-events.md). |
| 16 | + |
| 17 | +In order to do so we will first start by introducing a new asset type on |
| 18 | +`m.beacon_info` called `m.self.live` which will mark the start of an user's |
| 19 | +intent to share ephemeral location information. |
| 20 | + |
| 21 | +```json5 |
| 22 | +{ |
| 23 | + "type": "m.beacon_info.@stefan:matrix.org", |
| 24 | + "state_key": "@stefan:matrix.org", |
| 25 | + "content": { |
| 26 | + "m.beacon_info": { |
| 27 | + "description": "Stefan's live location", |
| 28 | + "timeout": 600000, // how long from the last event until we consider the beacon inactive in milliseconds |
| 29 | + }, |
| 30 | + "m.ts": 1436829458432, // creation timestamp of the beacon on the client |
| 31 | + "m.asset": { |
| 32 | + "type": "m.self.live" // Live user location tracking |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | +``` |
| 37 | + |
| 38 | +We define a new asset type as opposed to using the existing `m.self` to allow |
| 39 | +clients to distinguish between location types without potentially overwriting |
| 40 | +static ones. |
| 41 | + |
| 42 | +Multiple live beacons on the same timeline should behave similarly and aggregate |
| 43 | +all available location EDUs. |
| 44 | + |
| 45 | +Subsequently clients will start sending beacon data EDUs to the new |
| 46 | +`rooms/{roomId}/ephemeral/{eventType}` endpoint where `eventType` equals |
| 47 | +`m.beacon` with the same location payload as defined in [MSC3489](https://github.com/matrix-org/matrix-doc/blob/matthew/location-streaming/proposals/3489-location-streaming.md). |
| 48 | + |
| 49 | +XXX: Why do we need a `{txnId}` after `{eventType}` in [MSC2476](https://github.com/ananace/matrix-doc/blob/user-defined-edus/proposals/2477-user-defined-ephemeral-events.md#addition-of-an-ephemeral-event-sending-endpoint-to-the-client-server-api)? |
| 50 | + |
| 51 | +The relation to the original `m.beacon_info` event is not required as all live |
| 52 | +location beacons should display all available data, either grouped by user or not. |
| 53 | + |
| 54 | + |
| 55 | +```json5 |
| 56 | +{ |
| 57 | + "m.location": { |
| 58 | + "uri": "geo:51.5008,0.1247;u=35", |
| 59 | + "description": "Arbitrary beacon information" |
| 60 | + }, |
| 61 | + "m.ts": 1636829458432, |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +These will reach clients through `/sync`s `ephemeral` dictionary with the same |
| 66 | +payload but with the addition of a `sender` which the clients can aggregate user |
| 67 | +locations on. |
| 68 | + |
| 69 | +XXX: Do we need a "user stopped sharing live location" event or is the |
| 70 | +`m.beacon_info` `timeout` sufficient? |
| 71 | + |
| 72 | +## Encryption |
| 73 | + |
| 74 | +XXX: split out into different MSC? |
| 75 | + |
| 76 | +XXX: use `rooms/{roomId}/ephemeral/m.room.encrypted` instead? |
| 77 | + |
| 78 | +E2E encryption for EDUs isn't currently defined but as we're dealing with |
| 79 | +privacy sensitive data we propose to wrap them inside the standard encryption |
| 80 | +envelope: |
| 81 | + |
| 82 | +```json5 |
| 83 | +{ |
| 84 | + "algorithm": "m.megolm.v1.aes-sha2", |
| 85 | + "sender_key": "<sender_curve25519_key>", |
| 86 | + "device_id": "<sender_device_id>", |
| 87 | + "session_id": "<outbound_group_session_id>", |
| 88 | + "ciphertext": "<encrypted_payload_base_64>" |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +in which the `ciphertext` will contain the `m.beacon` payload defined above and |
| 93 | +which will similarly be sent to `rooms/{roomId}/ephemeral/m.beacon` |
| 94 | + |
| 95 | + |
| 96 | +## Alternatives |
| 97 | + |
| 98 | +No alternatives for sending custom ephemeral data are known at this point. |
| 99 | + |
| 100 | +## Unstable prefix |
| 101 | + |
| 102 | + * `m.beacon_info.*` should be referred to as `org.matrix.msc3489.beacon_info.*` until this MSC lands. |
| 103 | + * `m.beacon` should be referred to as `org.matrix.msc3489.beacon` until this MSC lands. |
| 104 | + * `m.location` should be referred to as `org.matrix.msc3488.location.*` until MSC3488 lands. |
| 105 | + * `m.ts` should be referred to as `org.matrix.msc3488.ts.*` until MSC3488 lands. |
| 106 | + * `m.asset` should be referred to as `org.matrix.msc3488.asset.*` until MSC3488 lands. |
0 commit comments