[][src]Struct tox_packet::onion::OnionRequest2

pub struct OnionRequest2 {
    pub nonce: Nonce,
    pub temporary_pk: PublicKey,
    pub payload: Vec<u8>,
    pub onion_return: OnionReturn,
}

Third onion request packet. It's sent from the second to the third node from onion chain. Payload should be encrypted with temporary generated SecretKey and with DHT PublicKey of receiver.

Serialized form:

LengthContent
10x82
24Nonce
32Temporary PublicKey
variablePayload
118OnionReturn

where payload is encrypted OnionRequest2Payload

Fields

nonce: Nonce

Nonce for the current encrypted payload

temporary_pk: PublicKey

Temporary PublicKey for the current encrypted payload

payload: Vec<u8>

Encrypted payload

onion_return: OnionReturn

Return address encrypted by the second node from onion chain

Implementations

impl OnionRequest2[src]

pub fn new(
    shared_secret: &PrecomputedKey,
    temporary_pk: &PublicKey,
    payload: &OnionRequest2Payload,
    onion_return: OnionReturn
) -> OnionRequest2
[src]

Create new OnionRequest2 object.

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

Decrypt payload and try to parse it as OnionRequest2Payload.

Returns Error in case of failure:

  • fails to decrypt
  • fails to parse as OnionRequest2Payload

Trait Implementations

impl Clone for OnionRequest2[src]

impl Debug for OnionRequest2[src]

impl Eq for OnionRequest2[src]

impl FromBytes for OnionRequest2[src]

impl PartialEq<OnionRequest2> for OnionRequest2[src]

impl StructuralEq for OnionRequest2[src]

impl StructuralPartialEq for OnionRequest2[src]

impl ToBytes for OnionRequest2[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.