pub trait SphinxSuite {
type P: Keypair;
type E: Scalar + for<'a> From<&'a Self::P>;
type ExpandedPublic;
type G: GroupElement<Self::E> + for<'a> From<&'a Self::ExpandedPublic>;
type PRP: PRP + KeyIvInit;
// Required method
fn expand_public(
public_key: &<Self::P as Keypair>::Public,
) -> Result<Self::ExpandedPublic>;
// Provided methods
fn expand_path(
public_keys: &[<Self::P as Keypair>::Public],
) -> Result<Vec<Self::ExpandedPublic>> { ... }
fn new_shared_keys<'a>(
public_keys: &'a [<Self::P as Keypair>::Public],
) -> Result<SharedKeys<Self::E, Self::G>>
where &'a Array<u8, <Self::G as GroupElement<Self::E>>::AlphaLen>: From<&'a <Self::P as Keypair>::Public> { ... }
fn new_shared_keys_expanded<'a>(
public_keys: &'a [Self::ExpandedPublic],
) -> Result<SharedKeys<Self::E, Self::G>>
where &'a Array<u8, <Self::G as GroupElement<Self::E>>::AlphaLen>: From<&'a Self::ExpandedPublic> { ... }
fn new_prp_init(secret: &SecretKey) -> Result<IvKey<Self::PRP>> { ... }
fn new_reply_prp_init(
secret: &SecretKey16,
salt: &[u8],
) -> Result<IvKey<Self::PRP>> { ... }
}Expand description
Represents an instantiation of the Spinx protocol using the given EC group and corresponding public key object.
Required Associated Types§
Sourcetype ExpandedPublic
type ExpandedPublic
Expanded form of Self::P’s public key, suitable for EC computations.
Deriving it from the compact [Keypair::Public] can be CPU-intensive, which is why it is
a type of its own: a path can be expanded once and reused across several packets.
Sourcetype G: GroupElement<Self::E> + for<'a> From<&'a Self::ExpandedPublic>
type G: GroupElement<Self::E> + for<'a> From<&'a Self::ExpandedPublic>
EC group element
Required Methods§
Sourcefn expand_public(
public_key: &<Self::P as Keypair>::Public,
) -> Result<Self::ExpandedPublic>
fn expand_public( public_key: &<Self::P as Keypair>::Public, ) -> Result<Self::ExpandedPublic>
Expands a compact public key into Self::ExpandedPublic.
Can be CPU-intensive. Fails if public_key is not a valid point on the curve.
Provided Methods§
Sourcefn expand_path(
public_keys: &[<Self::P as Keypair>::Public],
) -> Result<Vec<Self::ExpandedPublic>>
fn expand_path( public_keys: &[<Self::P as Keypair>::Public], ) -> Result<Vec<Self::ExpandedPublic>>
Expands an entire path. See SphinxSuite::expand_public.
Convenience function to generate shared keys from the path of public keys.
Expands every key on the path; use SphinxSuite::new_shared_keys_expanded when the path
has already been expanded, so that the cost is not paid once per packet.
As SphinxSuite::new_shared_keys, but for a path that is already expanded.
Sourcefn new_prp_init(secret: &SecretKey) -> Result<IvKey<Self::PRP>>
fn new_prp_init(secret: &SecretKey) -> Result<IvKey<Self::PRP>>
Instantiates a new Pseudo-Random Permutation IV and key for general packet data.
Sourcefn new_reply_prp_init(
secret: &SecretKey16,
salt: &[u8],
) -> Result<IvKey<Self::PRP>>
fn new_reply_prp_init( secret: &SecretKey16, salt: &[u8], ) -> Result<IvKey<Self::PRP>>
Instantiates a new Pseudo-Random Permutation IV and key for reply data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl SphinxSuite for Ed25519Suite
Available on crate feature ed25519 only.
impl SphinxSuite for Ed25519Suite
ed25519 only.