cln

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyOffsetFunding    = 0
	KeyOffsetRevocation = 1
	KeyOffsetHtlc       = 2
	KeyOffsetPayment    = 3
	KeyOffsetDelayed    = 4
)

Variables

View Source
var (
	InfoNodeID     = []byte("nodeid")
	InfoPeerSeed   = []byte("peer seed")
	InfoPerPeer    = []byte("per-peer seed")
	InfoCLightning = []byte("c-lightning")
)

Functions

func DeriveKeyPair

func DeriveKeyPair(hsmSecret [32]byte,
	desc *keychain.KeyDescriptor) (*btcec.PublicKey, *btcec.PrivateKey,
	error)

DeriveKeyPair derives a channel key pair from the given HSM secret, and the key descriptor. The public key in the key descriptor is used as the peer's public key, the family is converted to the CLN key type, and the index is used as the channel's database index.

func HkdfSha256

func HkdfSha256(key, salt, info []byte) ([32]byte, error)

HkdfSha256 derives a 32-byte key from the given input key material, salt, and info using the HKDF-SHA256 key derivation function.

func HkdfSha256WithSkip

func HkdfSha256WithSkip(key, salt, info []byte, skip int) ([32]byte, error)

HkdfSha256WithSkip derives a 32-byte key from the given input key material, salt, and info using the HKDF-SHA256 key derivation function and skips the first `skip` bytes of the output.

func NodeKey

func NodeKey(hsmSecret [32]byte) (*btcec.PublicKey, *btcec.PrivateKey, error)

NodeKey derives a CLN node key from the given HSM secret.

Types

type Signer

type Signer struct {
	*input.MusigSessionManager

	HsmSecret [32]byte

	// SwapDescKeyAfterDerive is a boolean that indicates that after
	// deriving the private key from the key descriptor (which interprets
	// the public key as the peer's public key), we should swap the public
	// key in the key descriptor to the actual derived public key. This is
	// required for P2WKH signatures that need to have the public key in the
	// witness stack.
	SwapDescKeyAfterDerive bool
}

func (*Signer) AddPartialSignature

func (s *Signer) AddPartialSignature(packet *psbt.Packet,
	keyDesc keychain.KeyDescriptor, utxo *wire.TxOut, witnessScript []byte,
	inputIndex int) error

func (*Signer) AddPartialSignatureWithDesc added in v0.14.1

func (s *Signer) AddPartialSignatureWithDesc(packet *psbt.Packet,
	signDesc *input.SignDescriptor) error

func (*Signer) ComputeInputScript

func (s *Signer) ComputeInputScript(_ *wire.MsgTx, _ *input.SignDescriptor) (
	*input.Script, error)

func (*Signer) FetchPrivateKey

func (s *Signer) FetchPrivateKey(
	descriptor *keychain.KeyDescriptor) (*btcec.PrivateKey, error)

func (*Signer) FindMultisigKey

func (s *Signer) FindMultisigKey(targetPubkey, peerPubKey *btcec.PublicKey,
	maxNumKeys uint32) (*keychain.KeyDescriptor, error)

func (*Signer) SignOutputRaw

func (s *Signer) SignOutputRaw(tx *wire.MsgTx,
	signDesc *input.SignDescriptor) (input.Signature, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL