signrpc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package signrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultSignerMacFilename is the default name of the signer macaroon
	// that we expect to find via a file handle within the main
	// configuration file in this package.
	DefaultSignerMacFilename = "signer.macaroon"
)
View Source
var File_signrpc_signer_proto protoreflect.FileDescriptor

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func RegisterSignerHandler added in v0.3.0

func RegisterSignerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterSignerHandler registers the http handlers for service Signer to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterSignerHandlerClient added in v0.3.0

func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SignerClient) error

RegisterSignerHandlerClient registers the http handlers for service Signer to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SignerClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SignerClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "SignerClient" to call the correct interceptors.

func RegisterSignerHandlerFromEndpoint added in v0.3.0

func RegisterSignerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterSignerHandlerFromEndpoint is same as RegisterSignerHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterSignerHandlerServer added in v0.3.0

func RegisterSignerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SignerServer) error

RegisterSignerHandlerServer registers the http handlers for service Signer to "mux". UnaryRPC :call SignerServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSignerHandlerFromEndpoint instead.

func RegisterSignerServer

func RegisterSignerServer(s *grpc.Server, srv SignerServer)

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Config

type Config struct {
	// SignerMacPath is the path for the signer macaroon. If unspecified
	// then we assume that the macaroon will be found under the network
	// directory, named DefaultSignerMacFilename.
	SignerMacPath string `long:"signermacaroonpath" description:"Path to the signer macaroon"`

	// NetworkDir is the main network directory wherein the signer rpc
	// server will find the macaroon named DefaultSignerMacFilename.
	NetworkDir string

	// MacService is the main macaroon service that we'll use to handle
	// authentication for the signer rpc server.
	MacService *macaroons.Service

	// Signer is the signer instance that backs the signer RPC server. The
	// job of the signer RPC server is simply to proxy valid requests to
	// the active signer instance.
	Signer input.Signer

	// KeyRing is an interface that the signer will use to derive any keys
	// for signing messages.
	KeyRing keychain.SecretKeyRing
}

Config is the primary configuration struct for the signer RPC server. It contains all the items required for the signer rpc server to carry out its duties. The fields with struct tags are meant to be parsed as normal configuration options, while if able to be populated, the latter fields MUST also be specified.

type InputScript

type InputScript struct {

	// The serializes witness stack for the specified input.
	Witness [][]byte `protobuf:"bytes,1,rep,name=witness,proto3" json:"witness,omitempty"`
	// The optional sig script for the specified witness that will only be set if
	// the input specified is a nested p2sh witness program.
	SigScript []byte `protobuf:"bytes,2,opt,name=sig_script,json=sigScript,proto3" json:"sig_script,omitempty"`
	// contains filtered or unexported fields
}

func (*InputScript) Descriptor deprecated

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

Deprecated: Use InputScript.ProtoReflect.Descriptor instead.

func (*InputScript) GetSigScript

func (x *InputScript) GetSigScript() []byte

func (*InputScript) GetWitness

func (x *InputScript) GetWitness() [][]byte

func (*InputScript) ProtoMessage

func (*InputScript) ProtoMessage()

func (*InputScript) ProtoReflect added in v0.3.0

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

func (*InputScript) Reset

func (x *InputScript) Reset()

func (*InputScript) String

func (x *InputScript) String() string

type InputScriptResp

type InputScriptResp struct {

	// The set of fully valid input scripts requested.
	InputScripts []*InputScript `protobuf:"bytes,1,rep,name=input_scripts,json=inputScripts,proto3" json:"input_scripts,omitempty"`
	// contains filtered or unexported fields
}

func (*InputScriptResp) Descriptor deprecated

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

Deprecated: Use InputScriptResp.ProtoReflect.Descriptor instead.

func (*InputScriptResp) GetInputScripts

func (x *InputScriptResp) GetInputScripts() []*InputScript

func (*InputScriptResp) ProtoMessage

func (*InputScriptResp) ProtoMessage()

