diff options
Diffstat (limited to 'src/Crypto/Tox.hs')
-rw-r--r-- | src/Crypto/Tox.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Crypto/Tox.hs b/src/Crypto/Tox.hs index 307a5db5..37725aea 100644 --- a/src/Crypto/Tox.hs +++ b/src/Crypto/Tox.hs | |||
@@ -29,7 +29,8 @@ module Crypto.Tox | |||
29 | , Plain | 29 | , Plain |
30 | , encodePlain | 30 | , encodePlain |
31 | , decodePlain | 31 | , decodePlain |
32 | , computeSharedSecret | 32 | -- , computeSharedSecret |
33 | , lookupSharedSecret | ||
33 | , encrypt | 34 | , encrypt |
34 | , decrypt | 35 | , decrypt |
35 | , Nonce8(..) | 36 | , Nonce8(..) |
@@ -98,6 +99,8 @@ newtype Encrypted8 a = E8 (Encrypted (a,Nonce8)) | |||
98 | 99 | ||
99 | newtype (f ∘ g) x = Composed { uncomposed :: f (g x) } | 100 | newtype (f ∘ g) x = Composed { uncomposed :: f (g x) } |
100 | 101 | ||
102 | infixr ∘ | ||
103 | |||
101 | newtype Auth = Auth Poly1305.Auth deriving (Eq, ByteArrayAccess) | 104 | newtype Auth = Auth Poly1305.Auth deriving (Eq, ByteArrayAccess) |
102 | instance Ord Auth where | 105 | instance Ord Auth where |
103 | compare (Auth a) (Auth b) = comparing (BA.convert :: Poly1305.Auth -> Bytes) a b | 106 | compare (Auth a) (Auth b) = comparing (BA.convert :: Poly1305.Auth -> Bytes) a b |
@@ -246,6 +249,11 @@ computeSharedSecret sk recipient nonce = State hash crypt | |||
246 | -- Since rs is 32 bytes, this pattern should never fail... | 249 | -- Since rs is 32 bytes, this pattern should never fail... |
247 | Cryptonite.CryptoPassed hash = Poly1305.initialize rs | 250 | Cryptonite.CryptoPassed hash = Poly1305.initialize rs |
248 | 251 | ||
252 | lookupSharedSecret :: TransportCrypto -> SecretKey -> PublicKey -> Nonce24 -> IO State | ||
253 | lookupSharedSecret crypto sk recipient nonce = do | ||
254 | -- TODO | ||
255 | return $ computeSharedSecret sk recipient nonce | ||
256 | |||
249 | hsalsa20 :: (ByteArrayAccess t, ByteArrayAccess t1) => t1 -> t -> BA.ScrubbedBytes | 257 | hsalsa20 :: (ByteArrayAccess t, ByteArrayAccess t1) => t1 -> t -> BA.ScrubbedBytes |
250 | hsalsa20 k n = BA.append a b | 258 | hsalsa20 k n = BA.append a b |
251 | where | 259 | where |