Files
quicproquo/sdks/ruby/README.md
Christian Nennemann 2e081ead8e chore: rename quicproquo → quicprochat in docs, Docker, CI, and packaging
Rename all project references from quicproquo/qpq to quicprochat/qpc
across documentation, Docker configuration, CI workflows, packaging
scripts, operational configs, and build tooling.

- Docker: crate paths, binary names, user/group, data dirs, env vars
- CI: workflow crate references, binary names, artifact names
- Docs: all markdown files under docs/, SDK READMEs, book.toml
- Packaging: OpenWrt Makefile, init script, UCI config (file renames)
- Scripts: justfile, dev-shell, screenshot, cross-compile, ai_team
- Operations: Prometheus config, alert rules, Grafana dashboard
- Config: .env.example (QPQ_* → QPC_*), CODEOWNERS paths
- Top-level: README, CONTRIBUTING, ROADMAP, CLAUDE.md
2026-03-21 19:14:06 +01:00

83 lines
1.9 KiB
Markdown

# QuicProChat Ruby SDK
Ruby FFI gem wrapping `libquicprochat_ffi` for the quicprochat E2E encrypted messenger.
## Prerequisites
- Ruby 3.1+
- `libquicprochat_ffi` built for the target platform
## Installation
```sh
gem install quicprochat
```
Or add to your Gemfile:
```ruby
gem "quicprochat"
```
## Building the Native Library
```sh
cargo build --release -p quicprochat-ffi
```
Set `QPC_LIB_PATH` if the library is not in the default search path.
## Usage
```ruby
require "quicprochat"
# Block form (auto-disconnect)
QuicProChat::Client.open("127.0.0.1:5001", ca_cert: "ca.pem") do |client|
client.login("alice", "secret")
client.send("bob", "hello from Ruby!")
messages = client.receive(timeout_ms: 5000)
messages.each { |msg| puts msg }
end
# Manual lifecycle
client = QuicProChat::Client.new("127.0.0.1:5001", ca_cert: "ca.pem")
client.login("alice", "secret")
client.send("bob", "hello")
client.disconnect
```
## API
| Method | Description |
|---|---|
| `Client.new(server, ca_cert:, server_name:)` | Connect to server |
| `Client.open(server, **opts) { \|c\| ... }` | Connect with auto-disconnect |
| `client.login(username, password)` | OPAQUE authentication |
| `client.send(recipient, message)` | Send message by username |
| `client.receive(timeout_ms: 5000)` | Receive pending messages |
| `client.disconnect` | Disconnect |
| `client.connected?` | Connection status |
## Error Handling
```ruby
begin
client.login("alice", "wrong")
rescue QuicProChat::AuthError => e
puts "Auth failed: #{e.message}"
rescue QuicProChat::TimeoutError => e
puts "Timeout: #{e.message}"
rescue QuicProChat::Error => e
puts "Error: #{e.message}"
end
```
## Structure
- `lib/quicprochat/client.rb` -- High-level client
- `lib/quicprochat/ffi_bindings.rb` -- FFI function declarations
- `lib/quicprochat/errors.rb` -- Exception classes
- `examples/demo.rb` -- Usage example