root 9fe66a4196 update doxy | vor 5 Jahren | |
---|---|---|
bin | vor 5 Jahren | |
doc | vor 5 Jahren | |
inc | vor 5 Jahren | |
lib | vor 5 Jahren | |
src | vor 5 Jahren | |
Doxyfile | vor 5 Jahren | |
Makefile | vor 5 Jahren | |
README.md | vor 5 Jahren |
libchat6 is a complete library that handles an IPv6 only, peer-to-peer, end-to-end encrypted, decentralised, chat client.
To bootstrap a node, a node will have a list of hardcoded nodes and a list of the last known nodes. The hardcoded list is a list of nodes that are put in place by the initiators of this library. Anyone willing to run a permanent node is welcome to contact us to add a node to the hardcoded list.
A client is the user. A person or a bot using the network to exchange messages. A node is the entity transporting messages for clients. Both are within the same library but use different identities (keypairs). Nodes sending messages to its peer node(s) will use a temporary keypair generated on startup. This keypair changes at every startup and is not stored. A client, on the other side, will generate a keypair once and will use it to generate a temporary keypair for each chat partner to ensure forward secrecy. The temporary keypair is never stored.
<MSGSIGNATURE> <MSGHASH> <TIMESTAMP> <MSGTYPE> [<name>=<value>] ...
NOTE: All ‘value’ transporting binary or UTF-8 data is represented as base64.
This is the very first message both nodes will send after connecting. The connecting node will send it’s HELLO first. If the connected node agrees it will reply with its own HELLO. If it doesn’t it will reply with a BYE msg and close the connection. Both nodes may send a BYE message at any time to terminate the connection.
HELLO {version,nodekey}
BYE
Clients can announce, withdraw or update their presence. A node will keep all client information and inform any new node of the state of all known clients. The metric must be updated when a ONLINE or UPDATE msg is received.
CLIENT_ONLINE {clientkey, nickname, icon, metric}
CLIENT_UPDATE {nonce, nickname, icon, metric}
CLIENT_OFFLINE
Keepalive and node-to-node only and are originated by both nodes on a connection. The interval is 15s and if a node doesn’t receive a timeout for 30s, it must shutdown the connection. The interval betweeen the request and the response is used to calculate the metric. The metric is caculcated as an average value of the last 10 messages.
KEEPALIVE_REQUEST
KEEPALIVE_RESPONSE
The friend request message has two purposes. First, for a new friend, is will ask the friend to confirm to actually be friends. Secondly, it will exchange temporary session keys. This means that everytime a client comes online and wants to initiate a chat with an existing friend, it will have to send a friend request and get a friend confirm message back in order to exchange new temporary keys. If a friend request from an existing friend comes in, the confim message will automatically be sent back without user confirmation. If the friend is unknown, a user confirmation is required.
FRIEND_REQUEST {target_hash, sessionkey}
FRIEND_CONFIRM {target_hash, sessionkey}
client-to-client messages are exchanged using those three message types. Message received and read are only confirmations. A UI may implement a visual aid to show those. Message send, sends a message using the name=value pair ‘message’. The message is encrypted using the temporary session key of the friend. Messages must be confirmed received, if they don’t, the client will retry sending it after a timeout of 30s until a recv is received or a CLIENT_OFFLINE message is received. Messages can only be sent to online friends. If a friend is offline, the client will have to store the message until the friend is online.
MESSAGE_SEND {target_hash, chatid, msgid, mtype, message}
MESSAGE_RECV {target_hash, chatid, msgid}
MESSAGE_READ {target_hash, chatid, msgid}
In order to discover other nodes, a node may request the directly connected nodes of a neighbor node. The list will be sent back to the requesting node with one or multiple name=value pairs of ‘neighbor’. The value is composed of the IP of the node and the TCP port separated by a comma. A neighbor will only be disclosed to another neighbor if it is relaying messages for others (showed more than one CLIENT_ONLINE msg).
NEIGHBORS_REQUEST # request the neighbours of your neighbour
NEIGHBORS_RESPONSE {neighbour,..} # neighbours list, multiple time the same key