func (*InputScriptResp) ProtoReflect added in v0.3.0

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

func (*InputScriptResp) Reset

func (x *InputScriptResp) Reset()

func (*InputScriptResp) String

func (x *InputScriptResp) String() string

type KeyDescriptor

type KeyDescriptor struct {

	// The raw bytes of the public key in the key pair being identified. Either
	// this or the KeyLocator must be specified.
	RawKeyBytes []byte `protobuf:"bytes,1,opt,name=raw_key_bytes,json=rawKeyBytes,proto3" json:"raw_key_bytes,omitempty"`
	// The key locator that identifies which private key to use for signing.
	// Either this or the raw bytes of the target public key must be specified.
	KeyLoc *KeyLocator `protobuf:"bytes,2,opt,name=key_loc,json=keyLoc,proto3" json:"key_loc,omitempty"`
	// contains filtered or unexported fields
}

func (*KeyDescriptor) Descriptor deprecated

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

Deprecated: Use KeyDescriptor.ProtoReflect.Descriptor instead.

func (*KeyDescriptor) GetKeyLoc

func (x *KeyDescriptor) GetKeyLoc() *KeyLocator

func (*KeyDescriptor) GetRawKeyBytes

func (x *KeyDescriptor) GetRawKeyBytes() []byte

func (*KeyDescriptor) ProtoMessage

func (*KeyDescriptor) ProtoMessage()

func (*KeyDescriptor) ProtoReflect added in v0.3.0

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

func (*KeyDescriptor) Reset

func (x *KeyDescriptor) Reset()

func (*KeyDescriptor) String

func (x *KeyDescriptor) String() string

type KeyLocator

type KeyLocator struct {

	// The family of key being identified.
	KeyFamily int32 `protobuf:"varint,1,opt,name=key_family,json=keyFamily,proto3" json:"key_family,omitempty"`
	// The precise index of the key being identified.
	KeyIndex int32 `protobuf:"varint,2,opt,name=key_index,json=keyIndex,proto3" json:"key_index,omitempty"`
	// contains filtered or unexported fields
}

func (*KeyLocator) Descriptor deprecated

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

Deprecated: Use KeyLocator.ProtoReflect.Descriptor instead.

func (*KeyLocator) GetKeyFamily

func (x *KeyLocator) GetKeyFamily() int32

func (*KeyLocator) GetKeyIndex

func (x *KeyLocator) GetKeyIndex() int32

func (*KeyLocator) ProtoMessage

func (*KeyLocator) ProtoMessage()

func (*KeyLocator) ProtoReflect added in v0.3.0

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

func (*KeyLocator) Reset

func (x *KeyLocator) Reset()

func (*KeyLocator) String

func (x *KeyLocator) String() string

type Server added in v0.3.0

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

Server is a sub-server of the main RPC server: the signer RPC. This sub RPC server allows external callers to access the full signing capabilities of lnd. This allows callers to create custom protocols, external to lnd, even backed by multiple distinct lnd across independent failure domains.

func New added in v0.3.0

func New(cfg *Config) (*Server, lnrpc.MacaroonPerms, error)

New returns a new instance of the signrpc Signer sub-server. We also return the set of permissions for the macaroons that we may create within this method. If the macaroons we need aren't found in the filepath, then we'll create them on start up. If we're unable to locate, or create the macaroons we need, then we'll return with an error.

func (*Server) ComputeInputScript added in v0.3.0

func (s *Server) ComputeInputScript(ctx context.Context,
	in *SignReq) (*InputScriptResp, error)

ComputeInputScript generates a complete InputIndex for the passed transaction with the signature as defined within the passed SignDescriptor. This method should be capable of generating the proper input script for both regular p2wkh output and p2wkh outputs nested within a regular p2sh output.

Note that when using this method to sign inputs belonging to the wallet, the only items of the SignDescriptor that need to be populated are pkScript in the TxOut field, the value in that same field, and finally the input index.

