Skip to main content

PublicKeyStore

Trait PublicKeyStore 

Source
pub trait PublicKeyStore {
    // Required method
    fn public_key(&self, id: &[u8; 32]) -> Result<PublicKey, KeyParsingError>;

    // Provided methods
    fn namespace_key(
        &self,
        bytes: &NamespaceId,
    ) -> Result<NamespacePublicKey, KeyParsingError> { ... }
    fn author_key(
        &self,
        bytes: &AuthorId,
    ) -> Result<AuthorPublicKey, KeyParsingError> { ... }
}
Expand description

Store trait for expanded public keys for authors and namespaces.

Used to cache iroh::PublicKey.

This trait is implemented for the unit type (), where no caching is used.

Required Methods§

Source

fn public_key(&self, id: &[u8; 32]) -> Result<PublicKey, KeyParsingError>

Convert a byte array into a iroh::PublicKey.

New keys are inserted into the PublicKeyStore and reused on subsequent calls.

Provided Methods§

Source

fn namespace_key( &self, bytes: &NamespaceId, ) -> Result<NamespacePublicKey, KeyParsingError>

Convert a NamespaceId into a NamespacePublicKey.

New keys are inserted into the PublicKeyStore and reused on subsequent calls.

Source

fn author_key( &self, bytes: &AuthorId, ) -> Result<AuthorPublicKey, KeyParsingError>

Convert a AuthorId into a AuthorPublicKey.

New keys are inserted into the PublicKeyStore and reused on subsequent calls.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl PublicKeyStore for ()

Source§

impl<T: PublicKeyStore> PublicKeyStore for &T

Source§

impl<T: PublicKeyStore> PublicKeyStore for &mut T

Implementors§