BOLT #12: * - MUST set `invreq_metadata` to an unpredictable series of bytes. */ Derive metadata (and thus temp key) from offer data and label * as payer_id must be same for all recurring payments. */
| 896 | /* Derive metadata (and thus temp key) from offer data and label |
| 897 | * as payer_id must be same for all recurring payments. */ |
| 898 | static u8 *recurrence_invreq_metadata(const tal_t *ctx, |
| 899 | const struct tlv_invoice_request *invreq, |
| 900 | const struct secret *nodealias_base, |
| 901 | const char *rec_label) |
| 902 | { |
| 903 | struct sha256 offer_id, tweak; |
| 904 | u8 *tweak_input; |
| 905 | |
| 906 | /* Use "offer_id || label" as tweak input */ |
| 907 | invreq_offer_id(invreq, &offer_id); |
| 908 | tweak_input = tal_arr(tmpctx, u8, |
| 909 | sizeof(offer_id) + strlen(rec_label)); |
| 910 | memcpy(tweak_input, &offer_id, sizeof(offer_id)); |
| 911 | memcpy(tweak_input + sizeof(offer_id), |
| 912 | rec_label, |
| 913 | strlen(rec_label)); |
| 914 | |
| 915 | bolt12_alias_tweak(nodealias_base, |
| 916 | tweak_input, |
| 917 | tal_bytelen(tweak_input), |
| 918 | &tweak); |
| 919 | return (u8 *)tal_dup(invreq, struct sha256, &tweak); |
| 920 | } |
| 921 | |
| 922 | static struct command_result *param_bip353(struct command *cmd, const char *name, |
| 923 | const char *buffer, const jsmntok_t *tok, |
no test coverage detected