libwallet

package module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MIT Imports: 50 Imported by: 0

README

muun

About

This is the source code repository for muun's wallet core library. Muun is a non-custodial 2-of-2 multisig wallet with a special focus on security and ease of use.

This library is used by our mobile wallets with gomobile.

Responsible Disclosure

Send us an email to report any security related bugs or vulnerabilities at security@muun.com.

You can encrypt your email message using our public PGP key.

Public key fingerprint: 1299 28C1 E79F E011 6DA4 C80F 8DB7 FD0F 61E6 ED76

Documentation

Index

Constants

View Source
const (
	AddressVersionSwapsV1 = addresses.SubmarineSwapV1
	AddressVersionSwapsV2 = addresses.SubmarineSwapV2
)

These constants are here for clients usage.

View Source
const (
	// EncodedKeyLength is the size of a modern encoded key, as exported by the clients.
	EncodedKeyLength = 147

	// EncodedKeyLengthLegacy is the size of a legacy key, when salt resided only in the 2nd key.
	EncodedKeyLengthLegacy = 136
)
View Source
const (
	ErrUnknown               = 1
	ErrInvalidURI            = 2
	ErrNetwork               = 3
	ErrInvalidPrivateKey     = 4
	ErrInvalidDerivationPath = 5
	ErrInvalidInvoice        = 6
)
View Source
const MaxUnusedSecrets = 5
View Source
const PKEncryptionVersion = 1
View Source
const RecoveryCodeAlphabet = recoverycode.Alphabet

RecoveryCodeAlphabet contains all upper-case characters except for numbers/letters that look alike.

Variables

View Source
var File_bip70_proto protoreflect.FileDescriptor

Functions

func AddEmergencyKitMetadata

func AddEmergencyKitMetadata(metadataText string, srcFile string, dstFile string) error

AddEmergencyKitMetadata produces a copy of the PDF file at `srcFile` with embedded metadata, writing it into `dstFile`. The provided metadata must be the same opaque string produced by `GenerateEmergencyKitHTML`.

func CreateInvoice

func CreateInvoice(net *Network, userKey *HDPrivateKey, routeHints *RouteHints, opts *InvoiceOptions) (string, error)

CreateInvoice returns a new lightning invoice string for the given network. Amount and description can be configured optionally.

func ErrorCode

func ErrorCode(err error) int64

func ExposePreimage

func ExposePreimage(paymentHash []byte) ([]byte, error)

ExposePreimage gives the preimage matching a payment hash if we have it

func GenerateRecoveryCode

func GenerateRecoveryCode() string

GenerateRecoveryCode generates a new random recovery code using a cryptographically secure random number generator.

func GetRecoveryCodeVersion

func GetRecoveryCodeVersion(code string) (int, error)

GetRecoveryCodeVersion returns the version for the recovery code given. If no version can be recognized, it returns an error.

func Init

func Init(c *Config)

Init configures the libwallet

func IsInvoiceFulfillable

func IsInvoiceFulfillable(paymentHash, onionBlob []byte, amount int64, userKey *HDPrivateKey, net *Network) error

func KeyEncrypt

func KeyEncrypt(privKey *HDPrivateKey, passphrase string) (string, error)

KeyEncrypt encrypts an HD priv key using a user-provided secret into a string We use SCrypt256 for key derivation and AES-CBC-PKCS7 for encryption. The returned string has information about version, derivation path, scrypt and AES parameters.

func PersistInvoiceSecrets

func PersistInvoiceSecrets(list *InvoiceSecretsList) error

PersistInvoiceSecrets stores secrets registered with the remote server in the device local database. These secrets can be used to craft new Lightning invoices.

func Scrypt256

func Scrypt256(data, salt []byte) []byte

func ValidateRecoveryCode

func ValidateRecoveryCode(code string) error

ValidateRecoveryCode returns an error if the recovery code is not valid or nil otherwise.

func ValidateSubmarineSwap

