pub struct NostrRootResolver { /* private fields */ }Expand description
NostrRootResolver - Maps npub/treename keys to merkle root hashes
Implementations§
Source§impl NostrRootResolver
impl NostrRootResolver
Sourcepub async fn new(
config: NostrResolverConfig,
) -> Result<NostrRootResolver, ResolverError>
pub async fn new( config: NostrResolverConfig, ) -> Result<NostrRootResolver, ResolverError>
Create a new NostrRootResolver
Sourcepub fn pubkey(&self) -> Option<PublicKey>
pub fn pubkey(&self) -> Option<PublicKey>
Get current user’s public key (if we have a secret key)
Sourcepub async fn resolve_wait(&self, key: &str) -> Result<Cid, ResolverError>
pub async fn resolve_wait(&self, key: &str) -> Result<Cid, ResolverError>
Resolve a key, waiting indefinitely until found.
Unlike resolve() which returns None after timeout, this method
subscribes and waits until a Cid is found. Caller should apply their
own timeout if needed (e.g., via tokio::time::timeout).
This matches the behavior of hashtree-ts NostrRootResolver.
Sourcepub async fn publish_private(
&self,
key: &str,
cid: &Cid,
) -> Result<bool, ResolverError>
pub async fn publish_private( &self, key: &str, cid: &Cid, ) -> Result<bool, ResolverError>
Publish a private root (selfEncryptedKey tag, NIP-44 to self)
Trait Implementations§
Source§impl RootResolver for NostrRootResolver
impl RootResolver for NostrRootResolver
Source§fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Cid>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NostrRootResolver: 'async_trait,
fn resolve<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Cid>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NostrRootResolver: 'async_trait,
Resolve a key to its current Cid (one-shot) Read more
Resolve with a share secret (for encrypted_key decryption)
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Option<Cid>>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NostrRootResolver: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Option<Cid>>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NostrRootResolver: 'async_trait,
Subscribe to Cid changes for a key. Read more
Source§fn publish<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
cid: &'life2 Cid,
) -> Pin<Box<dyn Future<Output = Result<bool, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NostrRootResolver: 'async_trait,
fn publish<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
cid: &'life2 Cid,
) -> Pin<Box<dyn Future<Output = Result<bool, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NostrRootResolver: 'async_trait,
Publish/update a Cid (optional - only for writable backends) Read more
Publish with encrypted key for sharing Read more
Source§fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResolverEntry>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NostrRootResolver: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ResolverEntry>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
NostrRootResolver: 'async_trait,
List all keys matching a prefix (one-shot) Read more
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
NostrRootResolver: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
NostrRootResolver: 'async_trait,
Stop the resolver and clean up resources
Source§fn subscribe_list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Vec<ResolverEntry>>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn subscribe_list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Receiver<Vec<ResolverEntry>>, ResolverError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Subscribe to list changes for a prefix. Read more
Auto Trait Implementations§
impl !Freeze for NostrRootResolver
impl !RefUnwindSafe for NostrRootResolver
impl Send for NostrRootResolver
impl Sync for NostrRootResolver
impl Unpin for NostrRootResolver
impl UnsafeUnpin for NostrRootResolver
impl !UnwindSafe for NostrRootResolver
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more