ChainKeyOperations

Trait ChainKeyOperations 

Source
pub trait ChainKeyOperations {
    type Error: Error + Send + Sync + 'static;
    type Mapper: KeyIdMapper<Ed25519Suite, HoprSphinxHeaderSpec> + Clone + Send + Sync + 'static;

    // Required methods
    fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        chain: &'life1 Address,
    ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>(
        &'life0 self,
        packet: &'life1 OffchainPublicKey,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn key_id_mapper_ref(&self) -> &Self::Mapper;
}
Expand description

Operations for offchain keys.

This typically translates to optimized (and cached) versions of [ChainReadChannelOperations].

Required Associated Types§

Required Methods§

Source

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Translates Address into OffchainPublicKey.

Source

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Translates OffchainPublicKey into Address.

Source

fn key_id_mapper_ref(&self) -> &Self::Mapper

Returns mapper for offchain key IDs as a reference.

Implementations on Foreign Types§

Source§

impl<'a, T> ChainKeyOperations for &'a T
where T: 'a + ChainKeyOperations + ?Sized,

Source§

type Error = <T as ChainKeyOperations>::Error

Source§

type Mapper = <T as ChainKeyOperations>::Mapper

Source§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, <&'a T as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, &'a T: 'async_trait,

Source§

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, <&'a T as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, &'a T: 'async_trait,

Source§

fn key_id_mapper_ref(&self) -> &<&'a T as ChainKeyOperations>::Mapper

Source§

impl<T> ChainKeyOperations for Box<T>

Source§

type Error = <T as ChainKeyOperations>::Error

Source§

type Mapper = <T as ChainKeyOperations>::Mapper

Source§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, <Box<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<T>: 'async_trait,

Source§

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, <Box<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Box<T>: 'async_trait,

Source§

fn key_id_mapper_ref(&self) -> &<Box<T> as ChainKeyOperations>::Mapper

Source§

impl<T> ChainKeyOperations for Arc<T>

Source§

type Error = <T as ChainKeyOperations>::Error

Source§

type Mapper = <T as ChainKeyOperations>::Mapper

Source§

fn chain_key_to_packet_key<'life0, 'life1, 'async_trait>( &'life0 self, chain: &'life1 Address, ) -> Pin<Box<dyn Future<Output = Result<Option<OffchainPublicKey>, <Arc<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Arc<T>: 'async_trait,

Source§

fn packet_key_to_chain_key<'life0, 'life1, 'async_trait>( &'life0 self, packet: &'life1 OffchainPublicKey, ) -> Pin<Box<dyn Future<Output = Result<Option<Address>, <Arc<T> as ChainKeyOperations>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Arc<T>: 'async_trait,

Source§

fn key_id_mapper_ref(&self) -> &<Arc<T> as ChainKeyOperations>::Mapper

Implementors§