func ValidateSubmarineSwap(rawInvoice string, userPublicKey *HDPublicKey, muunPublicKey *HDPublicKey, swap SubmarineSwap, originalExpirationInBlocks int64, network *Network) error

Types

type BestRouteFees

type BestRouteFees struct {
	MaxCapacity              int64
	FeeProportionalMillionth int64
	FeeBase                  int64
}

type BestRouteFeesList

type BestRouteFeesList struct {
	// contains filtered or unexported fields
}

func (*BestRouteFeesList) Add

func (l *BestRouteFeesList) Add(f *BestRouteFees)

type ChallengePrivateKey

type ChallengePrivateKey struct {
	// contains filtered or unexported fields
}

func NewChallengePrivateKey

func NewChallengePrivateKey(input, salt []byte) *ChallengePrivateKey

func RecoveryCodeToKey

func RecoveryCodeToKey(code, salt string) (*ChallengePrivateKey, error)

RecoveryCodeToKey generates a challenge private key using the recovery code as a seed.

The salt parameter is only used for version 1 codes. It will be ignored for version 2+ codes.

func (*ChallengePrivateKey) DecryptKey

func (k *ChallengePrivateKey) DecryptKey(decodedInfo *EncryptedPrivateKeyInfo, network *Network) (*DecryptedPrivateKey, error)

func (*ChallengePrivateKey) DecryptRawKey

func (k *ChallengePrivateKey) DecryptRawKey(encryptedKey string, network *Network) (*DecryptedPrivateKey, error)

func (*ChallengePrivateKey) PubKey

func (*ChallengePrivateKey) PubKeyHex

func (k *ChallengePrivateKey) PubKeyHex() string

func (*ChallengePrivateKey) SignSha

func (k *ChallengePrivateKey) SignSha(payload []byte) ([]byte, error)

SignSha computes the SHA-256 digest of the given payload and signs it.

type ChallengePublicKey

type ChallengePublicKey struct {
	// contains filtered or unexported fields
}

func NewChallengePublicKeyFromSerialized

func NewChallengePublicKeyFromSerialized(serializedKey []byte) (*ChallengePublicKey, error)

func (*ChallengePublicKey) EncryptKey

func (k *ChallengePublicKey) EncryptKey(privKey *HDPrivateKey, recoveryCodeSalt []byte, birthday int) (string, error)

type Config

type Config struct {
	DataDir  string
	Listener Listener
}

Config defines the global libwallet configuration.

type DecryptedKey

type DecryptedKey struct {
	Key  *HDPrivateKey
	Path string
}

func KeyDecrypt

func KeyDecrypt(value, passphrase string, network *Network) (*DecryptedKey, error)

KeyDecrypt decrypts a key encrypted with KeyEncrypt

type DecryptedPrivateKey

type DecryptedPrivateKey struct {
	Key      *HDPrivateKey
	Birthday int
}

type Decrypter

type Decrypter interface {
	// Decrypt a payload generated by Encrypter
	Decrypt(payload string) ([]byte, error)
}

type EKInput

type EKInput struct {
	FirstEncryptedKey  string
	FirstFingerprint   string
	SecondEncryptedKey string
	SecondFingerprint  string
}

EKInput input struct to fill the PDF

type EKOutput

type EKOutput struct {
	HTML             string
	VerificationCode string
	Metadata         string
}

EKOutput with the html as string and the verification code

func GenerateEmergencyKitHTML

func GenerateEmergencyKitHTML(ekParams *EKInput, language string) (*EKOutput, error)

GenerateEmergencyKitHTML returns the translated html as a string along with the verification code and the kit metadata, represented in an opaque string. After calling this method, clients should use their Chromium/WebKit implementations to render the HTML into a PDF (better done there), and then come back to call `AddEmergencyKitMetadata` and produce the final PDF (better done here).

type EncryptedPrivateKeyInfo

