logos-chat/README.md

131 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

# Logos Chat
2025-07-04 22:17:31 -07:00
[![Tests](https://github.com/logos-messaging/logos-chat/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/logos-messaging/logos-chat/actions/workflows/ci.yml)
![ProjectStatus]( https://img.shields.io/badge/Project_Status-Preview-orange)
A privacy focused decentralized messaging SDK, built on the Logos Stack. Logos Chat provides permission-less, censorship-resistant communication for humans and clankers.
2025-08-24 22:28:26 -07:00
## Quick Start
### Prerequisites
- [Nim](https://nim-lang.org/) >= 2.2.4
- [Rust](https://www.rust-lang.org/tools/install) (for libchat cryptographic backend)
- Make
### Build
```bash
# Initialize submodules and dependencies
2025-09-26 19:09:19 -07:00
make update
2025-08-24 22:28:26 -07:00
# Build all targets (examples + shared library)
2025-09-26 19:09:19 -07:00
make all
# Run tests
make tests
2025-08-24 22:28:26 -07:00
```
2025-12-17 19:16:02 -08:00
### Quick Tasks
2025-12-17 19:16:02 -08:00
Here are common tasks to get up and running. See [`examples/`](examples/) for full examples, including [`pingpong.nim`](examples/pingpong.nim) which demonstrates a full two-client conversation.
2025-12-17 19:16:02 -08:00
**Initialize Client**
2025-08-24 22:28:26 -07:00
```nim
let waku = initWakuClient(DefaultConfig())
var client = newClient(waku).get()
...
...
client.start()
```
2025-12-17 19:16:02 -08:00
**Create Introduction Bundle**
2025-10-10 11:05:58 -07:00
Introductions are single use key-bundles required by Senders to initiate a conversation.
Recipients must generate them before anyone can contact them.
IntroBundles contain no secrets and can be published, or transmitted over over other channels.
2025-10-10 11:05:58 -07:00
```nim
...
# IntroBundles are sent to other clients Out-of-Band to establish a conversation.
let intro_bundle = client.createIntroBundle()
...
```
**Create 1:1 Chat**
2025-10-10 11:05:58 -07:00
Once a Sender has retrieved a bundle then they can create a conversation.
All conversations must have an initial message.
```nim
...
let initial_content = @[1,2,3]
2025-10-10 11:05:58 -07:00
# This intro_bundle must come from another client
let convo_id = await client.newPrivateConversation( intro_bundle, initial_content )
...
```
2025-12-17 19:16:02 -08:00
**Receive Message**
2025-12-17 19:16:02 -08:00
Receiving a message is accomplished by registering a callback.
```nim
...
client.onNewMessage(proc( convo: Conversation, msg: ReceivedMessage ) {.async.} =
echo convo.id(), msg.content
2025-12-17 19:16:02 -08:00
)
...
```
2025-07-04 22:17:31 -07:00
**Send Message**
2025-07-04 22:17:31 -07:00
```nim
...
let content = @[1,2,3]
let convo = client.getConversation( convo_id )
await client.sendMessage( content )
...
```
2025-07-04 22:17:31 -07:00
## Message Flow
2025-07-04 22:17:31 -07:00
```mermaid
2025-07-07 16:03:16 -07:00
sequenceDiagram
2025-09-27 07:16:16 -07:00
participant S as Saro
participant R as Raya
Note over R,S: Discovery
R -->> S: Send intro bundle via established channel
2025-09-27 07:16:16 -07:00
Note over R,S: Initialization
S ->> R: PrivateV1 Invite + initial message
2025-09-27 07:16:16 -07:00
Note over R,S: Operation
loop Encrypted messaging
2025-09-27 07:16:16 -07:00
par
R ->> S: Send Message
2025-09-27 07:16:16 -07:00
and
S ->> R: Send Message
2025-09-27 07:16:16 -07:00
end
end
```
### C Bindings
2025-07-07 16:03:16 -07:00
A shared library with C bindings is available:
2025-07-07 16:03:16 -07:00
```bash
make liblogoschat
```
2025-07-07 16:03:16 -07:00
This produces `build/liblogoschat.{dylib,so,dll}`. See [`library/liblogoschat.h`](library/liblogoschat.h) and [`examples/cbindings/`](examples/cbindings/) for usage.
2025-07-07 16:03:16 -07:00
## License
Dual-licensed under [MIT](LICENSE-MIT) and [Apache 2.0](LICENSE-APACHE).