summaryrefslogtreecommitdiff
path: root/ToxCrypto.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-09-12 01:59:09 -0400
committerjoe <joe@jerkface.net>2017-09-12 01:59:09 -0400
commitf6678edece2fa77a5ff91abfc8c19913e4d1acdd (patch)
treec6268dc78cedf78718b000ea5e6f2cedcb425ed6 /ToxCrypto.hs
parent7372d2458b5f9c33e6aa676e5bae74dba438b289 (diff)
DHTMessage Show instance for debugging.
Diffstat (limited to 'ToxCrypto.hs')
-rw-r--r--ToxCrypto.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/ToxCrypto.hs b/ToxCrypto.hs
index 5e602fc9..4a466357 100644
--- a/ToxCrypto.hs
+++ b/ToxCrypto.hs
@@ -92,6 +92,9 @@ instance Serialize Auth where
92 get = Auth . Poly1305.Auth . BA.convert <$> getBytes 16 92 get = Auth . Poly1305.Auth . BA.convert <$> getBytes 16
93 put (Auth (Poly1305.Auth bs)) = putByteString $ BA.convert bs 93 put (Auth (Poly1305.Auth bs)) = putByteString $ BA.convert bs
94 94
95instance Typeable a => Show (Encrypted a) where
96 show (Encrypted _) = "Encrypted "++show (typeOf (undefined :: a))
97
95encryptedAuth :: Encrypted a -> Auth 98encryptedAuth :: Encrypted a -> Auth
96encryptedAuth (Encrypted bs) 99encryptedAuth (Encrypted bs)
97 | Right auth <- decode (B.take 16 bs) = auth 100 | Right auth <- decode (B.take 16 bs) = auth
@@ -279,7 +282,7 @@ data Assym a = Assym
279 , assymNonce :: Nonce24 282 , assymNonce :: Nonce24
280 , assymData :: a 283 , assymData :: a
281 } 284 }
282 deriving (Functor,Foldable,Traversable) 285 deriving (Functor,Foldable,Traversable, Show)
283 286
284instance Sized a => Sized (Assym a) where 287instance Sized a => Sized (Assym a) where
285 size = case size of 288 size = case size of