Class KeysInterface


  • public class KeysInterface
    extends Object
    A trait to describe an object which can get user secrets and key material.
    • Method Detail

      • get_node_secret

        public byte[] get_node_secret()
        Get node secret key (aka node_id or network_key). This method must return the same value each time it is called.
      • get_destination_script

        public byte[] get_destination_script()
        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_shutdown_scriptpubkey

        public ShutdownScript get_shutdown_scriptpubkey()
        Get a script pubkey which we will send funds to 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_channel_signer

        public Sign get_channel_signer​(boolean inbound,
                                       long channel_value_satoshis)
        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.
      • get_secure_random_bytes

        public byte[] get_secure_random_bytes()
        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.
      • read_chan_signer

        public Result_SignDecodeErrorZ read_chan_signer​(byte[] reader)
        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 `ChannelMonitor`s and `ChannelManager`s). The bytes are exactly those which `::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_invoice

        public Result_RecoverableSignatureNoneZ sign_invoice​(byte[] invoice_preimage)
        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.