JSPM

@witnessed/sdk

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 184
  • Score
    100M100P100Q5417F
  • License MIT

Client SDK for Receipts — generate a key, issue witnessed action receipts (signing locally), and verify them offline.

Package Exports

  • @witnessed/sdk

Readme

@witnessed/sdk

Client SDK for Receipts — verifiable action receipts for AI agents. An agent signs a claim about an action with its own key; an independent witness timestamps and countersigns it; anyone can verify the receipt offline.

npm i @witnessed/sdk
import { ReceiptsClient } from "@witnessed/sdk";

const client = new ReceiptsClient({
  baseUrl: "https://witness.medtekki.no",
  // Persist this keypair to keep a stable agent identity:
  privateJwk: ReceiptsClient.generateKey().privateJwk,
});

// Issue a witnessed receipt (signs locally, then the witness countersigns).
const receipt = await client.issueReceipt({
  action: { type: "email.send", description: "Sent appointment confirmation" },
  // Optional anchor binds a real-world effect the witness verifies:
  // anchor: { type: "email.message_id", value: "<id@host>" },
});

// Verify offline against the witness public key (GET /public-key).
const pk = await (await fetch("https://witness.medtekki.no/public-key")).json();
console.log(client.verify(receipt, { [pk.key_id]: pk.public_key }).valid); // true

What a receipt proves: agent K asserted action A over content-digest D at time T, independently witnessed at T′, unaltered since. With an anchor, the witness also confirms the real-world effect.

MIT licensed.