# QuicProChat Java SDK Java wrapper over `libquicprochat_ffi` via JNI for JVM and Android. ## Prerequisites - JDK 17+ - `libquicprochat_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 quicprochat-ffi # Build Java SDK ./gradlew build ``` ## Usage ```java import dev.quicprochat.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/quicprochat/QpqClient.java` -- High-level client - `src/main/java/dev/quicprochat/NativeBridge.java` -- JNI declarations - JNI C bridge shared with Kotlin SDK at `../kotlin/jni/`