Skip to main content

Crate nostro2_nips

Crate nostro2_nips 

Source

Structs§

GroupManager
Pure, in-memory group transport state machine.
GroupReceivedMessage
A group message decrypted by GroupManager::decrypt.
GroupSenderKeyMessage
A published one-to-many group message. The sender_event_pubkey locates the receiving chain; key_id + message_number index it. ciphertext is the base64 NIP-44 v2 payload from the chain.
GroupSnapshot
A full persistence snapshot of one group’s transport state: our sending chain (if minted) and every receiving chain keyed by its sender-event pubkey. The inverse of GroupManager::restore_group.
Header
The plaintext ratchet header, transmitted NIP-44-encrypted in each message. Wire field names are camelCase to match the reference implementation’s JSON exactly (this is the interop-critical type).
Invite
A double-ratchet invite: the inviter’s ephemeral pubkey and the shared “link” secret. The ephemeral secret is present only on the inviter’s own copy (it is needed to receive responses).
InviteResponse
What Invite::receive recovers from an accepted invite.
KeyPairBytes
A persisted ephemeral keypair: x-only public key plus its 32-byte secret.
MessageEnvelope
A ready-to-publish encrypted message: the NIP-44-encrypted header and the double-ratcheted ciphertext, plus the sender DH pubkey the recipient uses to locate the chain.
MessageKeys
Per-message key material derived from the conversation key and nonce (NIP-44 get_message_keys).
Nip46Request
Nip46Response
ReceivedMessage
A message successfully decrypted by SessionManager::process_event.
SenderKeyDecryptPlan
Result of SenderKeyState::plan_decrypt — apply to commit.
SenderKeyDistribution
Seed for one sender-key chain, distributed to members over their 1:1 sessions.
SenderKeyEncryptPlan
Result of SenderKeyState::plan_encrypt — apply to commit.
SenderKeyState
One sender-key chain: a symmetric KDF ratchet identified by key_id.
SendingChainSnapshot
A persistence snapshot of our sending side for one group.
Session
A 1:1 double-ratchet session. Generic over the in-process keypair type K so it works with the production K256Keypair and any test signer alike.
SessionManager
Routes double-ratchet sessions across many peers and devices.
SessionState
The full double-ratchet session state for one 1:1 channel.
SkippedKeysEntry
Per-sender map of skipped message keys (index → 32-byte key, hex).

Enums§

Nip17Error
Nip44Error
Nip46Error
Nip46Method
Nip59Error
Nip104Error
Errors raised by the double-ratchet session.

Constants§

GROUP_CHAT_MESSAGE_KIND
Inner-rumor kind for a group chat message (reference CHAT_MESSAGE_KIND, the NIP-17 private-DM kind). The plaintext inside an outer group event is a JSON rumor of this kind.
GROUP_MESSAGE_KIND
Outer Nostr event kind for group messages.
GROUP_SENDER_KEY_DISTRIBUTION_KIND
Inner-rumor kind for a sender-key distribution, delivered pairwise over each member’s 1:1 Double Ratchet session (reference GROUP_SENDER_KEY_DISTRIBUTION_KIND).
INVITE_EVENT_KIND
Nostr event kind for a published invite (parameterized replaceable), matching the reference INVITE_EVENT_KIND.
INVITE_RESPONSE_KIND
Nostr event kind for an invite response (the gift-wrapped acceptance), matching the reference INVITE_RESPONSE_KIND.
MAX_SKIP
Maximum number of skipped message keys retained per chain. Matches the reference implementation’s MAX_SKIP.
MESSAGE_EVENT_KIND
Nostr event kind carrying a double-ratchet message.
SENDER_KEY_MAX_SKIP
Maximum number of message keys we will skip ahead to decrypt an out-of-order message. Matches the reference.
SENDER_KEY_MAX_STORED_SKIPPED_KEYS
Maximum number of skipped message keys retained at once (oldest pruned).
VERSION_LEGACY
Legacy nostro2 format (b"1").
VERSION_V2
NIP-44 version 2 — the spec-compliant format (secp256k1 ECDH, HKDF, ChaCha20, HMAC-SHA256). Interoperates with Primal, Iris, and every other conformant client.

Traits§

Nip17
Nip44
Nip46
Nip59