type EncryptedPrivateKeyInfo struct {
	Version      int
	Birthday     int
	EphPublicKey string
	CipherText   string
	Salt         string
}

EncryptedPrivateKeyInfo is a Gomobile-compatible version of EncryptedPrivateKey using hex-encoding.

func DecodeEncryptedPrivateKey

func DecodeEncryptedPrivateKey(encodedKey string) (*EncryptedPrivateKeyInfo, error)

type Encrypter

type Encrypter interface {
	// Encrypt the payload and return a string with the necesary information for decryption
	Encrypt(payload []byte) (string, error)
}

type FundingOutputPolicies

type FundingOutputPolicies struct {
	MaximumDebt       int64
	PotentialCollect  int64
	MaxAmountFor0Conf int64
}

type HDPrivateKey

type HDPrivateKey struct {
	Network *Network
	Path    string
	// contains filtered or unexported fields
}

HDPrivateKey is an HD capable priv key

func NewHDPrivateKey

func NewHDPrivateKey(seed []byte, network *Network) (*HDPrivateKey, error)

NewHDPrivateKey builds an HD priv key from a seed for a given network

func NewHDPrivateKeyFromBytes

func NewHDPrivateKeyFromBytes(rawKey, chainCode []byte, network *Network) (*HDPrivateKey, error)

NewHDPrivateKeyFromBytes builds an HD priv key from the compress priv and chain code for a given network

func NewHDPrivateKeyFromString

func NewHDPrivateKeyFromString(str, path string, network *Network) (*HDPrivateKey, error)

NewHDPrivateKeyFromString creates an HD priv key from a base58-encoded string If the parsed key is public, it returns an error

func (*HDPrivateKey) Decrypter

func (p *HDPrivateKey) Decrypter() Decrypter

func (*HDPrivateKey) DecrypterFrom

func (p *HDPrivateKey) DecrypterFrom(senderKey *PublicKey) Decrypter

func (*HDPrivateKey) DeriveTo

func (p *HDPrivateKey) DeriveTo(path string) (*HDPrivateKey, error)

func (*HDPrivateKey) DerivedAt

func (p *HDPrivateKey) DerivedAt(index int64, hardened bool) (*HDPrivateKey, error)

DerivedAt derives a new child priv key, which may be hardened index should be uint32 but for java compat we use int64

func (*HDPrivateKey) Encrypter

func (p *HDPrivateKey) Encrypter() Encrypter

func (*HDPrivateKey) EncrypterTo

func (p *HDPrivateKey) EncrypterTo(receiver *HDPublicKey) Encrypter

func (*HDPrivateKey) PublicKey

func (p *HDPrivateKey) PublicKey() *HDPublicKey

PublicKey returns the matching pub key

func (*HDPrivateKey) Sign

func (p *HDPrivateKey) Sign(data []byte) ([]byte, error)

Sign a payload using the backing EC key

func (*HDPrivateKey) String

func (p *HDPrivateKey) String() string

String return the key base58-encoded

type HDPublicKey

type HDPublicKey struct {
	Network *Network
	Path    string
	// contains filtered or unexported fields
}

HDPublicKey is an HD capable pub key

func NewHDPublicKeyFromString

func NewHDPublicKeyFromString(str, path string, network *Network) (*HDPublicKey, error)

NewHDPublicKeyFromString creates an HD pub key from a base58-encoded string If the parsed key is private, it returns an error

func (*HDPublicKey) DeriveTo

func (p *HDPublicKey) DeriveTo(path string) (*HDPublicKey, error)

func (*HDPublicKey) DerivedAt

func (p *HDPublicKey) DerivedAt(index int64) (*HDPublicKey, error)

DerivedAt derives a new child pub key index should be uint32 but for java compat we use int64

func (*HDPublicKey) Fingerprint

func (p *HDPublicKey) Fingerprint() []byte

Fingerprint returns the 4-byte fingerprint for this pubkey

func (*HDPublicKey) Raw

