2.5 KiB
2.5 KiB
nomyo4J — Agent Instructions
Java 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/— exception hierarchy, allextends Exception(checked)util/—Pass2Key(PBKDF2 + AES-GCM),PEMConverter,Splitter
Critical: This is a partial/in-progress port
Many methods are stubbed with UnsupportedOperationException. Before implementing, check TRANSLATION_REFERENCE.md for the Python reference. Stubbed methods:
SecureCompletionClient.fetchServerPublicKey()— GET/pki/public_keySecureCompletionClient.encryptPayload()/doEncrypt()— hybrid encryptionSecureCompletionClient.decryptResponse()— response decryptionSecureCompletionClient.sendSecureRequest()(3 overloads) — full request lifecycleSecureCompletionClient.ensureKeys()— key init (partial DCL implemented)SecureCompletionClient.close()— resource cleanupSecureChatCompletion.create()/acreate()— returnnull, stubbedSecureMemorylock/unlock — always returnsfalse
No JSON library (Jackson/Gson) in pom.xml — needed for wire format serialization.
Key files
TRANSLATION_REFERENCE.md— primary documentation. Cross-language spec derived 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
status_codeanderror_details - Key files:
PosixFilePermissions.OWNER_READonly (mode 400) - RSA: 4096-bit, exponent 65537, OAEP-SHA256 padding
- Protocol constants in
Constants.java— marked "never change"