summaryrefslogtreecommitdiff
path: root/ToxCrypto.hs
diff options
context:
space:
mode:
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