| 499 | AUTODATA(json_command, &createinvreq_command); |
| 500 | |
| 501 | static struct command_result *json_payersign(struct command *cmd, |
| 502 | const char *buffer, |
| 503 | const jsmntok_t *obj UNNEEDED, |
| 504 | const jsmntok_t *params) |
| 505 | { |
| 506 | struct json_stream *response; |
| 507 | struct sha256 *merkle; |
| 508 | u8 *tweak; |
| 509 | struct bip340sig sig; |
| 510 | const char *messagename, *fieldname; |
| 511 | struct point32 key; |
| 512 | |
| 513 | if (!param(cmd, buffer, params, |
| 514 | p_req("messagename", param_string, &messagename), |
| 515 | p_req("fieldname", param_string, &fieldname), |
| 516 | p_req("merkle", param_sha256, &merkle), |
| 517 | p_req("tweak", param_bin_from_hex, &tweak), |
| 518 | NULL)) |
| 519 | return command_param_failed(); |
| 520 | |
| 521 | payer_key(cmd->ld, tweak, tal_bytelen(tweak), &key); |
| 522 | hsm_sign_b12(cmd->ld, messagename, fieldname, merkle, |
| 523 | tweak, &key, &sig); |
| 524 | |
| 525 | response = json_stream_success(cmd); |
| 526 | json_add_string(response, "signature", fmt_bip340sig(tmpctx, &sig)); |
| 527 | return command_success(cmd, response); |
| 528 | } |
| 529 | |
| 530 | static const struct json_command payersign_command = { |
| 531 | "payersign", |
nothing calls this directly
no test coverage detected