func (*Server) DeriveSharedKey added in v0.3.0

func (s *Server) DeriveSharedKey(_ context.Context, in *SharedKeyRequest) (
	*SharedKeyResponse, error)

DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key derivation between the ephemeral public key in the request and the node's key specified in the key_desc parameter. Either a key locator or a raw public key is expected in the key_desc, if neither is supplied, defaults to the node's identity private key. The old key_loc parameter in the request shouldn't be used anymore. The resulting shared public key is serialized in the compressed format and hashed with sha256, resulting in the final key length of 256bit.

func (*Server) Name added in v0.3.0

func (s *Server) Name() string

Name returns a unique string representation of the sub-server. This can be used to identify the sub-server and also de-duplicate them.

NOTE: This is part of the lnrpc.SubServer interface.

func (*Server) SignMessage added in v0.3.0

func (s *Server) SignMessage(_ context.Context,
	in *SignMessageReq) (*SignMessageResp, error)

SignMessage signs a message with the key specified in the key locator. The returned signature is fixed-size LN wire format encoded.

func (*Server) SignOutputRaw added in v0.3.0

func (s *Server) SignOutputRaw(ctx context.Context, in *SignReq) (*SignResp,
	error)

SignOutputRaw generates a signature for the passed transaction according to the data within the passed SignReq. If we're unable to find the keys that correspond to the KeyLocators in the SignReq then we'll return an error. Additionally, if the user doesn't provide the set of required parameters, or provides an invalid transaction, then we'll return with an error.

NOTE: The resulting signature should be void of a sighash byte.

func (*Server) Start added in v0.3.0

func (s *Server) Start() error

Start launches any helper goroutines required for the rpcServer to function.

NOTE: This is part of the lnrpc.SubServer interface.

func (*Server) Stop added in v0.3.0

func (s *Server) Stop() error

Stop signals any active goroutines for a graceful closure.

NOTE: This is part of the lnrpc.SubServer interface.

func (*Server) VerifyMessage added in v0.3.0

func (s *Server) VerifyMessage(ctx context.Context,
	in *VerifyMessageReq) (*VerifyMessageResp, error)

VerifyMessage verifies a signature over a message using the public key provided. The signature must be fixed-size LN wire format encoded.

type ServerShell added in v0.5.0

type ServerShell struct {
	SignerServer
}

ServerShell is a shell struct holding a reference to the actual sub-server. It is used to register the gRPC sub-server with the root server before we have the necessary dependencies to populate the actual sub-server.

func (*ServerShell) CreateSubServer added in v0.5.0

func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispatcher) (
	lnrpc.SubServer, lnrpc.MacaroonPerms, error)

CreateSubServer populates the subserver's dependencies using the passed SubServerConfigDispatcher. This method should fully initialize the sub-server instance, making it ready for action. It returns the macaroon permissions that the sub-server wishes to pass on to the root server for all methods routed towards it.

NOTE: This is part of the lnrpc.GrpcHandler interface.

func (*ServerShell) RegisterWithRestServer added in v0.5.0

func (r *ServerShell) RegisterWithRestServer(ctx context.Context,
	mux *runtime.ServeMux, dest string, opts []grpc.DialOption) error

RegisterWithRestServer will be called by the root REST mux to direct a sub RPC server to register itself with the main REST mux server. Until this is called, each sub-server won't be able to have requests routed towards it.

NOTE: This is part of the lnrpc.GrpcHandler interface.

func (*ServerShell) RegisterWithRootServer added in v0.5.0

func (r *ServerShell) RegisterWithRootServer(grpcServer *grpc.Server) error

RegisterWithRootServer will be called by the root gRPC server to direct a sub RPC server to register itself with the main gRPC root server. Until this is called, each sub-server won't be able to have requests routed towards it.

NOTE: This is part of the lnrpc.GrpcHandler interface.

type SharedKeyRequest added in v0.3.0