func (p *HDPublicKey) Raw() []byte

Raw returns the backing EC compressed raw key

func (*HDPublicKey) String

func (p *HDPublicKey) String() string

String return the key base58-encoded

type IncomingSwap

type IncomingSwap struct {
	FulfillmentTx       []byte
	MuunSignature       []byte
	Sphinx              []byte
	PaymentHash         []byte
	BlockHeight         int64 // unused
	HtlcTx              []byte
	OutputVersion       int    // unused
	OutputPath          string // unused
	SwapServerPublicKey string
	MerkleTree          []byte // unused
	HtlcExpiration      int64
	HtlcBlock           []byte // unused
	ConfirmationTarget  int64  // to validate fee rate, unused for now
	CollectInSats       int64
}

func (*IncomingSwap) VerifyAndFulfill

func (s *IncomingSwap) VerifyAndFulfill(userKey *HDPrivateKey, muunKey *HDPublicKey, net *Network) ([]byte, error)

type Input

type Input interface {
	OutPoint() Outpoint
	Address() MuunAddress
	UserSignature() []byte
	MuunSignature() []byte
	SubmarineSwapV1() InputSubmarineSwapV1
	SubmarineSwapV2() InputSubmarineSwapV2
	IncomingSwap() InputIncomingSwap
}

type InputIncomingSwap

type InputIncomingSwap interface {
	Sphinx() []byte
	HtlcTx() []byte
	PaymentHash256() []byte
	SwapServerPublicKey() string
	ExpirationHeight() int64
	CollectInSats() int64
}

type InputList

type InputList struct {
	// contains filtered or unexported fields
}

func (*InputList) Add

func (l *InputList) Add(input Input)

func (*InputList) Inputs

func (l *InputList) Inputs() []Input

type InputSubmarineSwapV1

type InputSubmarineSwapV1 interface {
	RefundAddress() string
	PaymentHash256() []byte
	ServerPublicKey() []byte
	LockTime() int64
}

type InputSubmarineSwapV2

type InputSubmarineSwapV2 interface {
	PaymentHash256() []byte
	UserPublicKey() []byte
	MuunPublicKey() []byte
	ServerPublicKey() []byte
	BlocksForExpiration() int64
	ServerSignature() []byte
}

type Invoice

type Invoice struct {
	RawInvoice      string
	FallbackAddress *MuunPaymentURI
	Network         *Network
	MilliSat        string
	Destination     []byte
	PaymentHash     []byte
	Expiry          int64
	Description     string
	Sats            int64
}

Invoice is muun's invoice struct

func ParseInvoice

func ParseInvoice(rawInput string, network *Network) (*Invoice, error)

ParseInvoice parses an Invoice from an invoice string and a network

type InvoiceOptions

type InvoiceOptions struct {
	Description string
	AmountSat   int64
}

InvoiceOptions defines additional options that can be configured when creating a new invoice.

type InvoiceSecrets

type InvoiceSecrets struct {
	PaymentHash []byte
	IdentityKey *HDPublicKey
	UserHtlcKey *HDPublicKey
	MuunHtlcKey *HDPublicKey
	ShortChanId int64
	// contains filtered or unexported fields
}

InvoiceSecrets represents a bundle of secrets required to generate invoices from the client. These secrets must be registered with the remote server and persisted in the client database before use.

type InvoiceSecretsList

type InvoiceSecretsList struct {
	// contains filtered or unexported fields
}

InvoiceSecretsList is a wrapper around an InvoiceSecrets slice to be able to pass through the gomobile bridge.

func GenerateInvoiceSecrets

func GenerateInvoiceSecrets(userKey, muunKey *HDPublicKey) (*InvoiceSecretsList, error)

GenerateInvoiceSecrets returns a slice of new secrets to register with the remote server. Once registered, those invoices should be stored with the PersistInvoiceSecrets method.

func (*InvoiceSecretsList) Get

Get returns the secret at the given index.

