-
Notifications
You must be signed in to change notification settings - Fork 80
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
Aptos HSM Signer Testing #974
base: main
Are you sure you want to change the base?
Conversation
Provide From conversion impls to construct PrivateKey and Signature from byte arrays. The conversions into PrivateKey are fallible, while a Signature is allowed to be constructed from any 64 bytes.
Add TestSigner providing an in-process Signing implementation for tests.
da28333
to
53e08b7
Compare
TryFromBytes is not needed, neither is the public key as a member of HashiCorpVault state.
/// Errors that occur when parsing signature or key material from byte sequences. | ||
#[derive(Debug, thiserror::Error)] | ||
#[error(transparent)] | ||
pub struct CryptoMaterialError(Box<dyn Error + Send + Sync>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be easier to have one error type for the crate. It avoids adding map_err every time when you need to extract the publickey from an u8 array, for example, and it eases the error management for external crate.
There's a reason you didn't add a new variant to the SignerError. Perhaps we need to rename it in a more generic name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like using the "fat" main error type for the much slimmer use case of TryFrom
conversions.
Summary
util
.Add a movement-signer-test crate, providing a local
TestSigner
, initially for the Ed25519 curve.Changelog
Testing
Added a test verifying basic functionality of
TestSigner
in the movement-signer-test crate.