diff options
Diffstat (limited to 'ToxCrypto.hs')
-rw-r--r-- | ToxCrypto.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/ToxCrypto.hs b/ToxCrypto.hs index 6b5e6f19..c2e2bbeb 100644 --- a/ToxCrypto.hs +++ b/ToxCrypto.hs | |||
@@ -2,6 +2,10 @@ | |||
2 | {-# LANGUAGE ScopedTypeVariables #-} | 2 | {-# LANGUAGE ScopedTypeVariables #-} |
3 | {-# LANGUAGE KindSignatures #-} | 3 | {-# LANGUAGE KindSignatures #-} |
4 | {-# LANGUAGE DeriveDataTypeable #-} | 4 | {-# LANGUAGE DeriveDataTypeable #-} |
5 | {-# LANGUAGE DeriveFunctor #-} | ||
6 | {-# LANGUAGE DeriveTraversable #-} | ||
7 | {-# LANGUAGE ExplicitNamespaces #-} | ||
8 | {-# LANGUAGE TypeOperators #-} | ||
5 | module ToxCrypto | 9 | module ToxCrypto |
6 | ( PublicKey | 10 | ( PublicKey |
7 | , publicKey | 11 | , publicKey |
@@ -9,9 +13,12 @@ module ToxCrypto | |||
9 | , SymmetricKey(..) | 13 | , SymmetricKey(..) |
10 | , TransportCrypto(..) | 14 | , TransportCrypto(..) |
11 | , Encrypted | 15 | , Encrypted |
12 | , Encrypted8 | 16 | , Encrypted8(..) |
17 | , type (∘)(..) | ||
13 | , Assym(..) | 18 | , Assym(..) |
14 | , Plain | 19 | , Plain |
20 | , encodePlain | ||
21 | , decodePlain | ||
15 | , computeSharedSecret | 22 | , computeSharedSecret |
16 | , encrypt | 23 | , encrypt |
17 | , decrypt | 24 | , decrypt |
@@ -24,6 +31,8 @@ module ToxCrypto | |||
24 | , Sized(..) | 31 | , Sized(..) |
25 | , Size(..) | 32 | , Size(..) |
26 | , State(..) | 33 | , State(..) |
34 | , zeros32 | ||
35 | , zeros24 | ||
27 | ) where | 36 | ) where |
28 | 37 | ||
29 | import qualified Crypto.Cipher.Salsa as Salsa | 38 | import qualified Crypto.Cipher.Salsa as Salsa |
@@ -56,6 +65,7 @@ newtype Encrypted a = Encrypted ByteString | |||
56 | newtype Encrypted8 a = E8 (Encrypted (a,Nonce8)) | 65 | newtype Encrypted8 a = E8 (Encrypted (a,Nonce8)) |
57 | deriving Serialize | 66 | deriving Serialize |
58 | 67 | ||
68 | newtype (f ∘ g) x = Composed { uncomposed :: f (g x) } | ||
59 | 69 | ||
60 | newtype Auth = Auth Poly1305.Auth deriving (Eq, ByteArrayAccess) | 70 | newtype Auth = Auth Poly1305.Auth deriving (Eq, ByteArrayAccess) |
61 | instance Ord Auth where | 71 | instance Ord Auth where |
@@ -229,6 +239,7 @@ data Assym a = Assym | |||
229 | , assymNonce :: Nonce24 | 239 | , assymNonce :: Nonce24 |
230 | , assymData :: a | 240 | , assymData :: a |
231 | } | 241 | } |
242 | deriving (Functor,Foldable,Traversable) | ||
232 | 243 | ||
233 | newtype SymmetricKey = SymmetricKey ByteString | 244 | newtype SymmetricKey = SymmetricKey ByteString |
234 | 245 | ||