summaryrefslogtreecommitdiff
path: root/src/Network/Tox/Crypto
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2018-11-28 22:19:33 -0500
committerJoe Crayne <joe@jerkface.net>2018-12-16 14:08:26 -0500
commitd8797823bb3cbf91eabad48c400632dcecfec245 (patch)
tree16fbe3de1231573789487d5ac175910679fbd682 /src/Network/Tox/Crypto
parent92fce0499c05c609cba423ea02f5c61aa33c6915 (diff)
Use getPublicKey/putPublicKey more liberally.
Diffstat (limited to 'src/Network/Tox/Crypto')
-rw-r--r--src/Network/Tox/Crypto/Transport.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs
index 555164f2..1c641584 100644
--- a/src/Network/Tox/Crypto/Transport.hs
+++ b/src/Network/Tox/Crypto/Transport.hs
@@ -170,12 +170,12 @@ instance Sized HandshakeData where
170 170
171instance Serialize HandshakeData where 171instance Serialize HandshakeData where
172 get = HandshakeData <$> get 172 get = HandshakeData <$> get
173 <*> (id2key <$> get) 173 <*> getPublicKey
174 <*> (fromJust . digestFromByteString <$> getBytes 64) 174 <*> (fromJust . digestFromByteString <$> getBytes 64)
175 <*> get 175 <*> get
176 put (HandshakeData n k h c) = do 176 put (HandshakeData n k h c) = do
177 put n 177 put n
178 put $ key2id k 178 putPublicKey k
179 putByteString (convert h) 179 putByteString (convert h)
180 put c 180 put c
181 181
@@ -724,15 +724,15 @@ instance HasPeerNumber PeerInfo where
724instance Serialize PeerInfo where 724instance Serialize PeerInfo where
725 get = do 725 get = do
726 w16 <- get 726 w16 <- get
727 ukey <- id2key <$> get 727 ukey <- getPublicKey
728 dkey <- id2key <$> get 728 dkey <- getPublicKey
729 w8 <- get :: Get Word8 729 w8 <- get :: Get Word8
730 PeerInfo w16 ukey dkey <$> getBytes (fromIntegral w8) 730 PeerInfo w16 ukey dkey <$> getBytes (fromIntegral w8)
731 731
732 put (PeerInfo w16 ukey dkey bs) = do 732 put (PeerInfo w16 ukey dkey bs) = do
733 put w16 733 put w16
734 put $ key2id ukey 734 putPublicKey ukey
735 put $ key2id dkey 735 putPublicKey dkey
736 let sz :: Word8 736 let sz :: Word8
737 sz = case B.length bs of 737 sz = case B.length bs of
738 n | n <= 255 -> fromIntegral n 738 n | n <= 255 -> fromIntegral n