झुंड
A swarm (group chat) is a set of participants capable of resilient, decentralized communication. For example, if two participants lose connectivity with the rest of the group (e.g., during an Internet outage) but can still reach each other over a LAN or subnetwork, they can exchange messages locally and then synchronize with the rest of the group once connectivity is restored.
A swarm is defined by the following properties:
Ability to split and merge based on network connectivity.
History synchronization. Every participant must be able to send a message to the entire group.
कोई केंद्रीय प्राधिकरण नहीं, किसी सर्वर पर भरोसा नहीं किया जा सकता।
Non-repudiation. Devices must be able to verify past messages' validity and to replay the entire history.
Perfect Forward Secrecy (PFS) is provided on the transport channels. Storage is handled by each device.
मुख्य विचार प्रतिभागियों के साथ एक सिंक्रनाइज़्ड मर्केल पेड़ प्राप्त करना है।
We identified four modes for swarms that we want to implement:
ONE_TO_ONE: A private conversation between two endpoints—either between two users or with yourself.
ADMIN_INVITES_ONLY: A swarm in which only the administrator can invite members (for example, a teacher-managed classroom).
INVITES_ONLY: A closed swarm that admits members strictly by invitation; no one may join without explicit approval.
PUBLIC: A public swarm that anyone can join without prior invitation (For example a forum).
परिदृश्य
एक झुंड बनाएं
बॉब एक नया झुंड बनाना चाहता है
Bob creates a local Git repository.
फिर, वह निम्नलिखित के साथ एक प्रारंभिक हस्ताक्षरित प्रतिबद्धता बनाता हैः
/admins
में उसकी सार्वजनिक कुंजीउसके उपकरण प्रमाण पत्र ̀ /डिवाइसेस ]]
उसके सीआरएल में ̀ /crls`
पहली प्रतिबद्धता का हैश बातचीत की ** आईडी ** बन जाता है
Bob announces to his other devices that he created a new conversation. This is done via an invite to join the group sent through the DHT to other devices linked to that account.
किसी को जोड़ना
Bob adds Alice
Bob adds Alice to the repo:
/invited
में आमंत्रित URI जोड़ता हैCRL को
/crls
में जोड़ता है
Bob sends a request on the DHT.
आमंत्रण प्राप्त करना
Alice gets the invite to join the previously created swarm
Alice accepts the invite (if she declines, nothing happens; she will remain in the "invited" list, and will never receive any messages)
A peer-to-peer connection is established between Alice and Bob.
Alice pulls the Git repository from Bob. WARNING this means that messages require a connection, not from the DHT as it is today.
Alice validates the commits from Bob.
To validate that Alice is a member, she removes the invite from
/invited
directory, then adds her certificate to the/members
directoryOnce all commits are validated and syncronized to her device, Alice discovers other members of the group. with these peers, she will then construct the DRT with Bob as a bootstrap.
संदेश भेजना
Alice sends a message to Bob
Alice creates a commit message. She constructs a JSON payload containing the MIME type and message body. For example:
{
"type": "text/plain",
"body": "hello"
}
Alice ensure her device credentials are present. If Alice’s device certificate or its associated CRL isn’t already stored in the repository, she adds them so that other participants can verify the commit.
Alice commits to the repository (Because Jami relies primarily on commit-message metadata rather than file contents, merge conflicts are rare; the only potential conflicts would involve CRLs or certificates, which are versioned in a dedicated location).
Alice announces the commit via the DRT with a service message and pings the DHT for mobile devices (they must receive a push notification).
टिप्पणी
To notify other devices, the sender transmits a SIP message with type: application/im-gitmessage-id
.
The JSON payload includes the deviceId (the sender’s), the conversationId and the reference (hash) of the new commit.
संदेश प्राप्त करना
Bob receives a message from Alice
Bob performs a Git pull on Alice's repository.
All incoming commits MUST be verified by a hook.
If all commits are valid, commits are stored and displayed.Bob then announces the message via the DRT for other devices.
If any commit is invalid, pull is aborted. Alice must restore her repository to a correct state before retrying.
प्रतिबद्धता की पुष्टि
उपयोगकर्ताओं को कुछ अवांछित प्रतिबद्धताओं (संघर्षों, झूठे संदेशों, आदि के साथ) को आगे बढ़ाने से बचने के लिए, रिमोट शाखा को मिलाए जाने से पहले प्रत्येक प्रतिबद्धता (पुराने से नवीनतम तक) को इस तरह सत्यापित किया जाना चाहिएः
टिप्पणी
If the validation fails, the fetch is ignored and we do not merge the branch (and remove the data), and the user should be notified.
If a fetch is too big, it's not merged.
For each incoming commit, ensure that the sending device is currently authorized and that the issuer’s certificate exists under /members or /admins, and the device’s certificate under /devices.
Then handle one of three cases, based on the commit’s parent count:
Merge Commit (2 parents). No further validation is required, merges are always accepted.
Initial Commit (0 parents). Validate that this is the very first repository snapshot:
Admin certificate is added.
Device certificate is added.
CRLs (Certificate Revocation Lists) are added.
No other files are present.
Ordinary Commit (1 parent). The commit message must be JSON with a top‑level
type
field. Handle eachtype
as follows:If
text
(or any non–file‑modifying MIME type)Signature is valid against the author’s certificate in the repo.
No unexpected files are added or removed.
If
vote
voteType
is one of the supported values (e.g. "ban", "unban").The vote matches the signing user.
The signer is an admin, their device is present, and not themselves banned.
No unexpected files are added or removed.
If
member
If
adds
Properly signed by the inviter.
New member’s URI appears under
/invited
.No unexpected files are added or removed.
If ONE_TO_ONE, ensure exactly one admin and one member.
If ADMIN_INVITES_ONLY, the inviter must be an admin.
If
joins
Properly signed by the joining device.
Device certificate added under
/devices
.Corresponding invite removed from
/invited
and certificate added to/members
.No unexpected files are added or removed.
If
banned
Vote is valid per the
vote
rules above.Ban is issued by an admin.
Target’s certificate moved to /banned.
Only files related to the ban vote are removed.
No unexpected files are added or removed.
Fallback. If the commit’s type or structure is unrecognized, reject it and notify the peer (or user) that they may be running an outdated version or attempting unauthorized changes.
डिवाइस पर प्रतिबंध लगाएं
महत्त्वपूर्ण
Jami source code tends to use the terms (un)ban, while the user interface uses the terms (un)block.
Alice, Bob, Carla, Denys are in a swarm. Alice issues a ban against Denys.
In a fully peer‑to‑peer system with no central authority, this simple action exposes three core challenges:
Untrusted Timestamps: Commit timestamps cannot be relied upon for ordering ban events, as any device can forge or replay commits with arbitrary dates.
Conflicting bans: In cases where multiple admin devices exist, network partitions can result in conflicting ban decisions. For instance, if Alice can communicate with Bob but not with Denys and Carla, while Carla can communicate with Denys, conflicting bans may occur. If Denys bans Alice while Alice bans Denys, the group’s state becomes unclear when all members eventually reconnect and merge their conversation histories.
Compromised or expired devices: Devices can be compromised, stolen, or have their certificates expire. The system must allow banning such devices and ensure they cannot manipulate their certificate or commit timestamps to send unauthorized messages or falsify their expiration status.
इसी तरह के सिस्टम (वितरित समूह प्रणाली के साथ) बहुत अधिक नहीं हैं, लेकिन ये कुछ उदाहरण हैंः
[mpOTR किसी को कैसे प्रतिबंधित करना है परिभाषित नहीं करता है]
सिग्नल, समूह चैट के लिए कोई केंद्रीय सर्वर नहीं है (EDIT: वे हाल ही में उस बिंदु को बदलते हैं), किसी को समूह से प्रतिबंधित करने की क्षमता नहीं देता है।
This voting system needs a human action to ban someone or must be based on the CRLs info from the repository (because we can not trust external CRLs).
वार्तालाप से डिवाइस निकालें
यह एकमात्र हिस्सा है कि बातचीत के विभाजन से बचने के लिए आम सहमति होनी चाहिए, जैसे कि अगर दो सदस्य बातचीत से एक दूसरे को बाहर निकालते हैं, तो तीसरा क्या होगा?
यह रद्द किए गए उपकरणों का पता लगाने के लिए आवश्यक है, या बस एक सार्वजनिक कमरे में अवांछित लोगों की उपस्थिति से बचने के लिए। प्रक्रिया एक सदस्य और एक उपकरण के बीच काफी समान हैः
एलिस बॉब को हटा देता है
महत्त्वपूर्ण
Alice MUST be an admin to vote.
सबसे पहले, वह बॉब पर प्रतिबंध लगाने के लिए मतदान करती है। ऐसा करने के लिए, वह फ़ाइल /votes/ban/members/uri_bob/uri_alice में बनाती है (सदस्यों को डिवाइस के लिए डिवाइस द्वारा प्रतिस्थापित किया जा सकता है, या आमंत्रण के लिए आमंत्रित किया जा सकता है या व्यवस्थापक के लिए व्यवस्थापक) और प्रतिबद्धता
इसके बाद वह जांच करती है कि क्या वोट तय हो गया है। इसका मतलब है कि 50% से अधिक प्रशासक बॉब पर प्रतिबंध लगाने के लिए सहमत हैं (यदि वह अकेली है, तो यह निश्चित रूप से 50% से अधिक है) ।
यदि मतदान हल हो जाता है, तो /votes/ban में फ़ाइलें हटा दी जा सकती हैं, /members, /admins, /invited, /CRLs, /devices में बॉब के लिए सभी फ़ाइलें हटा दी जा सकती हैं (या केवल /devices में यदि यह एक डिवाइस है जो प्रतिबंधित है) और बॉब का प्रमाण पत्र /banned/members/bob_uri.crt में रखा जा सकता है (या /banned/devices/uri.crt यदि कोई डिवाइस प्रतिबंधित है) और repo को समर्पित किया जा सकता है
फिर, एलिस अन्य उपयोगकर्ताओं को सूचित करती है (बॉब के बाहर)
Alice (admin) re-adds Bob (banned member)
If she votes for unbanning Bob. To do that, she creates the file in /votes/unban/members/uri_bob/uri_alice (members can be replaced by devices for a device, or invited for invites or admins for admins) and commits
इसके बाद वह जांच करती है कि क्या वोट तय हो गया है। इसका मतलब है कि 50% से अधिक प्रशासक बॉब पर प्रतिबंध लगाने के लिए सहमत हैं (यदि वह अकेली है, तो यह निश्चित रूप से 50% से अधिक है) ।
यदि मतदान हल हो जाता है, तो /votes/unban में फ़ाइलें हटा दी जा सकती हैं, /members, /admins, /invited, /CRLs में बॉब के लिए सभी फ़ाइलें, फिर से जोड़ी जा सकती हैं (या केवल /डिवाइसेस में यदि यह एक डिवाइस है जो गैर-प्रतिबंधित है) और रेपो में प्रतिबद्ध किया जा सकता है
बातचीत को हटा दें
convInfos में सहेजें हटाया=समय::अब() (जैसे हटाएंसंपर्क संपर्कों में सहेजता है) कि बातचीत हटाया जाता है और अन्य उपयोगकर्ता के उपकरणों के साथ सिंक्रनाइज़ किया जाता है
अब, अगर इस बातचीत के लिए एक नई प्रतिबद्धता प्राप्त है यह अनदेखा किया जाता है
अब, अगर Jami स्टार्टअप और रेपो अभी भी मौजूद है, बातचीत ग्राहकों को घोषित नहीं किया जाता है
Two cases: a. If no other member in the conversation we can immediately remove the repository b. If still other members, commit that we leave the conversation, and now wait that at least another device sync this message. This avoids the fact that other members will still detect the user as a valid member and still sends new message notifications.
जब हम सुनिश्चित कर रहे हैं कि किसी को सिंक्रनाइज़ किया गया है, हटाएँ मिटाया=समय::अब() और अन्य उपयोगकर्ताओं के उपकरणों के साथ सिंक्रनाइज़
उपयोगकर्ता के स्वामित्व वाले सभी उपकरणों को अब भंडार और संबंधित फ़ाइलों को मिटा सकते हैं
मोड कैसे निर्दिष्ट करें
समय के साथ मोड नहीं बदला जा सकता है. या यह एक और बातचीत है. तो, यह डेटा प्रारंभिक प्रतिबद्ध संदेश में संग्रहीत किया जाता है. प्रतिबद्ध संदेश निम्नानुसार होगाः
{
"type": "initial",
"mode": 0,
}
अभी के लिए, "मोड" मानों को स्वीकार करता है 0 (ONE_TO_ONE), 1 (ADMIN_INVITES_ONLY), 2 (INVITES_ONLY), 3 (PUBLIC)
Processes for 1:1 chats
The goal here is to keep the old API (addContact/removeContact, sendTrustRequest/acceptTrustRequest/discardTrustRequest) to create a chat with a peer and its contact. This still implies some changes that we cannot ignore:
प्रक्रिया अभी भी समान है, एक खाता addContact के माध्यम से एक संपर्क जोड़ सकता है, फिर DHT के माध्यम से एक TrustRequest भेज सकता है। लेकिन दो परिवर्तन आवश्यक हैंः
TrustRequest में एक "conversationId" शामिल है जो अनुरोध को स्वीकार करते समय सहकर्मी को सूचित करता है कि किस वार्तालाप को क्लोन करना है
TrustRequest को पुनः प्रयास किया जाता है जब संपर्क ऑनलाइन आता है। यह आज नहीं है (जैसा कि हम एक नया TrustRequest उत्पन्न नहीं करना चाहते हैं यदि सहकर्मी पहले को त्यागता है) । इसलिए, यदि किसी खाते को एक विश्वास अनुरोध प्राप्त होता है, तो यह स्वचालित रूप से अनदेखा किया जाएगा यदि संबंधित बातचीत के साथ अनुरोध अस्वीकार कर दिया जाता है (जैसा कि convRequests सिंक्रनाइज़ होते हैं)
फिर, जब संपर्क अनुरोध को स्वीकार करता है, तो सिंक्रनाइज़ेशन की अवधि आवश्यक होती है, क्योंकि संपर्क को अब बातचीत का क्लोन करने की आवश्यकता होती है।
removeContact() संपर्क और संबंधित 1:1 वार्तालापों को हटा देगा (एक ही प्रक्रिया के साथ "एक वार्तालाप हटाएं") यहाँ केवल नोट यह है कि यदि हम किसी संपर्क को प्रतिबंधित करते हैं, तो हम सिंक्रनाइज़ेशन के लिए इंतजार नहीं करते हैं, हम केवल संबंधित फ़ाइलों को हटा देते हैं।
मुश्किल परिदृश्य
कुछ मामलों में दो वार्तालाप हो सकते हैं। ये कम से कम दो ऐसे परिदृश्य हैंः
Alice adds Bob.
Bob accepts.
Alice removes Bob.
Alice adds Bob.
या
Alice adds Bob and Bob adds Alice at the same time, but both are not connected together.
In this case, two conversations are generated. We don't want to remove messages from users or choose one conversation here. So, sometimes two conversations between the same members will be shown. It will generate some bugs during the transition time (as we don't want to break API, the inferred conversation will be one of the two shown conversations, but for now it's "ok-ish", will be fixed when clients will fully handle conversationId for all APIs (calls, file transfer, etc)).
महत्त्वपूर्ण
After accepting a conversation's request, there is a time the daemon needs to retrieve the distant repository. During this time, clients MUST show a syncing view to give informations to the user. While syncing:
ConfigurationManager::getConversations() will return the conversation's id even while syncing.
ConfigurationManager::conversationInfos() सिंक्रनाइज़ेशन के मामले में {{"संक्रमण": "सच्चा"}} लौटाएगा।
ConfigurationManager::getConversationMembers() will return a map of two URIs (the current account and the peer who sent the request).
वार्तालापों में विनिर्देशों की मांग की गई है
वार्तालाप अनुरोधों को निम्नलिखित कुंजी के साथ Map<String, String> द्वारा दर्शाया जाता हैः
id: the conversation ID
from: URI of the sender
प्राप्त: समय टिकट
शीर्षकः वार्तालाप का नाम (वैकल्पिक)
विवरणः (वैकल्पिक)
avatar: (optional) the profile picture
वार्तालाप के प्रोफ़ाइल सिंक्रनाइज़ेशन
पहचान योग्य होने के लिए, एक वार्तालाप को आम तौर पर कुछ मेटाडेटा की आवश्यकता होती है, जैसे कि एक शीर्षक (जैसेः Jami), एक विवरण (जैसेः कुछ लिंक, परियोजना क्या है, आदि), और एक छवि (प्रोजेक्ट का लोगो) । ये मेटाडेटा वैकल्पिक हैं लेकिन सभी सदस्यों के बीच साझा किए जाते हैं, इसलिए अनुरोधों में सिंक्रनाइज़ करने और शामिल करने की आवश्यकता होती है।
भंडारण में भंडारण
बातचीत का प्रोफ़ाइल रूट (/profile.vcf
) पर एक क्लासिक vCard फ़ाइल में संग्रहीत किया जाता है जैसेः
BEGIN:VCARD
VERSION:2.1
FN:TITLE
DESCRIPTION:DESC
END:VCARD
समक्रमण
To update the vCard, a user with enough permissions (by default: =ADMIN) needs to edit /profile.vcf
and will commit the file with the mimetype application/update-profile
.
The new message is sent via the same mechanism and all peers will receive the MessageReceived signal from the daemon.
The branch is dropped if the commit contains other files or too big or if done by a non-authorized member (by default: <ADMIN).
अंतिम प्रदर्शित
सिंक्रनाइज़ेड डेटा में, प्रत्येक डिवाइस अन्य उपकरणों को वार्तालापों की स्थिति भेजता है। इस स्थिति में, अंतिम प्रदर्शित किया जाता है। हालांकि, क्योंकि प्रत्येक डिवाइस में प्रत्येक वार्तालाप के लिए अपनी स्थिति हो सकती है, और शायद किसी बिंदु पर एक ही अंतिम प्रतिबद्धता के बिना, कई परिदृश्य हैं जिन्हें ध्यान में रखा जाना चाहिएः
5 परिदृश्यों का समर्थन किया जाता हैः
यदि अन्य उपकरणों द्वारा भेजे गए अंतिम प्रदर्शित एक ही वर्तमान के समान है, तो कुछ नहीं किया जा सकता है।
यदि वर्तमान डिवाइस के लिए कोई अंतिम प्रदर्शित नहीं है, तो रिमोट प्रदर्शित संदेश का उपयोग किया जाता है।
यदि रिमोट अंतिम प्रदर्शित रेपो में मौजूद नहीं है, तो इसका मतलब है कि कमिट बाद में लाया जाएगा, इसलिए परिणाम कैश
यदि रिमोट पहले से ही लाया गया है, हम जाँच करते हैं कि स्थानीय अंतिम प्रदर्शित इतिहास में पहले है इसे बदलने के लिए
अंत में यदि एक ही लेखक से एक संदेश की घोषणा की जाती है, तो इसका मतलब है कि हमें अंतिम प्रदर्शित संदेश को अपडेट करने की आवश्यकता है।
प्राथमिकताएँ
प्रत्येक वार्तालाप में उपयोगकर्ता द्वारा निर्धारित वरीयताओं को संलग्न किया गया है। उन वरीयताओं को उपयोगकर्ता के उपकरणों के बीच सिंक्रनाइज़ किया जाता है। यह वार्तालाप का रंग हो सकता है, यदि उपयोगकर्ता सूचनाओं को अनदेखा करना चाहता है, फ़ाइल स्थानांतरण आकार सीमा, आदि। अभी के लिए, मान्यता प्राप्त कुंजी हैंः
"color" - the color of the conversation (#RRGGBB format)
"अभिज्ञापनों को अनदेखा करें" - इस बातचीत में नए संदेशों के लिए सूचनाओं को अनदेखा करना
"प्रतीक" - एक डिफ़ॉल्ट इमोजी को परिभाषित करने के लिए।
ये वरीयताएँ MapStringString पैकेट में संग्रहीत होती हैं, accountDir/conversation_data/conversationId/preferences
में संग्रहीत होती हैं और केवल SyncMsg के माध्यम से एक ही उपयोगकर्ता के उपकरणों के बीच भेजी जाती हैं।
प्राथमिकताओं के साथ बातचीत करने के लिए एपीआई हैंः
// Update preferences
void setConversationPreferences(const std::string& accountId,
const std::string& conversationId,
const std::map<std::string, std::string>& prefs);
// Retrieve preferences
std::map<std::string, std::string> getConversationPreferences(const std::string& accountId,
const std::string& conversationId);
// Emitted when preferences are updated (via setConversationPreferences or by syncing with other devices)
struct ConversationPreferencesUpdated
{
constexpr static const char* name = "ConversationPreferencesUpdated";
using cb_type = void(const std::string& /*accountId*/,
const std::string& /*conversationId*/,
std::map<std::string, std::string> /*preferences*/);
};
विलय संघर्ष प्रबंधन
चूंकि दो प्रशासक एक ही समय में विवरण बदल सकते हैं, इसलिए profile.vcf
पर एक विलय संघर्ष हो सकता है। इस मामले में, उच्च हैश (जैसे ffffff > 000000) के साथ प्रतिबद्धता का चयन किया जाएगा।
एपीआई
उपयोगकर्ता को वार्तालाप के मेटाडेटा प्राप्त करने और सेट करने के 2 तरीके मिलेः
<method name="updateConversationInfos" tp:name-for-bindings="updateConversationInfos">
<tp:added version="10.0.0"/>
<tp:docstring>
Update conversation's infos (supported keys: title, description, avatar)
</tp:docstring>
<arg type="s" name="accountId" direction="in"/>
<arg type="s" name="conversationId" direction="in"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="VectorMapStringString"/>
<arg type="a{ss}" name="infos" direction="in"/>
</method>
<method name="conversationInfos" tp:name-for-bindings="conversationInfos">
<tp:added version="10.0.0"/>
<tp:docstring>
Get conversation's infos (mode, title, description, avatar)
</tp:docstring>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
<arg type="a{ss}" name="infos" direction="out"/>
<arg type="s" name="accountId" direction="in"/>
<arg type="s" name="conversationId" direction="in"/>
</method>
जहां infos
निम्नलिखित कुंजी के साथ map<str, str>
है:
मोडः केवल पढ़ने के लिए
शीर्षक
विवरण
avatar: the profile picture
खाता फिर से आयात करें (लिंक/निर्यात)
संग्रह में conversationId होना चाहिए ताकि नए कॉमों पर वार्तालापों को पुनः आयात के बाद पुनर्प्राप्त किया जा सके (क्योंकि इस बिंदु पर कोई आमंत्रण नहीं है) । यदि एक कॉम वार्तालाप के लिए आता है जो मौजूद नहीं है तो दो संभावनाएं हैंः
बातचीत वहाँ है, इस मामले में, डेमोन इस बातचीत को पुनः क्लोन करने में सक्षम है
बातचीतId गायब है, इसलिए डेमोन (एक संदेश के माध्यम से) एक नया आमंत्रण पूछता है कि उपयोगकर्ता (पुनः) स्वीकार करने की जरूरत है
महत्त्वपूर्ण
A conversation can only be retrieved if a contact or another device is there, else it will be lost. There is no magic.
प्रयुक्त प्रोटोकॉल
गिट
यह विकल्प क्यों
Each conversation will be a Git repository. This choice is motivated by:
हमें संदेशों को सिंक करने और ऑर्डर करने की आवश्यकता है. मर्केल ट्री ऐसा करने के लिए एकदम सही संरचना है और शाखाओं को मिलाकर लाइनर बनाया जा सकता है. इसके अलावा, क्योंकि यह Git द्वारा बड़े पैमाने पर उपयोग किया जाता है, यह उपकरणों के बीच सिंक करने के लिए आसान है.
प्रकृति द्वारा वितरित, व्यापक रूप से उपयोग किया, बहुत सारे बैकेंड और प्लग करने योग्य।
हुक और बड़े पैमाने पर इस्तेमाल किए गए क्रिप्टो के माध्यम से प्रतिबद्धता की पुष्टि कर सकते हैं
आवश्यकतानुसार डेटाबेस में संग्रहीत किया जा सकता है
फ़ाइलों का नहीं, कॉम संदेशों का उपयोग करके संघर्षों से बचा जाता है।
हमें क्या सत्यापित करना है
प्रदर्शन
git.lock
कम हो सकता हैlibgit2 में हुक
एक ही समय में कई पल्स?
सीमाएँ
इतिहास को नहीं हटाया जा सकता है। किसी वार्तालाप को हटाने के लिए, डिवाइस को वार्तालाप छोड़ना होगा और एक और बनाना होगा।
हालांकि, गैर-स्थायी संदेश (जैसे संदेश जो केवल कुछ मिनटों के लिए पढ़े जा सकते हैं) DRT के माध्यम से एक विशेष संदेश (जैसे टाइपिंग या रीड सूचनाएं) के माध्यम से भेजे जा सकते हैं।
संरचना
/
- invited
- admins (public keys)
- members (public keys)
- devices (certificates of authors to verify commits)
- banned
- devices
- invited
- admins
- members
- votes
- ban
- members
- uri
- uriAdmin
- devices
- uri
- uriAdmin
- unban
- members
- uri
- uriAdmin
- CRLs
फ़ाइल स्थानांतरण
This new system overhauls file sharing: the entire history is now kept in sync, so any device in the conversation can instantly access past files. Rather than forcing the sender to push files directly—an approach that was fragile in the face of connection drops and often required manual retries—devices simply download files when they need them. Moreover, once one device has downloaded a file, it can act as a host for others, ensuring files remain available even if the original sender goes offline.
प्रोटोकॉल
प्रेषक वार्तालाप में निम्नलिखित प्रारूप के साथ एक नया प्रतिबद्ध जोड़ता हैः
value["tid"] = "RANDOMID";
value["displayName"] = "DISPLAYNAME";
value["totalSize"] = "SIZE OF THE FILE";
value["sha3sum"] = "SHA3SUM OF THE FILE";
value["type"] = "application/data-transfer+json";
और ${data_path}/conversation_data/${conversation_id}/${file_id}
में एक लिंक बनाता है जहां file_id=${commitid}_${value["टाइड"]}.${extension}
फिर, प्राप्तकर्ता अब फ़ाइल को name="data-transfer://" + conversationId + "/" + currentDeviceId() + "/" + fileId
के साथ एक चैनल खोलने से फ़ाइल को होस्ट करने वाले उपकरणों से संपर्क करके फ़ाइलों को डाउनलोड कर सकता है और जानकारी को स्टोर कर सकता है कि फ़ाइल ${data_path}/conversation_data/${conversation_id}/waiting
कनेक्शन प्राप्त करने वाला डिवाइस यह सत्यापित करके चैनल को स्वीकार करेगा कि क्या फ़ाइल भेजी जा सकती है (यदि sha3sum सही है और यदि फ़ाइल मौजूद है) । प्राप्तकर्ता पहले खोले गए चैनल को बनाए रखेगा, अन्य को बंद करेगा और सभी आने वाले डेटा को फ़ाइल में लिख देगा (उसी तरह के पथ के साथ जैसे प्रेषकः ${data_path}/conversation_data/${conversation_id}/${file_id}
) ।
जब स्थानांतरण समाप्त हो जाता है या चैनल बंद हो जाता है, तो फ़ाइल सही है (या यह हटा दिया जाता है) की पुष्टि करने के लिए sha3sum सत्यापित किया जाता है। यदि वैध है, तो फ़ाइल प्रतीक्षा से हटा दी जाएगी।
विफलता के मामले में, जब बातचीत का एक उपकरण फिर से ऑनलाइन हो जाएगा, हम सभी प्रतीक्षा फ़ाइलों के लिए उसी तरह से पूछेंगे।
Call in Swarm
विचार
A swarm conversation can have multiple rendez-vous. A rendez-vous is defined by the following URI:
"accountUri/deviceId/conversationId/confId" जहां accountUri/deviceId मेजबान का वर्णन करता है।
मेजबान को दो तरीकों से निर्धारित किया जा सकता हैः
In the swarm metadatas. Where it's stored like the title/desc/avatar (profile picture) of the room
या पहले कॉल करने वाला।
When starting a call, the host will add a new commit to the repository, with the URI to join (accountUri/deviceId/conversationId/confId). This will be valid till the end of the call (announced by a commit with the duration to show)
तो प्रत्येक भाग को सूचना मिलेगी कि कॉल शुरू हो गई है और उसे कॉल करके इसमें शामिल हो सकेगा।
हमले?
Avoid Git bombs
नोट्स
एक प्रतिबद्धता के समय टिकट पर भरोसा किया जा सकता है क्योंकि यह संपादन योग्य है. केवल उपयोगकर्ता के समय टिकट पर भरोसा किया जा सकता है.
TLS
Git ऑपरेशन, नियंत्रण संदेश, फ़ाइलें, और अन्य चीजें केवल उन सिक्स के साथ p2p TLS v1.3 लिंक का उपयोग करेंगी जो PFS की गारंटी देती हैं। इसलिए प्रत्येक नए कनेक्शन के लिए प्रत्येक कुंजी को फिर से बातचीत की जाती है।
DHT (UDP)
मोबाइल के लिए संदेश भेजने (पुश सूचनाओं को ट्रिगर करने) और TCP कनेक्शन शुरू करने के लिए उपयोग किया जाता है।
नेटवर्क गतिविधि
किसी को आमंत्रित करने की प्रक्रिया
एलिस बॉब को आमंत्रित करना चाहता हैः
एलिस ने बातचीत में बॉब को जोड़ दिया
Alice generates an invite: { "application/invite+json" : { "conversationId": "$id", "members": [{...}] }}
संदेश भेजने के लिए दो संभावनाएं a. यदि कनेक्ट नहीं है, DHT के माध्यम से b. अन्यथा, एलिस SIP चैनल पर भेजता है
दो संभावनाएं बोब के लिए a. निमंत्रण प्राप्त करता है, एक संकेत क्लाइंट के लिए जारी किया जाता है b. कनेक्टेड नहीं है, इसलिए कभी भी अनुरोध प्राप्त नहीं करेगा क्योंकि एलिस को यह नहीं पता होना चाहिए कि क्या बॉब ने एलिस को अनदेखा या अवरुद्ध किया है। एकमात्र तरीका एक नए संदेश के माध्यम से एक नया निमंत्रण पुनर्जनित करना है (देखें अगले परिदृश्य)
किसी को संदेश भेजने की प्रक्रिया
एलिस बॉब को एक संदेश भेजना चाहती हैः
एलिस रेपो में एक संदेश जोड़ती है, पहचान पत्र देती है
एलिस एक संदेश प्राप्त (अपने आप से) यदि सफल
दो संभावनाएं, एलिस और बॉब जुड़े हुए हैं, या नहीं। दोनों ही मामलों में एक संदेश बनाया जाता हैः { "अनुप्रयोग/im-gitmessage-id" : "{"id":"\(convId", "commit":"\)commitId", "deviceId": "$alice_device_hash"}"}. ए. यदि कनेक्ट नहीं है, तो DHT b. अन्यथा, एलिस SIP चैनल पर भेजता है
बॉब के लिए चार संभावनाएंः ए. बॉब एलिस से कनेक्ट नहीं है, इसलिए अगर वह एलिस पर भरोसा करता है, तो एक नया कनेक्शन मांगें और बी. बी. पर जाएं। यदि कनेक्ट है, तो एलिस से लाएं और नए संदेशों की घोषणा करें। सी. बॉब उस बातचीत को नहीं जानता। डीएचटी के माध्यम से पहले उस बातचीत को स्वीकार करने में सक्षम होने के लिए एक निमंत्रण प्राप्त करने के लिए पूछें ({"अनुप्रयोग/ निमंत्रण", बातचीतId}) डी. बॉब डिस्कनेक्ट है (कोई नेटवर्क नहीं, या बस बंद है) । वह नया संदेश प्राप्त नहीं करेगा लेकिन अगली कनेक्शन होने पर सिंक्रनाइज़ करने की कोशिश करेगा
कार्यान्वयन
! [आरेखः झुंड चैट कक्षाएं](छविएँ/ झुंड चैट-वर्ग-आरेख.jpg)
Supported messages
Initial message
{
"type": "initial",
"mode": 0,
"invited": "URI"
}
Represents the first commit of a repository and contains the mode:
enum class ConversationMode : int { ONE_TO_ONE = 0, ADMIN_INVITES_ONLY, INVITES_ONLY, PUBLIC }
and invited
if mode = 0.
Text message
{
"type": "text/plain",
"body": "content",
"react-to": "id (optional)"
}
Or for an edition:
{
"type": "application/edited-message",
"body": "content",
"edit": "id of the edited commit"
}
कॉल
Show the end of a call (duration in milliseconds):
{
"type": "application/call-history+json",
"to": "URI",
"duration": "3000"
}
Or for hosting a call in a group (when it starts)
{
"type": "application/call-history+json",
"uri": "host URI",
"device": "device of the host",
"confId": "hosted confId"
}
A second commit with the same JSON + duration
is added at the end of the call when hosted.
Add a file
{
"type": "application/data-transfer+json",
"tid": "unique identifier of the file",
"displayName": "File name",
"totalSize": "3000",
"sha3sum": "a sha3 sum"
}
totalSize
is in bits,
Updating profile
{
"type": "application/update-profile",
}
Member event
{
"type": "member",
"uri": "member URI",
"action": "add/join/remove/ban"
}
When a member is invited, join or leave or is kicked from a conversation
Vote event
Generated by administrators to add a vote for kicking or un-kicking someone.
{
"type": "vote",
"uri": "member URI",
"action": "ban/unban"
}
!! पुराने ड्राफ्ट!!
टिप्पणी
Following notes are not organized yet. Just some line of thoughts.
क्रिप्टो सुधार।
एक गंभीर समूह चैट सुविधा के लिए, हमें गंभीर क्रिप्टो की भी आवश्यकता है। वर्तमान डिजाइन के साथ, यदि एक प्रमाण पत्र को बातचीत के पिछले DHT मानों के रूप में चोरी किया जाता है, तो बातचीत को डिक्रिप्ट किया जा सकता है। शायद हमें ** डबल रचैट ** जैसे कुछ पर जाने की आवश्यकता है।
टिप्पणी
A lib might exist to implement group conversations.
OpenDHT में ECC सहायता की आवश्यकता
उपयोग
भूमिकाएँ जोड़ें?
समूह चैट के दो प्रमुख उपयोग मामले हैंः
कुछ ऐसा जैसे एक कंपनी में एक Mattermost, निजी चैनलों के साथ, और कुछ भूमिकाओं (प्रशासक / दर्शक / बॉट / आदि) या शिक्षा के लिए (जहां केवल कुछ ही सक्रिय हैं) ।
क्षैतिज बातचीत दोस्तों के बीच की तरह है।
Jami will be for which one?
कार्यान्वयन विचार
एक समूह के लिए प्रमाण पत्र जो किसी भूमिका के लिए उपयोगकर्ता को ध्वज के साथ साइन करता है। जोड़ना या रद्द करना भी किया जा सकता है।
बातचीत में शामिल हों
केवल प्रत्यक्ष आमंत्रण के माध्यम से
लिंक/क्यूआर कोड/जो भी
एक कमरे के नाम के माध्यम से?
हमें क्या चाहिए
गोपनीयताः समूह चैट के बाहर के सदस्यों को समूह में संदेश पढ़ने में सक्षम नहीं होना चाहिए
आगे की गोपनीयताः यदि समूह से कोई कुंजी बाधित हो जाती है, तो पिछले संदेशों को गोपनीय (जितना संभव हो उतना) रहना चाहिए
संदेशों का क्रम: संदेशों को सही क्रम में रखने की आवश्यकता है
समक्रमण: यह भी सुनिश्चित करना आवश्यक है कि सभी संदेश जल्द से जल्द उपलब्ध हों।
निरंतरता: वास्तव में, DHT पर एक संदेश केवल 10 मिनट रहता है। क्योंकि यह इस प्रकार के DHT के लिए गणना की गई सबसे अच्छी समय है। डेटा को बनाए रखने के लिए, नोड को हर 10 मिनट में DHT पर मूल्य को फिर से सेट करना होगा। एक और तरीका है जब नोड ऑफ़लाइन हो तो नोड को डेटा को फिर से सेट करने देना है। लेकिन, अगर 10 मिनट के बाद, 8 नोड अभी भी यहां हैं, तो वे 64 अनुरोध करेंगे (और यह एक्सपोनेंशियल है) । इसके लिए स्पैमिंग से बचने का वर्तमान तरीका पूछताछ है। यह अभी भी 64 अनुरोध करेगा लेकिन अधिकतम अधिशेष को 8 नोड तक सीमित करेगा।
अन्य वितरित मार्ग
आईपीएफएस: कुछ जांच की जरूरत है
कुछ जांच की जरूरत है
मैडसेफः कुछ जांच की जरूरत है
वर्तमान कार्य के आधार पर हमारे पास
समूह चैट उसी काम पर आधारित हो सकता है जो हमारे पास पहले से ही मल्टी-डिवाइस के लिए है (लेकिन यहां, एक समूह प्रमाणपत्र के साथ) ।
इतिहास सिंक्रनाइज़. यह क्लाइंट से डेटाबेस को डेमोन में स्थानांतरित करने की जरूरत है.
यदि कोई भी कनेक्ट नहीं है, तो सिंक्रनाइज़ेशन नहीं किया जा सकता है, और व्यक्ति कभी भी बातचीत नहीं देख पाएगा
एक और समर्पित DHT
एक सुपरयूजर के साथ एक डीएचटी की तरह.
What's next for file transfers
Currently, the file transfer algorithm is based on a TURN connection (See फ़ाइल स्थानांतरण). In the case of a big group, this will be bad. We first need a P2P connection for the file transfer. Implement the RFC for P2P transfer.
Other problem: currently there is no implementation for TCP support for ICE in PJSIP. This is mandatory for this point (in PJSIP or homemade)