@aere/cloud 1.2.0: proof(hash) (post-quantum finality), readiness(domain, {attest, fresh}), readinessReport, sponsorCreatePqAccount; pqVerify interface:'external' documented
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
fa8478c816
commit
3ff4bb4a9a
19
README.md
19
README.md
@ -38,10 +38,29 @@ const { valid } = await aere.pqVerify({
|
||||
const receipt = await aere.notarize('0x' + sha256Hex);
|
||||
const proof = await aere.proofOf('0x' + sha256Hex); // { notarized, firstSeenAt, … }
|
||||
|
||||
// 1.2.0 (2026-09-17): the proof with its post-quantum finality: first appearance from the contract log,
|
||||
// the anchor that covers it, a verdict, and how to verify every claim without Aere Cloud
|
||||
const full = await aere.proof('0x' + sha256Hex); // { block, txHash, finality: 'post-quantum', pqAnchor: {…}, verify: {…} }
|
||||
|
||||
// quantum readiness of a domain's public TLS edge (free, no key); attest:true notarizes the report digest on chain
|
||||
const scan = await aere.readiness('example.com'); // { score, verdict, summary, findings, … }
|
||||
const attested = await aere.readiness('example.com', { attest: true }); // + attestation: { reportHash, txHash, proof, … }
|
||||
|
||||
// pqVerify: pass interface:'external' to verify a standard FIPS 204/205 signature (the precompile implements the
|
||||
// internal interface; the gateway builds M' = 0x00 || len(ctx) || ctx || message for you)
|
||||
const v = await aere.pqVerify({ scheme: 'ml-dsa-44', interface: 'external', publicKey, signature, message });
|
||||
|
||||
// transfer history for an address (token from genesis, native from launch)
|
||||
const tx = await aere.transfers('0xYourAddress', 50);
|
||||
|
||||
// a smart account with a POST-QUANTUM owner (Falcon-512), gas sponsored:
|
||||
const acct = await aere.sponsorCreatePqAccount('0x09' + falconPkHex, 0);
|
||||
// -> { txHash, account: '0x…', alreadyDeployed: false }
|
||||
```
|
||||
|
||||
A Python mirror of this client lives in `sdk/python/` (`pip install aere-cloud`): same routes,
|
||||
same semantics, snake_case names.
|
||||
|
||||
Every method throws `AereCloudError` on a non-2xx response, carrying `.status` and the server's
|
||||
JSON `.body` so you can act on the exact error.
|
||||
|
||||
|
||||
18
index.mjs
18
index.mjs
@ -76,6 +76,16 @@ export class AereCloud {
|
||||
/** Notarizeaza un digest de 32 de octeti (0x + 64 hex); noi platim gazul. */
|
||||
notarize(hash) { return this._req('POST', '/notarize', { body: { hash } }); }
|
||||
proofOf(hash) { return this._req('GET', `/notarize/${encodeURIComponent(hash)}`); }
|
||||
// 2026-09-17: the proof with its post-quantum finality (first appearance, covering anchor, verdict, verification steps)
|
||||
proof(hash) { return this._req('GET', `/proof/${encodeURIComponent(hash)}`); }
|
||||
|
||||
// quantum readiness scan of a domain's public TLS edge: free without a key; { attest: true } notarizes the report digest
|
||||
// on chain 2800 and needs the key (the response then carries `attestation`)
|
||||
readiness(domain, opts = {}) {
|
||||
const body = { domain, ...(opts.fresh ? { fresh: true } : {}), ...(opts.attest ? { attest: true } : {}) };
|
||||
return this._req('POST', '/pq/readiness', { body, auth: !!opts.attest });
|
||||
}
|
||||
readinessReport(domain) { return this._req('GET', `/pq/readiness/${encodeURIComponent(domain)}`, { auth: false }); }
|
||||
|
||||
// ---- webhooks ----
|
||||
listWebhooks() { return this._req('GET', '/webhooks'); }
|
||||
@ -85,6 +95,14 @@ export class AereCloud {
|
||||
// ---- gas sponsorship ----
|
||||
sponsorHealth() { return this._req('GET', '/sponsor/health'); }
|
||||
sponsorCreateAccount(body) { return this._req('POST', '/sponsor/createAccount', { body }); }
|
||||
/**
|
||||
* Cont inteligent cu proprietar POST-CUANTIC (Falcon-512), gazul platit de releu.
|
||||
* @param {string} falconPubKey 0x-hex, 897 octeti, antetul 0x09
|
||||
* @param {number} [salt=0] idempotent pe (cheie, salt): a doua chemare intoarce contul, fara tx
|
||||
*/
|
||||
sponsorCreatePqAccount(falconPubKey, salt = 0) {
|
||||
return this._req('POST', '/sponsor/createPqAccount', { body: { falconPubKey, salt } });
|
||||
}
|
||||
sponsorExecute(body) { return this._req('POST', '/sponsor/execute', { body }); }
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aere/cloud",
|
||||
"version": "1.0.0",
|
||||
"version": "1.2.0",
|
||||
"description": "Official client for the Aere Cloud API: keyed RPC, post-quantum verification, chain data, notarization, webhooks and gas sponsorship on Aere Network (chain 2800).",
|
||||
"type": "module",
|
||||
"main": "index.mjs",
|
||||
|
||||
@ -72,6 +72,34 @@ await test('rutele de date construiesc corect query-ul', async () => {
|
||||
// daca reperele nu s-ar potrivi, fetchFals ar da 404 si _req ar arunca
|
||||
});
|
||||
|
||||
await test('sponsorCreatePqAccount: cale si corp corecte', async () => {
|
||||
const rute = { 'POST /sponsor/createPqAccount': { status: 200, corp: { txHash: '0xab', account: '0xcd', alreadyDeployed: false } } };
|
||||
const c = new AereCloud({ apiKey: 'ak2800.0xAAA.AERE-SINTETIC-s', baseUrl: BAZA_TEST, fetch: fetchFals(rute) });
|
||||
const d = await c.sponsorCreatePqAccount('0x09aa', 5);
|
||||
assert.equal(d.account, '0xcd');
|
||||
const trimis = rute['POST /sponsor/createPqAccount']._vazut.body; // fetchFals parseaza deja
|
||||
|
||||
assert.equal(trimis.salt, 5);
|
||||
assert.equal(trimis.falconPubKey, '0x09aa');
|
||||
});
|
||||
|
||||
await test('2026-09-17: proof(hash) si readiness(): ruta, cheia doar cand se cere, corpul corect', async () => {
|
||||
const H = '0x' + 'ab'.repeat(32);
|
||||
const vazute = [];
|
||||
const rute = {
|
||||
['GET /proof/' + H]: { status: 200, corp: { hash: H, notarized: true, finality: 'post-quantum' } },
|
||||
'POST /pq/readiness': { status: 200, corp: { domain: 'aere.network', score: 75 } },
|
||||
'GET /pq/readiness/aere.network': { status: 200, corp: { domain: 'aere.network', score: 75, cached: true } },
|
||||
};
|
||||
const f = fetchFals(rute);
|
||||
const spion = async (url, init) => { vazute.push({ url, cheie: !!(init.headers && init.headers['x-api-key']), corp: init.body }); return f(url, init); };
|
||||
const c = new AereCloud({ apiKey: 'ak2800.0xAAA.AERE-SINTETIC-s', baseUrl: BAZA_TEST, fetch: spion });
|
||||
const p = await c.proof(H); assert.equal(p.finality, 'post-quantum'); assert.equal(vazute[0].cheie, true, 'proof cere cheia');
|
||||
await c.readiness('aere.network'); assert.equal(vazute[1].cheie, false, 'scanarea libera nu trimite cheia'); assert.equal(vazute[1].corp, JSON.stringify({ domain: 'aere.network' }));
|
||||
await c.readiness('aere.network', { attest: true, fresh: true }); assert.equal(vazute[2].cheie, true, 'atestarea trimite cheia'); assert.deepEqual(JSON.parse(vazute[2].corp), { domain: 'aere.network', fresh: true, attest: true });
|
||||
const g = await c.readinessReport('aere.network'); assert.equal(g.cached, true); assert.equal(vazute[3].cheie, false);
|
||||
});
|
||||
|
||||
await test('verifyWebhook: semnatura buna trece, una gresita pica, o litera in plus pica', async () => {
|
||||
const secret = 'AERE-SINTETIC-secretul-meu';
|
||||
const corp = JSON.stringify({ event: 'pq-anchor', data: { height: 42 } });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user