Skip to main content

Fabric

Struct Fabric 

Source
pub struct Fabric { /* private fields */ }

Implementations§

Source§

impl Fabric

Source

pub fn new() -> Self

Create a new client with the default seeds.

Source

pub fn with_seeds(seeds: &[&str]) -> Self

Create a new client with custom seed URLs.

Source

pub fn with_dev_mode(self) -> Self

Source

pub fn save_state(&self) -> FabricState

Export the current state for persistence.

Source

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.

Source

pub fn badge(&self, zone: &Zone) -> Badge

Source

pub async fn trust(&self, trust_id: TrustId) -> Result<()>

Pin a specific trust id to be loaded from peers.

Source

pub async fn observe(&self) -> Result<()>

Update observed trust id from peers

Source

pub async fn semi_trust(&self, trust_id: TrustId) -> Result<()>

Set a semi-trusted anchor from an external source (e.g. public explorer).

Source

pub fn trusted(&self) -> Option<TrustId>

The trusted trust id, pinned explicitly with trust()

Source

pub fn observed(&self) -> Option<TrustId>

The latest trust id observed from peers, if any.

Source

pub fn semi_trusted(&self) -> Option<TrustId>

The semi-trusted trust id, if any.

Source

pub fn trust_from_set(&self, set: &AnchorSet) -> Result<TrustId>

Pin trust directly from an AnchorSet. No network requests. Returns the computed TrustId.

Source

pub async fn trust_from_qr(&self, payload: &str) -> Result<()>

Parse a veritas://scan?id=... QR payload and pin as trusted.

Source

pub async fn semi_trust_from_qr(&self, payload: &str) -> Result<()>

Parse a veritas://scan?id=... QR payload and pin as semi-trusted.

Source

pub fn clear_trusted(&self)

Clear the trusted state. Badge will never return Orange until trust is pinned again.

Source

pub fn clear_semi_trusted(&self)

Clear the semi trusted state.

Source

pub fn set_prefer_latest(&self, latest: bool)

Set whether to query multiple relays for freshness hints before resolving.

Source

pub async fn bootstrap(&self) -> Result<()>

Bootstrap the client: discover peers from seeds and fetch anchors.

Source

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.

Source

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.

Source

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.

Source

pub async fn resolve_all(&self, handles: &[&str]) -> Result<Vec<Zone>>

Resolve multiple handles, including nested names like hello.alice@bitcoin.

Source

pub async fn export(&self, handle: &str) -> Result<Vec<u8>>

Export a certificate chain for a handle in .spacecert format.

Source

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.

Source

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.

Source

pub async fn peers(&self) -> Result<Vec<PeerInfo>>

Fetch the peer list from a random relay.

Source

pub async fn refresh_peers(&self) -> Result<()>

Re-fetch peers from all known relays and update the relay pool.

Source

pub fn relays(&self) -> Vec<String>

Get the current list of known relay URLs.

Source

pub fn veritas(&self) -> Veritas

Returns a clone of the internal Veritas instance for offline verification.

Trait Implementations§

Source§

impl Default for Fabric

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more