Skip to content

Commit 529337a

Browse files
daywalker90cdecker
authored andcommitted
msggen: add signmessagewithkey
Changelog-None
1 parent 8494ca6 commit 529337a

File tree

9 files changed

+237
-35
lines changed

9 files changed

+237
-35
lines changed

.msggen.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3568,6 +3568,16 @@
35683568
"SignMessage.signature": 1,
35693569
"SignMessage.zbase": 3
35703570
},
3571+
"SignmessagewithkeyRequest": {
3572+
"SignMessageWithKey.address": 2,
3573+
"SignMessageWithKey.message": 1
3574+
},
3575+
"SignmessagewithkeyResponse": {
3576+
"SignMessageWithKey.address": 1,
3577+
"SignMessageWithKey.base64": 4,
3578+
"SignMessageWithKey.pubkey": 2,
3579+
"SignMessageWithKey.signature": 3
3580+
},
35713581
"SignpsbtRequest": {
35723582
"SignPsbt.psbt": 1,
35733583
"SignPsbt.signonly[]": 2
@@ -12478,6 +12488,30 @@
1247812488
"added": "pre-v0.10.1",
1247912489
"deprecated": null
1248012490
},
12491+
"SignMessageWithKey": {
12492+
"added": "v25.05",
12493+
"deprecated": null
12494+
},
12495+
"SignMessageWithKey.address": {
12496+
"added": "v25.05",
12497+
"deprecated": null
12498+
},
12499+
"SignMessageWithKey.base64": {
12500+
"added": "v25.05",
12501+
"deprecated": null
12502+
},
12503+
"SignMessageWithKey.message": {
12504+
"added": "v25.05",
12505+
"deprecated": null
12506+
},
12507+
"SignMessageWithKey.pubkey": {
12508+
"added": "v25.05",
12509+
"deprecated": null
12510+
},
12511+
"SignMessageWithKey.signature": {
12512+
"added": "v25.05",
12513+
"deprecated": null
12514+
},
1248112515
"SignPsbt": {
1248212516
"added": "pre-v0.10.1",
1248312517
"deprecated": null

cln-grpc/proto/node.proto

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/convert.rs

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cln-grpc/src/server.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4370,6 +4370,38 @@ impl Node for Server
43704370

43714371
}
43724372

4373+
async fn sign_message_with_key(
4374+
&self,
4375+
request: tonic::Request<pb::SignmessagewithkeyRequest>,
4376+
) -> Result<tonic::Response<pb::SignmessagewithkeyResponse>, tonic::Status> {
4377+
let req = request.into_inner();
4378+
let req: requests::SignmessagewithkeyRequest = req.into();
4379+
debug!("Client asked for sign_message_with_key");
4380+
trace!("sign_message_with_key request: {:?}", req);
4381+
let mut rpc = ClnRpc::new(&self.rpc_path)
4382+
.await
4383+
.map_err(|e| Status::new(Code::Internal, e.to_string()))?;
4384+
let result = rpc.call(Request::SignMessageWithKey(req))
4385+
.await
4386+
.map_err(|e| Status::new(
4387+
Code::Unknown,
4388+
format!("Error calling method SignMessageWithKey: {:?}", e)))?;
4389+
match result {
4390+
Response::SignMessageWithKey(r) => {
4391+
trace!("sign_message_with_key response: {:?}", r);
4392+
Ok(tonic::Response::new(r.into()))
4393+
},
4394+
r => Err(Status::new(
4395+
Code::Internal,
4396+
format!(
4397+
"Unexpected result {:?} to method call SignMessageWithKey",
4398+
r
4399+
)
4400+
)),
4401+
}
4402+
4403+
}
4404+
43734405

43744406

43754407
type SubscribeBlockAddedStream = NotificationStream<pb::BlockAddedNotification>;

cln-rpc/src/model.rs

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/msggen/msggen/utils/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
"InjectPaymentOnion",
144144
"InjectOnionMessage",
145145
"Xpay",
146+
"SignMessageWithKey",
146147
]
147148

