use ciphersuite::{Ciphersuite, Secp256k1}; use dkg::ThresholdKeys; use ethereum_schnorr::PublicKey; pub(crate) struct KeyGenParams; impl key_gen::KeyGenParams for KeyGenParams { const ID: &'static str = "Ethereum"; type ExternalNetworkCiphersuite = Secp256k1; fn tweak_keys(keys: &mut ThresholdKeys) { while PublicKey::new(keys.group_key()).is_none() { *keys = keys.offset(::F::ONE); } } fn encode_key(key: ::G) -> Vec { PublicKey::new(key).unwrap().eth_repr().to_vec() } fn decode_key(key: &[u8]) -> Option<::G> { PublicKey::from_eth_repr(key.try_into().ok()?).map(|key| key.point()) } }