lightningdevkit
Version:
Lightning Development Kit
192 lines (191 loc) • 9.17 kB
text/typescript
import { DelayedPaymentOutputDescriptor } from '../structs/DelayedPaymentOutputDescriptor.mjs';
import { StaticPaymentOutputDescriptor } from '../structs/StaticPaymentOutputDescriptor.mjs';
import { OutPoint } from '../structs/OutPoint.mjs';
import { ChannelPublicKeys } from '../structs/ChannelPublicKeys.mjs';
import { ChannelTransactionParameters } from '../structs/ChannelTransactionParameters.mjs';
import { ChannelSigner } from '../structs/ChannelSigner.mjs';
import { EcdsaChannelSigner } from '../structs/EcdsaChannelSigner.mjs';
import { Option_u16Z } from '../structs/Option_u16Z.mjs';
import { Option_boolZ } from '../structs/Option_boolZ.mjs';
import { Result_WitnessNoneZ } from '../structs/Result_WitnessNoneZ.mjs';
import { Result_InMemorySignerDecodeErrorZ } from '../structs/Result_InMemorySignerDecodeErrorZ.mjs';
import { EntropySource } from '../structs/EntropySource.mjs';
import { ChannelTypeFeatures } from '../structs/ChannelTypeFeatures.mjs';
import { CommonBase } from './CommonBase.mjs';
/**
* A simple implementation of [`EcdsaChannelSigner`] that just keeps the private keys in memory.
*
* This implementation performs no policy checks and is insufficient by itself as
* a secure external signer.
*/
export declare class InMemorySigner extends CommonBase {
/**
* Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
* holder's anchor output in a commitment transaction, if one is present.
*/
get_funding_key(): Uint8Array;
/**
* Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the
* holder's anchor output in a commitment transaction, if one is present.
*/
set_funding_key(val: Uint8Array): void;
/**
* Holder secret key for blinded revocation pubkey.
*/
get_revocation_base_key(): Uint8Array;
/**
* Holder secret key for blinded revocation pubkey.
*/
set_revocation_base_key(val: Uint8Array): void;
/**
* Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
*/
get_payment_key(): Uint8Array;
/**
* Holder secret key used for our balance in counterparty-broadcasted commitment transactions.
*/
set_payment_key(val: Uint8Array): void;
/**
* Holder secret key used in an HTLC transaction.
*/
get_delayed_payment_base_key(): Uint8Array;
/**
* Holder secret key used in an HTLC transaction.
*/
set_delayed_payment_base_key(val: Uint8Array): void;
/**
* Holder HTLC secret key used in commitment transaction HTLC outputs.
*/
get_htlc_base_key(): Uint8Array;
/**
* Holder HTLC secret key used in commitment transaction HTLC outputs.
*/
set_htlc_base_key(val: Uint8Array): void;
/**
* Commitment seed.
*/
get_commitment_seed(): Uint8Array;
/**
* Commitment seed.
*/
set_commitment_seed(val: Uint8Array): void;
clone_ptr(): bigint;
/**
* Creates a copy of the InMemorySigner
*/
clone(): InMemorySigner;
/**
* Creates a new [`InMemorySigner`].
*/
static constructor_new(funding_key: Uint8Array, revocation_base_key: Uint8Array, payment_key: Uint8Array, delayed_payment_base_key: Uint8Array, htlc_base_key: Uint8Array, commitment_seed: Uint8Array, channel_value_satoshis: bigint, channel_keys_id: Uint8Array, rand_bytes_unique_start: Uint8Array): InMemorySigner;
/**
* Returns the counterparty's pubkeys.
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
counterparty_pubkeys(): ChannelPublicKeys;
/**
* Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable
* transactions, i.e., the amount of time that we have to wait to recover our funds if we
* broadcast a transaction.
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*/
counterparty_selected_contest_delay(): Option_u16Z;
/**
* Returns the `contest_delay` value specified by us and applied on transactions broadcastable
* by our counterparty, i.e., the amount of time that they have to wait to recover their funds
* if they broadcast a transaction.
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*/
holder_selected_contest_delay(): Option_u16Z;
/**
* Returns whether the holder is the initiator.
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*/
is_outbound(): Option_boolZ;
/**
* Funding outpoint
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
funding_outpoint(): OutPoint;
/**
* Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or
* building transactions.
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
get_channel_parameters(): ChannelTransactionParameters;
/**
* Returns the channel type features of the channel parameters. Should be helpful for
* determining a channel's category, i. e. legacy/anchors/taproot/etc.
*
* Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called.
* In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation.
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
channel_type_features(): ChannelTypeFeatures;
/**
* Sign the single input of `spend_tx` at index `input_idx`, which spends the output described
* by `descriptor`, returning the witness stack for the input.
*
* Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
* is not spending the outpoint described by [`descriptor.outpoint`],
* or if an output descriptor `script_pubkey` does not match the one we can spend.
*
* [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint
*/
sign_counterparty_payment_input(spend_tx: Uint8Array, input_idx: number, descriptor: StaticPaymentOutputDescriptor): Result_WitnessNoneZ;
/**
* Sign the single input of `spend_tx` at index `input_idx` which spends the output
* described by `descriptor`, returning the witness stack for the input.
*
* Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`,
* is not spending the outpoint described by [`descriptor.outpoint`], does not have a
* sequence set to [`descriptor.to_self_delay`], or if an output descriptor
* `script_pubkey` does not match the one we can spend.
*
* [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint
* [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay
*/
sign_dynamic_p2wsh_input(spend_tx: Uint8Array, input_idx: number, descriptor: DelayedPaymentOutputDescriptor): Result_WitnessNoneZ;
/**
* Constructs a new EntropySource which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
*/
as_EntropySource(): EntropySource;
/**
* Constructs a new ChannelSigner which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
*/
as_ChannelSigner(): ChannelSigner;
/**
* Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is
*/
as_EcdsaChannelSigner(): EcdsaChannelSigner;
/**
* Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read
*/
write(): Uint8Array;
/**
* Read a InMemorySigner from a byte array, created by InMemorySigner_write
*/
static constructor_read(ser: Uint8Array, arg: EntropySource): Result_InMemorySignerDecodeErrorZ;
}