[][src]Struct tox_packet::dht::DhtPkAnnounce

pub struct DhtPkAnnounce {
    pub real_pk: PublicKey,
    pub nonce: Nonce,
    pub payload: Vec<u8>,
}

Packet to announce self short term DHT PublicKey to a friend.

Onion client can send self announce info to its friend via two channels: through OnionDataRequest or through DhtRequest. DhtRequest will be used if friend's DHT PublicKey is known.

LengthContent
10x9C
32Public Key
24Nonce
variablePayload

Fields

real_pk: PublicKey

Long term PublicKey that was used for the inner encrypted payload

nonce: Nonce

Nonce for the current encrypted payload

payload: Vec<u8>

Encrypted payload

Implementations

impl DhtPkAnnounce[src]

pub fn new(
    shared_secret: &PrecomputedKey,
    real_pk: PublicKey,
    payload: &DhtPkAnnouncePayload
) -> DhtPkAnnounce
[src]

Create DhtPkAnnounce from DhtPkAnnouncePayload encrypting it with shared_key

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

Decrypt payload and try to parse it as DhtPkAnnouncePayload.

Returns Error in case of failure:

  • fails to decrypt
  • fails to parse as DhtPkAnnouncePayload

Trait Implementations

impl Clone for DhtPkAnnounce[src]

impl Debug for DhtPkAnnounce[src]

impl Eq for DhtPkAnnounce[src]

impl FromBytes for DhtPkAnnounce[src]

impl PartialEq<DhtPkAnnounce> for DhtPkAnnounce[src]

impl StructuralEq for DhtPkAnnounce[src]

impl StructuralPartialEq for DhtPkAnnounce[src]

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