diff options
author | joe <joe@jerkface.net> | 2017-10-28 03:54:36 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-10-28 03:54:36 -0400 |
commit | 58d078d19c5e3c391a1bba3dddafff15308af757 (patch) | |
tree | a0823d0b85c305f9050917c176c0662f920f13d0 /src/Network/Tox/DHT/Transport.hs | |
parent | f41c696481f118bc105a0679e30ed23edfdb254c (diff) |
Tox: handle cookie-request message.
Diffstat (limited to 'src/Network/Tox/DHT/Transport.hs')
-rw-r--r-- | src/Network/Tox/DHT/Transport.hs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/Network/Tox/DHT/Transport.hs b/src/Network/Tox/DHT/Transport.hs index bebb8ae7..5ebe8b15 100644 --- a/src/Network/Tox/DHT/Transport.hs +++ b/src/Network/Tox/DHT/Transport.hs | |||
@@ -20,8 +20,9 @@ module Network.Tox.DHT.Transport | |||
20 | , FriendRequest(..) | 20 | , FriendRequest(..) |
21 | , NoSpam(..) | 21 | , NoSpam(..) |
22 | , verifyChecksum | 22 | , verifyChecksum |
23 | , CookieRequest | 23 | , CookieRequest(..) |
24 | , Cookie | 24 | , Cookie(..) |
25 | , CookieData(..) | ||
25 | , DHTRequest | 26 | , DHTRequest |
26 | , mapMessage | 27 | , mapMessage |
27 | , encrypt | 28 | , encrypt |
@@ -378,6 +379,15 @@ data CookieData = CookieData -- 16 (mac) | |||
378 | instance Sized CookieData where | 379 | instance Sized CookieData where |
379 | size = ConstSize 72 | 380 | size = ConstSize 72 |
380 | 381 | ||
382 | instance Serialize CookieData where | ||
383 | get = CookieData <$> get | ||
384 | <*> (id2key <$> get) | ||
385 | <*> (id2key <$> get) | ||
386 | put (CookieData tm userkey dhtkey) = do | ||
387 | put tm | ||
388 | put (key2id userkey) | ||
389 | put (key2id dhtkey) | ||
390 | |||
381 | instance Sized CookieRequest where | 391 | instance Sized CookieRequest where |
382 | size = ConstSize 64 -- 32 byte key + 32 byte padding | 392 | size = ConstSize 64 -- 32 byte key + 32 byte padding |
383 | 393 | ||