Expand description
Shared Nostr protocol primitives for the nostr-bbs forum.
This crate provides the cryptographic and protocol building blocks shared between the WASM client bridge and the Rust Cloudflare Workers. It covers:
- NIP-01 event creation, signing, and verification
- NIP-44 encrypted direct messages (ChaCha20-Poly1305)
- NIP-98 HTTP auth token creation and verification
- DID:nostr document generation (delegates to
solid_pod_rs::did_nostr_types) - Key management including HKDF derivation from WebAuthn PRF output
- Value types (
EventId,Timestamp,Tag, etc.)
Re-exports§
pub use event::compute_event_id;pub use event::sign_event;pub use event::sign_event_deterministic;pub use event::sign_event_upstream;pub use event::signing_key_to_upstream;pub use event::verify_event;pub use event::verify_event_strict;pub use event::verify_events_batch;pub use event::EventError;pub use event::NostrEvent;pub use event::PubkeyMismatch;pub use event::UnsignedEvent;pub use gift_wrap::gift_wrap;pub use gift_wrap::gift_wrap_with_signer;pub use gift_wrap::unwrap_gift;pub use gift_wrap::unwrap_gift_with_signer;pub use gift_wrap::GiftWrapError;pub use gift_wrap::SignerGiftWrapError;pub use gift_wrap::UnwrappedGift;pub use keys::derive_from_prf;pub use keys::derive_subkey;pub use keys::generate_keypair;pub use keys::Keypair;pub use keys::PublicKey;pub use keys::SecretKey;pub use keys::Signature;pub use nip44::decrypt as nip44_decrypt;pub use nip44::encrypt as nip44_encrypt;pub use nip98::create_token as create_nip98_token;pub use nip98::sign_request_header as nip98_sign_request_header;pub use nip98::verify_nip98;pub use nip98::verify_nip98_with_replay;pub use nip98::verify_token as verify_nip98_token;pub use nip98::verify_token_at as verify_nip98_token_at;pub use nip98::verify_token_at_with_replay as verify_nip98_token_at_with_replay;pub use nip98::verify_token_full as verify_nip98_token_full;pub use nip98::Nip98Error;pub use nip98::Nip98ReplayStore;pub use nip98::Nip98Token as VerifiedToken;pub use nip98::REPLAY_CACHE_TTL_SECS;pub use nip98::TIMESTAMP_TOLERANCE as NIP98_TIMESTAMP_TOLERANCE;pub use types::EventId;pub use types::Tag;pub use types::Timestamp;pub use calendar::create_calendar_event;pub use calendar::create_calendar_event_signer;pub use calendar::create_date_calendar_event;pub use calendar::create_rsvp;pub use calendar::create_rsvp_signer;pub use calendar::is_known_venue;pub use calendar::read_venue_tag;pub use calendar::read_zone_tag;pub use calendar::set_venue_tag;pub use calendar::set_zone_tag;pub use calendar::to_free_busy;pub use calendar::CalendarError;pub use calendar::RsvpStatus;pub use calendar::KIND_CALENDAR_DATE_EVENT;pub use calendar::KIND_CALENDAR_EVENT;pub use calendar::KIND_CALENDAR_RSVP;pub use calendar::VENUE_PRIMARY;pub use calendar::VENUE_SECONDARY;pub use calendar::VENUE_TAG;pub use calendar::ZONE_TAG;pub use moderation_events::build_ban;pub use moderation_events::build_moderation_action;pub use moderation_events::build_mute;pub use moderation_events::build_report;pub use moderation_events::build_unban;pub use moderation_events::build_unmute;pub use moderation_events::build_warning;pub use moderation_events::d_tag_of;pub use moderation_events::mute_expires_at;pub use moderation_events::validate_moderation_event;pub use moderation_events::ModerationEventError;pub use moderation_events::ADMIN_ONLY_MOD_KINDS;pub use moderation_events::KIND_BAN;pub use moderation_events::KIND_MODERATION_ACTION;pub use moderation_events::KIND_MUTE;pub use moderation_events::KIND_REPORT;pub use moderation_events::KIND_REPORT_NIP56;pub use moderation_events::KIND_UNBAN;pub use moderation_events::KIND_UNMUTE;pub use moderation_events::KIND_WARNING;pub use moderation_events::MOD_KINDS;pub use did::did_nostr_uri;pub use did::is_valid_hex_pubkey;pub use did::render_did_document_tier1;pub use did::render_did_document_tier3;pub use did::verify_webid_tag;pub use did::well_known_path;pub use did::NostrPubkey;pub use nip04::nip04_decrypt;pub use nip04::nip04_encrypt;pub use nip04::Nip04Error;pub use nip19::decode_naddr;pub use nip19::decode_nevent;pub use nip19::decode_note;pub use nip19::decode_nprofile;pub use nip19::decode_npub;pub use nip19::decode_nsec;pub use nip19::encode_naddr;pub use nip19::encode_nevent;pub use nip19::encode_note;pub use nip19::encode_nprofile;pub use nip19::encode_npub;pub use nip19::encode_nsec;pub use nip19::NAddr;pub use nip19::NEvent;pub use nip19::NProfile;pub use nip19::Nip19Error;pub use signer::PrfSigner;pub use signer::Signer;pub use signer::SignerError;pub use admin_shared::admin_pubkeys_from_env_str;pub use admin_shared::is_static_admin;pub use admin_shared::IsAdminRow;pub use admin_shared::PubkeyRow;pub use admin_shared::ADMIN_PUBKEYS_VAR;pub use admin_shared::MEMBERS_ADMIN_LIST_SQL;pub use admin_shared::MEMBERS_IS_ADMIN_SQL;pub use admin_shared::WHITELIST_ADMIN_LIST_SQL;pub use admin_shared::WHITELIST_IS_ADMIN_SQL;pub use cors::CorsHeader;pub use cors::POD_CORS_HEADERS;pub use cors::STANDARD_CORS_HEADERS;pub use governance::extract_d_tag;pub use governance::extract_tag;pub use governance::is_governance_kind;pub use governance::ActionDef;pub use governance::ActionPriority;pub use governance::ActionRequest;pub use governance::ActionResponse;pub use governance::ActionStyle;pub use governance::FieldDef;pub use governance::FieldType;pub use governance::LayoutHint;pub use governance::PanelCapability;pub use governance::PanelDefinition;pub use governance::PanelSchema;pub use governance::RegisteredAgent;pub use governance::GOVERNANCE_KIND_RANGE;pub use governance::KIND_ACTION_REQUEST;pub use governance::KIND_ACTION_RESPONSE;pub use governance::KIND_PANEL_DEFINITION;pub use governance::KIND_PANEL_RETIRED;pub use governance::KIND_PANEL_STATE;pub use governance::KIND_PANEL_UPDATE;
Modules§
- admin_
shared - Shared admin-check primitives consumed by all worker crates.
- calendar
- NIP-52: Calendar Events — date-based and time-based calendar events with RSVPs.
- cors
- Shared CORS header definitions consumed by all worker crates.
- d1_
helpers - Cloudflare D1 helpers shared by worker crates.
- deletion
- NIP-09: Event Deletion — kind 5 deletion request events.
- did
did:nostrDID Document generation and verification.- event
- Nostr event types and NIP-01 canonical serialization.
- gift_
wrap - NIP-59 Gift Wrap: Triple-layered encrypted direct messages.
- governance
- Agent Control Surface Protocol — governance types for the nostr-bbs relay.
- groups
- NIP-29: Relay-based Groups — group event constructors.
- keys
- Nostr keypair management, HKDF key derivation from WebAuthn PRF, and BIP-340 Schnorr signing.
- moderation_
events - Moderation event kinds for forum operation (parameterized-replaceable).
- nip04
- NIP-04: Encrypted Direct Messages — delegated to upstream
nostrcrate. - nip19
- NIP-19: bech32-encoded entities.
- nip44
- NIP-44 v2: Encrypted Direct Messages — delegated to upstream
nostrcrate. - nip98
- NIP-98: HTTP Auth via Nostr events (kind 27235).
- signer
- NIP-46 / generic Signer trait for nostr-bbs.
- types
Functions§
- format_
multibase_ schnorr - Build a
publicKeyMultibasestring for a BIP-340 x-only pubkey (I2).