func (*InvoiceSecretsList) Length

func (l *InvoiceSecretsList) Length() int

Length returns the number of secrets in the list.

type Listener

type Listener interface {
	OnDataChanged(tag string)
}

Listener is an interface implemented by the apps to receive notifications of data changes from the libwallet code. Each change is reported with a string tag identifying the type of change.

type MuunAddress

type MuunAddress interface {
	Version() int
	DerivationPath() string
	Address() string
}

func CreateAddressV1

func CreateAddressV1(publicKey *HDPublicKey) (MuunAddress, error)

CreateAddressV1 returns a P2PKH MuunAddress from a publicKey for use in TransactionSchemeV1

func CreateAddressV2

func CreateAddressV2(userKey, muunKey *HDPublicKey) (MuunAddress, error)

func CreateAddressV3

func CreateAddressV3(userKey, muunKey *HDPublicKey) (MuunAddress, error)

func CreateAddressV4

func CreateAddressV4(userKey, muunKey *HDPublicKey) (MuunAddress, error)

CreateAddressV4 returns a P2WSH MuunAddress from a user HD-pubkey and a Muun co-signing HD-pubkey.

type MuunPaymentURI

type MuunPaymentURI struct {
	Address      string
	Label        string
	Message      string
	Amount       string
	URI          string
	BIP70Url     string
	CreationTime string
	ExpiresTime  string
	Invoice      *Invoice
}

MuunPaymentURI is muun's uri struct

func DoPaymentRequestCall

func DoPaymentRequestCall(url string, network *Network) (*MuunPaymentURI, error)

DoPaymentRequestCall builds a MuunPaymentUri from a url and a network. Handling BIP70 to 72

func GetPaymentURI

func GetPaymentURI(rawInput string, network *Network) (*MuunPaymentURI, error)

GetPaymentURI builds a MuunPaymentURI from text (Bitcoin Uri, Muun Uri or address) and a network

type Network

type Network struct {
	// contains filtered or unexported fields
}

Network has the parameters for operating in a given Bitcoin network

func Mainnet

func Mainnet() *Network

Mainnet returns an instance of the Bitcoin Main Network

func Regtest

func Regtest() *Network

Regtest returns an instance of the Bitcoin Regression Network

func Testnet

func Testnet() *Network

Testnet returns an instance of the Bitcoin Test Network

func (*Network) Name

func (n *Network) Name() string

Name returns the Network's name

type Outpoint

type Outpoint interface {
	TxId() []byte
	Index() int
	Amount() int64
}

type Output

type Output struct {
	Amount uint64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` // amount is integer-number-of-satoshis
	Script []byte `protobuf:"bytes,2,opt,name=script,proto3" json:"script,omitempty"`  // usually one of the standard Script forms
	// contains filtered or unexported fields
}

Generalized form of "send payment to this/these bitcoin addresses"

func (*Output) Descriptor deprecated

func (*Output) Descriptor() ([]byte, []int)

Deprecated: Use Output.ProtoReflect.Descriptor instead.

func (*Output) ProtoMessage

func (*Output) ProtoMessage()

func (*Output) ProtoReflect

func (x *Output) ProtoReflect() protoreflect.Message

func (*Output) Reset

func (x *Output) Reset()

func (*Output) String

func (x *Output) String() string

type PartiallySignedTransaction

type PartiallySignedTransaction struct {
	// contains filtered or unexported fields
}

func NewPartiallySignedTransaction

func NewPartiallySignedTransaction(inputs *InputList, rawTx []byte) (*PartiallySignedTransaction, error)

func (*PartiallySignedTransaction) FullySign

func (p *PartiallySignedTransaction) FullySign(userKey, muunKey *HDPrivateKey) (*Transaction, error)

func (*PartiallySignedTransaction) Sign

func (p *PartiallySignedTransaction) Sign(userKey *HDPrivateKey, muunKey *HDPublicKey) (*Transaction, error)

func (*PartiallySignedTransaction) Verify

func (p *PartiallySignedTransaction) Verify(expectations *SigningExpectations, userPublicKey *HDPublicKey, muunPublickKey *HDPublicKey) error

type Payment

type Payment struct {
	MerchantData []byte    `protobuf:"bytes,1,opt,name=merchant_data,json=merchantData,proto3" json:"merchant_data,omitempty"` // From PaymentDetails.merchant_data
	Transactions [][]byte  `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"`                     // Signed transactions that satisfy PaymentDetails.outputs
	RefundTo     []*Output `protobuf:"bytes,3,rep,name=refund_to,json=refundTo,proto3" json:"refund_to,omitempty"`             // Where to send refunds, if a refund is necessary
	Memo         string    `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"`                                     // Human-readable message for the merchant
	// contains filtered or unexported fields
}

