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§
Sourcefn load(&self, peer: &PeerId) -> Result<Option<PinRecord>, TrustError>
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.
Sourcefn save_first(&self, peer: &PeerId, fpr: [u8; 32]) -> Result<(), TrustError>
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.