tel / saltine

Cryptography that's easy to digest (NaCl/libsodium bindings)
https://github.com/tel/saltine
MIT License
61 stars 29 forks source link

Fix `Show` instances formatting, and add instances for `Keypair`s #61

Closed NicolasT closed 1 year ago

NicolasT commented 1 year ago

Two patches (could be cherry-picked if desired):

Before:

ghci> publicKey <$> newKeypair 
Box.PublicKey {hashesTo = "b67156c9c95a39d2}"

After:

ghci> publicKey <$> newKeypair 
Box.PublicKey {hashesTo = "e51d64ac0e388666"}

(Notice the placement of the final }).

I tried to use the same approach/formatting of string form as is used for Box.PrivateKey etc. instead of using automatically-derived instances (which would be simpler, or course). As a result, they're not compatible with a (hypothetical) auto-derived Read instance or can't be copy-pasted as-is in code/a REPL.

NicolasT commented 1 year ago

I'm very unsure how some test can, given this change, only fail on a specific GHC version :thinking:

linearray commented 1 year ago

Yeah, we had some intermittently failing tests before, I have now started to collect info in issue #63, because it is concerning.

Thanks for the PR!