PinStore

Trait PinStore 

Source
pub trait PinStore: Send + Sync {
    // Required methods
    fn load(&self, peer: &PeerId) -> Result<Option<PinRecord>, TrustError>;
    fn save_first(&self, peer: &PeerId, fpr: [u8; 32]) -> Result<(), TrustError>;
    fn rotate(
        &self,
        peer: &PeerId,
        old: [u8; 32],
        new: [u8; 32],
    ) -> Result<(), TrustError>;
}
Expand description

A trait for storing and retrieving pinned peer fingerprints. Implementations must be thread-safe (Send + Sync) for concurrent access.

Required Methods§

Source

fn load(&self, peer: &PeerId) -> Result<Option<PinRecord>, TrustError>

Load the pin record for a given peer, if one exists. Returns None if the peer has not been pinned yet.

Source

fn save_first(&self, peer: &PeerId, fpr: [u8; 32]) -> Result<(), TrustError>

Save the first (initial) fingerprint for a peer. Fails if the peer is already pinned.

Source

fn rotate( &self, peer: &PeerId, old: [u8; 32], new: [u8; 32], ) -> Result<(), TrustError>

Rotate a peer’s fingerprint from old to new, updating the pin record. Validates that the old fingerprint matches the current one.

Implementors§