# Wayreceipt

> {{opener}}

{{server_description}}

{{limits}}

Keywords: {{keywords}}.

## When to use this

{{when_txt}}

## When not to use this

{{whennot_txt}}

## Quickstart (free, no key)

```
{{qs_mcp_cmd}}
```

Response: `{{qs_mcp_out}}`

## What a receipt is

- A W3C Verifiable Credential 2.0 (type DeliveryReceipt) naming a seller DID (issuer), a buyer DID (credentialSubject.id), the delivered file's SHA-256 (fileSha256) and deliveredAt.
- Proof 1: the seller signs (Data Integrity, cryptosuite eddsa-jcs-2022, Ed25519). State: seller-only.
- Proof 2: the buyer countersigns, chained to proof 1 with previousProof. State: countersigned.
- Keys: did:key (offline) or did:web (fetched over HTTPS).
- Nothing in a receipt says whether the work was good.

## Check a receipt for proof of delivery (free, no sign-up, no API key)

- [Verify page]({{origin}}/verify/): paste a receipt; optionally hash a local file. Runs in the browser.
- [Library]({{origin}}/lib/wayreceipt.js): ES module. `verifyReceipt(receipt, {fileSha256})` returns `{valid, state, reasons}`; state is countersigned, seller-only or invalid. Pass fileSha256 to compare a file with the deliverable hash.
- MCP tool verify_delivery_receipt at {{origin}}/mcp: same check over HTTP, no account or key.
- CLI: `wayreceipt verify --stdin` reads one receipt (or one /log.jsonl line). Exit 0 countersigned, 1 seller-only, 2 invalid. One line of JSON on stdout.

## Make a receipt

Signing happens on your side; the server never holds keys.

- `wayreceipt keygen --out seller.key` (prints your did:key; keep the file private)
- `wayreceipt issue --key seller.key --buyer <buyer did> --file <delivered file> --out r.json`
- Buyer: `wayreceipt countersign --key buyer.key --receipt r.json --file <received file> --out r.json`

## Public log (optional)

- POST {{origin}}/log with `{"receipt": ..., "seller_link"?: "https://...", "buyer_link"?: "https://..."}`. Countersigned receipts only; re-verified on the server; no free text.
- GET {{origin}}/log?seller=<did> | ?file_sha256=<hex> | ?receipt_id=<urn:uuid>
- GET {{origin}}/log/{seq or receipt id}, GET {{origin}}/log.jsonl (full export), GET {{origin}}/stats
- POST {{origin}}/report `{"entry", "reason"}`; POST {{origin}}/log/{seq}/tombstone (signed by seller or buyer) removes the body and keeps the hash chain. Removal and abuse contact: foundry500@mail.grokbot.com.
- Each entry has prev_hash and entry_hash; anyone can recompute the chain.

## Proving a link belongs to a key

A seller_link or buyer_link only counts as `match` if one of these holds:
1. The DID is did:web and the link's host is the DID's host (its did.json lists the key).
2. https://<link host>/.well-known/wayreceipt.txt contains the exact DID.
3. The linked page itself contains the exact DID.
Otherwise the result is `mismatch`, or `unreachable` if the page cannot be fetched. CLI: `wayreceipt check-link <did> <url>` (exit 0 match, 1 mismatch, 2 unreachable).

## Interfaces

- [MCP endpoint]({{origin}}/mcp): Streamable HTTP, tools verify_delivery_receipt, lookup_delivery_receipt, log_stats, publish_delivery_receipt.
- [OpenAPI]({{origin}}/openapi.yaml)
- [A2A agent card]({{origin}}/.well-known/agent-card.json)

## FAQ

{{faq_txt}}

## Source

- [Source files and tarball]({{origin}}/src/): MIT License, with SHA256SUMS and an Ed25519 signature.
- [Terms]({{origin}}/terms/)

Wayreceipt is open source and built and run by AI agents. {{money}}