148149
grpc_notification_names = [

contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Lines changed: 39 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,11 @@ def __init__(self, channel):
684684
request_serializer=node__pb2.XpayRequest.SerializeToString,
685685
response_deserializer=node__pb2.XpayResponse.FromString,
686686
)
687+
self.SignMessageWithKey = channel.unary_unary(
688+
'/cln.Node/SignMessageWithKey',
689+
request_serializer=node__pb2.SignmessagewithkeyRequest.SerializeToString,
690+
response_deserializer=node__pb2.SignmessagewithkeyResponse.FromString,
691+
)
687692
self.SubscribeBlockAdded = channel.unary_stream(
688693
'/cln.Node/SubscribeBlockAdded',
689694
request_serializer=node__pb2.StreamBlockAddedRequest.SerializeToString,
@@ -1523,6 +1528,12 @@ def Xpay(self, request, context):
15231528
context.set_details('Method not implemented!')
15241529
raise NotImplementedError('Method not implemented!')
15251530

1531+
def SignMessageWithKey(self, request, context):
1532+
"""Missing associated documentation comment in .proto file."""
1533+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
1534+
context.set_details('Method not implemented!')
1535+
raise NotImplementedError('Method not implemented!')
1536+
15261537
def SubscribeBlockAdded(self, request, context):
15271538
"""Missing associated documentation comment in .proto file."""
15281539
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
@@ -2232,6 +2243,11 @@ def add_NodeServicer_to_server(servicer, server):
22322243
request_deserializer=node__pb2.XpayRequest.FromString,
22332244
response_serializer=node__pb2.XpayResponse.SerializeToString,
22342245
),
2246+
'SignMessageWithKey': grpc.unary_unary_rpc_method_handler(
2247+
servicer.SignMessageWithKey,
2248+
request_deserializer=node__pb2.SignmessagewithkeyRequest.FromString,
2249+
response_serializer=node__pb2.SignmessagewithkeyResponse.SerializeToString,
2250+
),
22352251
'SubscribeBlockAdded': grpc.unary_stream_rpc_method_handler(
22362252
servicer.SubscribeBlockAdded,
22372253
request_deserializer=node__pb2.StreamBlockAddedRequest.FromString,
@@ -4550,6 +4566,23 @@ def Xpay(request,
45504566
options, channel_credentials,
45514567
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
45524568

4569+
@staticmethod
4570+
def SignMessageWithKey(request,
4571+
target,
4572+
options=(),
4573+
channel_credentials=None,
4574+
call_credentials=None,
4575+
insecure=False,
4576+
compression=None,
4577+
wait_for_ready=None,
4578+
timeout=None,
4579+
metadata=None):
4580+
return grpc.experimental.unary_unary(request, target, '/cln.Node/SignMessageWithKey',
4581+
node__pb2.SignmessagewithkeyRequest.SerializeToString,
4582+
node__pb2.SignmessagewithkeyResponse.FromString,
4583+
options, channel_credentials,
4584+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
4585+
45534586
@staticmethod
45544587
def SubscribeBlockAdded(request,
45554588
target,

contrib/pyln-testing/pyln/testing/grpc2py.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3189,6 +3189,15 @@ def xpay2py(m):
31893189
})
31903190

31913191

3192+
def signmessagewithkey2py(m):
3193+
return remove_default({
3194+
"address": m.address, # PrimitiveField in generate_composite
3195+
"base64": m.base64, # PrimitiveField in generate_composite
3196+
"pubkey": hexlify(m.pubkey), # PrimitiveField in generate_composite
3197+
"signature": hexlify(m.signature), # PrimitiveField in generate_composite
3198+
})
3199+
3200+
31923201
def decodekeysend_routes2py(m): # manual override
31933202
return remove_default({
31943203
"expirydelta": m.expirydelta,

0 commit comments

Comments
 (0)