pub trait KeyExpander: Sync {
// Required method
fn expand(
&self,
key: &OffchainPublicKey,
) -> Result<ExpandedOffchainPublicKey>;
// Provided method
fn expand_path(
&self,
keys: &[OffchainPublicKey],
) -> Result<Vec<ExpandedOffchainPublicKey>> { ... }
}Expand description
Supplies the expanded form of a packet key to the Sphinx sender path.
Packet keys are stored, routed and compared in their compact form, but deriving the shared secrets for an outgoing packet needs the decompressed point for every hop. That is the only place in the protocol where the expanded form is required, so it is reached through this trait rather than by widening the types that carry a path.
Expansion is CPU-intensive and a sender keeps using the same handful of relays, so
implementations are free to memoize; see CachingKeyExpander in hopr-protocol-hopr.
Required Methods§
Provided Methods§
Sourcefn expand_path(
&self,
keys: &[OffchainPublicKey],
) -> Result<Vec<ExpandedOffchainPublicKey>>
fn expand_path( &self, keys: &[OffchainPublicKey], ) -> Result<Vec<ExpandedOffchainPublicKey>>
Expands an entire path, in order.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".