Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonce generating function should be abstracted over a monad #38

Open
Martoon-00 opened this issue Dec 24, 2021 · 0 comments
Open

Nonce generating function should be abstracted over a monad #38

Martoon-00 opened this issue Dec 24, 2021 · 0 comments
Labels
code Code quality improvements

Comments

@Martoon-00
Copy link
Member

Description

Currently, generate :: IO Nonce works only in IO.

This means, that if I have primitives containing nonce, generators for these primitives are bound to IO too. If I want to use deterministic generation in tests, I have to re-implement generation logic from scratch in pure environment.

See this module from Morley project as an example. It declares createChestAndChestKey generator in IO, and then has to re-implement it from scratch in pure way, see createChestAndChestKeyFromSeed.

So I want crypto-sodium to expose some MonadRandom, and let the generation of nonce work there.

Acceptance criteria

  • That module from Morley defines only one createChestAndChestKey generator.
  • This generator is easy to run both in IO and in Hedgehog tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Code quality improvements
Projects
None yet
Development

No branches or pull requests

1 participant