[−][src]Struct tox_packet::dht::CookieRequest
CookieRequest packet struct. According to https://zetok.github.io/tox-spec/#net-crypto
CookieRequest packet (145 bytes):
[uint8_t 24] [Sender's DHT Public key (32 bytes)] [Random nonce (24 bytes)] [Encrypted message containing: [Sender's real public key (32 bytes)] [padding (32 bytes)] [uint64_t echo id (must be sent back untouched in cookie response)] ]
Serialized form:
Length | Content |
---|---|
1 | 0x18 |
32 | DHT Public Key |
24 | Random nonce |
88 | Payload |
where Payload is encrypted CookieRequestPayload
Fields
pk: PublicKey
DHT public key
nonce: Nonce
Random nonce
payload: Vec<u8>
Encrypted payload of CookieRequest
Implementations
impl CookieRequest
[src]
pub fn new(
shared_secret: &PrecomputedKey,
pk: &PublicKey,
payload: &CookieRequestPayload
) -> CookieRequest
[src]
shared_secret: &PrecomputedKey,
pk: &PublicKey,
payload: &CookieRequestPayload
) -> CookieRequest
Create CookieRequest
from CookieRequestPayload
encrypting it with shared_key
pub fn get_payload(
&self,
shared_secret: &PrecomputedKey
) -> Result<CookieRequestPayload, GetPayloadError>
[src]
&self,
shared_secret: &PrecomputedKey
) -> Result<CookieRequestPayload, GetPayloadError>
Decrypt payload with secret key and try to parse it as CookieRequestPayload
.
Returns Error
in case of failure:
- fails to decrypt
- fails to parse
CookieRequestPayload
Trait Implementations
impl Clone for CookieRequest
[src]
pub fn clone(&self) -> CookieRequest
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for CookieRequest
[src]
impl Eq for CookieRequest
[src]
impl FromBytes for CookieRequest
[src]
impl PartialEq<CookieRequest> for CookieRequest
[src]
pub fn eq(&self, other: &CookieRequest) -> bool
[src]
pub fn ne(&self, other: &CookieRequest) -> bool
[src]
impl StructuralEq for CookieRequest
[src]
impl StructuralPartialEq for CookieRequest
[src]
impl ToBytes for CookieRequest
[src]
Auto Trait Implementations
impl RefUnwindSafe for CookieRequest
[src]
impl Send for CookieRequest
[src]
impl Sync for CookieRequest
[src]
impl Unpin for CookieRequest
[src]
impl UnwindSafe for CookieRequest
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,