Skip to content

Nonce generating function should be abstracted over a monad #38

Description

@Martoon-00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    codeCode quality improvements

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions