Documentation ¶
Overview ¶
Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
Index ¶
- func CalculateWitnessHash(amount int64, script string, transaction string) (*string, error)
- func CalculateWitnessHashPSBT(transaction string) (*string, error)
- func DeclineToSignMessages(client *services.LightsparkClient, event webhooks.WebhookEvent) (string, error)
- func GetPaymentHashFromScript(scriptHex string) (*string, error)
- func HandleRemoteSigningWebhook(client *services.LightsparkClient, validator Validator, ...) (string, error)
- func HandleSigningResponse(client *services.LightsparkClient, response SigningResponse) (string, error)
- type DeriveKeyAndSignRequest
- type DeriveKeyAndSignResponse
- type ECDHRequest
- type ECDHResponse
- type GetPerCommitmentPointRequest
- type GetPerCommitmentPointResponse
- type GraphQLResponse
- type HashValidator
- type InvoicePaymentHashRequest
- type InvoicePaymentHashResponse
- type PositiveValidator
- type ReleaseCounterpartyPerCommitmentSecretRequest
- type ReleasePaymentPreimageRequest
- type ReleasePaymentPreimageResponse
- type ReleasePerCommitmentSecretRequest
- type ReleasePerCommitmentSecretResponse
- type SignInvoiceRequest
- type SignInvoiceResponse
- type SignatureResponse
- type SigningJob
- type SigningRequest
- type SigningResponse
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateWitnessHash ¶ added in v0.13.0
func CalculateWitnessHashPSBT ¶ added in v0.13.0
func DeclineToSignMessages ¶
func DeclineToSignMessages(client *services.LightsparkClient, event webhooks.WebhookEvent) (string, error)
func GetPaymentHashFromScript ¶ added in v0.7.0
func HandleRemoteSigningWebhook ¶
func HandleRemoteSigningWebhook( client *services.LightsparkClient, validator Validator, webhook webhooks.WebhookEvent, seedBytes []byte, ) (string, error)
HandleRemoteSigningWebhook handles a webhook event that is related to remote signing.
This method should only be called with a webhook event that has the event_type `WebhookEventTypeRemoteSigning`. The method will call the appropriate handler for the sub_event_type of the webhook.
Args:
client: The LightsparkClient used to respond to webhook events. validator: A validator for deciding whether to sign events. webhook: The webhook event that you want to handle. seedBytes: The bytes of the master seed that you want to use to sign messages or derive keys.
func HandleSigningResponse ¶ added in v0.5.0
func HandleSigningResponse(client *services.LightsparkClient, response SigningResponse) (string, error)
Types ¶
type DeriveKeyAndSignRequest ¶ added in v0.5.0
type DeriveKeyAndSignRequest struct { SigningJobs []SigningJob BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for a key to be derived and used to sign a message.
func ParseDeriveAndSignRequest ¶ added in v0.5.0
func ParseDeriveAndSignRequest(webhook webhooks.WebhookEvent) (*DeriveKeyAndSignRequest, error)
func (*DeriveKeyAndSignRequest) Type ¶ added in v0.5.0
func (r *DeriveKeyAndSignRequest) Type() objects.RemoteSigningSubEventType
type DeriveKeyAndSignResponse ¶ added in v0.5.0
type DeriveKeyAndSignResponse struct {
Signatures []SignatureResponse
}
func HandleDeriveKeyAndSignRequest ¶ added in v0.5.0
func HandleDeriveKeyAndSignRequest(request *DeriveKeyAndSignRequest, seedBytes []byte) (*DeriveKeyAndSignResponse, error)
func (DeriveKeyAndSignResponse) GraphqlResponse ¶ added in v0.5.0
func (r DeriveKeyAndSignResponse) GraphqlResponse() *GraphQLResponse
type ECDHRequest ¶ added in v0.5.0
type ECDHRequest struct { NodeId string PeerPubKeyHex string BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for a shared secret to be computed using Eliptic Curve Diffie-Hellman. The shared secret is computed using your node's identity private key and the peer's public key. This request is only for nodes created before 10/06/2023.
func ParseECDHRequest ¶ added in v0.5.0
func ParseECDHRequest(webhook webhooks.WebhookEvent) (*ECDHRequest, error)
func (*ECDHRequest) Type ¶ added in v0.5.0
func (r *ECDHRequest) Type() objects.RemoteSigningSubEventType
type ECDHResponse ¶ added in v0.5.0
type ECDHResponse struct { NodeId string }
func HandleEcdhRequest ¶ added in v0.5.0
func HandleEcdhRequest(request *ECDHRequest, seedBytes []byte) (*ECDHResponse, error)
func (ECDHResponse) GraphqlResponse ¶ added in v0.5.0
func (r ECDHResponse) GraphqlResponse() *GraphQLResponse
type GetPerCommitmentPointRequest ¶ added in v0.5.0
type GetPerCommitmentPointRequest struct { ChannelId string DerivationPath string PerCommitmentPointIdx uint64 NodeId string BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for a per-commitment point for a particular channel. The per-commitment point is the point on the secp256k1 curve for the commitment secret described in bolt 3.
func ParseGetPerCommitmentPointRequest ¶ added in v0.5.0
func ParseGetPerCommitmentPointRequest(webhook webhooks.WebhookEvent) (*GetPerCommitmentPointRequest, error)
func (*GetPerCommitmentPointRequest) Type ¶ added in v0.5.0
func (r *GetPerCommitmentPointRequest) Type() objects.RemoteSigningSubEventType
type GetPerCommitmentPointResponse ¶ added in v0.5.0
type GetPerCommitmentPointResponse struct { ChannelId string PerCommitmentPointIdx uint64 PerCommitmentPointHex string }
func HandleGetPerCommitmentPointRequest ¶ added in v0.5.0
func HandleGetPerCommitmentPointRequest(request *GetPerCommitmentPointRequest, seedBytes []byte) (*GetPerCommitmentPointResponse, error)
func (GetPerCommitmentPointResponse) GraphqlResponse ¶ added in v0.5.0
func (r GetPerCommitmentPointResponse) GraphqlResponse() *GraphQLResponse
type GraphQLResponse ¶ added in v0.5.0
type HashValidator ¶ added in v0.13.0
type HashValidator struct{}
func (HashValidator) ShouldSign ¶ added in v0.13.0
func (v HashValidator) ShouldSign(webhookEvent webhooks.WebhookEvent) bool
type InvoicePaymentHashRequest ¶ added in v0.5.0
type InvoicePaymentHashRequest struct { InvoiceId string BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for a payment hash. A payment hash is the hash of a payment preimage. The payment preimage is the secret that is revealed when a payment is made on the Lightning Network.
func ParseRequestInvoicePaymentHashRequest ¶ added in v0.5.0
func ParseRequestInvoicePaymentHashRequest(webhook webhooks.WebhookEvent) (*InvoicePaymentHashRequest, error)
func (*InvoicePaymentHashRequest) Type ¶ added in v0.5.0
func (r *InvoicePaymentHashRequest) Type() objects.RemoteSigningSubEventType
type InvoicePaymentHashResponse ¶ added in v0.5.0
func HandleInvoicePaymentHashRequest ¶ added in v0.5.0
func HandleInvoicePaymentHashRequest(request *InvoicePaymentHashRequest, seedBytes []byte) (*InvoicePaymentHashResponse, error)
func (InvoicePaymentHashResponse) GraphqlResponse ¶ added in v0.5.0
func (r InvoicePaymentHashResponse) GraphqlResponse() *GraphQLResponse
type PositiveValidator ¶
type PositiveValidator struct{}
func (PositiveValidator) ShouldSign ¶
func (v PositiveValidator) ShouldSign(webhooks.WebhookEvent) bool
type ReleaseCounterpartyPerCommitmentSecretRequest ¶ added in v0.5.0
type ReleaseCounterpartyPerCommitmentSecretRequest struct { ChannelId string PerCommitmentSecretIdx uint64 PerCommitmentSecret string NodeId string }
A informational request that reveals counterparty per-commitment secret.
func ParseReleaseCounterpartyPerCommitmentSecretRequest ¶ added in v0.5.0
func ParseReleaseCounterpartyPerCommitmentSecretRequest(webhook webhooks.WebhookEvent) (*ReleaseCounterpartyPerCommitmentSecretRequest, error)
type ReleasePaymentPreimageRequest ¶ added in v0.5.0
type ReleasePaymentPreimageRequest struct { InvoiceId string Nonce *string BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for a payment preimage to be released.
func ParseReleasePaymentPreimageRequest ¶ added in v0.5.0
func ParseReleasePaymentPreimageRequest(webhook webhooks.WebhookEvent) (*ReleasePaymentPreimageRequest, error)
func (*ReleasePaymentPreimageRequest) Type ¶ added in v0.5.0
func (r *ReleasePaymentPreimageRequest) Type() objects.RemoteSigningSubEventType
type ReleasePaymentPreimageResponse ¶ added in v0.5.0
func HandleReleaseInvoicePreimageRequest ¶ added in v0.5.0
func HandleReleaseInvoicePreimageRequest(request *ReleasePaymentPreimageRequest, seedBytes []byte) (*ReleasePaymentPreimageResponse, error)
func (ReleasePaymentPreimageResponse) GraphqlResponse ¶ added in v0.5.0
func (r ReleasePaymentPreimageResponse) GraphqlResponse() *GraphQLResponse
type ReleasePerCommitmentSecretRequest ¶ added in v0.5.0
type ReleasePerCommitmentSecretRequest struct { ChannelId string DerivationPath string PerCommitmentPointIdx uint64 NodeId string BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for a per-commitment secret to be released for a particular channel. The per-commitment secret is the secret described in bolt 3.
func ParseReleasePerCommitmentSecretRequest ¶ added in v0.5.0
func ParseReleasePerCommitmentSecretRequest(webhook webhooks.WebhookEvent) (*ReleasePerCommitmentSecretRequest, error)
func (*ReleasePerCommitmentSecretRequest) Type ¶ added in v0.5.0
func (r *ReleasePerCommitmentSecretRequest) Type() objects.RemoteSigningSubEventType
type ReleasePerCommitmentSecretResponse ¶ added in v0.5.0
type ReleasePerCommitmentSecretResponse struct { ChannelId string PerCommitmentPointIdx uint64 PerCommitmentSecret string }
func HandleReleasePerCommitmentSecretRequest ¶ added in v0.5.0
func HandleReleasePerCommitmentSecretRequest(request *ReleasePerCommitmentSecretRequest, seedBytes []byte) (*ReleasePerCommitmentSecretResponse, error)
func (ReleasePerCommitmentSecretResponse) GraphqlResponse ¶ added in v0.5.0
func (r ReleasePerCommitmentSecretResponse) GraphqlResponse() *GraphQLResponse
type SignInvoiceRequest ¶ added in v0.5.0
type SignInvoiceRequest struct { InvoiceId string PaymentRequestHash string BitcoinNetwork objects.BitcoinNetwork }
A signing request asking for an invoice to be signed. The invoice is signed using the node's identity private key. This request is only for nodes created before 10/06/2023.
func ParseSignInvoiceRequest ¶ added in v0.5.0
func ParseSignInvoiceRequest(webhook webhooks.WebhookEvent) (*SignInvoiceRequest, error)
func (*SignInvoiceRequest) Type ¶ added in v0.5.0
func (r *SignInvoiceRequest) Type() objects.RemoteSigningSubEventType
type SignInvoiceResponse ¶ added in v0.5.0
func HandleSignInvoiceRequest ¶ added in v0.5.0
func HandleSignInvoiceRequest(request *SignInvoiceRequest, seedBytes []byte) (*SignInvoiceResponse, error)
func (SignInvoiceResponse) GraphqlResponse ¶ added in v0.5.0
func (r SignInvoiceResponse) GraphqlResponse() *GraphQLResponse
type SignatureResponse ¶ added in v0.5.0
SignatureResponse A separate type is required for the response because the json field names are different from objects.Signature.
type SigningJob ¶
type SigningJob struct { Id string `json:"id"` DerivationPath string `json:"derivation_path"` Message string `json:"message"` AddTweak *string `json:"add_tweak"` MulTweak *string `json:"mul_tweak"` Script *string `json:"script"` Transaction *string `json:"transaction"` Amount *int64 `json:"amount"` }
A signing job is a request to sign a message with a particular key. The signig key is computed using the node's master key and the parameter. DerivationPath is the bip32 derivation path to get the key from the master key `k`. Then apply MulTweak * k + AddTweak to get the final signing key.
func (*SigningJob) AddTweakBytes ¶
func (j *SigningJob) AddTweakBytes() ([]byte, error)
func (*SigningJob) MessageBytes ¶
func (j *SigningJob) MessageBytes() ([]byte, error)
func (*SigningJob) MulTweakBytes ¶
func (j *SigningJob) MulTweakBytes() ([]byte, error)
type SigningRequest ¶ added in v0.5.0
type SigningRequest interface {
Type() objects.RemoteSigningSubEventType
}
func ParseRemoteSigningRequest ¶ added in v0.5.0
func ParseRemoteSigningRequest(webhook webhooks.WebhookEvent) (SigningRequest, error)
type SigningResponse ¶ added in v0.5.0
type SigningResponse interface {
GraphqlResponse() *GraphQLResponse
}
func GraphQLResponseForRemoteSigningWebhook ¶ added in v0.12.0
func GraphQLResponseForRemoteSigningWebhook( validator Validator, webhook webhooks.WebhookEvent, seedBytes []byte, ) (SigningResponse, error)
func HandleSigningRequest ¶ added in v0.5.0
func HandleSigningRequest(request SigningRequest, seedBytes []byte) (SigningResponse, error)
type Validator ¶
type Validator interface {
ShouldSign(webhookEvent webhooks.WebhookEvent) bool
}
Validator an interface which decides whether to sign or reject a remote signing webhook event.