mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-09 14:48:08 -05:00
Private Chat docs (#113)
* added a section for configuring a private chat * issue #108 * fixed grammer and line numbers Co-authored-by: narodnik-intern <narodnik-intern@proton.me>
This commit is contained in:
@@ -86,7 +86,7 @@ in order for them to spawn a config file, which you can then review.
|
||||
## Bash Completion
|
||||
This will add the options auto completion of `drk` and `darkfid`.
|
||||
```shell
|
||||
% echo source $(pwd)/contrib/auto-complete >> ~/.bashrc
|
||||
% echo source \$(pwd)/contrib/auto-complete >> ~/.bashrc
|
||||
```
|
||||
|
||||
### Examples and usage
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
- [vanityaddr](misc/vanityaddr.md)
|
||||
- [ircd](misc/ircd/ircd.md)
|
||||
- [Specification](misc/ircd/specification.md)
|
||||
- [Private Message](misc/ircd/private_message.md)
|
||||
- [tau](misc/tau.md)
|
||||
- [event_graph](misc/event_graph/event_graph.md)
|
||||
- [Network Protocol](misc/event_graph/network_protocol.md)
|
||||
|
||||
@@ -41,10 +41,10 @@ Let's take a quick look at the underlying p2p methods we're using here.
|
||||
|
||||
## Start
|
||||
|
||||
This is [start()](https://github.com/darkrenaissance/darkfi/blob/master/src/net/p2p.rs#L129):
|
||||
This is [start()](https://github.com/darkrenaissance/darkfi/blob/master/src/net/p2p.rs#L135):
|
||||
|
||||
```rust
|
||||
{{#include ../../../../../src/net/p2p.rs:129:143}}
|
||||
{{#include ../../../../../src/net/p2p.rs:134:149}}
|
||||
```
|
||||
|
||||
`start()` changes the `P2pState` to `P2pState::Start` and runs a [seed
|
||||
@@ -60,10 +60,10 @@ the channel from the channel list.
|
||||
|
||||
## Run
|
||||
|
||||
This is [run()](https://github.com/darkrenaissance/darkfi/blob/master/src/net/p2p.rs#L157):
|
||||
This is [run()](https://github.com/darkrenaissance/darkfi/blob/master/src/net/p2p.rs#L163):
|
||||
|
||||
```rust
|
||||
{{#include ../../../../../src/net/p2p.rs:157:184}}
|
||||
{{#include ../../../../../src/net/p2p.rs:161:190}}
|
||||
```
|
||||
|
||||
`run()` changes the P2pState to `P2pState::Run`. It then calls `start()`
|
||||
@@ -83,10 +83,10 @@ is received.
|
||||
|
||||
## Stop
|
||||
|
||||
This is [stop()](https://github.com/darkrenaissance/darkfi/blob/master/src/net/p2p.rs#L186).
|
||||
This is [stop()](https://github.com/darkrenaissance/darkfi/blob/master/src/net/p2p.rs#L306).
|
||||
|
||||
```rust
|
||||
{{#include ../../../../../src/net/p2p.rs:186:188}}
|
||||
{{#include ../../../../../src/net/p2p.rs:306:308}}
|
||||
```
|
||||
|
||||
`stop()` transmits a shutdown signal to all channels subscribed to the
|
||||
|
||||
84
doc/src/misc/ircd/private_message.md
Normal file
84
doc/src/misc/ircd/private_message.md
Normal file
@@ -0,0 +1,84 @@
|
||||
|
||||
# Configuring a Private chat between users
|
||||
|
||||
Any two users on the ircd server can establish a fully encrypted
|
||||
communication medium between each other using a basic keypair setup.
|
||||
|
||||
## Configuring ircd_config.toml
|
||||
|
||||
Generate a keypair using the command
|
||||
|
||||
```shell
|
||||
% ircd --gen-keypair
|
||||
```
|
||||
This is the Private key used for encryption of messages across the network.
|
||||
|
||||
Save the privateKey safely & add it to the ircd_config.toml file as shown below.
|
||||
|
||||
```toml
|
||||
[private_key.”your_private_key_goes_here”]
|
||||
```
|
||||
|
||||
To share your public key with a user over the ircd server you can use the following command.
|
||||
|
||||
/query User_A “Hi this is my publickey: XXXXXX"
|
||||
|
||||
Note: This message will be publically visible on the IRC chat
|
||||
i.e anyone running the irc demon can view these messages in their logs.
|
||||
|
||||
See the [example ircd_config.toml](https://github.com/darkrenaissance/darkfi/blob/master/bin/ircd/ircd_config.toml) for more details
|
||||
|
||||
## Example
|
||||
Lets start by configuring our contacts list in the generated ircd_config.toml file
|
||||
(you can also refer to the examples written in the comments of the toml file)
|
||||
|
||||
```toml
|
||||
[contact.”User_A”]
|
||||
contact_pubkey = “XXXXXXX”
|
||||
[contact.”User_B”]
|
||||
contact_pubkey = “YYYYYYY”
|
||||
```
|
||||
|
||||
<u>Note</u>: After configuring our ircd_config.toml file, you will need to restart your irc demon for the changes to reflect.
|
||||
|
||||
|
||||
Lets see an Example where 'User_A' sends “Hi” message to 'User_B' using the /msg command
|
||||
|
||||
/msg User_B Hi
|
||||
|
||||
IRCD logs of 'User_A'
|
||||
```
|
||||
9:36:59 [INFO] [CLIENT 127.0.0.1:xxxx] Msg: PRIVMSG User_B :Hi
|
||||
09:36:59 [INFO] [CLIENT 127.0.0.1:xxxx] (Plain) PRIVMSG User_B :Hi
|
||||
09:36:59 [INFO] [CLIENT 127.0.0.1:57964] (Encrypted) PRIVMSG: Privmsg { id: 12345, nickname: “xxxxxxx”, target: “xxxxx”, message: “xxxxxx”, timestamp: 1665481019, term: 0, read_confirms: 0 }
|
||||
09:36:59 [INFO] [P2P] Broadcast: Privmsg { id: 7563042059426128593, nickname: “xxxx”, target: “xxxxx”, message: “xxxx”, timestamp: 1665481019, term: 0, read_confirms: 0 }
|
||||
```
|
||||
IRCD logs of 'User_B'
|
||||
```
|
||||
09:36:59 [INFO] [P2P] Received: Privmsg { id: 123457, nickname: “xxxx”, target: “xxxx”, message: “xxxx”, timestamp: 1665481019, term: 0, read_confirms: 0 }
|
||||
09:36:59 [INFO] [P2P] Decrypted received message: Privmsg { id: 123457, nickname: "User_A", target: "User_B", message: "Hi", timestamp: 1665481019, term: 0, read_confirms: 0 }
|
||||
```
|
||||
<u>Note for Weechat Client Users:</u>
|
||||
When you private message somone as shown above,
|
||||
the buffer will not pop in weechat client until you receive a
|
||||
reply from that person.
|
||||
For example here 'User_A' will not see any new buffer on his irc interface for
|
||||
the recent message which he just send to 'User_B' until 'User_B' replies,
|
||||
but 'User_B' will get a buffer shown on his irc client with the message 'Hi'.
|
||||
|
||||
Reply from 'User_B' to 'User_A'
|
||||
|
||||
/msg User_A welcome!
|
||||
|
||||
IRCD logs of 'User_B'
|
||||
```
|
||||
10:25:45 [INFO] [CLIENT 127.0.0.1:57396] Msg: PRIVMSG User_A :welcome!
|
||||
10:25:45 [INFO] [CLIENT 127.0.0.1:57396] (Plain) PRIVMSG User_A :welcome!
|
||||
10:25:45 [INFO] [CLIENT 127.0.0.1:57396] (Encrypted) PRIVMSG: Privmsg { id: 123458, nickname: “xxxx”, target: “xxxx”, message: “yyyyyyy”, timestamp: 1665483945, term: 0, read_confirms: 0 }
|
||||
10:25:45 [INFO] [P2P] Broadcast: Privmsg { id: 123458, nickname: “xxxxx”, target: “xxxxx”, message: “yyyyyyyy”, timestamp: 1665483945, term: 0, read_confirms: 0 }
|
||||
```
|
||||
IRCD logs of 'User_A'
|
||||
```
|
||||
10:25:46 [INFO] [P2P] Received: Privmsg { id: 123458, nickname: “xxxxxxx”, target: “xxxxxx”, message: “yyyyyy”, timestamp: 1665483945, term: 0, read_confirms: 0 }
|
||||
10:25:46 [INFO] [P2P] Decrypted received message: Privmsg { id: 123458, nickname: "User_B”, target: "User_A”, message: "welcome! ", timestamp: 1665483945, term: 0, read_confirms: 0 }
|
||||
```
|
||||
Reference in New Issue
Block a user