Trait KeyIdMapper
pub trait KeyIdMapper<S, H>where
S: SphinxSuite,
H: SphinxHeaderSpec,{
// Required methods
fn map_key_to_id(
&self,
key: &<<S as SphinxSuite>::P as Keypair>::Public,
) -> Option<<H as SphinxHeaderSpec>::KeyId>;
fn map_id_to_public(
&self,
id: &<H as SphinxHeaderSpec>::KeyId,
) -> Option<<<S as SphinxSuite>::P as Keypair>::Public>;
// Provided methods
fn map_keys_to_ids(
&self,
keys: &[<<S as SphinxSuite>::P as Keypair>::Public],
) -> Vec<Option<<H as SphinxHeaderSpec>::KeyId>> { ... }
fn map_ids_to_keys(
&self,
ids: &[<H as SphinxHeaderSpec>::KeyId],
) -> Vec<Option<<<S as SphinxSuite>::P as Keypair>::Public>> { ... }
}
Expand description
Trait that defines 1:1 mapper between key identifiers and the actual public keys.
This is used to uniquely map between short public key identifiers used in the Sphinx header, and actual routing addresses (public keys) of the nodes.
Required Methods§
fn map_key_to_id(
&self,
key: &<<S as SphinxSuite>::P as Keypair>::Public,
) -> Option<<H as SphinxHeaderSpec>::KeyId>
fn map_key_to_id( &self, key: &<<S as SphinxSuite>::P as Keypair>::Public, ) -> Option<<H as SphinxHeaderSpec>::KeyId>
Maps public key to its unique identifier.
fn map_id_to_public(
&self,
id: &<H as SphinxHeaderSpec>::KeyId,
) -> Option<<<S as SphinxSuite>::P as Keypair>::Public>
fn map_id_to_public( &self, id: &<H as SphinxHeaderSpec>::KeyId, ) -> Option<<<S as SphinxSuite>::P as Keypair>::Public>
Maps public key identifier to the actual public key.
Provided Methods§
fn map_keys_to_ids(
&self,
keys: &[<<S as SphinxSuite>::P as Keypair>::Public],
) -> Vec<Option<<H as SphinxHeaderSpec>::KeyId>>
fn map_keys_to_ids( &self, keys: &[<<S as SphinxSuite>::P as Keypair>::Public], ) -> Vec<Option<<H as SphinxHeaderSpec>::KeyId>>
Convenience method to map a slice of public keys to IDs.
fn map_ids_to_keys(
&self,
ids: &[<H as SphinxHeaderSpec>::KeyId],
) -> Vec<Option<<<S as SphinxSuite>::P as Keypair>::Public>>
fn map_ids_to_keys( &self, ids: &[<H as SphinxHeaderSpec>::KeyId], ) -> Vec<Option<<<S as SphinxSuite>::P as Keypair>::Public>>
Convenience method to map a slice of IDs to public keys.