feat(sdk): add Java and Ruby SDK wrappers over C FFI
Java SDK: JNI bindings to libquicproquo_ffi with QpqClient class, Gradle build, and exception hierarchy matching Kotlin SDK. Ruby SDK: FFI gem wrapping libquicproquo_ffi with Client class, block-form auto-disconnect, gemspec for RubyGems publishing, and example script.
This commit is contained in:
50
sdks/java/README.md
Normal file
50
sdks/java/README.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# QuicProQuo Java SDK
|
||||
|
||||
Java wrapper over `libquicproquo_ffi` via JNI for JVM and Android.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- JDK 17+
|
||||
- `libquicproquo_ffi` built for the target platform
|
||||
- JNI bridge compiled (shared with Kotlin SDK: `../kotlin/jni/`)
|
||||
|
||||
## Building
|
||||
|
||||
```sh
|
||||
# Build Rust FFI library
|
||||
cargo build --release -p quicproquo-ffi
|
||||
|
||||
# Build Java SDK
|
||||
./gradlew build
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```java
|
||||
import dev.quicproquo.QpqClient;
|
||||
|
||||
try (QpqClient client = new QpqClient("127.0.0.1:5001", "ca.pem")) {
|
||||
client.login("alice", "secret");
|
||||
client.send("bob", "hello".getBytes());
|
||||
|
||||
var messages = client.receive(5000);
|
||||
messages.forEach(msg -> System.out.println("Received: " + msg));
|
||||
}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `new QpqClient(server, caCertPath)` | Connect to server |
|
||||
| `client.login(username, password)` | OPAQUE authentication |
|
||||
| `client.send(recipient, message)` | Send message by username |
|
||||
| `client.receive(timeoutMs)` | Receive pending messages |
|
||||
| `client.close()` / `client.disconnect()` | Disconnect |
|
||||
| `client.isConnected()` | Connection status |
|
||||
|
||||
## Structure
|
||||
|
||||
- `src/main/java/dev/quicproquo/QpqClient.java` -- High-level client
|
||||
- `src/main/java/dev/quicproquo/NativeBridge.java` -- JNI declarations
|
||||
- JNI C bridge shared with Kotlin SDK at `../kotlin/jni/`
|
||||
Reference in New Issue
Block a user