package
0.18.4-beta.rc2
Repository: https://github.com/lightningnetwork/lnd.git
Documentation: pkg.go.dev
# Functions
Decrypt unenciphers a blob of justice by decrypting the ciphertext using chacha20poly1305 with the chosen (nonce, key) pair.
Encrypt encodes the blob of justice using encoding version, and then creates a ciphertext using chacha20poly1305 under the chosen (nonce, key) pair.
IsSupportedType returns true if the given type is supported by the package.
NewBreachHintAndKeyFromHash derives a BreachHint and BreachKey from a given txid in a single pass.
NewBreachHintFromHash creates a breach hint from a transaction ID.
NewBreachKeyFromHash creates a breach key from a transaction ID.
Size returns the size of the encoded-and-encrypted blob in bytes.
SupportedTypes returns a list of all supported blob types.
TypeFromChannel returns the appropriate blob Type for the given channel type.
TypeFromFlags creates a single Type from an arbitrary list of flags.
# Constants
AnchorCommitment represents the commitment transaction of an anchor channel.
BreachHintSize is the length of the identifier used to detect remote commitment broadcasts.
CiphertextExpansion is the number of bytes padded to a plaintext encrypted with chacha20poly1305, which comes from a 16-byte MAC.
FlagAnchorChannel signals that this blob is meant to spend an anchor channel, and therefore must expect a P2WSH-style to-remote output if one exists.
FlagCommitOutputs signals that the blob contains the information required to sweep commitment outputs.
FlagReward signals that the justice transaction should contain an additional output for itself.
FlagTaprootChannel signals that this blob is meant to spend a taproot channel and therefore must expect P2TR outputs.
KeySize is the length of a chacha20poly1305 key, 32 bytes.
LegacyCommitment represents a legacy commitment transaction where anchor outputs are not yet used and so the to_remote output is just a regular but tweaked P2WKH.
LegacyTweaklessCommitment is similar to the LegacyCommitment with the added detail of the to_remote output not being tweaked.
MaxSweepAddrSize defines the maximum sweep address size that can be encoded in a blob.
NonceSize is the length of a chacha20poly1305 nonce, 24 bytes.
TaprootCommitment represents the commitment transaction of a simple taproot channel.
TypeAltruistAnchorCommit sweeps only commitment outputs from an anchor commitment to a sweep address controlled by the user, and does not give the tower a reward.
TypeAltruistCommit sweeps only commitment outputs to a sweep address controlled by the user, and does not give the tower a reward.
TypeAltruistTaprootCommit sweeps only the commitment outputs from a taproot channel commitment to a sweep address controlled by the user, and does not give the tower a reward.
TypeRewardCommit sweeps only commitment outputs to a sweep address controlled by the user, and pays a negotiated reward to the tower.
V0PlaintextSize is the plaintext size of a version 0 encoded blob.
V1PlaintextSize is the plaintext size of a version 1 encoded blob.
# Variables
ErrCiphertextTooSmall is a decryption error signaling that the ciphertext is smaller than the ciphertext expansion factor.
ErrNoCommitToRemoteOutput is returned when trying to retrieve the commit to-remote output from the blob, though none exists.
ErrSweepAddressToLong is returned when trying to encode or decode a sweep address with length greater than the maximum length of 42 bytes, which supports p2wkh and p2sh addresses.
ErrUnknownBlobType signals that we don't understand the requested blob encoding scheme.
# Interfaces
JusticeKit is an interface that describes lé Blob of Justice.
# Type aliases
BreachHint is the first 16-bytes of SHA256(txid), which is used to identify the breach transaction.
BreachKey is computed as SHA256(txid || txid), which produces the key for decrypting a client's encrypted blobs.
CommitmentType characterises the various properties of the breach commitment transaction.
Flag represents a specify option that can be present in a Type.
Type is a bit vector composed of Flags that govern various aspects of reconstructing the justice transaction from an encrypted blob.