| 879 | } |
| 880 | |
| 881 | static struct command_result *param_bip353(struct command *cmd, const char *name, |
| 882 | const char *buffer, const jsmntok_t *tok, |
| 883 | struct bip_353_name **bip353) |
| 884 | { |
| 885 | char *str, *at; |
| 886 | |
| 887 | /* BOLT #12: |
| 888 | * - if it received the offer from which it constructed this |
| 889 | * `invoice_request` using BIP 353 resolution: |
| 890 | * - MUST include `invreq_bip_353_name` with, |
| 891 | * - `name` set to the post-₿, pre-@ part of the BIP 353 HRN, |
| 892 | * - `domain` set to the post-@ part of the BIP 353 HRN. |
| 893 | */ |
| 894 | str = json_strdup(tmpctx, buffer, tok); |
| 895 | if (!utf8_check(str, strlen(str))) |
| 896 | return command_fail_badparam(cmd, name, buffer, tok, "invalid UTF-8"); |
| 897 | |
| 898 | at = strchr(str, '@'); |
| 899 | if (!at) |
| 900 | return command_fail_badparam(cmd, name, buffer, tok, "missing @"); |
| 901 | |
| 902 | /* Strip ₿ if present (0xE2 0x82 0xBF) */ |
| 903 | if (strstarts(str, "₿")) |
| 904 | str += strlen("₿"); |
| 905 | |
| 906 | *bip353 = tal(cmd, struct bip_353_name); |
| 907 | /* Not nul-terminated! */ |
| 908 | (*bip353)->name |
| 909 | = tal_dup_arr(*bip353, u8, (const u8 *)str, at - str, 0); |
| 910 | (*bip353)->domain |
| 911 | = tal_dup_arr(*bip353, u8, (const u8 *)at + 1, strlen(at + 1), 0); |
| 912 | |
| 913 | return NULL; |
| 914 | } |
| 915 | |
| 916 | /* Fetches an invoice for this offer, and makes sure it corresponds. */ |
| 917 | struct command_result *json_fetchinvoice(struct command *cmd, |
nothing calls this directly
no test coverage detected