func (*Payment) Descriptor deprecated

func (*Payment) Descriptor() ([]byte, []int)

Deprecated: Use Payment.ProtoReflect.Descriptor instead.

func (*Payment) ProtoMessage

func (*Payment) ProtoMessage()

func (*Payment) ProtoReflect

func (x *Payment) ProtoReflect() protoreflect.Message

func (*Payment) Reset

func (x *Payment) Reset()

func (*Payment) String

func (x *Payment) String() string

type PaymentACK

type PaymentACK struct {
	Payment *Payment `protobuf:"bytes,1,opt,name=payment,proto3" json:"payment,omitempty"` // Payment message that triggered this ACK
	Memo    string   `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"`       // human-readable message for customer
	// contains filtered or unexported fields
}

func (*PaymentACK) Descriptor deprecated

func (*PaymentACK) Descriptor() ([]byte, []int)

Deprecated: Use PaymentACK.ProtoReflect.Descriptor instead.

func (*PaymentACK) ProtoMessage

func (*PaymentACK) ProtoMessage()

func (*PaymentACK) ProtoReflect

func (x *PaymentACK) ProtoReflect() protoreflect.Message

func (*PaymentACK) Reset

func (x *PaymentACK) Reset()

func (*PaymentACK) String

func (x *PaymentACK) String() string

type PaymentDetails

type PaymentDetails struct {
	Network      string    `protobuf:"bytes,1,opt,name=network,proto3" json:"network,omitempty"`                               // "main" or "test"
	Outputs      []*Output `protobuf:"bytes,2,rep,name=outputs,proto3" json:"outputs,omitempty"`                               // Where payment should be sent
	Time         uint64    `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"`                                    // Timestamp; when payment request created
	Expires      uint64    `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"`                              // Timestamp; when this request should be considered invalid
	Memo         string    `protobuf:"bytes,5,opt,name=memo,proto3" json:"memo,omitempty"`                                     // Human-readable description of request for the customer
	PaymentUrl   string    `protobuf:"bytes,6,opt,name=payment_url,json=paymentUrl,proto3" json:"payment_url,omitempty"`       // URL to send Payment and get PaymentACK
	MerchantData []byte    `protobuf:"bytes,7,opt,name=merchant_data,json=merchantData,proto3" json:"merchant_data,omitempty"` // Arbitrary data to include in the Payment message
	// contains filtered or unexported fields
}

func (*PaymentDetails) Descriptor deprecated

func (*PaymentDetails) Descriptor() ([]byte, []int)

Deprecated: Use PaymentDetails.ProtoReflect.Descriptor instead.

func (*PaymentDetails) ProtoMessage

func (*PaymentDetails) ProtoMessage()

func (*PaymentDetails) ProtoReflect

func (x *PaymentDetails) ProtoReflect() protoreflect.Message

func (*PaymentDetails) Reset

func (x *PaymentDetails) Reset()

func (*PaymentDetails) String

func (x *PaymentDetails) String() string

type PaymentRequest

