pub trait SignerProvider {
type EcdsaSigner: EcdsaChannelSigner;
// Required methods
fn generate_channel_keys_id(
&self,
inbound: bool,
user_channel_id: u128,
) -> [u8; 32];
fn derive_channel_signer(
&self,
channel_keys_id: [u8; 32],
) -> Self::EcdsaSigner;
fn get_destination_script(
&self,
channel_keys_id: [u8; 32],
) -> Result<ScriptBuf, ()>;
fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()>;
}Expand description
A trait that can return signer instances for individual channels.
Required Associated Types§
Sourcetype EcdsaSigner: EcdsaChannelSigner
type EcdsaSigner: EcdsaChannelSigner
A type which implements EcdsaChannelSigner which will be returned by Self::derive_channel_signer.
Required Methods§
Sourcefn generate_channel_keys_id(
&self,
inbound: bool,
user_channel_id: u128,
) -> [u8; 32]
fn generate_channel_keys_id( &self, inbound: bool, user_channel_id: u128, ) -> [u8; 32]
Generates a unique channel_keys_id that can be used to obtain a Self::EcdsaSigner through
SignerProvider::derive_channel_signer. The user_channel_id is provided to allow
implementations of SignerProvider to maintain a mapping between itself and the generated
channel_keys_id.
This method must return a different value each time it is called.
Sourcefn derive_channel_signer(&self, channel_keys_id: [u8; 32]) -> Self::EcdsaSigner
fn derive_channel_signer(&self, channel_keys_id: [u8; 32]) -> Self::EcdsaSigner
Derives the private key material backing a Signer.
To derive a new Signer, a fresh channel_keys_id should be obtained through
SignerProvider::generate_channel_keys_id. Otherwise, an existing Signer can be
re-derived from its channel_keys_id, which can be obtained through its trait method
ChannelSigner::channel_keys_id.
Sourcefn get_destination_script(
&self,
channel_keys_id: [u8; 32],
) -> Result<ScriptBuf, ()>
fn get_destination_script( &self, channel_keys_id: [u8; 32], ) -> Result<ScriptBuf, ()>
Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
If this function returns an error, this will result in a channel failing to open.
This method should return a different value each time it is called, to avoid linking
on-chain funds across channels as controlled to the same user. channel_keys_id may be
used to derive a unique value for each channel.
Sourcefn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()>
fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()>
Get a script pubkey which we will send funds to when closing a channel.
If this function returns an error, this will result in a channel failing to open or close. In the event of a failure when the counterparty is initiating a close, this can result in a channel force close.
This method should return a different value each time it is called, to avoid linking on-chain funds across channels as controlled to the same user.