tendermint: PrivateKey
and PublicKey
have From
impls for ed25519-consensus
types
#1401
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
currently, when working with
tendermint::{PrivateKey, PublicKey}
, users of theed25519-consensus
crate must convert aed25519_consensus::VerificationKey
ored25519_consensus::SigningKey
viaTryFrom<&'_ [u8]>
. this has the unfortunate effect of requiring a bounds check, on a value that is already known to be a valid key.this branch introduces some additional
From<T>
implementations, to facilitate free conversions fromed25519-consensus
types.PrivateKey
isFrom<ed25519_consensus::SigningKey>
SigningKey
isFrom<ed25519_consensus::SigningKey>
PublicKey
isFrom<ed25519_consensus::VerificationKey>
VerificationKey
isFrom<ed25519_consensus::VerificationKey>
an internal
SigningKey::new()
constructor is also added, for the sake of consistency withVerificationKey::new()
. this is optional, i'd be happy to back out of that change if it seems prudent.some additional
from_ed25519_consensus
methods are provided, for cases where type inference might not suffice. these felt complimentary to existing methods likefrom_raw_ed25519
, but are another optional change i'd be happy to back out of.