Add HDKeyOrigin and SIngleKeyOrigin for Signer#107
Conversation
…parate entity * add HDKeyOrigin and SingleKeyOrigin * impement KeyProvider trait for them and adapt tests
789c518 to
de219be
Compare
rename: * KeyProvider - KeyOrigin * HDKeyOrigin - HDKey * SingleKeyOrigin - SingleKey remove network conversion to bitcoin type
* inline HDKey initialization in tests
| fn get_blinding_private_key(&self, secp: &Secp256k1<All>, network: &SimplicityNetwork) -> PrivateKey { | ||
| let master_blinding = self | ||
| .blinding_key | ||
| .expect("Blinding key is required for confidential operations"); |
There was a problem hiding this comment.
How will this work with the unblinding logic? We can skip the unblinding (move the unblind function from the Signer to KeyOrigin). Maybe there is a better solution.
There was a problem hiding this comment.
Based on rust-elements, I could only find 1 function where we need to insert
blinding_key: SecretKey
link
Since both objects would have the same unblinding implementation anyway, it might be best to keep the current setup for now.
There was a problem hiding this comment.
Changed the interface a little bit, now we'd throw an error if something fails in unblinding.
Move code and improve the interface of KeyOrigin and Signer.
Improve the implementation and the interface of get_utxos_filter().
Test the implementation with Lending. To migrate it to our code version, we need to handle an error from get_blinding_public_key and remove & before the closure when we pass it into the UTXO filtering function.
There was a problem hiding this comment.
before:
let matching_utxos = context.signer.get_utxos_filter(
&|utxo| utxo.outpoint == reissuance_outpoint,
&|utxo| utxo.outpoint == reissuance_outpoint,
)?;now:
let matching_utxos = context.signer.get_utxos_filter(
|utxo| utxo.outpoint == reissuance_outpoint,
|utxo| utxo.outpoint == reissuance_outpoint,
)?;And get_blinding_public_key, get_blinding_private_key, get_confidential_address now return errors.
* improve allocations in get_utxos_filter * remove &dyn in Fn closure passing * return SignerTrait implementation
Add the KeyOrigin trait to move the logic for determining keys into a separate entity