diff options
author | Joe Crayne <joe@jerkface.net> | 2018-09-04 23:08:58 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2018-09-07 13:18:56 -0400 |
commit | 18eb72eca608b5858be66a4d48c6818556b8e124 (patch) | |
tree | 4cecb20dfce635135ef92da23550ecdb9dfaa8ca /src/Network | |
parent | d133be0736d6ce366a41582bc59501e6eab81163 (diff) |
tox: Generate keys within STM monad.
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/Tox.hs | 5 |
1 files changed, 5 insertions, 0 deletions
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 | |||
101 | let (nonce, drg2) = withDRG drg1 (Nonce24 <$> getRandomBytes 24) | 101 | let (nonce, drg2) = withDRG drg1 (Nonce24 <$> getRandomBytes 24) |
102 | writeTVar noncevar drg2 | 102 | writeTVar noncevar drg2 |
103 | return nonce | 103 | return nonce |
104 | , transportNewKey = do | ||
105 | drg1 <- readTVar noncevar | ||
106 | let (k, drg2) = withDRG drg1 generateSecretKey | ||
107 | writeTVar noncevar drg2 | ||
108 | return k | ||
104 | , userKeys = return [] | 109 | , userKeys = return [] |
105 | , pendingCookies = cookieKeys | 110 | , pendingCookies = cookieKeys |
106 | , secretsCache = cache | 111 | , secretsCache = cache |