Skip to content

Using provided tools

Adrien Béraud edited this page Oct 16, 2019 · 1 revision

dhtnode

See Running a node with dhtnode.

dhtchat

This example tool provides a simple authenticated open chat CLI using OpenDHT APIs.

The same arguments as dhtnode are allowed (if --privkey is not provided, an identity is always generated as dhtchat requires a node identity).

Every message written is signed using the node private key (generated or loaded from file), and is published on the Dht at a specific key.

Under the hood, dhtchat works by:

  • computing chan_key = sha1("ChannelName"), where ChannelName is the channel name specified using the dhtchat' CLI
  • performing listen(chan_key) on the dht to listen for new messages on the channel
  • performing putSigned(chan_key, message) on the dht to publish a new message on the channel

Usage

Example starting and generating an identity saved to chatuser1*:

dhtchat -b bootstrap.jami.net --save-identity chatuser1

Example starting and loading a private key from chatuser1.pem:

dhtchat -b bootstrap.jami.net --privkey chatuser1.pem

On startup, dhtchat prints its public key ID (used as identifier of the user).

When dhtchat is started, it waits for the user to specify a channel to join (prompt is >). Enter c channelName and press enter to join a channel and switch to message mode.

In message mode (prompt is >>), messages can be sent to the current channel by typing a message and pressing enter.

  • command d allows to disconnect from the channel
  • command e target message allows to send an encrypted (and authenticated) message to a specific user with public key ID target.