pub struct OnionRequest0 {
pub nonce: Nonce,
pub temporary_pk: PublicKey,
pub payload: Vec<u8>,
}
Expand description
First onion request packet. It’s sent from DHT node to the first node from
onion chain. Payload can be encrypted with either temporary generated
SecretKey
or DHT SecretKey
of sender and with DHT PublicKey
of receiver.
Serialized form:
Length | Content |
---|---|
1 | 0x80 |
24 | Nonce |
32 | PublicKey of sender |
variable | Payload |
where payload is encrypted OnionRequest0Payload
Fields§
§nonce: Nonce
Nonce for the current encrypted payload
temporary_pk: PublicKey
Temporary PublicKey
for the current encrypted payload
payload: Vec<u8>
Encrypted payload
Implementations§
Source§impl OnionRequest0
impl OnionRequest0
Sourcepub fn new(
shared_secret: &PrecomputedKey,
temporary_pk: &PublicKey,
payload: &OnionRequest0Payload,
) -> OnionRequest0
pub fn new( shared_secret: &PrecomputedKey, temporary_pk: &PublicKey, payload: &OnionRequest0Payload, ) -> OnionRequest0
Create new OnionRequest0
object.
Sourcepub fn get_payload(
&self,
shared_secret: &PrecomputedKey,
) -> Result<OnionRequest0Payload, GetPayloadError>
pub fn get_payload( &self, shared_secret: &PrecomputedKey, ) -> Result<OnionRequest0Payload, GetPayloadError>
Decrypt payload and try to parse it as OnionRequest0Payload
.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse as
OnionRequest0Payload
Trait Implementations§
Source§impl Clone for OnionRequest0
impl Clone for OnionRequest0
Source§fn clone(&self) -> OnionRequest0
fn clone(&self) -> OnionRequest0
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for OnionRequest0
impl Debug for OnionRequest0
Source§impl FromBytes for OnionRequest0
impl FromBytes for OnionRequest0
Source§fn from_bytes(i: &[u8]) -> IResult<&[u8], OnionRequest0, (&[u8], ErrorKind)>
fn from_bytes(i: &[u8]) -> IResult<&[u8], OnionRequest0, (&[u8], ErrorKind)>
Deserialize struct using
nom
from raw bytesSource§impl PartialEq for OnionRequest0
impl PartialEq for OnionRequest0
Source§impl ToBytes for OnionRequest0
impl ToBytes for OnionRequest0
impl Eq for OnionRequest0
impl StructuralPartialEq for OnionRequest0
Auto Trait Implementations§
impl Freeze for OnionRequest0
impl RefUnwindSafe for OnionRequest0
impl Send for OnionRequest0
impl Sync for OnionRequest0
impl Unpin for OnionRequest0
impl UnwindSafe for OnionRequest0
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more