One of the biggest weaknesses of using NaCl is that nonces must all be unique and it's up to the end user to ensure that. newNonce is sufficient for all of default NaCl, but it requires IO. IsNonce can help in pure settings, but you have to remember to always call nudge. If there was a Noncey monad it'd be easy enough to statically ensure this behavior locally. There are times that two communicating parties would want to collaborate on nonce incrementing, though, so those strategies would have to be possible: Endo Nonce?
One of the biggest weaknesses of using
NaClis that nonces must all be unique and it's up to the end user to ensure that.newNonceis sufficient for all of default NaCl, but it requiresIO.IsNoncecan help in pure settings, but you have to remember to always callnudge. If there was aNonceymonad it'd be easy enough to statically ensure this behavior locally. There are times that two communicating parties would want to collaborate on nonce incrementing, though, so those strategies would have to be possible:Endo Nonce?