From 18eb72eca608b5858be66a4d48c6818556b8e124 Mon Sep 17 00:00:00 2001 From: Joe Crayne Date: Tue, 4 Sep 2018 23:08:58 -0400 Subject: tox: Generate keys within STM monad. --- src/Network/Tox.hs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Network/Tox.hs') diff --git a/src/Network/Tox.hs b/src/Network/Tox.hs index 1bf6efc5..7011618c 100644 --- a/src/Network/Tox.hs +++ b/src/Network/Tox.hs @@ -101,6 +101,11 @@ newCrypto = do let (nonce, drg2) = withDRG drg1 (Nonce24 <$> getRandomBytes 24) writeTVar noncevar drg2 return nonce + , transportNewKey = do + drg1 <- readTVar noncevar + let (k, drg2) = withDRG drg1 generateSecretKey + writeTVar noncevar drg2 + return k , userKeys = return [] , pendingCookies = cookieKeys , secretsCache = cache -- cgit v1.2.3