From c0fa29752e5786097f266876245c402fc73d2d0e Mon Sep 17 00:00:00 2001 From: onsriahi14 Date: Wed, 12 Jun 2024 01:09:29 +0200 Subject: [PATCH 1/7] defined data exchange message + an example of such message --- .../federation_tokens_exchange.json | 8 ++++ .../data/dataFederationTokensExchange.json | 48 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 protocol/examples/messageData/federation_tokens_exchange/federation_tokens_exchange.json create mode 100644 protocol/query/method/message/data/dataFederationTokensExchange.json diff --git a/protocol/examples/messageData/federation_tokens_exchange/federation_tokens_exchange.json b/protocol/examples/messageData/federation_tokens_exchange/federation_tokens_exchange.json new file mode 100644 index 0000000000..4ea713bf4e --- /dev/null +++ b/protocol/examples/messageData/federation_tokens_exchange/federation_tokens_exchange.json @@ -0,0 +1,8 @@ +{ + "object": "federation", + "action": "tokens_exchange", + "lao_id": "fzJSZjKf-2cbXH7kds9H8NORuuFIRLkevJlN7qQemjo=", + "roll_call_id": "fEvAfdtNrykd9NPYl9ReHLX-6IP6SFLKTZJLeGUHZ_U=" , + "tokens": ["M5ZychEi5rwm22FjwjNuljL1qMJWD2sE7oX9fcHNMDU="], + "timestamp": 1712854874 +} \ No newline at end of file diff --git a/protocol/query/method/message/data/dataFederationTokensExchange.json b/protocol/query/method/message/data/dataFederationTokensExchange.json new file mode 100644 index 0000000000..05e1f5b6d5 --- /dev/null +++ b/protocol/query/method/message/data/dataFederationTokensExchange.json @@ -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/dataFederationChallengeRequest.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" + ] +} From 2e24df0b055761b23040716b2880c74c724a7d4b Mon Sep 17 00:00:00 2001 From: onsriahi14 Date: Wed, 12 Jun 2024 01:34:59 +0200 Subject: [PATCH 2/7] updated the documentation in messageData.md according to the new added message --- docs/messageData.md | 74 +++++++++++++++++++ .../data/dataFederationTokensExchange.json | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/docs/messageData.md b/docs/messageData.md index 550b928c9f..7aa6783dd3 100644 --- a/docs/messageData.md +++ b/docs/messageData.md @@ -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) @@ -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 include the pop tokens of the other LAO. Upon receiving this message, participants will be able to subscribe to each channel /root/lao_id/social/token. +
+ +💡 See an example + + +```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 +} +``` +
+ +```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" + ] +} + +``` \ No newline at end of file diff --git a/protocol/query/method/message/data/dataFederationTokensExchange.json b/protocol/query/method/message/data/dataFederationTokensExchange.json index 05e1f5b6d5..cfb4d7b90e 100644 --- a/protocol/query/method/message/data/dataFederationTokensExchange.json +++ b/protocol/query/method/message/data/dataFederationTokensExchange.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "$id": "https://raw.githubusercontent.com/dedis/popstellar/master/protocol/query/method/message/data/dataFederationChallengeRequest.json", + "$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": { From 5917b6d8931aec9a56a333b60cc7b154cf7df363 Mon Sep 17 00:00:00 2001 From: onsriahi14 Date: Fri, 14 Jun 2024 20:53:45 +0200 Subject: [PATCH 3/7] changed the doc --- docs/messageData.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/messageData.md b/docs/messageData.md index 7aa6783dd3..7dd71186d4 100644 --- a/docs/messageData.md +++ b/docs/messageData.md @@ -3315,7 +3315,7 @@ 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 include the pop tokens of the other LAO. Upon receiving this message, participants will be able to subscribe to each channel /root/lao_id/social/token. +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.
💡 See an example From 43c5bb619572dbf90a51dec56702def58432b92f Mon Sep 17 00:00:00 2001 From: onsriahi14 Date: Fri, 14 Jun 2024 18:58:31 +0000 Subject: [PATCH 4/7] auto-format action fixes --- docs/messageData.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/messageData.md b/docs/messageData.md index 7dd71186d4..9abc4354ca 100644 --- a/docs/messageData.md +++ b/docs/messageData.md @@ -3385,4 +3385,4 @@ This message is sent by both organizers to their servers to be broadcast. The me ] } -``` \ No newline at end of file +``` From 4c6ae76d120f7f94777d51a5109fc6c8c14ec646 Mon Sep 17 00:00:00 2001 From: onsriahi14 Date: Fri, 14 Jun 2024 21:56:58 +0200 Subject: [PATCH 5/7] corrected the description in the documentation --- docs/messageData.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/messageData.md b/docs/messageData.md index 7dd71186d4..7aa6783dd3 100644 --- a/docs/messageData.md +++ b/docs/messageData.md @@ -3315,7 +3315,7 @@ 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. +This message is sent by both organizers to their servers to be broadcast. The message include the pop tokens of the other LAO. Upon receiving this message, participants will be able to subscribe to each channel /root/lao_id/social/token.
💡 See an example From 012ae3b58d2b9af19f54011dfb13735b4dd6ba2a Mon Sep 17 00:00:00 2001 From: onsriahi14 Date: Fri, 14 Jun 2024 22:43:32 +0200 Subject: [PATCH 6/7] added the requirements in data.json, main.js and main.test.js files --- project/build.properties | 1 + protocol/query/method/message/data/data.json | 3 +++ protocol/test/main.js | 2 ++ protocol/test/main.test.js | 3 +++ 4 files changed, 9 insertions(+) create mode 100644 project/build.properties diff --git a/project/build.properties b/project/build.properties new file mode 100644 index 0000000000..10fd9eee04 --- /dev/null +++ b/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.5.5 diff --git a/protocol/query/method/message/data/data.json b/protocol/query/method/message/data/data.json index 382d5eb1d0..a72b62effa 100644 --- a/protocol/query/method/message/data/data.json +++ b/protocol/query/method/message/data/data.json @@ -67,6 +67,9 @@ { "$ref": "dataFederationResult.json" }, + { + "$ref": "dataFederationTokensExchange.json" + }, { "$ref": "dataWitnessMessage.json" }, diff --git a/protocol/test/main.js b/protocol/test/main.js index 12fbbe16a9..ab5cf35ac3 100644 --- a/protocol/test/main.js +++ b/protocol/test/main.js @@ -49,6 +49,7 @@ const message_data_federation_expect_schema = require("../query/method/message/d const message_data_federation_challenge_request_schema = require("../query/method/message/data/dataFederationChallengeRequest.json") const message_data_federation_challenge_schema = require("../query/method/message/data/dataFederationChallenge.json") const message_data_federation_result_schema = require("../query/method/message/data/dataFederationResult.json") +const message_data_federation_tokens_exchange_schema = require("../query/method/message/data/dataFederationTokensExchange.json") const message_data_chirp_add_schema = require("../query/method/message/data/dataAddChirp.json"); const message_data_chirp_notify_add_schema = require("../query/method/message/data/dataNotifyAddChirp.json"); @@ -124,6 +125,7 @@ ajv.addSchema([ message_data_federation_challenge_request_schema, message_data_federation_challenge_schema, message_data_federation_result_schema, + message_data_federation_tokens_exchange_schema, message_data_chirp_notify_add_schema, message_data_chirp_add_schema, diff --git a/protocol/test/main.test.js b/protocol/test/main.test.js index 0d4cc46c3d..df64e6cd42 100644 --- a/protocol/test/main.test.js +++ b/protocol/test/main.test.js @@ -270,6 +270,9 @@ test("message data: federation", () => { federation_result = require("../examples/messageData/federation_result/federation_result.json"); expect(federation_result).toBeValid(messageDataSchema); + federation_tokens_exchange = require("../examples/messageData/federation_tokens_exchange/federation_tokens_exchange.json"); + expect(federation_tokens_exchange).toBeValid(messageDataSchema); + }); test("message data: chirp", () => { From cfdbf13b5489228c48d64793e96b95e55753741c Mon Sep 17 00:00:00 2001 From: onsriahi14 <73482468+onsriahi14@users.noreply.github.com> Date: Tue, 25 Jun 2024 01:48:11 +0200 Subject: [PATCH 7/7] Delete unnecessary file --- project/build.properties | 1 - 1 file changed, 1 deletion(-) delete mode 100644 project/build.properties diff --git a/project/build.properties b/project/build.properties deleted file mode 100644 index 10fd9eee04..0000000000 --- a/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.5.5