Struct internet2::presentation::sphinx::SphinxPacket
source · [−]pub struct SphinxPacket<const PACKET_LEN: usize>(_);
Expand description
Cyphered raw sphinx packet as it is sent over the wire
Implementations
sourceimpl<const PACKET_LEN: usize> SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> SphinxPacket<PACKET_LEN>
sourcepub fn with<C, Payload>(
secp: &Secp256k1<C>,
session_key: SecretKey,
hops: &[Hop<Payload>],
assoc_data: &[u8]
) -> Result<(Self, Hmac<Hash>), EncodeError> where
C: Signing,
Payload: SphinxPayload,
pub fn with<C, Payload>(
secp: &Secp256k1<C>,
session_key: SecretKey,
hops: &[Hop<Payload>],
assoc_data: &[u8]
) -> Result<(Self, Hmac<Hash>), EncodeError> where
C: Signing,
Payload: SphinxPayload,
Constructs Sphinx packet for a given multi-hop route and hop-secific
messages represented as an array of Hop
s. Requires pre-generated
session_key
.
Trait Implementations
sourceimpl<const PACKET_LEN: usize> Clone for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Clone for SphinxPacket<PACKET_LEN>
sourcefn clone(&self) -> SphinxPacket<PACKET_LEN>
fn clone(&self) -> SphinxPacket<PACKET_LEN>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<const PACKET_LEN: usize> Debug for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Debug for SphinxPacket<PACKET_LEN>
sourceimpl<const PACKET_LEN: usize> Hash for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Hash for SphinxPacket<PACKET_LEN>
sourceimpl<const PACKET_LEN: usize> LightningDecode for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> LightningDecode for SphinxPacket<PACKET_LEN>
sourcefn lightning_decode<D: Read>(d: D) -> Result<Self, Error>
fn lightning_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given std::io::Read
instance; must either
construct an instance or return implementation-specific error type. Read more
sourcefn lightning_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn lightning_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
LightningDecode::lightning_decode
function. Read more
sourceimpl<const PACKET_LEN: usize> LightningEncode for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> LightningEncode for SphinxPacket<PACKET_LEN>
sourcefn lightning_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn lightning_encode<E: Write>(&self, e: E) -> Result<usize, Error>
Encode with the given std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type. Read more
sourcefn lightning_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn lightning_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using
LightningEncode::lightning_encode
function. Read more
sourceimpl<const PACKET_LEN: usize> PartialEq<SphinxPacket<PACKET_LEN>> for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> PartialEq<SphinxPacket<PACKET_LEN>> for SphinxPacket<PACKET_LEN>
sourcefn eq(&self, other: &SphinxPacket<PACKET_LEN>) -> bool
fn eq(&self, other: &SphinxPacket<PACKET_LEN>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SphinxPacket<PACKET_LEN>) -> bool
fn ne(&self, other: &SphinxPacket<PACKET_LEN>) -> bool
This method tests for !=
.
sourceimpl<const PACKET_LEN: usize> StrictDecode for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> StrictDecode for SphinxPacket<PACKET_LEN>
sourcefn strict_decode<D: Read>(d: D) -> Result<Self, Error>
fn strict_decode<D: Read>(d: D) -> Result<Self, Error>
Decode with the given std::io::Read
instance; must either
construct an instance or return implementation-specific error type. Read more
sourcefn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
Tries to deserialize byte array into the current type using
StrictDecode::strict_decode
Read more
sourceimpl<const PACKET_LEN: usize> StrictEncode for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> StrictEncode for SphinxPacket<PACKET_LEN>
sourcefn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
fn strict_encode<E: Write>(&self, e: E) -> Result<usize, Error>
Encode with the given std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type. Read more
sourcefn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
Serializes data as a byte array using StrictEncode::strict_encode
function Read more
impl<const PACKET_LEN: usize> Copy for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Eq for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> StructuralEq for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> StructuralPartialEq for SphinxPacket<PACKET_LEN>
Auto Trait Implementations
impl<const PACKET_LEN: usize> RefUnwindSafe for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Send for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Sync for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> Unpin for SphinxPacket<PACKET_LEN>
impl<const PACKET_LEN: usize> UnwindSafe for SphinxPacket<PACKET_LEN>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more