KeyMgr::insert should maybe take a reference to the key
Probably other key types too. If this is actually good-practice and not an over-site then I can deal with it and change my APIs or keep my work-around.
I wrap the various tor-llcrypto
key+signature types in my own wrapper and provide various additional methods needed to deal with c-tor and with the gosling protocol. While implementing onion service support in my arti-based TorProvider
, I need to hand off ownership of a pk::ed25519::ExpandedKeypair
to a KeyMgr
to insert an HsIdKeypair
. My APIs take a reference, meaning i have to manually clone the key via:
// generate a new HsIdKeypair (from an Ed25519PrivateKey)
// clone() isn't implemented for ExpandedKeypair >:[
let secret_key_bytes = private_key.inner().to_secret_key_bytes();
let expanded_keypair = ExpandedKeypair::from_secret_key_bytes(secret_key_bytes).unwrap().into();
Which is fine but I'd be nice if the type either implemented clone or KeyMgr::insert took a reference since it has to be serialised anyawy.