Skip to content

MSC4143: MatrixRTC – Real-time communication over Matrix - #4143

Open
toger5 wants to merge 167 commits into
mainfrom
toger5/matrixRTC
Open

MSC4143: MatrixRTC – Real-time communication over Matrix#4143
toger5 wants to merge 167 commits into
mainfrom
toger5/matrixRTC

Conversation

@toger5

@toger5 toger5 commented May 10, 2024

Copy link
Copy Markdown

Rendered

Pull Request Checklist


SCT Stuff:

MSC Checklist

FCP tickyboxes

@toger5
toger5 marked this pull request as draft May 10, 2024 10:33
@toger5
toger5 force-pushed the toger5/matrixRTC branch 2 times, most recently from d717c0b to cff8291 Compare May 10, 2024 10:34
Signed-off-by: Timo K <toger5@hotmail.de>
@toger5
toger5 force-pushed the toger5/matrixRTC branch from cff8291 to 9cbe448 Compare May 10, 2024 10:35
@turt2live turt2live changed the title MatrixRTC (draft) MSC4143: MatrixRTC May 10, 2024
Comment thread proposals/4143-MatrixRTC.md Outdated
@turt2live turt2live added A-VOIP Any VoIP or MatrixRTC related proposals proposal A matrix spec change proposal. Process state. kind:core MSC which is critical to the protocol's success needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels May 10, 2024
Signed-off-by: Timo K <toger5@hotmail.de>
@toger5
toger5 force-pushed the toger5/matrixRTC branch from b0aa20b to b2b4e5e Compare May 14, 2024 09:24
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md
The recipient devices are determined from the `m.rtc.member` events that are considered to be
joined to the slot. The conditions for considering a member joined were given
[above](#joining-a-slot). Once the member events are determined, the `m.rtc.encryption_key`
to-device messages are sent to the devices that were used to encrypt these member events.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this obvious how to do correctly? Given that e.g. device_id and sender_key are untrusted and shouldn't really be used? Might want to be explicit here if this is a non-standard thing to do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had detailed steps for how to do this in #4516 but @BillCarsonFr preferred to not put these into the MSC because this is a general gap in the spec that's covered in https://github.com/element-hq/crypto-internal/issues/422. So I think it's a standard thing to do but the spec is lacking clear wording for how to do it correctly. I'd suggest to keep the MSC as is and solve https://github.com/element-hq/crypto-internal/issues/422 separately.

Comment thread proposals/4143-matrix-rtc.md

When joining a slot, clients generate a 32-byte key by using a cryptographically secure pseudorandom
number generator. They then share the key with other clients joined to the slot by sending encrypted
to-device messages of the type `m.rtc.encryption_key`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to worry about missed to-device messages? I think megolm allows rerequesting keys in case of wedged OLM session?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no re-requesting of RTC keys, and for now no plan to support it in the future.
This behavior in megolm is also pretty much deprecated.

- `key` (required, string): The key (32 bytes) encoded as specified by `format`.
- `index` (required, number): The rolling index of the key to distinguish it from other keys. The
value MUST be between 0 and 255 inclusive. WebRTC-based transports may use this as the `keyID`
field of [SFrame](https://www.w3.org/TR/webrtc-encoded-transform/#sframe) headers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if index reaches 255?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should wrap around 0

Comment thread proposals/4143-matrix-rtc.md
Comment thread proposals/4143-matrix-rtc.md Outdated
are defined by the transport's specification. This could, for instance, include WebSocket URLs.
The transport's specification would be as per its [MSC4519] registration.
- `can_subscribe` (array): An array of transport types that the member is able to subscribe to.
Other members can use this as cue for deciding which transports to use to accommodate this member.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need a section for how transports work in the abstract? Like how does a client choose which one to use? What happens if there is no overlap of supported transport types?

Also it says can_subscribe can be used to decide what transports to start to accommodate other members? But wouldn't you want to have every type you support published anyway? Or does everyone join initially with empty published and then decides what to publish?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need a section for how transports work in the abstract? Like how does a client choose which one to use? What happens if there is no overlap of supported transport types?

Yes, good point. Our thinking was to offload any negotiation or consensus for choosing transports to a future MSC. Right now we only have one transport (LiveKit). How exactly clients agree on which transport to choose depends on what transports are available. So I think we cannot prescribe that generically. The future MSC that introduces the second transport will need to cover how clients choose between LiveKit and the new transport and what happens if there is no overlap in client support.

But wouldn't you want to have every type you support published anyway? Or does everyone join initially with empty published and then decides what to publish?

No, I think you wouldn't. Publishing a transport will usually incur some amount of cost (traffic, processing, etc.) on clients. So you clients have an interest to only publish transports that are actually needed.

Have tried to clarify both in d6133e4.

Comment thread proposals/4143-matrix-rtc.md
Comment thread proposals/4143-matrix-rtc.md Outdated
Comment thread proposals/4143-matrix-rtc.md Outdated

#### Distributing keys

When joining a slot, clients generate a 32-byte key by using a cryptographically secure random

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[non-blocking] To support future encryption mechanisms that want more entropy, I would suggest either saying that:

  • 32 bytes is the minimum, but clients could generate more bytes. (Transports might need to specify what to do with excess bytes, but it shouldn't cause a problem for transports that use HKDF.), or
  • clients should generate the number of bytes specified by the transport that they're publishing to (or the maximum of the number of bytes specified by the transports).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00-weekly-pings Tracking for weekly pings in the SCT office. 00 to make it first in the labels list. A-VOIP Any VoIP or MatrixRTC related proposals disposition-merge Process state. kind:core MSC which is critical to the protocol's success matrix-2.0 Required for Matrix 2.0 (note: do not rename - used in reports/links) proposal A matrix spec change proposal. Process state. proposed-final-comment-period Currently awaiting signoff of a majority of team members in order to enter the FCP. Process state. unresolved-concerns This proposal has at least one outstanding concern. Process state.

Projects

Status: Ready for FCP ticks

Development

Successfully merging this pull request may close these issues.