feat!: Ed25519 expanded signing key
This PR adds support for expanded ed25519 keys, enabling compatibility with different key formats (including those exported from YubiHSM).
Copilot Summary
This pull request introduces support for expanded Ed25519 signing keys in the keyring, enabling compatibility with different key formats (including those exported from YubiHSM) and providing more flexible signing capabilities. The changes refactor the SigningKey type to handle both standard and expanded keys.
Expanded Ed25519 key support and refactoring:
- Refactored the
SigningKeytype from a struct to an enum, allowing it to represent either a standard Ed25519 signing key (Ed25519) or an expanded Ed25519 signing key (Ed25519Expanded). This enables handling multiple key formats. - Updated methods in
SigningKeyto correctly process both key types for serialization (as_bytes), verification key conversion (verifying_key), and external key conversions (e.g., totendermint_p2p::secret_connection::PublicKey). - Enhanced the
TryFrom<&[u8]> for SigningKeyimplementation to support parsing seed keys, big-endian expanded keys, and little-endian expanded keys (such as those exported from YubiHSM), improving compatibility with external hardware and key sources. - Modified the signing logic in the
Signer<Signature>implementation to use the appropriate signing method for expanded keys (raw_sign), ensuring correct signature generation for both key types.
Dependency addition:
- Added the
ed25519-dalekcrate with thehazmatfeature toCargo.toml, providing the necessary cryptographic primitives for expanded Ed25519 key support.
@tarcieri I can put it behind a feature flag if needed.
hey! just chiming it to say thank you for taking the time to develop this feature. it's greatly appreciated and we've found it useful when dealing with yubihsm-exported keys
Closing in favor of #1096