pub struct TrustStore { /* private fields */ }Expand description
The trust store — manages all known peer records
Implementations§
Source§impl TrustStore
impl TrustStore
Sourcepub async fn verify_or_pin(
&self,
peer_id: &str,
public_key: &[u8],
) -> TrustResult<bool>
pub async fn verify_or_pin( &self, peer_id: &str, public_key: &[u8], ) -> TrustResult<bool>
Called when we first encounter a peer’s public key (TOFU).
Returns Ok(true) if this is a new peer, Ok(false) if key matches.
Returns Err if key has changed for a known peer.
Sourcepub async fn add_attestation(&self, attestation: Attestation) -> TrustResult<()>
pub async fn add_attestation(&self, attestation: Attestation) -> TrustResult<()>
Record an attestation from a trusted peer about another peer
Sourcepub async fn mark_verified(
&self,
peer_id: &str,
verified_key: &[u8],
) -> TrustResult<()>
pub async fn mark_verified( &self, peer_id: &str, verified_key: &[u8], ) -> TrustResult<()>
Upgrade a peer to Verified status (after out-of-band verification)
Sourcepub async fn get(&self, peer_id: &str) -> Option<PeerRecord>
pub async fn get(&self, peer_id: &str) -> Option<PeerRecord>
Get trust info for a peer
Sourcepub async fn trust_score(&self, peer_id: &str) -> f32
pub async fn trust_score(&self, peer_id: &str) -> f32
Get trust score (0.0–1.0, or negative for warnings)
Sourcepub async fn all_peers(&self) -> Vec<PeerRecord>
pub async fn all_peers(&self) -> Vec<PeerRecord>
List all known peers, sorted by trust score descending
Sourcepub async fn set_attester_trust(&self, peer_id: String, score: f32)
pub async fn set_attester_trust(&self, peer_id: String, score: f32)
Set our trust score for a peer
Sourcepub async fn blocked_count(&self) -> usize
pub async fn blocked_count(&self) -> usize
Count of blocked peers
Sourcepub async fn average_trust_score(&self) -> f32
pub async fn average_trust_score(&self) -> f32
Average trust score across all known peers
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrustStore
impl !RefUnwindSafe for TrustStore
impl Send for TrustStore
impl Sync for TrustStore
impl Unpin for TrustStore
impl UnsafeUnpin for TrustStore
impl !UnwindSafe for TrustStore
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
Mutably borrows from an owned value. Read more