Hey All,
Firstly I will say I am very new to this so forgive me if I am asking stupid questions here. I have gone through the basic chat app examples in GitHub - libp2p/js-libp2p-examples: Examples for the JS implementation of libp2p but there are a few questions I have. Again, if these are stupid questions feel free to let me know.
1) Async/Offline messages
If Bob wants to send Alice a message and she is offline I would like to allow bob to nominate x nodes to store the message which Alice can pick up later.
Looking at Signal/Session I think that there could be some use of persistant and ephemeral keys that could be exchanged in some kind of friend request flow which would allow Bob to use these to create a DH secret and start sending messages to Alice when offline. I think the flow would be:
- On friend request a series of ephemeral keys are exchanged for offline communications. These are one time use only and deleted after use.
- When Bob comes online he is able to check if Alice is online, if they are not then they use Alice ephemeral key and their persistent key to create DH secrets that can be used in a KDF to encrypt the message.
- Bob then sends the message to longer lived nodes that are specified by Alice somehow.
- When alice comes online they recieve the messages from thier specified nodes and knowing the keys can also generate the decryption key to read the messages
I think this is somewhat like the flow that Session app takes. However been very new to libp2p Im not sure where this flow should be coded.
I think I could do this in the protocol/handler itself but I dont know if this is the correct place. Would this be something that should be coded as a custom encryption module, or for that matter is something like I describe already supported by Noise etc? If so any docs on how?
2) Annonimity
Are there any out of the box ways to hide Bob/Alice IP addresses when connecting to libp2p? Would tor be the correct approach, does the built in relay module do something similar to this with onioin layers or is this something completely different?
3) General advise on storage
In the case I mentioned where Bob wants to send messages to Alices predefined nodes then these nodes will need to store these messages somewhere. Is this something usually done just in memory of the handler as a plain old js collection, or is some embedded db the usual choice. I also am very vage on the use of the DHT here, I understand its used as the distributed store for routing but can this also be used as a store for other things aka the messages?
Thanks in advance, and again if these questions are not sensible please let me know.