[][src]Struct tox_packet::onion::OnionRequest1

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

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

Serialized form:

LengthContent
10x81
24Nonce
32Temporary PublicKey
variablePayload
59OnionReturn

where payload is encrypted OnionRequest1Payload

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 first node from onion chain

Implementations

impl OnionRequest1[src]

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

Create new OnionRequest1 object.

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

Decrypt payload and try to parse it as OnionRequest1Payload.

Returns Error in case of failure:

  • fails to decrypt
  • fails to parse as OnionRequest1Payload

Trait Implementations

impl Clone for OnionRequest1[src]

impl Debug for OnionRequest1[src]

impl Eq for OnionRequest1[src]

impl FromBytes for OnionRequest1[src]

impl PartialEq<OnionRequest1> for OnionRequest1[src]

impl StructuralEq for OnionRequest1[src]

impl StructuralPartialEq for OnionRequest1[src]

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