mirror of
https://github.com/block/buzz.git
synced 2026-10-27 04:30:52 +00:00
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com> Signed-off-by: npub1jh9wn95s0472h86ahapupaf7m6kx4v9sx2n0atj2hltcfer8k06s5n3pyf <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co> Signed-off-by: npub17jjz49l9jjmhhk7cac63j8yt9z555n9cw8vk7v5jz4vzw4ppld5qgj57cc <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Eva <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Mari <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Sami <f4a42a97e594b77bdbd8ee35191c8b28a94a4cb871d96f32921558275421fb68@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Max <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Quinn <96f056ad5f2305c8ddf637dc65d048aa4c12d7daeb8867690e34fca46b0ef64c@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Dawn <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co> Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Co-authored-by: Sami <sami@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co>
72 lines
2.5 KiB
Rust
72 lines
2.5 KiB
Rust
#![deny(unsafe_code)]
|
|
#![warn(missing_docs)]
|
|
//! `buzz-core` — zero-I/O foundation types for the Buzz relay.
|
|
//!
|
|
//! Provides [`StoredEvent`], filter matching, kind constants, and event
|
|
//! verification. All other Buzz crates depend on this one.
|
|
|
|
/// Channel and membership enums shared across crates.
|
|
pub mod channel;
|
|
/// NIP-AE Agent Engrams — slug grammar, conversation key, d-tag derivation,
|
|
/// body parse/serialize, envelope build/validate, head selection.
|
|
pub mod engram;
|
|
/// Relay-side error types.
|
|
pub mod error;
|
|
/// Relay-side event wrapper with verification tracking.
|
|
pub mod event;
|
|
/// NIP-01 subscription filter matching.
|
|
pub mod filter;
|
|
/// Git permission types — ref patterns, protection rules, policy evaluation.
|
|
pub mod git_perms;
|
|
/// Buzz kind number registry — custom event type constants.
|
|
pub mod kind;
|
|
/// Network utilities — SSRF-safe IP classification.
|
|
pub mod network;
|
|
/// Agent observer frame helpers.
|
|
pub mod observer;
|
|
/// NIP-AB device pairing — crypto primitives, message types, and errors.
|
|
pub mod pairing;
|
|
/// Presence status types shared across crates.
|
|
pub mod presence;
|
|
/// Tenant identity — the server-resolved community key carried on scoped paths.
|
|
pub mod tenant;
|
|
/// Schnorr signature and event ID verification.
|
|
pub mod verification;
|
|
|
|
pub use error::VerificationError;
|
|
pub use event::StoredEvent;
|
|
pub use nostr::{Event, EventId, Filter, Keys, Kind, PublicKey};
|
|
pub use presence::PresenceStatus;
|
|
pub use tenant::{normalize_host, CommunityId, TenantContext};
|
|
pub use verification::verify_event;
|
|
|
|
#[cfg(any(test, feature = "test-utils"))]
|
|
/// Test helper utilities for creating events and stored events.
|
|
pub mod test_helpers {
|
|
use crate::StoredEvent;
|
|
use chrono::Utc;
|
|
use nostr::{EventBuilder, Keys, Kind};
|
|
|
|
/// Create a signed test event with the given kind and random keys.
|
|
pub fn make_event(kind: Kind) -> nostr::Event {
|
|
let keys = Keys::generate();
|
|
EventBuilder::new(kind, "test")
|
|
.tags([])
|
|
.sign_with_keys(&keys)
|
|
.expect("sign")
|
|
}
|
|
|
|
/// Create a signed test event with the given keys and kind.
|
|
pub fn make_event_with_keys(keys: &Keys, kind: Kind) -> nostr::Event {
|
|
EventBuilder::new(kind, "test")
|
|
.tags([])
|
|
.sign_with_keys(keys)
|
|
.expect("sign")
|
|
}
|
|
|
|
/// Create a [`StoredEvent`] wrapper around a test event.
|
|
pub fn make_stored_event(kind: Kind, channel_id: Option<uuid::Uuid>) -> StoredEvent {
|
|
StoredEvent::with_received_at(make_event(kind), Utc::now(), channel_id, true)
|
|
}
|
|
}
|