Docs · Build
SDK
One dependency-free file, served at /sdk/pod.mjs: seal plates, run queries over x402, verify receipts.
Functions
| Call | Does |
|---|---|
createClient({ base, meter, plates, rpc }) | Client bound to a site and the deployed contracts |
attestation() | The live enclave's sealing key, signer and quote |
quote(aggregate) | Price and plates in scope, free |
upload({ bytes, kind, account }) | Seal to the enclave, sign the plate, upload |
query({ aggregate, account }) | Run an aggregate, answering the 402 with EIP-3009 |
verifyReceipt({ queryId, output }) | Compare the output with the Meter's Settled event |
sealPlate, seal, open | The HPKE primitives |
Sealing by hand
import { sealPlate, fromHex } from "https://proofofdata.app/sdk/pod.mjs";
const att = await (await fetch("https://proofofdata.app/api/enclave")).json();
const bytes = new TextEncoder().encode(JSON.stringify({ text: "I dreamt of a lighthouse" }));
const { envelope, cipherHash } = await sealPlate({
enclavePublicKey: fromHex(att.sealPublicKey), enclaveId: att.enclaveId, kind: 3, bytes,
});