pub trait KeyIdMapper<S: SphinxSuite, H: SphinxHeaderSpec> {
// Required methods
fn map_key_to_id(&self, key: &<S::P as Keypair>::Public) -> Option<H::KeyId>;
fn map_id_to_public(
&self,
id: &H::KeyId,
) -> Option<<S::P as Keypair>::Public>;
// Provided methods
fn map_keys_to_ids(
&self,
keys: &[<S::P as Keypair>::Public],
) -> Vec<Option<H::KeyId>> { ... }
fn map_ids_to_keys(
&self,
ids: &[H::KeyId],
) -> Vec<Option<<S::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§
Sourcefn map_key_to_id(&self, key: &<S::P as Keypair>::Public) -> Option<H::KeyId>
fn map_key_to_id(&self, key: &<S::P as Keypair>::Public) -> Option<H::KeyId>
Maps public key to its unique identifier.
Sourcefn map_id_to_public(&self, id: &H::KeyId) -> Option<<S::P as Keypair>::Public>
fn map_id_to_public(&self, id: &H::KeyId) -> Option<<S::P as Keypair>::Public>
Maps public key identifier to the actual public key.