type SharedKeyRequest struct {

	// The ephemeral public key to use for the DH key derivation.
	EphemeralPubkey []byte `protobuf:"bytes,1,opt,name=ephemeral_pubkey,json=ephemeralPubkey,proto3" json:"ephemeral_pubkey,omitempty"`
	// Deprecated. The optional key locator of the local key that should be used.
	// If this parameter is not set then the node's identity private key will be
	// used.
	//
	// Deprecated: Marked as deprecated in signrpc/signer.proto.
	KeyLoc *KeyLocator `protobuf:"bytes,2,opt,name=key_loc,json=keyLoc,proto3" json:"key_loc,omitempty"`
	// A key descriptor describes the key used for performing ECDH. Either a key
	// locator or a raw public key is expected, if neither is supplied, defaults to
	// the node's identity private key.
	KeyDesc *KeyDescriptor `protobuf:"bytes,3,opt,name=key_desc,json=keyDesc,proto3" json:"key_desc,omitempty"`
	// contains filtered or unexported fields
}

func (*SharedKeyRequest) Descriptor deprecated added in v0.3.0

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

Deprecated: Use SharedKeyRequest.ProtoReflect.Descriptor instead.

func (*SharedKeyRequest) GetEphemeralPubkey added in v0.3.0

func (x *SharedKeyRequest) GetEphemeralPubkey() []byte

func (*SharedKeyRequest) GetKeyDesc added in v0.5.0

func (x *SharedKeyRequest) GetKeyDesc() *KeyDescriptor

func (*SharedKeyRequest) GetKeyLoc deprecated added in v0.3.0

func (x *SharedKeyRequest) GetKeyLoc() *KeyLocator

Deprecated: Marked as deprecated in signrpc/signer.proto.

func (*SharedKeyRequest) ProtoMessage added in v0.3.0

func (*SharedKeyRequest) ProtoMessage()

func (*SharedKeyRequest) ProtoReflect added in v0.3.0

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

func (*SharedKeyRequest) Reset added in v0.3.0

func (x *SharedKeyRequest) Reset()

func (*SharedKeyRequest) String added in v0.3.0

func (x *SharedKeyRequest) String() string

type SharedKeyResponse added in v0.3.0

type SharedKeyResponse struct {

	// The shared public key, hashed with sha256.
	SharedKey []byte `protobuf:"bytes,1,opt,name=shared_key,json=sharedKey,proto3" json:"shared_key,omitempty"`
	// contains filtered or unexported fields
}

func (*SharedKeyResponse) Descriptor deprecated added in v0.3.0

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

Deprecated: Use SharedKeyResponse.ProtoReflect.Descriptor instead.

func (*SharedKeyResponse) GetSharedKey added in v0.3.0

func (x *SharedKeyResponse) GetSharedKey() []byte

func (*SharedKeyResponse) ProtoMessage added in v0.3.0

func (*SharedKeyResponse) ProtoMessage()

func (*SharedKeyResponse) ProtoReflect added in v0.3.0

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

func (*SharedKeyResponse) Reset added in v0.3.0

func (x *SharedKeyResponse) Reset()

func (*SharedKeyResponse) String added in v0.3.0

func (x *SharedKeyResponse) String() string

type SignDescriptor

