lnrpc: update grpc-gateway library to v2
This commit is contained in:
70 files changed
+8799
-8287
No files matched your search
+1
-316
@@ -1,17 +1,12 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.23.0
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.6.1
|
||||
// source: signrpc/signer.proto
|
||||
|
||||
package signrpc
|
||||
|
||||
import (
|
||||
context "context"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
@@ -25,10 +20,6 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type KeyLocator struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -1255,309 +1246,3 @@ func file_signrpc_signer_proto_init() {
|
||||
file_signrpc_signer_proto_goTypes = nil
|
||||
file_signrpc_signer_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// 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.
|
||||
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)
|
||||
}
|
||||
|
||||
type signerClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSignerClient(cc grpc.ClientConnInterface) SignerClient {
|
||||
return &signerClient{cc}
|
||||
}
|
||||
|
||||
func (c *signerClient) SignOutputRaw(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*SignResp, error) {
|
||||
out := new(SignResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/SignOutputRaw", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) ComputeInputScript(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*InputScriptResp, error) {
|
||||
out := new(InputScriptResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/ComputeInputScript", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) SignMessage(ctx context.Context, in *SignMessageReq, opts ...grpc.CallOption) (*SignMessageResp, error) {
|
||||
out := new(SignMessageResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/SignMessage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) VerifyMessage(ctx context.Context, in *VerifyMessageReq, opts ...grpc.CallOption) (*VerifyMessageResp, error) {
|
||||
out := new(VerifyMessageResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/VerifyMessage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) DeriveSharedKey(ctx context.Context, in *SharedKeyRequest, opts ...grpc.CallOption) (*SharedKeyResponse, error) {
|
||||
out := new(SharedKeyResponse)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/DeriveSharedKey", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SignerServer is the server API for Signer service.
|
||||
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)
|
||||
}
|
||||
|
||||
// UnimplementedSignerServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedSignerServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedSignerServer) SignOutputRaw(context.Context, *SignReq) (*SignResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignOutputRaw not implemented")
|
||||
}
|
||||
func (*UnimplementedSignerServer) ComputeInputScript(context.Context, *SignReq) (*InputScriptResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ComputeInputScript not implemented")
|
||||
}
|
||||
func (*UnimplementedSignerServer) SignMessage(context.Context, *SignMessageReq) (*SignMessageResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignMessage not implemented")
|
||||
}
|
||||
func (*UnimplementedSignerServer) VerifyMessage(context.Context, *VerifyMessageReq) (*VerifyMessageResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method VerifyMessage not implemented")
|
||||
}
|
||||
func (*UnimplementedSignerServer) DeriveSharedKey(context.Context, *SharedKeyRequest) (*SharedKeyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeriveSharedKey not implemented")
|
||||
}
|
||||
|
||||
func RegisterSignerServer(s *grpc.Server, srv SignerServer) {
|
||||
s.RegisterService(&_Signer_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Signer_SignOutputRaw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).SignOutputRaw(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/SignOutputRaw",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).SignOutputRaw(ctx, req.(*SignReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_ComputeInputScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).ComputeInputScript(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/ComputeInputScript",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).ComputeInputScript(ctx, req.(*SignReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_SignMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignMessageReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).SignMessage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/SignMessage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).SignMessage(ctx, req.(*SignMessageReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_VerifyMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(VerifyMessageReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).VerifyMessage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/VerifyMessage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).VerifyMessage(ctx, req.(*VerifyMessageReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_DeriveSharedKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SharedKeyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).DeriveSharedKey(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/DeriveSharedKey",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).DeriveSharedKey(ctx, req.(*SharedKeyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Signer_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "signrpc.Signer",
|
||||
HandlerType: (*SignerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SignOutputRaw",
|
||||
Handler: _Signer_SignOutputRaw_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ComputeInputScript",
|
||||
Handler: _Signer_ComputeInputScript_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SignMessage",
|
||||
Handler: _Signer_SignMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "VerifyMessage",
|
||||
Handler: _Signer_VerifyMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeriveSharedKey",
|
||||
Handler: _Signer_DeriveSharedKey_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "signrpc/signer.proto",
|
||||
}
|
||||
@@ -13,14 +13,14 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/golang/protobuf/descriptor"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/utilities"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/utilities"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// Suppress "imported and not used" errors
|
||||
@@ -29,7 +29,7 @@ var _ io.Reader
|
||||
var _ status.Status
|
||||
var _ = runtime.String
|
||||
var _ = utilities.NewDoubleArray
|
||||
var _ = descriptor.ForMessage
|
||||
var _ = metadata.Join
|
||||
|
||||
func request_Signer_SignOutputRaw_0(ctx context.Context, marshaler runtime.Marshaler, client SignerClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq SignReq
|
||||
@@ -204,18 +204,22 @@ func local_request_Signer_DeriveSharedKey_0(ctx context.Context, marshaler runti
|
||||
// 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 RegisterSignerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SignerServer) error {
|
||||
|
||||
mux.Handle("POST", pattern_Signer_SignOutputRaw_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signrpc.Signer/SignOutputRaw", runtime.WithHTTPPathPattern("/v2/signer/signraw"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Signer_SignOutputRaw_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -229,13 +233,16 @@ func RegisterSignerHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
|
||||
mux.Handle("POST", pattern_Signer_ComputeInputScript_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signrpc.Signer/ComputeInputScript", runtime.WithHTTPPathPattern("/v2/signer/inputscript"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Signer_ComputeInputScript_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -249,13 +256,16 @@ func RegisterSignerHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
|
||||
mux.Handle("POST", pattern_Signer_SignMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signrpc.Signer/SignMessage", runtime.WithHTTPPathPattern("/v2/signer/signmessage"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Signer_SignMessage_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -269,13 +279,16 @@ func RegisterSignerHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
|
||||
mux.Handle("POST", pattern_Signer_VerifyMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signrpc.Signer/VerifyMessage", runtime.WithHTTPPathPattern("/v2/signer/verifymessage"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Signer_VerifyMessage_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -289,13 +302,16 @@ func RegisterSignerHandlerServer(ctx context.Context, mux *runtime.ServeMux, ser
|
||||
mux.Handle("POST", pattern_Signer_DeriveSharedKey_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
var stream runtime.ServerTransportStream
|
||||
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signrpc.Signer/DeriveSharedKey", runtime.WithHTTPPathPattern("/v2/signer/sharedkey"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_Signer_DeriveSharedKey_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
@@ -351,7 +367,7 @@ func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signrpc.Signer/SignOutputRaw", runtime.WithHTTPPathPattern("/v2/signer/signraw"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -371,7 +387,7 @@ func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signrpc.Signer/ComputeInputScript", runtime.WithHTTPPathPattern("/v2/signer/inputscript"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -391,7 +407,7 @@ func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signrpc.Signer/SignMessage", runtime.WithHTTPPathPattern("/v2/signer/signmessage"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -411,7 +427,7 @@ func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signrpc.Signer/VerifyMessage", runtime.WithHTTPPathPattern("/v2/signer/verifymessage"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -431,7 +447,7 @@ func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signrpc.Signer/DeriveSharedKey", runtime.WithHTTPPathPattern("/v2/signer/sharedkey"))
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
@@ -451,15 +467,15 @@ func RegisterSignerHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli
|
||||
}
|
||||
|
||||
var (
|
||||
pattern_Signer_SignOutputRaw_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "signraw"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Signer_SignOutputRaw_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "signraw"}, ""))
|
||||
|
||||
pattern_Signer_ComputeInputScript_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "inputscript"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Signer_ComputeInputScript_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "inputscript"}, ""))
|
||||
|
||||
pattern_Signer_SignMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "signmessage"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Signer_SignMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "signmessage"}, ""))
|
||||
|
||||
pattern_Signer_VerifyMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "verifymessage"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Signer_VerifyMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "verifymessage"}, ""))
|
||||
|
||||
pattern_Signer_DeriveSharedKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "sharedkey"}, "", runtime.AssumeColonVerbOpt(true)))
|
||||
pattern_Signer_DeriveSharedKey_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "signer", "sharedkey"}, ""))
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -4,6 +4,11 @@
|
||||
"title": "signrpc/signer.proto",
|
||||
"version": "version not set"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "Signer"
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -15,7 +20,7 @@
|
||||
"post": {
|
||||
"summary": "ComputeInputScript generates a complete InputIndex for the passed\ntransaction with the signature as defined within the passed SignDescriptor.\nThis method should be capable of generating the proper input script for\nboth regular p2wkh output and p2wkh outputs nested within a regular p2sh\noutput.",
|
||||
"description": "Note that when using this method to sign inputs belonging to the wallet,\nthe only items of the SignDescriptor that need to be populated are pkScript\nin the TxOut field, the value in that same field, and finally the input\nindex.",
|
||||
"operationId": "ComputeInputScript",
|
||||
"operationId": "Signer_ComputeInputScript",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -24,9 +29,9 @@
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response",
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/runtimeError"
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -48,7 +53,7 @@
|
||||
"/v2/signer/sharedkey": {
|
||||
"post": {
|
||||
"summary": "DeriveSharedKey returns a shared secret key by performing Diffie-Hellman key\nderivation between the ephemeral public key in the request and the node's\nkey specified in the key_desc parameter. Either a key locator or a raw\npublic key is expected in the key_desc, if neither is supplied, defaults to\nthe node's identity private key:\nP_shared = privKeyNode * ephemeralPubkey\nThe resulting shared public key is serialized in the compressed format and\nhashed with sha256, resulting in the final key length of 256bit.",
|
||||
"operationId": "DeriveSharedKey",
|
||||
"operationId": "Signer_DeriveSharedKey",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -57,9 +62,9 @@
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response",
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/runtimeError"
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -82,7 +87,7 @@
|
||||
"post": {
|
||||
"summary": "SignMessage signs a message with the key specified in the key locator. The\nreturned signature is fixed-size LN wire format encoded.",
|
||||
"description": "The main difference to SignMessage in the main RPC is that a specific key is\nused to sign the message instead of the node identity private key.",
|
||||
"operationId": "SignMessage",
|
||||
"operationId": "Signer_SignMessage",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -91,9 +96,9 @@
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response",
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/runtimeError"
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -116,7 +121,7 @@
|
||||
"post": {
|
||||
"summary": "SignOutputRaw is a method that can be used to generated a signature for a\nset of inputs/outputs to a transaction. Each request specifies details\nconcerning how the outputs should be signed, which keys they should be\nsigned with, and also any optional tweaks. The return value is a fixed\n64-byte signature (the same format as we use on the wire in Lightning).",
|
||||
"description": "If we are unable to sign using the specified keys, then an error will be\nreturned.",
|
||||
"operationId": "SignOutputRaw",
|
||||
"operationId": "Signer_SignOutputRaw",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -125,9 +130,9 @@
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response",
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/runtimeError"
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -150,7 +155,7 @@
|
||||
"post": {
|
||||
"summary": "VerifyMessage verifies a signature over a message using the public key\nprovided. The signature must be fixed-size LN wire format encoded.",
|
||||
"description": "The main difference to VerifyMessage in the main RPC is that the public key\nused to sign the message does not have to be a node known to the network.",
|
||||
"operationId": "VerifyMessage",
|
||||
"operationId": "Signer_VerifyMessage",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
@@ -159,9 +164,9 @@
|
||||
}
|
||||
},
|
||||
"default": {
|
||||
"description": "An unexpected error response",
|
||||
"description": "An unexpected error response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/runtimeError"
|
||||
"$ref": "#/definitions/rpcStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -194,12 +199,9 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"runtimeError": {
|
||||
"rpcStatus": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"error": {
|
||||
"type": "string"
|
||||
},
|
||||
"code": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
@@ -435,7 +437,6 @@
|
||||
"properties": {
|
||||
"valid": {
|
||||
"type": "boolean",
|
||||
"format": "boolean",
|
||||
"description": "Whether the signature was valid over the given message."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
|
||||
package signrpc
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// SignerClient is the client API for Signer service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
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)
|
||||
}
|
||||
|
||||
type signerClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSignerClient(cc grpc.ClientConnInterface) SignerClient {
|
||||
return &signerClient{cc}
|
||||
}
|
||||
|
||||
func (c *signerClient) SignOutputRaw(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*SignResp, error) {
|
||||
out := new(SignResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/SignOutputRaw", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) ComputeInputScript(ctx context.Context, in *SignReq, opts ...grpc.CallOption) (*InputScriptResp, error) {
|
||||
out := new(InputScriptResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/ComputeInputScript", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) SignMessage(ctx context.Context, in *SignMessageReq, opts ...grpc.CallOption) (*SignMessageResp, error) {
|
||||
out := new(SignMessageResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/SignMessage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) VerifyMessage(ctx context.Context, in *VerifyMessageReq, opts ...grpc.CallOption) (*VerifyMessageResp, error) {
|
||||
out := new(VerifyMessageResp)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/VerifyMessage", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *signerClient) DeriveSharedKey(ctx context.Context, in *SharedKeyRequest, opts ...grpc.CallOption) (*SharedKeyResponse, error) {
|
||||
out := new(SharedKeyResponse)
|
||||
err := c.cc.Invoke(ctx, "/signrpc.Signer/DeriveSharedKey", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SignerServer is the server API for Signer service.
|
||||
// All implementations must embed UnimplementedSignerServer
|
||||
// for forward compatibility
|
||||
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)
|
||||
mustEmbedUnimplementedSignerServer()
|
||||
}
|
||||
|
||||
// UnimplementedSignerServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedSignerServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedSignerServer) SignOutputRaw(context.Context, *SignReq) (*SignResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignOutputRaw not implemented")
|
||||
}
|
||||
func (UnimplementedSignerServer) ComputeInputScript(context.Context, *SignReq) (*InputScriptResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ComputeInputScript not implemented")
|
||||
}
|
||||
func (UnimplementedSignerServer) SignMessage(context.Context, *SignMessageReq) (*SignMessageResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SignMessage not implemented")
|
||||
}
|
||||
func (UnimplementedSignerServer) VerifyMessage(context.Context, *VerifyMessageReq) (*VerifyMessageResp, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method VerifyMessage not implemented")
|
||||
}
|
||||
func (UnimplementedSignerServer) DeriveSharedKey(context.Context, *SharedKeyRequest) (*SharedKeyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeriveSharedKey not implemented")
|
||||
}
|
||||
func (UnimplementedSignerServer) mustEmbedUnimplementedSignerServer() {}
|
||||
|
||||
// UnsafeSignerServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to SignerServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeSignerServer interface {
|
||||
mustEmbedUnimplementedSignerServer()
|
||||
}
|
||||
|
||||
func RegisterSignerServer(s grpc.ServiceRegistrar, srv SignerServer) {
|
||||
s.RegisterService(&Signer_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Signer_SignOutputRaw_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).SignOutputRaw(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/SignOutputRaw",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).SignOutputRaw(ctx, req.(*SignReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_ComputeInputScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).ComputeInputScript(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/ComputeInputScript",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).ComputeInputScript(ctx, req.(*SignReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_SignMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SignMessageReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).SignMessage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/SignMessage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).SignMessage(ctx, req.(*SignMessageReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_VerifyMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(VerifyMessageReq)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).VerifyMessage(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/VerifyMessage",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).VerifyMessage(ctx, req.(*VerifyMessageReq))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Signer_DeriveSharedKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SharedKeyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SignerServer).DeriveSharedKey(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/signrpc.Signer/DeriveSharedKey",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SignerServer).DeriveSharedKey(ctx, req.(*SharedKeyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Signer_ServiceDesc is the grpc.ServiceDesc for Signer service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Signer_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "signrpc.Signer",
|
||||
HandlerType: (*SignerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SignOutputRaw",
|
||||
Handler: _Signer_SignOutputRaw_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ComputeInputScript",
|
||||
Handler: _Signer_ComputeInputScript_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SignMessage",
|
||||
Handler: _Signer_SignMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "VerifyMessage",
|
||||
Handler: _Signer_VerifyMessage_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeriveSharedKey",
|
||||
Handler: _Signer_DeriveSharedKey_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "signrpc/signer.proto",
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/runtime"
|
||||
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
@@ -88,6 +88,9 @@ type ServerShell struct {
|
||||
// lnd. This allows callers to create custom protocols, external to lnd, even
|
||||
// backed by multiple distinct lnd across independent failure domains.
|
||||
type Server struct {
|
||||
// Required by the grpc-gateway/v2 library for forward compatibility.
|
||||
UnimplementedSignerServer
|
||||
|
||||
cfg *Config
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user