2.7 KiB
2.7 KiB
nomyo4J — Agent Instructions
Java 25 port of the NOMYO Python client. Hybrid encryption (RSA-4096 + AES-256-GCM) for secure API communication.
Build & Run
mvn compile # Java 25, Lombok annotation processor
mvn test # JUnit Jupiter 5.12.1, @Order enforced
mvn test -Dtest=ClassName # single test class
Architecture
SecureCompletionClient— low-level client: key mgmt, HTTP, encryption, decryptionSecureChatCompletion— high-level OpenAI-compatible surface (create(),acreate())Constants— all protocol/crypto constants (version, algorithms, timeouts)SecureMemory— Java 25 FFMSecureBufferfor locked/zeroed memoryerrors/— 9 exception classes, allextends Exception(checked), allextends APIErrorutil/—Pass2Key(PBKDF2 + AES-GCM),PEMConverter,SplitterEncryptedRequest— wire format model with Gson@SerializedNameannotations
Stubbed methods (check before implementing)
SecureMemory.lock()— always returnsfalse(FFM doesn't support locking)SecureMemory.unlock()— always returnsfalseSecureMemory.initMemoryLocking()— always returnsfalse
Dependencies
- Gson (2.13.2) — JSON serialization, in
pom.xml - Lombok (1.18.44,
providedscope) — annotation processor configured in maven-compiler-plugin - JUnit Jupiter (5.12.1,
testscope) - Maven Surefire (3.5.0)
Key files
TRANSLATION_REFERENCE.md— primary documentation. Cross-language spec from Python reference. Read before implementing any method.client_keys/— contains real RSA keys. Gitignored. Do not commit.Main.java— entry point isstatic void main()— notpublic static void main(String[]). Cannot run standalone.
Conventions
- Package:
ai.nomyo - Lombok:
@Getteron fields,@Setteron static flags - Tests:
@TestMethodOrder(OrderAnnotation.class),@DisplayNameon every test - Error classes: checked exceptions with
statusCodeanderrorDetails(immutable, viaCollections.unmodifiableMap) - Key files:
PosixFilePermissions.fromString("rw-------")for private,"rw-r--r--"for public - RSA: 4096-bit, exponent 65537, OAEP-SHA256 (MGF1 with SHA-256)
- Protocol constants in
Constants.java— marked "never change" (downgrade detection) SecureChatCompletion.acreate()is a sync alias, not async — delegates tocreate()- Streaming is explicitly rejected with
IllegalArgumentException SecureCompletionClient.ValueError— inner class, maps to PythonValueError- Retry: 429/500/502/503/504 + network errors, exponential backoff 2^(attempt-1)s, default 2 retries
- All HTTP endpoints use
application/octet-streamcontent type for encrypted payloads