Expand description
Ed25519 sign-over-event_id (Nostr NIP-01 style).
Sign flow:
- Compute SHA-256 over canonical bytes of
msg(strict: drops event_id). - That 32-byte digest IS the
event_id(hex-encoded for transport). - Sign the raw 32-byte digest. The signature commits to event_id, which transitively commits to the canonical body — tamper anything, the digest changes, the signature fails.
Why sign the id and not the body: lets relays/index layers cite events by id without re-canonicalizing every body. Same property Nostr exploits.
Re-exports§
pub use crate::canonical::canonical as canonical_value;
Enums§
Constants§
- EVENT_
SCHEMA_ VERSION - Schema version tag stamped on every signed event by 0.5.11+. Pull-side
verification rejects events whose schema_version’s major component
disagrees with this — see
pull::process_events.
Statics§
- KIND_
RANGES - Disjoint kind-id ranges. Mirrors v3 protocol; v0.1 ships a strict subset.
Functions§
- b64decode
- b64encode
- canonical_
event - compute_
event_ id - fingerprint
- generate_
keypair - Returns
(private_key_bytes, public_key_bytes)— both 32 bytes, raw. - kind_
class - Classify a kind id.
Nonemeans unknown — caller decides how to handle. - kinds
- v0.1 named kinds. Anything not here is unknown to this version.
- kinds_
map kinds()as aBTreeMapfor membership tests. Allocated per call — callers that need it hot should cache.- make_
key_ id - schema_
major - Major component of a
v<major>.<minor>schema_version. Used to decide whether a received event is wire-compatible. - sign_
message_ v31 - Sign a message. Returns the canonical wire form: original fields + the
computed
event_id,public_key_id,signature. - verify_
message_ v31 - Verify a signed message against a trust dict (see
trustmodule).