P2P - Message for a node that does not exists yet

108 views Asked by At

The p2p libraries I have found rely on the premise that in order to transfer information both nodes (sender and receiver) exists. What if the receiving node does not exists yet? How could the receiver get the private messages previously addressed to him.

Let me give you more context. I want to make a P2P Message App in Flutter, where sender A can send a private message to receiver B, even if receiver B has not yet the app. When receiver B downloads the App, receiver B gets all the private messages that were previously addressed to him (without being in server) from sender A.

I have been drawing multiple MSC on how this could be done with two nodes and a server, that registers the status (sent, pending) of what is sent between the nodes. However, I have come to the conclusion that is an overkill trying to come up with my own P2P protocol, specially I am concerned about authentication. (How could I stop bad-intentionally Node_C requesting all messages addressed to Node_B)

I would appreciate any help and thank you in advanced for pointing me in the right direction.

Best Regards, #driggy

PS: The solution might involved having a server, as I mentioned, but the server cannot store the message.

1

There are 1 answers

0
the8472 On BEST ANSWER

A simple solution is for A to periodically check the existence of B and send the message when it comes online. If B knows about A (e.g. because they're in a contact list) they could actively announce their presence to A, thus avoiding the delay from the polling interval.

This still requires both nodes to be online simultaneously at some point in the future. If you don't want that requirement then the message must be stored on a 3rd party which could be a server or another node in the p2p network.

specially I am concerned about authentication. (How could I stop bad-intentionally Node_C requesting all messages addressed to Node_B

Authentication seems orthogonal to delivery timing. Each node should have a cryptographic identity (an asymmetric key pair) and the messages should be encrypted based on the public key of the receiver. If you want direct delivery without intermediaries then the remote node's identity should be verified with a MitM-resistant challenge-response authentication before delivering messages.