summaryrefslogtreecommitdiff
path: root/src/Network/Tox/DHT/Transport.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-10-28 03:54:36 -0400
committerjoe <joe@jerkface.net>2017-10-28 03:54:36 -0400
commit58d078d19c5e3c391a1bba3dddafff15308af757 (patch)
treea0823d0b85c305f9050917c176c0662f920f13d0 /src/Network/Tox/DHT/Transport.hs
parentf41c696481f118bc105a0679e30ed23edfdb254c (diff)
Tox: handle cookie-request message.
Diffstat (limited to 'src/Network/Tox/DHT/Transport.hs')
-rw-r--r--src/Network/Tox/DHT/Transport.hs14
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)
378instance Sized CookieData where 379instance Sized CookieData where
379 size = ConstSize 72 380 size = ConstSize 72
380 381
382instance 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
381instance Sized CookieRequest where 391instance 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