type SignDescriptor struct {

	// A descriptor that precisely describes *which* key to use for signing. This
	// may provide the raw public key directly, or require the Signer to re-derive
	// the key according to the populated derivation path.
	//
	// Note that if the key descriptor was obtained through walletrpc.DeriveKey,
	// then the key locator MUST always be provided, since the derived keys are not
	// persisted unlike with DeriveNextKey.
	KeyDesc *KeyDescriptor `protobuf:"bytes,1,opt,name=key_desc,json=keyDesc,proto3" json:"key_desc,omitempty"`
	// A scalar value that will be added to the private key corresponding to the
	// above public key to obtain the private key to be used to sign this input.
	// This value is typically derived via the following computation:
	//
	// derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N
	SingleTweak []byte `protobuf:"bytes,2,opt,name=single_tweak,json=singleTweak,proto3" json:"single_tweak,omitempty"`
	// A private key that will be used in combination with its corresponding
	// private key to derive the private key that is to be used to sign the target
	// input. Within the Lightning protocol, this value is typically the
	// commitment secret from a previously revoked commitment transaction. This
	// value is in combination with two hash values, and the original private key
	// to derive the private key to be used when signing.
	//
	// k = (privKey*sha256(pubKey || tweakPub) +
	// tweakPriv*sha256(tweakPub || pubKey)) mod N
	DoubleTweak []byte `protobuf:"bytes,3,opt,name=double_tweak,json=doubleTweak,proto3" json:"double_tweak,omitempty"`
	// The full script required to properly redeem the output.  This field will
	// only be populated if a p2wsh or a p2sh output is being signed.
	WitnessScript []byte `protobuf:"bytes,4,opt,name=witness_script,json=witnessScript,proto3" json:"witness_script,omitempty"`
	// A description of the output being spent. The value and script MUST be
	// provided.
	Output *TxOut `protobuf:"bytes,5,opt,name=output,proto3" json:"output,omitempty"`
	// The target sighash type that should be used when generating the final
	// sighash, and signature.
	Sighash uint32 `protobuf:"varint,7,opt,name=sighash,proto3" json:"sighash,omitempty"`
	// The target input within the transaction that should be signed.
	InputIndex int32 `protobuf:"varint,8,opt,name=input_index,json=inputIndex,proto3" json:"input_index,omitempty"`
	// contains filtered or unexported fields
}

func (*SignDescriptor) Descriptor deprecated

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

Deprecated: Use SignDescriptor.ProtoReflect.Descriptor instead.

func (*SignDescriptor) GetDoubleTweak

func (x *SignDescriptor) GetDoubleTweak() []byte

func (*SignDescriptor) GetInputIndex

func (x *SignDescriptor) GetInputIndex() int32

func (*SignDescriptor) GetKeyDesc

func (x *SignDescriptor) GetKeyDesc() *KeyDescriptor

func (*SignDescriptor) GetOutput

func (x *SignDescriptor) GetOutput() *TxOut

func (*SignDescriptor) GetSighash

func (x *SignDescriptor) GetSighash() uint32

func (*SignDescriptor) GetSingleTweak

func (x *SignDescriptor) GetSingleTweak() []byte

func (*SignDescriptor) GetWitnessScript

func (x *SignDescriptor) GetWitnessScript() []byte

func (*SignDescriptor) ProtoMessage

func (*SignDescriptor) ProtoMessage()

func (*SignDescriptor) ProtoReflect added in v0.3.0

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

func (*SignDescriptor) Reset

func (x *SignDescriptor) Reset()

func (*SignDescriptor) String

func (x *SignDescriptor) String() string

type SignMessageReq added in v0.3.0

