[#790] Straighten out detSecretKey's behavior
NB: I've introduced KeyType
instead of reusing HashTag
for two reasons:
- Semantically, this seems more correct
-
HashTag
is a GADT which makesBounded
andEnum
instances un-deriveable, and writing those by hand is a huge chore and frankly not worth the effort.
Description
Problem: Morley.Tezos.Crypto.detSecretKey chooses the type of key it generates based on seed length, which can lead to subtle bugs wrt key generation.
Solution: Rewrite it to use seed value instead. Add a couple simple
tests. Introduce a variant function detSecretKey'
that accepts
explicit key type as argument. Introduce KeyType
enum for key types.
Problem: KeyType and HashTag duplicate key types between them.
Solution: Replace all key HashTag constructors with a single constructor accepting KeyType as argument.
Related issue(s)
Resolves #790 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.
Edited by Nikolay Yakimov