Skip to main content

Crate solid_pod_rs_nostr

Crate solid_pod_rs_nostr 

Source
Expand description

§solid-pod-rs-nostr

did:nostr DID documents, WebID ↔ did:nostr resolver, and an embedded Nostr relay (NIP-01, NIP-11, NIP-16) for solid-pod-rs.

This sibling crate rounds out the Solid / Nostr bridge introduced in the library core:

  • The core solid_pod_rs::auth::nip98 verifies NIP-98 HTTP auth signatures.
  • The core solid_pod_rs::interop::did_nostr (feature did-nostr) ships a low-level Tier-1 DID Doc renderer and a TTL-cached WebID resolver for server-side lookup of outside pubkeys.
  • This crate adds the full operator surface: Tier-3 DID Docs with alsoKnownAs + service entries, bidirectional WebID ↔ did:nostr resolution (including HTML JSON-LD islands and Turtle fallback), and a self-contained NIP-01/11/16 relay with a pluggable event store and a tokio-tungstenite WebSocket wire handler.

PARITY-CHECKLIST targets: rows 89, 90, 101, 132.

§Module layout

  • diddid:nostr URIs + Tier 1 / Tier 3 document renderers.
  • resolver — bidirectional did:nostr ↔ WebID resolver with SSRF guard.
  • relay — NIP-01 event envelope, filter matching, replaceable-event semantics (NIP-16), broadcast-channel live dispatch, NIP-11 relay-info document.
  • ws — WebSocket wire protocol on top of tokio-tungstenite.
  • error — error types for each domain.

§Quick-start

use std::sync::Arc;
use solid_pod_rs_nostr::{
    NostrPubkey, render_did_document_tier1, well_known_path, Relay,
};

// DID Document publication.
let pk = NostrPubkey::from_hex(
    "1111111111111111111111111111111111111111111111111111111111111111",
)
.unwrap();
let doc = render_did_document_tier1(&pk);
let path = well_known_path(&pk); // "/.well-known/did/nostr/…json"
let _ = (doc, path);

// Relay.
let relay = Arc::new(Relay::in_memory());
let _info = relay.info().clone(); // serve at GET / (Accept: application/nostr+json)

§solid-pod-rs-nostr

Status: 0.4.0-alpha.2 — functional did:nostr + embedded relay. 2,177 LOC, 45 tests. Integrators may depend on this crate today.

Note: the did:nostr bidirectional resolver also ships inside the core library at interop::did_nostr (feature did-nostr). This sibling crate adds the embedded relay and the Tier 3 DID surface on top of that core resolver.

§Target scope

  • did:nostr DID Document publication at /.well-known/did/nostr/:pubkey.json (Tier 1 / Tier 3) — Tier 1 already in interop::did_nostr, this crate adds Tier 3.
  • Embedded Nostr relay implementing NIP-01, NIP-11, NIP-16.
  • Integration hook with solid-pod-rs-activitypub for the SAND stack (AP Actor + did:nostr via alsoKnownAs).
  • NIP-98 Schnorr already ships in the library core (auth::nip98::verify_schnorr_signature under nip98-schnorr); this crate does not re-implement it.

Target LOC: 800–1,200 at first landing.

§Parity rows

Rows that will close when this crate lands (see ../solid-pod-rs/PARITY-CHECKLIST.md):

  • 89 — Embedded Nostr relay (NIP-01).
  • 90 — Relay NIP-11 + NIP-16 support.
  • 101 — did:nostr Tier 3 DID Document surface.
  • 132 — SAND composition (AP Actor + did:nostr alsoKnownAs).

§JSS references

  • src/did/resolver.js
  • src/nostr/relay.js
  • src/auth/did-nostr.js

§Licence

AGPL-3.0-only.

Re-exports§

pub use did::did_nostr_uri;
pub use did::render_did_document_tier1;
pub use did::render_did_document_tier3;
pub use did::well_known_path;
pub use did::NostrPubkey;
pub use did::ServiceEntry;
pub use error::DidError;
pub use error::RelayError;
pub use error::ResolverError;
pub use relay::is_ephemeral;
pub use relay::is_parameterised_replaceable;
pub use relay::is_replaceable;
pub use relay::Event;
pub use relay::EventStore;
pub use relay::Filter;
pub use relay::InMemoryEventStore;
pub use relay::Relay;
pub use relay::RelayInfo;
pub use resolver::DefaultSsrfCheck;
pub use resolver::NostrWebIdResolver;
pub use resolver::SsrfCheck;
pub use ws::dispatch_message;
pub use ws::serve_relay_ws;
pub use ws::serve_relay_ws_stream;

Modules§

did
did:nostr DID Document rendering and well-known path layout.
error
Error types for the solid-pod-rs-nostr crate.
relay
In-memory Nostr relay implementing NIP-01, NIP-11, and NIP-16.
resolver
did:nostr ↔ WebID bidirectional resolver.
ws
WebSocket wire handler for the Nostr relay.