| 860 | } |
| 861 | |
| 862 | bool bolt12_bip353_valid_string(const u8 *str, size_t len) |
| 863 | { |
| 864 | /* BOLT #12: |
| 865 | * - if `invreq_bip_353_name` is present: |
| 866 | * - MUST reject the invoice request if `name` or `domain` |
| 867 | * contain any bytes which are not `0`-`9`, `a`-`z`, |
| 868 | * `A`-`Z`, `-`, `_` or `.`. |
| 869 | */ |
| 870 | for (size_t i = 0; i < len; i++) { |
| 871 | if (cisalnum(str[i])) |
| 872 | continue; |
| 873 | if (str[i] == '-' || str[i] == '_' || str[i] == '.') |
| 874 | continue; |
| 875 | return false; |
| 876 | } |
| 877 | return true; |
| 878 | } |
| 879 | |
| 880 | const struct recurrence *offer_recurrence(const struct tlv_offer *offer) |
| 881 | { |
no test coverage detected