[][src]Struct tox_packet::onion::OnionDataResponse

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

When onion node receives OnionDataRequest packet it converts it to OnionDataResponse and sends to destination node if it announced itself and is contained in onion nodes list.

Serialized form:

LengthContent
10x86
24Nonce
32Temporary PublicKey
variablePayload

where payload is encrypted OnionDataResponsePayload

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 OnionDataResponse[src]

pub fn new(
    shared_secret: &PrecomputedKey,
    temporary_pk: PublicKey,
    nonce: Nonce,
    payload: &OnionDataResponsePayload
) -> OnionDataResponse
[src]

Create OnionDataResponse from OnionDataResponsePayload encrypting it with shared_key and nonce

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

Decrypt payload and try to parse it as OnionDataResponsePayload.

Returns Error in case of failure:

  • fails to decrypt
  • fails to parse as OnionDataResponsePayload

Trait Implementations

impl Clone for OnionDataResponse[src]

impl Debug for OnionDataResponse[src]

impl Eq for OnionDataResponse[src]

impl FromBytes for OnionDataResponse[src]

impl PartialEq<OnionDataResponse> for OnionDataResponse[src]

impl StructuralEq for OnionDataResponse[src]

impl StructuralPartialEq for OnionDataResponse[src]

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