aere-cloud-sdk/java/README.md
Liviu af565d3aec Install from this repository (the clients are not on npm or PyPI yet); Python and Java clients 1.5.1/1.5.0 added
The README told readers to run npm install @aere/cloud and pip install aere-cloud; neither name exists on those registries, so the
command failed, and a name there that looks like ours is not ours. Install now points at this repository for JavaScript, Python
(python/, subdirectory install) and Go (go/); java/ builds from source with the JDK alone.
2026-09-25 11:02:13 +03:00

65 lines
3.1 KiB
Markdown

# aere-cloud (Java)
The official Java client for the [Aere Cloud API](https://aere.network/cloud.html) — one keyed
endpoint for RPC, post-quantum signature verification, chain data, notarization, webhooks and
gas sponsorship on Aere Network (chain 2800). **Zero dependencies** beyond the JDK (11+):
`java.net.http.HttpClient` and `javax.crypto` only.
Mirror of `@aere/cloud` (JS) and `aere-cloud` (Python): same routes, same semantics. Bodies are
raw JSON strings — the client does not force a JSON library on the integrator; parse responses
with whatever you already use (Jackson, Gson, `org.json`, ...).
## Use
```java
import network.aere.cloud.AereCloud;
var aere = new AereCloud(System.getenv("AERE_KEY"));
String head = aere.dataHead(); // {"block":...,"chainId":2800,...}
String anchors = aere.anchors(5); // post-quantum anchor certificates
long n = aere.blockNumber();
// a smart account with a POST-QUANTUM owner (Falcon-512), gas sponsored:
String acct = aere.sponsorCreatePqAccount("0x09" + falconPkHex, 0);
// verify a webhook delivery (constant-time HMAC) — never trust one without this:
boolean ok = AereCloud.verifyWebhook(rawBodyBytes, request.header("x-aere-signature"), secret);
```
Non-2xx responses raise `AereCloud.AereCloudException` with `.status`, `.body` (server JSON)
and `.path`.
## Since 1.5.0 (same surface as the JS and Python SDKs 1.5.0)
```java
aere.proof("0x" + sha256Hex); // a proof with its post-quantum finality
aere.readiness("example.com", false, false); // quantum-readiness scan, free, no key sent
aere.readinessPerimeter("example.com", new String[]{"api"}, null, false); // a domain's whole public perimeter
aere.pqFinality("latest", "testnet", "both"); // AIP-21 per-block PQ finality, both clients
AereCloud.AuditExport day = aere.auditExport("2026-09-24", "jsonl");
// day.bytes are the exact bytes of the day file; day.verified is true only if THEIR sha256 equals the stated digest
aere.auditRetention(); // read-only with the API key; set it in the console
AereCloud.KeptCheck k = aere.auditVerifyKept("2026-05-01", keptBytes);
// k.matches: your kept export still matches the day we hold, or the tombstone (digest) a deleted day left behind
```
`auditVerifyKept` hashes YOUR bytes locally. An error (rate limit, network) is raised, never returned as "does not match".
## Tests
```
javac -d out src/main/java/network/aere/cloud/AereCloud.java src/test/java/network/aere/cloud/TestAereCloud.java
java -cp out network.aere.cloud.TestAereCloud # unit, offline
AERE_KEY=ak2800... java -cp out network.aere.cloud.TestAereCloud --live # + live probes
```
Measured 2026-08-27: 7/7 green, including live probes against production (health, validator
set, block number, and the free JSON refusal on the PQ sponsorship route).
Measured 2026-09-25 (1.5.0): 7/7 offline, the new routes judged against a local JDK HTTP server (what the client sends,
what it does with each answer). `node control-negativ.mjs` breaks five guards in a copy of the class and requires each
one's test to fail: 5/5 red, the untouched class green.