Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data exchange protocol message definition #1936

Merged
merged 10 commits into from
Jun 26, 2024
74 changes: 74 additions & 0 deletions docs/messageData.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
- [Expecting a connection (federation#expect)](#expecting-a-connection-federationexpect)
- [Initiating a connection (federation#init)](#initiating-a-connection-federationinit)
- [Confirming or Aborting the connection attempt (federation#result)](#confirming-or-aborting-the-connection-attempt-federationresult)
- [Exchanging tokens to share data between LAOs (federation#tokens_exchange)](#exchanging-tokens-to-share-data-between-LAOs-federationtokens_exchange)


<!-- END doctoc.sh generated TOC please keep comment here to allow auto update -->
Expand Down Expand Up @@ -3311,4 +3312,77 @@ This message is sent by Bob's server. The purpose of this message is to provide
]
}
```
## Exchanging tokens to share data between LAOs (federation#tokens_exchange)
For now, data exchange is only implemented for social media channel.

This message is sent by both organizers to their servers to be broadcast. The message sent from Alice's server to Bob's server contains the pop tokens of Alice's LAO and vice versa. Upon receiving this message, participants will be able to subscribe to each channel /root/lao_id/social/token.
arnauds5 marked this conversation as resolved.
Show resolved Hide resolved
<details>
<summary>
💡 See an example
</summary>

```json5
// ../protocol/examples/messageData/federation_tokens_exchange/federation_tokens_exchange.json
{
"object": "federation",
"action": "tokens_exchange",
"lao_id": "fzJSZjKf-2cbXH7kds9H8NORuuFIRLkevJlN7qQemjo=",
"roll_call_id": "fEvAfdtNrykd9NPYl9ReHLX-6IP6SFLKTZJLeGUHZ_U=" ,
"tokens": ["M5ZychEi5rwm22FjwjNuljL1qMJWD2sE7oX9fcHNMDU="],
"timestamp": 1712854874
}
```
</details>

```json5
// ../protocol/query/method/message/data/dataFederationTokensExchange.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/dedis/popstellar/master/protocol/query/method/message/data/dataFederationTokensExchange.json",
"description": "Sent by an organizer client to its server, to broadcast the Pop tokens",
"type": "object",
"properties": {
"object": {
"const": "federation"
},
"action": {
"const": "tokens_exchange"
},
"lao_id": {
"type": "string",
"contentEncoding": "base64",
"$comment": "Hash : HashLen(organizer, creation, name)"
},
"roll_call_id": {
"type": "string",
"contentEncoding": "base64",
"$comment": "last roll call id"
},
"tokens": {
"description": "[Array[Base64String]] list of Pop tokens",
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"contentEncoding": "base64"
},
"$comment": "List must be sorted according to byte encoding: -,0...9,A...Z,_,a...z"
},
"timestamp": {
"type": "integer",
"description": "[Timestamp] of the tokens' exchange",
"minimum": 0
}
},
"additionalProperties": false,
"required": [
"object",
"action",
"lao_id",
"roll_call_id",
"tokens",
"timestamp"
]
}

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"object": "federation",
"action": "tokens_exchange",
"lao_id": "fzJSZjKf-2cbXH7kds9H8NORuuFIRLkevJlN7qQemjo=",
"roll_call_id": "fEvAfdtNrykd9NPYl9ReHLX-6IP6SFLKTZJLeGUHZ_U=" ,
"tokens": ["M5ZychEi5rwm22FjwjNuljL1qMJWD2sE7oX9fcHNMDU="],
"timestamp": 1712854874
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://raw.githubusercontent.com/dedis/popstellar/master/protocol/query/method/message/data/dataFederationTokensExchange.json",
"description": "Sent by an organizer client to its server, to broadcast the Pop tokens",
"type": "object",
"properties": {
"object": {
"const": "federation"
},
"action": {
"const": "tokens_exchange"
},
"lao_id": {
"type": "string",
"contentEncoding": "base64",
"$comment": "Hash : HashLen(organizer, creation, name)"
},
"roll_call_id": {
"type": "string",
"contentEncoding": "base64",
"$comment": "last roll call id"
},
"tokens": {
"description": "[Array[Base64String]] list of Pop tokens",
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"contentEncoding": "base64"
},
"$comment": "List must be sorted according to byte encoding: -,0...9,A...Z,_,a...z"
},
"timestamp": {
"type": "integer",
"description": "[Timestamp] of the tokens' exchange",
"minimum": 0
}
},
"additionalProperties": false,
"required": [
"object",
"action",
"lao_id",
"roll_call_id",
"tokens",
"timestamp"
]
}
Loading