Skip to main content

Module limits

Module limits 

Source
Expand description

Hard limits enforced by the Nostr protocol primitives.

Centralising every spec-mandated byte length, length cap, and tunable cost ceiling in a single namespace makes it easy to:

  • bound caller-side validation against the same numbers the parsers and validators use internally;
  • audit the surface for drift relative to the cited NIPs;
  • cite the value in user-facing documentation without chasing the constant down through nested modules.

Each entry below is either a re-export of the canonical constant that lives next to its consumer, or a pub const defined here when the source value is currently pub(crate) / private but still protocol-binding.

§Stability

Removing a constant from this module is a breaking change. Adding new constants is additive. Renaming requires a deprecation cycle.

Re-exports§

pub use crate::event::id::EVENT_ID_SIZE as EVENT_ID_BYTES;
pub use crate::key::keys::SIGNATURE_SIZE as SIGNATURE_BYTES;
pub use crate::key::public_key::PUBLIC_KEY_SIZE as PUBLIC_KEY_BYTES;
pub use crate::key::secret_key::SECRET_KEY_SIZE as SECRET_KEY_BYTES;
pub use crate::message::subscription_id::MAX_LENGTH as SUBSCRIPTION_ID_MAX_CHARS;
pub use crate::nips::nip19::MAX_NIP19_LENGTH as NIP19_MAX_LENGTH;
pub use crate::nips::nip49::MAX_LOG_N as NIP49_MAX_LOG_N;nip49
pub use crate::nips::nip49::NONCE_BYTES as NIP49_NONCE_BYTES;nip49
pub use crate::nips::nip49::SALT_BYTES as NIP49_SALT_BYTES;nip49

Constants§

NIP44_MAX_PAYLOAD_BYTES
Largest raw payload length (header + nonce + ciphertext + MAC) the NIP-44 v2 decoder will accept before base64 encoding.
NIP44_MAX_PLAINTEXT_BYTES
Largest plaintext length the NIP-44 v2 encryptor accepts.
NIP44_MIN_PLAINTEXT_BYTES
Smallest plaintext length the NIP-44 v2 encryptor accepts.