Expand description
Protocol primitives for the Nostr protocol used across the nula workspace.
nula-core is the lowest layer of the workspace. It defines the on-the-wire
data model (events, filters, tags, messages), the cryptographic identity
(keys, signatures), and a small set of shared value types. It performs no
I/O, has no async runtime dependency, and is safe to reuse from tests,
relays, signers, and offline tooling.
Higher-level crates layer pool management, transports, databases, gossip, signers, and relay servers on top of these primitives.
§Hard limits
Every byte size, length cap, and tunable bound the protocol mandates lives
in limits. The table below summarises the most common values; consult
the cited NIPs for the binding spec text.
| Constant | Value | Spec |
|---|---|---|
limits::EVENT_ID_BYTES | 32 | NIP-01 §id |
limits::SIGNATURE_BYTES | 64 | NIP-01 §sig |
limits::PUBLIC_KEY_BYTES | 32 | BIP-340 |
limits::SECRET_KEY_BYTES | 32 | BIP-340 |
limits::SUBSCRIPTION_ID_MAX_CHARS | 64 | NIP-01 §<subscription_id> |
limits::NIP19_MAX_LENGTH | 5_000 | NIP-19 §guards |
limits::NIP44_MIN_PLAINTEXT_BYTES | 1 | NIP-44 §plaintext |
limits::NIP44_MAX_PLAINTEXT_BYTES | 65_535 | NIP-44 §plaintext |
limits::NIP44_MAX_PAYLOAD_BYTES | 65_603 | NIP-44 §payload |
limits::NIP49_SALT_BYTES | 16 | NIP-49 §scrypt |
limits::NIP49_NONCE_BYTES | 24 | NIP-49 §XChaCha20 |
limits::NIP49_MAX_LOG_N | 30 | NIP-49 §scrypt cost cap |
Re-exports§
pub use self::boxed::BoxFuture;pub use self::boxed::BoxStream;pub use self::event::Coordinate;pub use self::event::Event;pub use self::event::EventBuilder;pub use self::event::EventId;pub use self::event::Kind;pub use self::event::SingleLetterTag;pub use self::event::Tag;pub use self::event::TagKind;pub use self::event::Tags;pub use self::event::UnsignedEvent;pub use self::event::compute_event_id;pub use self::filter::Filter;pub use self::key::Keys;pub use self::key::PublicKey;pub use self::key::SecretKey;pub use self::message::ClientMessage;pub use self::message::RelayMessage;pub use self::message::SubscriptionId;pub use self::metadata::Metadata;pub use self::nips::nip19::FromBech32;pub use self::nips::nip19::Nip19Entity;pub use self::nips::nip19::ToBech32;pub use self::signer::NostrSigner;pub use self::types::ImageDimensions;pub use self::types::RelayUrl;pub use self::types::Timestamp;pub use self::types::Url;pub use self::util::JsonUtil;
Modules§
- boxed
- Boxed, type-erased async return shapes used across object-safe
trait surfaces in
nula-*crates. - event
- Nostr events.
- filter
- NIP-01 subscription filter.
- key
- Cryptographic identity for the Nostr protocol.
- limits
- Hard limits enforced by the Nostr protocol primitives.
- message
- Wire messages exchanged over a relay WebSocket.
- metadata
- NIP-01 user metadata (kind
0event content). - nips
- NIP modules — one Rust module per Nostr Implementation Possibility.
- observe
- Observability field conventions for
tracingspans. - parser
- Single-pass content parser for Nostr text-bearing events.
- prelude
- Convenience re-exports for the most common Nostr types.
- signer
NostrSignertrait — the universal signing interface used by every higher-level crate.- types
- Shared value objects used across the Nostr protocol.
- util
- Utility helpers shared by every other
nula-coremodule.