type PaymentRequest struct {
	PaymentDetailsVersion    uint32 ``                                                                                   /* 127-byte string literal not displayed */
	PkiType                  string `protobuf:"bytes,2,opt,name=pki_type,json=pkiType,proto3" json:"pki_type,omitempty"` // none / x509+sha256 / x509+sha1
	PkiData                  []byte `protobuf:"bytes,3,opt,name=pki_data,json=pkiData,proto3" json:"pki_data,omitempty"` // depends on pki_type
	SerializedPaymentDetails []byte ``                                                                                   // PaymentDetails
	/* 135-byte string literal not displayed */
	Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` // pki-dependent signature
	// contains filtered or unexported fields
}

func (*PaymentRequest) Descriptor deprecated

func (*PaymentRequest) Descriptor() ([]byte, []int)

Deprecated: Use PaymentRequest.ProtoReflect.Descriptor instead.

func (*PaymentRequest) ProtoMessage

func (*PaymentRequest) ProtoMessage()

func (*PaymentRequest) ProtoReflect

func (x *PaymentRequest) ProtoReflect() protoreflect.Message

func (*PaymentRequest) Reset

func (x *PaymentRequest) Reset()

func (*PaymentRequest) String

func (x *PaymentRequest) String() string

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

func NewPublicKeyFromBytes

func NewPublicKeyFromBytes(bytes []byte) (*PublicKey, error)

type RouteHints

type RouteHints struct {
	Pubkey                    string
	FeeBaseMsat               int64
	FeeProportionalMillionths int64
	CltvExpiryDelta           int32
}

RouteHints is a struct returned by the remote server containing the data necessary for constructing an invoice locally.

type SigningExpectations

type SigningExpectations struct {
	// contains filtered or unexported fields
}

func NewSigningExpectations

func NewSigningExpectations(destination string, amount int64, change MuunAddress, fee int64) *SigningExpectations

type SubmarineSwap

type SubmarineSwap interface {
	Invoice() string
	Receiver() SubmarineSwapReceiver
	FundingOutput() SubmarineSwapFundingOutput

	PreimageInHex() string
}

type SubmarineSwapFundingOutput

type SubmarineSwapFundingOutput interface {
	ScriptVersion() int64

	OutputAddress() string
	OutputAmount() int64
	ConfirmationsNeeded() int
	ServerPaymentHashInHex() string
	ServerPublicKeyInHex() string

	UserLockTime() int64

	// v1 only
	UserRefundAddress() MuunAddress

	// v2 only
	ExpirationInBlocks() int64
	UserPublicKey() *HDPublicKey
	MuunPublicKey() *HDPublicKey
}

type SubmarineSwapReceiver

type SubmarineSwapReceiver interface {
	Alias() string
	PublicKey() string
}

type SwapFees

type SwapFees struct {
	RoutingFee          int64
	SweepFee            int64
	DebtType            string
	DebtAmount          int64
	ConfirmationsNeeded int64
}

func ComputeSwapFees

func ComputeSwapFees(amount int64, bestRouteFees *BestRouteFeesList, policies *FundingOutputPolicies) *SwapFees

type Transaction

type Transaction struct {
	Hash  string
	Bytes []byte
}

type X509Certificates

type X509Certificates struct {
	Certificate [][]byte `protobuf:"bytes,1,rep,name=certificate,proto3" json:"certificate,omitempty"` // DER-encoded X.509 certificate chain
	// contains filtered or unexported fields
}

func (*X509Certificates) Descriptor deprecated

func (*X509Certificates) Descriptor() ([]byte, []int)

Deprecated: Use X509Certificates.ProtoReflect.Descriptor instead.

func (*X509Certificates) ProtoMessage

func (*X509Certificates) ProtoMessage()

func (*X509Certificates) ProtoReflect

func (x *X509Certificates) ProtoReflect() protoreflect.Message

func (*X509Certificates) Reset

func (x *X509Certificates) Reset()

func (*X509Certificates) String

func (x *X509Certificates) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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