mirror of
https://github.com/zap-proto/dev.git
synced 2026-10-30 15:05:18 +00:00
examples/ — 4 working code samples under zap-proto/rns/examples/.
Every one builds and runs from a clean checkout.
- 01_compute_did — derive a did:zap from a (kemPk, sigPk)
- 02_dual_identity_collision — rotation surfaces in the DID; use
Records, not equality, to track service
identity across rotations
- 03_signed_record_roundtrip — registry signs Record → resolver returns
it → client verifies + checks window +
derives DID
- 04_capability_mailbox — PostCap vs ReadCap, unforgeable handles,
revocation without rotating identities
dev/content/docs/examples/ — three MDX pages walking through the
roundtrip, the cross-language KAT (Go + Rust + Python + Node all
reproduce did:zap:ok7klbkh4p3udjjeo4n7hkevssfyhswx6zygqif3tiemjmbgz7fa
from the same canonical inputs), and the capability model.
benchmarks.mdx — fully rewritten against the actual harness output.
The old page had wall-to-wall fabricated tables (1438×, 736458×,
656× — none traceable to a benchmark file). Replaced with real
numbers from zap-proto/bench/bench-results.txt: ZAP modestly wins
at small payloads, loses at large, ties under concurrency. Honest.
The "ZAP wins at X" argument is moved from µs to mechanism: one
wire format for many protocols, PQ at the transport by default,
capability semantics, PQ-RNS.
This burns the last of the AI-slop in the perf claims. Whatever
numbers replace these will come from a real harness run.
37 lines
1.5 KiB
Plaintext
37 lines
1.5 KiB
Plaintext
---
|
|
title: Overview
|
|
description: Runnable, end-to-end examples — PQ-RNS round-trip, cross-language conformance, capability-passing.
|
|
---
|
|
|
|
# Examples
|
|
|
|
Concrete things you can `go run` or copy-paste. Every example here is real source in a repo, not a sketch — the URL after each title is the canonical commit.
|
|
|
|
| Example | What it shows |
|
|
|---|---|
|
|
| [PQ-RNS round-trip](/docs/examples/pq-rns-roundtrip) | Registry signs a Record → resolver returns it → client verifies → DID derives → ready to dial |
|
|
| [Cross-language conformance](/docs/examples/multi-lang-conformance) | Run the DID KAT in Go, Rust, Python, Node — all four reproduce the same DID |
|
|
| [Capability mailbox](/docs/examples/capability-mailbox) | A drop-box where the holder of a capability can post but not read — pure ZAP cap semantics |
|
|
|
|
Each example fits in a single file. If something here doesn't compile or doesn't run, that's a bug — open an issue against [zap-proto/dev](https://github.com/zap-proto/dev).
|
|
|
|
## Quick sanity check
|
|
|
|
The smallest possible "is ZAP working" test:
|
|
|
|
```bash
|
|
go install github.com/zap-proto/rns/examples/01_compute_did@latest
|
|
01_compute_did
|
|
```
|
|
|
|
Output:
|
|
```
|
|
== PQ-RNS DID derivation ==
|
|
kem pk (first 16 bytes): 352744dfbe14d2d70056a319d6aa7a68 ...
|
|
sig pk (first 16 bytes): 5067f5f9a5777725dfadc21acee4033f ...
|
|
|
|
did:zap:l72zl3smczdgrmuttpp3yespcoxmwdy5kd2b3kykmw6jz6e4ztsq
|
|
```
|
|
|
|
You changed the seed strings? The DID changes. You ran it on a different machine? Same output. That's the floor of conformance.
|