summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Network/DatagramServer/Tox.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Network/DatagramServer/Tox.hs b/src/Network/DatagramServer/Tox.hs
index 1763e74c..85ee269c 100644
--- a/src/Network/DatagramServer/Tox.hs
+++ b/src/Network/DatagramServer/Tox.hs
@@ -394,8 +394,13 @@ instance WireFormat ByteString Message where
394 394
395 initializeServerState _ _ = do 395 initializeServerState _ _ = do
396 k <- generateSecretKey 396 k <- generateSecretKey
397 let Right nid = S.decode $ convert $ toPublic k 397 nid <- withByteArray (toPublic k) $ \p -> do
398 return (nid, ToxCipherContext k) 398 wlo <- peekElemOff p 0
399 wmid <- peekElemOff p 1
400 whi <- peekElemOff p 2
401 whigest <- peekElemOff p 3
402 return $ LargeKey wlo (LargeKey wmid (LargeKey whi whigest))
403 return (NodeId nid, ToxCipherContext k)
399 404
400 405
401instance Read (NodeId Message) where readsPrec d s = map (\(w,xs) -> (NodeId w, xs)) $ decodeHex s 406instance Read (NodeId Message) where readsPrec d s = map (\(w,xs) -> (NodeId w, xs)) $ decodeHex s