type SignMessageReq struct {

	// The message to be signed.
	Msg []byte `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// The key locator that identifies which key to use for signing.
	KeyLoc *KeyLocator `protobuf:"bytes,2,opt,name=key_loc,json=keyLoc,proto3" json:"key_loc,omitempty"`
	// Double-SHA256 hash instead of just the default single round.
	DoubleHash bool `protobuf:"varint,3,opt,name=double_hash,json=doubleHash,proto3" json:"double_hash,omitempty"`
	// Use the compact (pubkey recoverable) format instead of the raw lnwire
	// format.
	CompactSig bool `protobuf:"varint,4,opt,name=compact_sig,json=compactSig,proto3" json:"compact_sig,omitempty"`
	// contains filtered or unexported fields
}

func (*SignMessageReq) Descriptor deprecated added in v0.3.0

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

Deprecated: Use SignMessageReq.ProtoReflect.Descriptor instead.

func (*SignMessageReq) GetCompactSig added in v0.6.0

func (x *SignMessageReq) GetCompactSig() bool

func (*SignMessageReq) GetDoubleHash added in v0.6.0

func (x *SignMessageReq) GetDoubleHash() bool

func (*SignMessageReq) GetKeyLoc added in v0.3.0

func (x *SignMessageReq) GetKeyLoc() *KeyLocator

func (*SignMessageReq) GetMsg added in v0.3.0

func (x *SignMessageReq) GetMsg() []byte

func (*SignMessageReq) ProtoMessage added in v0.3.0

func (*SignMessageReq) ProtoMessage()

func (*SignMessageReq) ProtoReflect added in v0.3.0

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

func (*SignMessageReq) Reset added in v0.3.0

func (x *SignMessageReq) Reset()

func (*SignMessageReq) String added in v0.3.0

func (x *SignMessageReq) String() string

type SignMessageResp added in v0.3.0

type SignMessageResp struct {

	// The signature for the given message in the fixed-size LN wire format.
	Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*SignMessageResp) Descriptor deprecated added in v0.3.0

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

Deprecated: Use SignMessageResp.ProtoReflect.Descriptor instead.

func (*SignMessageResp) GetSignature added in v0.3.0

func (x *SignMessageResp) GetSignature() []byte

func (*SignMessageResp) ProtoMessage added in v0.3.0

func (*SignMessageResp) ProtoMessage()

func (*SignMessageResp) ProtoReflect added in v0.3.0

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

func (*SignMessageResp) Reset added in v0.3.0

func (x *SignMessageResp) Reset()

func (*SignMessageResp) String added in v0.3.0

func (x *SignMessageResp) String() string

type SignReq

type SignReq struct {

	// The raw bytes of the transaction to be signed.
	RawTxBytes []byte `protobuf:"bytes,1,opt,name=raw_tx_bytes,json=rawTxBytes,proto3" json:"raw_tx_bytes,omitempty"`
	// A set of sign descriptors, for each input to be signed.
	SignDescs []*SignDescriptor `protobuf:"bytes,2,rep,name=sign_descs,json=signDescs,proto3" json:"sign_descs,omitempty"`
	// contains filtered or unexported fields
}

func (*SignReq) Descriptor deprecated

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

Deprecated: Use SignReq.ProtoReflect.Descriptor instead.

func (*SignReq) GetRawTxBytes

func (x *SignReq) GetRawTxBytes() []byte

func (*SignReq) GetSignDescs

func (x *SignReq) GetSignDescs() []*SignDescriptor

func (*SignReq) ProtoMessage

func (*SignReq) ProtoMessage()

func (*SignReq) ProtoReflect added in v0.3.0

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

func (*SignReq) Reset

func (x *SignReq) Reset()

func (*SignReq) String

func (x *SignReq) String() string

type SignResp

type SignResp struct {

	// A set of signatures realized in a fixed 64-byte format ordered in ascending
	// input order.
	RawSigs [][]byte `protobuf:"bytes,1,rep,name=raw_sigs,json=rawSigs,proto3" json:"raw_sigs,omitempty"`
	// contains filtered or unexported fields
}

func (*SignResp) Descriptor deprecated

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

Deprecated: Use SignResp.ProtoReflect.Descriptor instead.

func (*SignResp) GetRawSigs

func (x *SignResp) GetRawSigs() [][]byte

func (*SignResp) ProtoMessage

func (*SignResp) ProtoMessage()

func (*SignResp) ProtoReflect added in v0.3.0

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

func (*SignResp) Reset

func (x *SignResp) Reset()

func (*SignResp) String

func (x *SignResp) String() string

type SignerClient

type SignerClient interface {
	// SignOutputRaw is a method that can be used to generated a signature for a
	// set of inputs/outputs to a transaction. Each request specifies details
	// concerning how the outputs should be signed, which keys they should be
	// signed with, and also any optional tweaks. The return value is a fixed
	// 64-byte signature (the same format as we use on the wire in Lightning).
	//
	// If we are  unable to sign using the specified keys, then an error will be
	// returned.
	SignOutputRaw(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*SignResp, error)
	// ComputeInputScript generates a complete InputIndex for the passed
	// transaction with the signature as defined within the passed SignDescriptor.
	// This method should be capable of generating the proper input script for
	// both regular p2wkh output and p2wkh outputs nested within a regular p2sh
	// output.
	//
	// Note that when using this method to sign inputs belonging to the wallet,
	// the only items of the SignDescriptor that need to be populated are pkScript
	// in the TxOut field, the value in that same field, and finally the input
	// index.
	ComputeInputScript(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*InputScriptResp, error)
	// SignMessage signs a message with the key specified in the key locator. The
	// returned signature is fixed-size LN wire format encoded.
	//
	// The main difference to SignMessage in the main RPC is that a specific key is
	// used to sign the message instead of the node identity private key.
	SignMessage(ctx context.Context, in *SignMessageReq, opts ...grpc.CallOption) (*SignMessageResp, error)
	// VerifyMessage verifies a signature over a message using the public key
	// provided. The signature must be fixed-size LN wire format encoded.
	//
	// The main difference to VerifyMessage in the main RPC is that the public key
	// used to sign the message does not have to be a node known to the network.
	VerifyMessage(ctx context.Context, in *VerifyMessageReq, opts ...grpc.CallOption) (*VerifyMessageResp, error)
	// DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key
	// derivation between the ephemeral public key in the request and the node's
	// key specified in the key_desc parameter. Either a key locator or a raw
	// public key is expected in the key_desc, if neither is supplied, defaults to
	// the node's identity private key:
	// P_shared = privKeyNode * ephemeralPubkey
	// The resulting shared public key is serialized in the compressed format and
	// hashed with sha256, resulting in the final key length of 256bit.
	DeriveSharedKey(ctx context.Context, in *SharedKeyRequest, opts ...grpc.CallOption) (*SharedKeyResponse, error)
}

SignerClient is the client API for Signer service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewSignerClient

func NewSignerClient(cc grpc.ClientConnInterface) SignerClient

type SignerServer

type SignerServer interface {
	// SignOutputRaw is a method that can be used to generated a signature for a
	// set of inputs/outputs to a transaction. Each request specifies details
	// concerning how the outputs should be signed, which keys they should be
	// signed with, and also any optional tweaks. The return value is a fixed
	// 64-byte signature (the same format as we use on the wire in Lightning).
	//
	// If we are  unable to sign using the specified keys, then an error will be
	// returned.
	SignOutputRaw(context.Context, *SignReq) (*SignResp, error)
	// ComputeInputScript generates a complete InputIndex for the passed
	// transaction with the signature as defined within the passed SignDescriptor.
	// This method should be capable of generating the proper input script for
	// both regular p2wkh output and p2wkh outputs nested within a regular p2sh
	// output.
	//
	// Note that when using this method to sign inputs belonging to the wallet,
	// the only items of the SignDescriptor that need to be populated are pkScript
	// in the TxOut field, the value in that same field, and finally the input
	// index.
	ComputeInputScript(context.Context, *SignReq) (*InputScriptResp, error)
	// SignMessage signs a message with the key specified in the key locator. The
	// returned signature is fixed-size LN wire format encoded.
	//
	// The main difference to SignMessage in the main RPC is that a specific key is
	// used to sign the message instead of the node identity private key.
	SignMessage(context.Context, *SignMessageReq) (*SignMessageResp, error)
	// VerifyMessage verifies a signature over a message using the public key
	// provided. The signature must be fixed-size LN wire format encoded.
	//
	// The main difference to VerifyMessage in the main RPC is that the public key
	// used to sign the message does not have to be a node known to the network.
	VerifyMessage(context.Context, *VerifyMessageReq) (*VerifyMessageResp, error)
	// DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key
	// derivation between the ephemeral public key in the request and the node's
	// key specified in the key_desc parameter. Either a key locator or a raw
	// public key is expected in the key_desc, if neither is supplied, defaults to
	// the node's identity private key:
	// P_shared = privKeyNode * ephemeralPubkey
	// The resulting shared public key is serialized in the compressed format and
	// hashed with sha256, resulting in the final key length of 256bit.
	DeriveSharedKey(context.Context, *SharedKeyRequest) (*SharedKeyResponse, error)
}

SignerServer is the server API for Signer service.

type TxOut

type TxOut struct {

	// The value of the output being spent.
	Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
	// The script of the output being spent.
	PkScript []byte `protobuf:"bytes,2,opt,name=pk_script,json=pkScript,proto3" json:"pk_script,omitempty"`
	// contains filtered or unexported fields
}

func (*TxOut) Descriptor deprecated

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

Deprecated: Use TxOut.ProtoReflect.Descriptor instead.

func (*TxOut) GetPkScript

func (x *TxOut) GetPkScript() []byte

func (*TxOut) GetValue

func (x *TxOut) GetValue() int64

func (*TxOut) ProtoMessage

func (*TxOut) ProtoMessage()

func (*TxOut) ProtoReflect added in v0.3.0

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

func (*TxOut) Reset

func (x *TxOut) Reset()

func (*TxOut) String

func (x *TxOut) String() string

type UnimplementedSignerServer added in v0.3.0

type UnimplementedSignerServer struct {
}

UnimplementedSignerServer can be embedded to have forward compatible implementations.

func (*UnimplementedSignerServer) ComputeInputScript added in v0.3.0

func (*UnimplementedSignerServer) DeriveSharedKey added in v0.3.0

func (*UnimplementedSignerServer) SignMessage added in v0.3.0

func (*UnimplementedSignerServer) SignOutputRaw added in v0.3.0

func (*UnimplementedSignerServer) VerifyMessage added in v0.3.0

type VerifyMessageReq added in v0.3.0

type VerifyMessageReq struct {

	// The message over which the signature is to be verified.
	Msg []byte `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// The fixed-size LN wire encoded signature to be verified over the given
	// message.
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// The public key the signature has to be valid for.
	Pubkey []byte `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyMessageReq) Descriptor deprecated added in v0.3.0

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

Deprecated: Use VerifyMessageReq.ProtoReflect.Descriptor instead.

func (*VerifyMessageReq) GetMsg added in v0.3.0

func (x *VerifyMessageReq) GetMsg() []byte

func (*VerifyMessageReq) GetPubkey added in v0.3.0

func (x *VerifyMessageReq) GetPubkey() []byte

func (*VerifyMessageReq) GetSignature added in v0.3.0

func (x *VerifyMessageReq) GetSignature() []byte

func (*VerifyMessageReq) ProtoMessage added in v0.3.0

func (*VerifyMessageReq) ProtoMessage()

func (*VerifyMessageReq) ProtoReflect added in v0.3.0

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

func (*VerifyMessageReq) Reset added in v0.3.0

func (x *VerifyMessageReq) Reset()

func (*VerifyMessageReq) String added in v0.3.0

func (x *VerifyMessageReq) String() string

type VerifyMessageResp added in v0.3.0

type VerifyMessageResp struct {

	// Whether the signature was valid over the given message.
	Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
	// contains filtered or unexported fields
}

func (*VerifyMessageResp) Descriptor deprecated added in v0.3.0

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

Deprecated: Use VerifyMessageResp.ProtoReflect.Descriptor instead.

func (*VerifyMessageResp) GetValid added in v0.3.0

func (x *VerifyMessageResp) GetValid() bool

func (*VerifyMessageResp) ProtoMessage added in v0.3.0

func (*VerifyMessageResp) ProtoMessage()

func (*VerifyMessageResp) ProtoReflect added in v0.3.0

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

func (*VerifyMessageResp) Reset added in v0.3.0

func (x *VerifyMessageResp) Reset()

func (*VerifyMessageResp) String added in v0.3.0

func (x *VerifyMessageResp) String() string

Jump to

Keyboard shortcuts

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