moreinlaw-kernel
The rules every copy of MoreInLaw must share to stay on the network. An organization can fork the app, rebrand it and rebuild every screen; as long as it depends on this crate unchanged, the other instances still find it, prove its address and count its verifications.
A copy that edits these rules still runs. It just stops being seen: other instances refuse its events, and it refuses theirs.
The one rule for what belongs here
Code belongs in the kernel if two instances must agree on it byte for byte to understand and trust each other. Anything one instance could change without another noticing stays out.
| In the kernel | Outside it |
|---|---|
Event kinds, tags, d values, schema version |
Screens, branding, wording |
| How a registration, list or badge is built and checked | Where rows are stored |
| The paths peers call on each other | Which relays or HTTP client are used |
| Size limits and time windows that decide acceptance | Sync timers, retries, logging |
Constraints
- Pure. No tokio, sqlx, actix, reqwest, filesystem or environment access. Functions take
their inputs as arguments, including the clock where it matters (
*_atvariants). - Same
nostras the backend (0.33), re-exported asmoreinlaw_kernel::nostr, so anEventcrosses the boundary without conversion. - Frozen values.
params.rsis never edited, only extended. A different value means a new schema version that old and new instances can tell apart.
Modules
| Module | Holds |
|---|---|
params |
Kinds, tags, d values, limits, and the routes peers call |
registration |
The kind-30779 registration: validate_input, build_registration_event, parse_registration, URL and slug rules |
lists |
30779:<hex>:<slug> coordinates, the public organization set, the private verified list |
nip98 |
Peer-to-peer request auth: nip98_header, verify_nip98 |
proof |
The address proof: HostIdentityResponse, check_identity, api_on_own_site, accept_registration, is_public_ip |
count |
verified_by_count over each peer's PeerList |
badge |
The kind-30777 lawyer badge: build_badge, parse_badge |
directory |
The maintainer-signed kind-30778 entry and its withdrawal. Behind the directory feature |
manifest |
The kind-4777 verification manifest: verify_manifest, reviewed_hash |
= "0.3"
# the maintainer instance also signs directory entries:
= { = "0.3", = ["directory"] }
Tests
Each module carries its own unit tests. The frozen vectors (tests/vectors/, events signed once
with a published test key and never regenerated) and their generator (examples/gen_vectors.rs)
are kept by the maintainers outside this repository; they catch a change that would make other
organizations' existing events unreadable.
To add a vector for a new schema version:
Changing the kernel
A change that alters what is accepted or produced is a protocol change, not a refactor:
- Add a new schema version; keep parsing the old one.
- Add vectors for the new version; leave the old vectors untouched and passing.
- Raise the crate's minor version (major, once past 1.0).