Skip to content

Commit f9eb3e7

Browse files
dbrgnlgrahl
authored andcommitted
Relayed Data Task (#141)
This adds a task that simply exists for the purpose of relaying arbitrary data from initiator to responder.
1 parent e3e9302 commit f9eb3e7

File tree

4 files changed

+116
-7
lines changed

4 files changed

+116
-7
lines changed

Readme.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
SaltyRTC is an **end-to-end encrypted signalling protocol**. It offers
88
to freely choose from a range of signalling tasks, such as setting up a
9-
**WebRTC** or **ORTC** peer-to-peer connection. SaltyRTC is completely
10-
open to new and custom signalling tasks for everything feasible.
9+
**WebRTC** or **ORTC** peer-to-peer connection, or simply to exchange
10+
arbitrary data over the established transport in a secure manner.
11+
SaltyRTC is completely open to new and custom signalling tasks for
12+
everything feasible.
1113

1214
In this repository, you can find...
1315

@@ -17,6 +19,9 @@ In this repository, you can find...
1719
encryption techniques.
1820
* The [SaltyRTC ORTC Task Protocol](Task-ORTC.md) to set up a secure
1921
ORTC peer-to-peer connection.
22+
* The [SaltyRTC Relayed Data Task Protocol](Task-RelayedData.md) to set
23+
up a secure channel for exchanging arbitrary data by using SaltyRTC's
24+
end-to-end encryption techniques.
2025
* The [SaltyRTC Chunking Specification](Chunking.md) used by SaltyRTC's
2126
WebRTC task. However, the specification can also be used as a generic
2227
message chunking solution.

Task-ORTC.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ dedicated WebSocket connection over a SaltyRTC server.
1212

1313
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
1414
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
15-
document are to be interpreted as described in [RFC 2119
16-
[RFC2119]](https://tools.ietf.org/html/rfc2119).
15+
document are to be interpreted as described in
16+
[RFC 2119](https://tools.ietf.org/html/rfc2119).
1717

1818
# Terminology
1919

@@ -158,7 +158,7 @@ channel:
158158
designate these for handover, the *label* field of each message SHALL
159159
be set to `handover`.
160160
2. The client creates a new `RTCDataChannel` instance from the negotiated
161-
`RTCDataTransport` instance and the `RTCDataChannelParameters` object
161+
`RTCDataTransport` instance and the `RTCDataChannelParameters` object
162162
containing only the following values:
163163
* *ordered* SHALL be set to `true`,
164164
* *protocol* and *label* SHALL be set to the same subprotocol that has

Task-RelayedData.md

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# SaltyRTC Relayed Data Task
2+
3+
This task uses the end-to-end encrypted WebSocket connection set up by
4+
the SaltyRTC protocol to send user defined messages.
5+
6+
# Conventions
7+
8+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
9+
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
10+
document are to be interpreted as described in
11+
[RFC 2119](https://tools.ietf.org/html/rfc2119).
12+
13+
# Terminology
14+
15+
All terms from the [SaltyRTC protocol
16+
specification](./Protocol.md#terminology) are valid in this document.
17+
18+
# Task Protocol Name
19+
20+
The following protocol name SHALL be used for task negotiation:
21+
22+
`v0.relayed-data.tasks.saltyrtc.org`
23+
24+
# Task Data
25+
26+
This task does not currently make use of the *data* field of the 'auth'
27+
messages described in the [SaltyRTC protocol
28+
specification](./Protocol.md#auth-message). The task data sent by the
29+
peers should be `Nil`.
30+
31+
# Message Structure
32+
33+
The same message structure as defined in the [SaltyRTC protocol
34+
specification](./Protocol.md#message-structure) SHALL be used.
35+
36+
# Client-to-Client Messages
37+
38+
Once the task has taken over, user data MAY be sent using 'data'
39+
messages.
40+
41+
If one of the sides wants to terminate the connection, the 'close'
42+
Message SHALL be sent as described in the [SaltyRTC protocol
43+
specification](./Protocol.md#close-message).
44+
45+
Other message types (including the
46+
['application' message](./Protocol.md#application-message))
47+
SHALL NOT be used in the Relayed Data task.
48+
49+
## Message States (Beyond 'auth')
50+
51+
+--+
52+
| v
53+
+-+----+ +-------+
54+
-+->+ data +--->+ close |
55+
| +------+ +-------+
56+
| ^
57+
+------------------+
58+
59+
## 'data' messages
60+
61+
Once the task has taken over, the user application of a client MAY
62+
trigger sending this message.
63+
64+
This message MAY contain any MessagePack value type. If the user does
65+
not wish to encode messages with MessagePack, they can be transmitted
66+
using MessagePack binary or string value types.
67+
68+
A task who sends a 'data' message SHALL set the *p* field to whatever
69+
data the user application provided. The name is an abbreviation that
70+
stands for "payload" and has been chosen to reduce the message overhead.
71+
72+
A receiving task SHALL validate that the *p* field is set. It MUST pass
73+
the payload inside that field to the user application.
74+
75+
```
76+
{
77+
"type": "data",
78+
"p": ...
79+
}
80+
```
81+
82+
# Sending a Message
83+
84+
The task must provide a way for the user application to send 'data'
85+
messages. It MUST validate the messages as described in the section on
86+
['data' messages](#data-messages).
87+
88+
The same procedure as described in the [SaltyRTC protocol
89+
specification](./Protocol.md#sending-a-signalling-message) SHALL be
90+
followed to send 'data' messages.
91+
92+
# Receiving a Message
93+
94+
Incoming task messages shall be processed as follows:
95+
96+
* The client SHALL validate and decrypt the message according to the
97+
[SaltyRTC protocol specification](./Protocol.md#receiving-a-signalling-message)
98+
* If the message type is 'close', the message MUST be handled as
99+
described in the
100+
[SaltyRTC protocol specification](./Protocol.md#close-message)
101+
* Otherwise, if the message type is 'data', the payload MUST be passed
102+
to the user application.
103+
* For all other message types, the connection MUST be closed with a
104+
close code of `3001` (*Protocol Error*)

Task-WebRTC.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ dedicated WebSocket connection over a SaltyRTC server.
1212

1313
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
1414
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
15-
document are to be interpreted as described in [RFC 2119
16-
[RFC2119]](https://tools.ietf.org/html/rfc2119).
15+
document are to be interpreted as described in
16+
[RFC 2119](https://tools.ietf.org/html/rfc2119).
1717

1818
# Terminology
1919

0 commit comments

Comments
 (0)