[][src]Struct tox_packet::onion::OnionRequest0

pub struct OnionRequest0 {
    pub nonce: Nonce,
    pub temporary_pk: PublicKey,
    pub payload: Vec<u8>,
}

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:

LengthContent
10x80
24Nonce
32PublicKey of sender
variablePayload

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

impl OnionRequest0[src]

pub fn new(
    shared_secret: &PrecomputedKey,
    temporary_pk: &PublicKey,
    payload: &OnionRequest0Payload
) -> OnionRequest0
[src]

Create new OnionRequest0 object.

pub fn get_payload(
    &self,
    shared_secret: &PrecomputedKey
) -> Result<OnionRequest0Payload, GetPayloadError>
[src]

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

impl Clone for OnionRequest0[src]

impl Debug for OnionRequest0[src]

impl Eq for OnionRequest0[src]

impl FromBytes for OnionRequest0[src]

impl PartialEq<OnionRequest0> for OnionRequest0[src]

impl StructuralEq for OnionRequest0[src]

impl StructuralPartialEq for OnionRequest0[src]

impl ToBytes for OnionRequest0[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.