Add keypair encoding, fix seckey size checks #57
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "uw-account_seckey"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A curious issue with
account_seckeyencoding was detected:gmser_api_encoder:encode(account_seckey, Sec64Byte)would work, but the subsequent decode would fail.encode/2never bothered to check the payload size, butdecode()did, which is backwards.encode()to generate an illegal encoding, and then verifying that it couldn't be decoded.This PR introduces size checks in
encode(), which technically might be a compatibility break. For testing,encode_/2works like the oldencode/2, without checking size.Also encode/decode of
account_seckeynow supports both 32-byte and 64-byte payload.The new functions
encode_keypair/1andsafe_decode_keypair/1convert between anenaclkeypair and one that the gajumaru config schema can handle. The decode verifies that the public and secret keys in fact match.The usual caveats still apply that secret keys should remain secret (thus strictly not being good candidates for serialization) - but for testing, it is quite useful, and since we've gone down that road already, it would be nice to have the support be consistent and reasonably safe.