50 Commits

Author SHA1 Message Date
Jazz Turner-Baggs
39bf267564
Add Account Struct (#94)
* Add Account Struct

* Quell Warnings

* Update core/conversations/src/account.rs

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>

* Add clarity to todo

* Update test account constructor docs

* Add removal todo

* Resolve cargo.lock conflict

* remove warnings

---------

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>
2026-04-28 07:47:57 -07:00
Jazz Turner-Baggs
25debdc051
Add Signature + Verifying key types (#93) 2026-04-27 13:35:20 -07:00
osmaczko
eaeffcd21f
feat(chat-cli): wire up logos-delivery transport and switch to client API (#91)
Replace the direct use of `conversations::Context` with `client::ChatClient`,
which is the intended public API for library consumers.

Remove `MessageEnvelope` and the username-keyed session model. The envelope
was never part of the wire protocol — sender identity was only tracked in the
CLI's local state. Chats are now keyed by conversation ID; add `/nickname` as
the user-facing replacement for named sessions.

Add a logos-delivery (Waku) transport alongside the existing file transport.
The active transport is selected at compile time: set `LOGOS_DELIVERY_LIB_DIR`
to link liblogosdelivery, otherwise the file transport is used.

Add logos-delivery as a Nix flake input and expose `.#logos-delivery` so the
library can be built with `nix build` and referenced by `LOGOS_DELIVERY_LIB_DIR`.

CI: rename `c-ffi-smoketest` to `smoketest`; add logos-delivery build step
and a `--smoketest` invocation of chat-cli to verify startup.
2026-04-27 13:22:16 +02:00
Pablo Lopez
df84fc87cf
feat: add flake (#85)
* feat: add flake

* fix: pr feedback

* fix: removing dylib for libchat

not used and it was causing the error with panic abort
2026-04-17 16:27:15 +03:00
kaichao
6c7b3a4252
feat: chat cli demo app (#87)
* chore: remove ffi from double ratchet

* chore: format

* feat: chat cli demo app via file transport

* chore: fix the compile issues

* chore: fix long intro copy to clipboard

* chore: move chat cli to bin folder

* chore: use tmp data folder

* chore: update doc

* chore: use encrypted db with default db pass

* chore: fmt and clippy

* chore: fix clippy and refactor

* chore: utils for helper funcs

* chore: rename sessions to chats
2026-04-17 14:43:04 +08:00
kaichao
94935c28fe
refactor: remove FFI interfaces from double ratchets (#84)
* chore: remove ffi from double ratchet

* chore: update doc

* chore: format
2026-04-16 23:26:19 +08:00
dependabot[bot]
c0e07c765e
Build(deps): bump rand from 0.8.5 to 0.9.3 (#86)
Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.3.
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/0.9.3/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/0.8.5...0.9.3)

---
updated-dependencies:
- dependency-name: rand
  dependency-version: 0.9.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-16 07:50:16 -07:00
kaichao
9cc73622ed
Move double ratchet storage operations to PrivateV1 (#82)
* feat: move private store out of context

* feat: move convo store to private v1

* feat: clean context

* chore: params postion

* chore: use git exclue for justfile
2026-04-10 08:33:58 +08:00
osmaczko
d68c0cb275
feat: implement Client crate and C FFI bindings (#73)
Implement a `client` crate that wraps the `libchat` context behind a
simple `ChatClient<D>` API. The delivery strategy is pluggable via a
`DeliveryService` trait, with two implementations provided:

- `InProcessDelivery` — shared `MessageBus` for single-process tests
- `CDelivery` — C function-pointer callback for the FFI layer

Add a `client-ffi` crate that exposes the client as a C API via
`safer-ffi`. A `generate-headers` binary produces the companion C
header.

Include two runnable examples:
- `examples/in-process` — Alice/Bob exchange using in-process delivery
- `examples/c-ffi` — same exchange written entirely in C; smoketested
under valgrind (to catch memory leaks) in CI

iterates: #71
2026-04-08 23:15:48 +02:00
kaichao
8e8b0c0dd7
Use inbox to handle save and load ephemeral key from store (#81)
* feat: move inbox store out from context

* chore: clear boundary between context and inbox to store dependencies
2026-04-08 11:07:23 +08:00
kaichao
c44c52b127
feat: storage implementation and trait abstraction (#79)
* feat: storage for conversations

* fix: db types conversion

* feat: run migrations from sql files

* feat: persist identity

* fix: revert double ratchet storage refactor

* fix: clean

* refactor: use result wrapper for ffi

* refactor: uniform storage error into chat error

* fix: zeroize identity record

* fix: zeroize for secret keys in db operations

* fix: transactional sql migration

* fix: remove destroy_string

* feat: db storage for inbox ephermeral keys

* chore: remove in memory hashmap for ephemeral keys

* feat: persist conversation store

* feat: wire with the double ratchet storage

* feat: remove conversation store

* chore: fix conversation type not used

* feat: mock chat store implementation

* chore: sqlite module

* feat: sqlite crate

* chore: sqlite rename

* chore: more refactor

* extract ratchet store trait

* chore: clear error conversion

* chore: remove customized db conn

* chore: fix clippy

* chore: refactor to use generics and enum

* chore: further clean for review comments
2026-04-03 08:25:26 +08:00
Jazz Turner-Baggs
d905de3592
Remove Legacy FFI from LibChat (#80)
* Remove libchat legacy FFI

* Remove legacy nim bindings

* Remove stray headerfile

* Remove deprecated CI jobs
2026-04-01 12:54:27 -07:00
kaichao
8cddd9ddcf
refactor: use new styling for conversations crate without mod.rs (#72)
* refactor: use new styling for conversations crate without mod.rs

* refactor: remove put crate for identity types
2026-03-27 10:23:33 +08:00
Jazz Turner-Baggs
9a94f9a6d6
Flatten Repos (#70)
* move to “crates” style folder

* Update workspace

* clear crate names

* Rename crate folders based on feedback

* Use workspace dependencies instead of paths

* Move updated files from core
2026-03-24 18:21:00 -07:00
kaichao
daeecbd679
Persist identity (#67)
* feat: storage for conversations

* fix: db types conversion

* feat: run migrations from sql files

* feat: persist identity

* fix: revert double ratchet storage refactor

* fix: clean

* refactor: use result wrapper for ffi

* refactor: uniform storage error into chat error

* fix: zeroize identity record

* fix: zeroize for secret keys in db operations

* fix: transactional sql migration

* fix: remove destroy_string

* refactor: inline identity record name clone
2026-03-25 08:45:22 +08:00
osmaczko
d006f20bce
fix(nim-bindings): add all-endpoints test and fix installation_name ABI (#66)
Add nim-bindings/tests/test_all_endpoints.nim which imports bindings
directly and calls every FFI proc, forcing the linker to include all
symbols. This catches link-time and runtime issues that the pingpong
example missed because unused symbols were optimised out.

Running the new test revealed an ABI mismatch in installation_name:
the Rust function used an explicit out-parameter but ReprCString has
only flat fields, so Nim emits it as a C return value.

CI now runs nimble test next to nimble pingpong.
2026-02-28 21:03:55 +01:00
Jazz Turner-Baggs
1158865bf2
feat: ListConversations (#60)
* Add function to get available conversations_ids

* Update bindings

* linter fix

* remove dynlib reference

* destructor fix
2026-02-28 03:16:10 -08:00
osmaczko
fa79b1c79c
chore(nim-bindings): replace dynlib dlopen with plain importc (#61)
* chore(nim-bindings): replace dynlib dlopen with plain importc

The dynlib pragma hard-coded a library path and resolved it via dlopen() at
runtime, preventing static linking and forcing a specific load-time path.
Using bare {.importc.} lets consumers choose: link liblibchat dynamically
at link time (--passL:-llibchat) or link it statically into their binary.

* Rust -> Nim ABI  (#62)

* Use correct build hook

* force sret like return from rust code for nim compatibility

* Fix target mismatch

* Update usages

* ci: add nim-bindings-test

* fix(nim-bindings): fix ABI mismatch in destroy_* FFI functions and add defer-based cleanup

Nim's C backend silently transforms large struct parameters (>16 bytes) into
pointer parameters when calling importc functions. The destroy_* functions were
declared taking T by value in Rust, but Nim always passed &T — causing Rust to
read garbage from the stack on x86-64 (SIGILL on CI) while accidentally working
on ARM64 macOS due to that ABI coincidentally also using pointers for large structs.

Fix by changing all destroy_* functions to take &mut T and using drop_in_place,
which is the correct idiom for dropping a value through a pointer.

On the Nim side, replace scattered manual destroy calls with defer, which
guarantees cleanup on all exit paths and prevents use-after-destroy bugs.

---------

Co-authored-by: Jazz Turner-Baggs <473256+jazzz@users.noreply.github.com>
2026-02-25 20:09:55 +01:00
Jazz Turner-Baggs
960bb195a1
Update crate name (#59) 2026-02-22 08:24:10 +02:00
Jazz Turner-Baggs
eb941387df
Add Installation name (#58)
* Add Identity name

* Update Context to accept a name

* Change constructor in bindings

* Add name retrieval to bindings

* Update constructor string type

* Remove uneeded files

* rename functions for symmetry
2026-02-19 17:25:42 -08:00
osmaczko
a9ca4ffb7d
chore: expose isNewConvo property (#57) 2026-02-18 20:01:47 +01:00
Jazz Turner-Baggs
95ddce9161
Key types (#56)
* Add generic SymmetricKey container

* Rename SecretKey to SymmetricKey32

* Update SymmetricKey usage

* Add PublicKey

* Update PublicKey uses

* Add PrivateKey

* Replace StaticSecret with PrivateKey

* Fix imports

* Remove InstallKey from constructors

* Final integration

* lint fixes

* Fixups
2026-02-18 09:29:33 -08:00
Jazz Turner-Baggs
3b69f946fd
PrivateV1 Convo Ids (#54)
* Add conversation_ids for privateV1

* Skip handling of unknown payloads

* Tag initial ContentData as new

* Add Integration test

* truncate convo_id to size

* Clippy fixes

* cleanup

* Apply suggestion from @osmaczko

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>

* Apply suggestion from @osmaczko

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>

* Linter fixes

---------

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>
2026-02-11 14:10:21 -08:00
osmaczko
57fe656728
feat: update introduction bundle encoding (#43)
closes: #27
2026-02-11 19:51:22 +01:00
Patryk Osmaczko
cd737ea058 fix: make ci checks pass 2026-02-10 19:45:00 +01:00
Aleksey
c5f9994c9e
feat: add ci checks
* base ci add

* Remove .DS_Store files

* Add .DS_Store to gitignore

* remove master & develop, kept only stable in matrix

Restrict CI workflow to only the main branch for pushes and pull requests.

* Update .github/workflows/ci.yml

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>

* Update .github/workflows/ci.yml

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>

---------

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>
2026-02-10 14:40:01 +01:00
Jazz Turner-Baggs
71f7b8a485
FFI Integration fixes (#48)
* Make conversation store easier to use

* fix: Bug in Inbox id’s

* Clean up warnings

* Add DH decryption for Inbox
2026-02-09 09:55:58 -08:00
Jazz Turner-Baggs
e3e3097947
Safer FFI Migration (#47)
* Use safer_ffi for all functions

* Clean up FFI docs and imports

* Update nim bindings

* Binding Memory Management

* Update tests
2026-02-09 06:37:47 -08:00
dependabot[bot]
45b54bf983
Build(deps): bump bytes from 1.11.0 to 1.11.1 (#41)
Bumps [bytes](https://github.com/tokio-rs/bytes) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.11.0...v1.11.1)

---
updated-dependencies:
- dependency-name: bytes
  dependency-version: 1.11.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-06 18:44:47 -08:00
Jazz Turner-Baggs
135347cdd0
Update Conversation handles over FFI (#46)
* Remove convo handles

* Remove convo_handle from docs
2026-02-06 08:58:23 -08:00
Jazz Turner-Baggs
1ce196e5ec
Implement handle_payload (#44)
* Implement handle_payload

* Cleanup handler for easier understanding

* Fixups
2026-02-06 08:41:12 -08:00
Jazz Turner-Baggs
97a1cf150a
Update content to use byte slice (#45) 2026-02-06 08:08:06 -08:00
Jazz Turner-Baggs
2a74066cd4
Remove unneeded traits and warnings (#42) 2026-02-06 07:24:13 -08:00
Igor Sirotin
989035a431
docs: rename apache license file 2026-02-04 13:49:54 +00:00
Jazz Turner-Baggs
d5c16f51de
Integrate DR into PrivateV1 (#32)
* Add crate

* Initialize session

* Add encrypt / decrypt
2026-02-03 15:17:45 -08:00
kaichao
74695877fa
Split storage crate to abstract database layer (#30)
* feat: shared storage crate

* chore: remove backup codes

* chore: remove feature gates

* chore: clean out of order demo

* chore: refactor create session

* chore: shorten error name

* chore: clean errors

* chore: remove table exist check

* chore: remove unused traits

* chore: remove unused functions.

* chore: use tempfile for examples
2026-02-03 09:39:02 +08:00
Igor Sirotin
7c580b5896
docs: added licenses (#33)
* docs: added licenses

* docs: fix licenses
2026-01-30 15:46:36 +00:00
Jazz Turner-Baggs
5a98258ff1
Implement Content::send_content (#31)
* Implement Content::send_content

* rename stamp fn
2026-01-29 08:36:18 -08:00
kaichao
10940321ff
Encode ratchet sate for serialization (#20)
* feat: costom encode for double ratchet

* chore: correct capacity

* chore: refactor reference

* chore: reader for parse bytes

* chore: extract reader

* chore: example with persist state.

* chore: update example

* chore: implement serde compatibility.

* chore: as_bytes

* chore: zerorize the secrec material

* chore: use as_types to return reference for static key.

* chore: extract example from basic demo
2026-01-29 09:19:52 +08:00
Jazz Turner-Baggs
1f0354f8e2
Add FFI functions for send_content and handle_payload (#29)
* Add api calls for handle_payload and send_content

* Add handle_payload and send_content to FFI
2026-01-28 10:50:41 -08:00
Jazz Turner-Baggs
1cb1ffc996
Nim FFI Wrapper for LibChat (#25)
* remove unneeded code

* Update comment style

* Update Nim side to support safer_ffi

* Fix Introduction from impl

* Updates
2026-01-28 10:38:08 -08:00
Jazz Turner-Baggs
15bb395475
Rust API - conversation creation (#24)
* Adds final changes for rust side API

* Add Safer_ffi impl

* Simplify api

* Add const handle offset
2026-01-28 09:59:07 -08:00
kaichao
8e2b5211b4
Managed data storage for Ratchet state (#21)
* feat: managed persist storage with sqlite

* chore: sync skipped keys

* chore: refactor

* chore: refactor

* chore: clean code

* chore: export skipped keys from state.

* chore: renaming data to record

* chore: remove types from stroage mod file
2026-01-28 14:54:16 +08:00
Jazz Turner-Baggs
4b1069a4a8
Use PayloadData for outbound datatype (#23)
* Add Introductions (#22)

* Move to Payload data

* compute delivery_address
2026-01-27 16:17:04 -08:00
Jazz Turner-Baggs
d40e72be9b
Add Introductions (#22) 2026-01-26 08:53:44 -08:00
Jazz Turner-Baggs
fe23c39321
PrivateV1 Convo Initialization via Inbox (#13)
* Load orginal protofiles

* Change package name

* Add prost generation

* Remove placeholders

* Add generated files + imports

* replace with chat-proto

* Add XK0

* auto formatting

* Initial implementation of PrivateV1 initialization

* Add ConvoFactory trait

* Hook up indentity placeholder

* Remove RemoteInbox until it’s needed

* Simplify Identity ownership

* Clean up x3handshake

* Move inbox encryption

* Simplify inbox encryption

* Cleanup warnings

* Add todos

* Update chat-proto crate

* Publickey Handling

* Reorg Inbox handshake

* Update Inbox convoId

* Remove file structure headers

* Update ConvoID

* Add Domain Separator trait

* Remove Convo trait functions

* Rename Context

* Add SecretKey

* Add workspace dependency

* update KE name

* Update comments for clarity

* Remove Xk0 references

* Bump chat_proto version and relock
2026-01-21 15:39:09 -08:00
kaichao
58392841cd
Double ratchet FFI usage in Nim (#14)
* feat: ffi

* feat: ffi interface and header generation

* feat: nim ffi example

* chore: doc

* fix: encrypt state clean

* chore: zeroize when drop
2026-01-21 17:24:20 +08:00
kaichao
fc76453f4c
Implement double ratchet (#9) 2026-01-15 08:47:02 +08:00
Jazz Turner-Baggs
04d6f8a84b
Add Project scaffolding (#1) 2025-12-22 09:40:46 -08:00
Jazz Turner-Baggs
afefa3c5a2
Initial commit 2025-12-20 22:34:08 -08:00