Trait lightning::chain::keysinterface::KeysInterface[][src]

pub trait KeysInterface {
    type Signer: Sign;
    fn get_node_secret(&self) -> SecretKey;
fn get_destination_script(&self) -> Script;
fn get_shutdown_pubkey(&self) -> PublicKey;
fn get_channel_signer(
        &self,
        inbound: bool,
        channel_value_satoshis: u64
    ) -> Self::Signer;
fn get_secure_random_bytes(&self) -> [u8; 32];
fn read_chan_signer(
        &self,
        reader: &[u8]
    ) -> Result<Self::Signer, DecodeError>;
fn sign_invoice(
        &self,
        invoice_preimage: Vec<u8>
    ) -> Result<RecoverableSignature, ()>; }
Expand description

A trait to describe an object which can get user secrets and key material.

Associated Types

A type which implements Sign which will be returned by get_channel_signer.

Required methods

Get node secret key (aka node_id or network_key).

This method must return the same value each time it is called.

Get a script pubkey which we send funds to when claiming on-chain contestable outputs.

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.

Get a public key which we will send funds to (in the form of a P2WPKH output) when closing a channel.

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.

Get a new set of Sign for per-channel secrets. These MUST be unique even if you restarted with some stale data!

This method must return a different value each time it is called.

Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting onion packets and for temporary channel IDs. There is no requirement that these be persisted anywhere, though they must be unique across restarts.

This method must return a different value each time it is called.

Reads a Signer for this KeysInterface from the given input stream. This is only called during deserialization of other objects which contain Sign-implementing objects (ie ChannelMonitors and ChannelManagers). The bytes are exactly those which <Self::Signer as Writeable>::write() writes, and contain no versioning scheme. You may wish to include your own version prefix and ensure you’ve read all of the provided bytes to ensure no corruption occurred.

Sign an invoice’s preimage (note that this is the preimage of the invoice, not the HTLC’s preimage). By parameterizing by the preimage instead of the hash, we allow implementors of this trait to parse the invoice and make sure they’re signing what they expect, rather than blindly signing the hash.

Implementors