mirror of
https://github.com/bumi/lnrpc
synced 2026-02-16 16:17:48 +00:00
Add support for v0.11 GRPC services
This also refactors the client GRPC wrapper to dynamically load the request objects. All GRPC generated client files now live under lib/grpc_services
This commit is contained in:
83
lib/grpc_services/signrpc/signer_pb.rb
Normal file
83
lib/grpc_services/signrpc/signer_pb.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# source: signrpc/signer.proto
|
||||
|
||||
require 'google/protobuf'
|
||||
|
||||
Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||
add_file("signrpc/signer.proto", :syntax => :proto3) do
|
||||
add_message "signrpc.KeyLocator" do
|
||||
optional :key_family, :int32, 1
|
||||
optional :key_index, :int32, 2
|
||||
end
|
||||
add_message "signrpc.KeyDescriptor" do
|
||||
optional :raw_key_bytes, :bytes, 1
|
||||
optional :key_loc, :message, 2, "signrpc.KeyLocator"
|
||||
end
|
||||
add_message "signrpc.TxOut" do
|
||||
optional :value, :int64, 1
|
||||
optional :pk_script, :bytes, 2
|
||||
end
|
||||
add_message "signrpc.SignDescriptor" do
|
||||
optional :key_desc, :message, 1, "signrpc.KeyDescriptor"
|
||||
optional :single_tweak, :bytes, 2
|
||||
optional :double_tweak, :bytes, 3
|
||||
optional :witness_script, :bytes, 4
|
||||
optional :output, :message, 5, "signrpc.TxOut"
|
||||
optional :sighash, :uint32, 7
|
||||
optional :input_index, :int32, 8
|
||||
end
|
||||
add_message "signrpc.SignReq" do
|
||||
optional :raw_tx_bytes, :bytes, 1
|
||||
repeated :sign_descs, :message, 2, "signrpc.SignDescriptor"
|
||||
end
|
||||
add_message "signrpc.SignResp" do
|
||||
repeated :raw_sigs, :bytes, 1
|
||||
end
|
||||
add_message "signrpc.InputScript" do
|
||||
repeated :witness, :bytes, 1
|
||||
optional :sig_script, :bytes, 2
|
||||
end
|
||||
add_message "signrpc.InputScriptResp" do
|
||||
repeated :input_scripts, :message, 1, "signrpc.InputScript"
|
||||
end
|
||||
add_message "signrpc.SignMessageReq" do
|
||||
optional :msg, :bytes, 1
|
||||
optional :key_loc, :message, 2, "signrpc.KeyLocator"
|
||||
end
|
||||
add_message "signrpc.SignMessageResp" do
|
||||
optional :signature, :bytes, 1
|
||||
end
|
||||
add_message "signrpc.VerifyMessageReq" do
|
||||
optional :msg, :bytes, 1
|
||||
optional :signature, :bytes, 2
|
||||
optional :pubkey, :bytes, 3
|
||||
end
|
||||
add_message "signrpc.VerifyMessageResp" do
|
||||
optional :valid, :bool, 1
|
||||
end
|
||||
add_message "signrpc.SharedKeyRequest" do
|
||||
optional :ephemeral_pubkey, :bytes, 1
|
||||
optional :key_loc, :message, 2, "signrpc.KeyLocator"
|
||||
end
|
||||
add_message "signrpc.SharedKeyResponse" do
|
||||
optional :shared_key, :bytes, 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Signrpc
|
||||
KeyLocator = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.KeyLocator").msgclass
|
||||
KeyDescriptor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.KeyDescriptor").msgclass
|
||||
TxOut = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.TxOut").msgclass
|
||||
SignDescriptor = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SignDescriptor").msgclass
|
||||
SignReq = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SignReq").msgclass
|
||||
SignResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SignResp").msgclass
|
||||
InputScript = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.InputScript").msgclass
|
||||
InputScriptResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.InputScriptResp").msgclass
|
||||
SignMessageReq = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SignMessageReq").msgclass
|
||||
SignMessageResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SignMessageResp").msgclass
|
||||
VerifyMessageReq = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.VerifyMessageReq").msgclass
|
||||
VerifyMessageResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.VerifyMessageResp").msgclass
|
||||
SharedKeyRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SharedKeyRequest").msgclass
|
||||
SharedKeyResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("signrpc.SharedKeyResponse").msgclass
|
||||
end
|
||||
68
lib/grpc_services/signrpc/signer_services_pb.rb
Normal file
68
lib/grpc_services/signrpc/signer_services_pb.rb
Normal file
@@ -0,0 +1,68 @@
|
||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
# Source: signrpc/signer.proto for package 'signrpc'
|
||||
|
||||
require 'grpc'
|
||||
require 'signrpc/signer_pb'
|
||||
|
||||
module Signrpc
|
||||
module Signer
|
||||
# Signer is a service that gives access to the signing functionality of the
|
||||
# daemon's wallet.
|
||||
class Service
|
||||
|
||||
include GRPC::GenericService
|
||||
|
||||
self.marshal_class_method = :encode
|
||||
self.unmarshal_class_method = :decode
|
||||
self.service_name = 'signrpc.Signer'
|
||||
|
||||
#
|
||||
# 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.
|
||||
rpc :SignOutputRaw, SignReq, SignResp
|
||||
#
|
||||
# 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.
|
||||
rpc :ComputeInputScript, SignReq, InputScriptResp
|
||||
#
|
||||
# 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.
|
||||
rpc :SignMessage, SignMessageReq, SignMessageResp
|
||||
#
|
||||
# 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.
|
||||
rpc :VerifyMessage, VerifyMessageReq, VerifyMessageResp
|
||||
#
|
||||
# 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_loc parameter (or the node's identity private key
|
||||
# if no key locator is specified):
|
||||
# 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.
|
||||
rpc :DeriveSharedKey, SharedKeyRequest, SharedKeyResponse
|
||||
end
|
||||
|
||||
Stub = Service.rpc_stub_class
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user