Skip to content

msggen: add signmessagewithkey #8287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -3568,6 +3568,16 @@
"SignMessage.signature": 1,
"SignMessage.zbase": 3
},
"SignmessagewithkeyRequest": {
"SignMessageWithKey.address": 2,
"SignMessageWithKey.message": 1
},
"SignmessagewithkeyResponse": {
"SignMessageWithKey.address": 1,
"SignMessageWithKey.base64": 4,
"SignMessageWithKey.pubkey": 2,
"SignMessageWithKey.signature": 3
},
"SignpsbtRequest": {
"SignPsbt.psbt": 1,
"SignPsbt.signonly[]": 2
Expand Down Expand Up @@ -12478,6 +12488,30 @@
"added": "pre-v0.10.1",
"deprecated": null
},
"SignMessageWithKey": {
"added": "v25.05",
"deprecated": null
},
"SignMessageWithKey.address": {
"added": "v25.05",
"deprecated": null
},
"SignMessageWithKey.base64": {
"added": "v25.05",
"deprecated": null
},
"SignMessageWithKey.message": {
"added": "v25.05",
"deprecated": null
},
"SignMessageWithKey.pubkey": {
"added": "v25.05",
"deprecated": null
},
"SignMessageWithKey.signature": {
"added": "v25.05",
"deprecated": null
},
"SignPsbt": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
13 changes: 13 additions & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions cln-grpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4370,6 +4370,38 @@ impl Node for Server

}

async fn sign_message_with_key(
&self,
request: tonic::Request<pb::SignmessagewithkeyRequest>,
) -> Result<tonic::Response<pb::SignmessagewithkeyResponse>, tonic::Status> {
let req = request.into_inner();
let req: requests::SignmessagewithkeyRequest = req.into();
debug!("Client asked for sign_message_with_key");
trace!("sign_message_with_key request: {:?}", req);
let mut rpc = ClnRpc::new(&self.rpc_path)
.await
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
let result = rpc.call(Request::SignMessageWithKey(req))
.await
.map_err(|e| Status::new(
Code::Unknown,
format!("Error calling method SignMessageWithKey: {:?}", e)))?;
match result {
Response::SignMessageWithKey(r) => {
trace!("sign_message_with_key response: {:?}", r);
Ok(tonic::Response::new(r.into()))
},
r => Err(Status::new(
Code::Internal,
format!(
"Unexpected result {:?} to method call SignMessageWithKey",
r
)
)),
}

}



type SubscribeBlockAddedStream = NotificationStream<pb::BlockAddedNotification>;
Expand Down
44 changes: 44 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions contrib/msggen/msggen/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
"InjectPaymentOnion",
"InjectOnionMessage",
"Xpay",
"SignMessageWithKey",
]

grpc_notification_names = [
Expand Down
74 changes: 39 additions & 35 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,11 @@ def __init__(self, channel):
request_serializer=node__pb2.XpayRequest.SerializeToString,
response_deserializer=node__pb2.XpayResponse.FromString,
)
self.SignMessageWithKey = channel.unary_unary(
'/cln.Node/SignMessageWithKey',
request_serializer=node__pb2.SignmessagewithkeyRequest.SerializeToString,
response_deserializer=node__pb2.SignmessagewithkeyResponse.FromString,
)
self.SubscribeBlockAdded = channel.unary_stream(
'/cln.Node/SubscribeBlockAdded',
request_serializer=node__pb2.StreamBlockAddedRequest.SerializeToString,
Expand Down Expand Up @@ -1523,6 +1528,12 @@ def Xpay(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def SignMessageWithKey(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def SubscribeBlockAdded(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -2232,6 +2243,11 @@ def add_NodeServicer_to_server(servicer, server):
request_deserializer=node__pb2.XpayRequest.FromString,
response_serializer=node__pb2.XpayResponse.SerializeToString,
),
'SignMessageWithKey': grpc.unary_unary_rpc_method_handler(
servicer.SignMessageWithKey,
request_deserializer=node__pb2.SignmessagewithkeyRequest.FromString,
response_serializer=node__pb2.SignmessagewithkeyResponse.SerializeToString,
),
'SubscribeBlockAdded': grpc.unary_stream_rpc_method_handler(
servicer.SubscribeBlockAdded,
request_deserializer=node__pb2.StreamBlockAddedRequest.FromString,
Expand Down Expand Up @@ -4550,6 +4566,23 @@ def Xpay(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def SignMessageWithKey(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/cln.Node/SignMessageWithKey',
node__pb2.SignmessagewithkeyRequest.SerializeToString,
node__pb2.SignmessagewithkeyResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def SubscribeBlockAdded(request,
target,
Expand Down
9 changes: 9 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -3189,6 +3189,15 @@ def xpay2py(m):
})


def signmessagewithkey2py(m):
return remove_default({
"address": m.address, # PrimitiveField in generate_composite
"base64": m.base64, # PrimitiveField in generate_composite
"pubkey": hexlify(m.pubkey), # PrimitiveField in generate_composite
"signature": hexlify(m.signature), # PrimitiveField in generate_composite
})


def decodekeysend_routes2py(m): # manual override
return remove_default({
"expirydelta": m.expirydelta,
Expand Down
Loading