witnessed

v0.2.0
io.github.BARRYPMARSHALL/witnessed Checked 1 day ago Published 1 month ago

Signed, reproducible market facts for agents, verifiable without trust.

Verify a Witnessed publication without trusting the publisher. Ed25519 signature, canonical bytes, and freshness — in three checks. Recomputation of the indicators is left to you, because the feed tells you exactly how to re-derive every number from the public venue. check() proves the bytes are the bytes that were signed, that a specific did:key signed them, and that the feed is inside its TTL.

Summary extracted from the README.

witnessed-sdk

Verify a Witnessed publication without trusting the publisher.

Ed25519 signature, canonical bytes, and freshness — in three checks. Recomputation of the indicators is left to you, because the feed tells you exactly how to re-derive every number from the public venue.

npm install witnessed-sdk
import { check } from 'witnessed-sdk';

const r = await check('https://api.witnessed.workers.dev');
if (!r.ok) throw new Error(r.reasons.join('; '));

for (const a of r.feed.assets) {
  console.log(a.symbol, a.close, 'MA333', a.ma333, 'band', a.band_3_3sigma);
  console.log('  evidence:', a.evidence.request);
}

API

export what it does
check(base, opts) bytes + signature + TTL. Returns { ok, reasons, feed, did, age }
fetchFeed(base) { feed, raw, sig, did } with no verification
verifySignature(feed, sigB64, did) true/false for an Ed25519 signature
canonical(value) sorted-keys JSON, the exact bytes that were signed
isFresh(feed, now, skew) { age, fresh } against the feed's own ttl_seconds
keyFromDid(did) did:key → crypto.KeyObject, no registry lookup

What it proves, and what it does not

check() proves the bytes are the bytes that were signed, that a specific did:key signed them, and that the feed is inside its TTL.

It does not prove the numbers are true. For that, recompute them — each asset carries evidence.source, evidence.request, evidence.method, evidence.window_from/to and a one-line recompute instruction. A figure you can regenerate is worth more than a figure you are told.

Zero runtime dependencies.

Licence

MIT