| 570 | AUTODATA(json_command, &createinvreq_command); |
| 571 | |
| 572 | static struct command_result *json_payersign(struct command *cmd, |
| 573 | const char *buffer, |
| 574 | const jsmntok_t *obj UNNEEDED, |
| 575 | const jsmntok_t *params) |
| 576 | { |
| 577 | struct json_stream *response; |
| 578 | struct sha256 *merkle; |
| 579 | u8 *tweak; |
| 580 | struct bip340sig sig; |
| 581 | const char *messagename, *fieldname; |
| 582 | struct pubkey key; |
| 583 | |
| 584 | if (!param(cmd, buffer, params, |
| 585 | p_req("messagename", param_string, &messagename), |
| 586 | p_req("fieldname", param_string, &fieldname), |
| 587 | p_req("merkle", param_sha256, &merkle), |
| 588 | p_req("tweak", param_bin_from_hex, &tweak), |
| 589 | NULL)) |
| 590 | return command_param_failed(); |
| 591 | |
| 592 | payer_key(cmd->ld, tweak, tal_bytelen(tweak), &key); |
| 593 | hsm_sign_b12(cmd->ld, messagename, fieldname, merkle, |
| 594 | tweak, &key, &sig); |
| 595 | |
| 596 | response = json_stream_success(cmd); |
| 597 | json_add_string(response, "signature", fmt_bip340sig(tmpctx, &sig)); |
| 598 | return command_success(cmd, response); |
| 599 | } |
| 600 | |
| 601 | static const struct json_command payersign_command = { |
| 602 | "payersign", |
nothing calls this directly
no test coverage detected