pub struct Fabric { /* private fields */ }Implementations§
Source§impl Fabric
impl Fabric
Sourcepub fn with_seeds(seeds: &[&str]) -> Self
pub fn with_seeds(seeds: &[&str]) -> Self
Create a new client with custom seed URLs.
pub fn with_dev_mode(self) -> Self
Sourcepub fn save_state(&self) -> FabricState
pub fn save_state(&self) -> FabricState
Export the current state for persistence.
Sourcepub fn from_state(state: FabricState) -> Result<Self>
pub fn from_state(state: FabricState) -> Result<Self>
Create a Fabric instance from previously saved state. Rebuilds trust sets and Veritas from the persisted anchors.
pub fn badge(&self, zone: &Zone) -> Badge
Sourcepub async fn trust(&self, trust_id: TrustId) -> Result<()>
pub async fn trust(&self, trust_id: TrustId) -> Result<()>
Pin a specific trust id to be loaded from peers.
Sourcepub async fn semi_trust(&self, trust_id: TrustId) -> Result<()>
pub async fn semi_trust(&self, trust_id: TrustId) -> Result<()>
Set a semi-trusted anchor from an external source (e.g. public explorer).
Sourcepub fn semi_trusted(&self) -> Option<TrustId>
pub fn semi_trusted(&self) -> Option<TrustId>
The semi-trusted trust id, if any.
Sourcepub fn trust_from_set(&self, set: &AnchorSet) -> Result<TrustId>
pub fn trust_from_set(&self, set: &AnchorSet) -> Result<TrustId>
Pin trust directly from an AnchorSet. No network requests. Returns the computed TrustId.
Sourcepub async fn trust_from_qr(&self, payload: &str) -> Result<()>
pub async fn trust_from_qr(&self, payload: &str) -> Result<()>
Parse a veritas://scan?id=... QR payload and pin as trusted.
Sourcepub async fn semi_trust_from_qr(&self, payload: &str) -> Result<()>
pub async fn semi_trust_from_qr(&self, payload: &str) -> Result<()>
Parse a veritas://scan?id=... QR payload and pin as semi-trusted.
Sourcepub fn clear_trusted(&self)
pub fn clear_trusted(&self)
Clear the trusted state. Badge will never return Orange until trust is pinned again.
Sourcepub fn clear_semi_trusted(&self)
pub fn clear_semi_trusted(&self)
Clear the semi trusted state.
Sourcepub fn set_prefer_latest(&self, latest: bool)
pub fn set_prefer_latest(&self, latest: bool)
Set whether to query multiple relays for freshness hints before resolving.
Sourcepub async fn bootstrap(&self) -> Result<()>
pub async fn bootstrap(&self) -> Result<()>
Bootstrap the client: discover peers from seeds and fetch anchors.
Sourcepub async fn resolve(&self, handle: &str) -> Result<Option<Zone>>
pub async fn resolve(&self, handle: &str) -> Result<Option<Zone>>
Resolve a single handle and return its verified Zone.
Returns None if the handle doesn’t exist.
Supports dotted names like hello.alice@bitcoin.
Sourcepub async fn resolve_by_id(&self, num_id: &str) -> Result<Option<Zone>>
pub async fn resolve_by_id(&self, num_id: &str) -> Result<Option<Zone>>
Reverse-resolve by a num id to retrieve its human-readable name.
Queries relays for the reverse mapping, resolves the forward name, and verifies the zone’s num_id matches.
Sourcepub async fn search_addr(&self, name: &str, addr: &str) -> Result<Vec<Zone>>
pub async fn search_addr(&self, name: &str, addr: &str) -> Result<Vec<Zone>>
Search for handles by address record.
Queries relays for handles claiming the address, resolves them forward, and filters to zones that actually contain the matching addr record.
Sourcepub async fn resolve_all(&self, handles: &[&str]) -> Result<Vec<Zone>>
pub async fn resolve_all(&self, handles: &[&str]) -> Result<Vec<Zone>>
Resolve multiple handles, including nested names like hello.alice@bitcoin.
Sourcepub async fn export(&self, handle: &str) -> Result<Vec<u8>>
pub async fn export(&self, handle: &str) -> Result<Vec<u8>>
Export a certificate chain for a handle in .spacecert format.
Sourcepub async fn prove(&self, request: &ChainProofRequest) -> Result<Vec<u8>>
pub async fn prove(&self, request: &ChainProofRequest) -> Result<Vec<u8>>
Request a chain proof from a relay.
Sends a ChainProofRequest and returns the borsh-encoded ChainProof bytes.
Sourcepub async fn broadcast(&self, msg_bytes: &[u8]) -> Result<()>
pub async fn broadcast(&self, msg_bytes: &[u8]) -> Result<()>
Broadcast a message to up to 4 random relays for gossip propagation. Returns Ok if at least one relay accepted.
Sourcepub async fn refresh_peers(&self) -> Result<()>
pub async fn refresh_peers(&self) -> Result<()>
Re-fetch peers from all known relays and update the relay pool.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Fabric
impl !RefUnwindSafe for Fabric
impl Send for Fabric
impl Sync for Fabric
impl Unpin for Fabric
impl UnsafeUnpin for Fabric
impl !UnwindSafe for Fabric
Blanket Implementations§
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
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>
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>
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