You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.2 KiB
92 lines
3.2 KiB
#ifndef LIGHTNING_COMMON_BOLT12_H
|
|
#define LIGHTNING_COMMON_BOLT12_H
|
|
#include "config.h"
|
|
#include <wire/bolt12_exp_wiregen.h>
|
|
|
|
struct feature_set;
|
|
|
|
/**
|
|
* offer_encode - encode this complete bolt12 offer TLV into text.
|
|
*/
|
|
char *offer_encode(const tal_t *ctx, const struct tlv_offer *bolt12_tlv);
|
|
|
|
/**
|
|
* offer_decode - decode this complete bolt12 text into a TLV.
|
|
* @ctx: the context to allocate return or *@fail off.
|
|
* @b12: the offer string
|
|
* @b12len: the offer string length
|
|
* @our_features: if non-NULL, feature set to check against.
|
|
* @must_be_chain: if non-NULL, chain to enforce.
|
|
* @fail: pointer to descriptive error string, set if this returns NULL.
|
|
*
|
|
* Note: checks signature!
|
|
*/
|
|
struct tlv_offer *offer_decode(const tal_t *ctx, const char *b12, size_t b12len,
|
|
const struct feature_set *our_features,
|
|
const struct chainparams *must_be_chain,
|
|
char **fail);
|
|
|
|
/* Variant which does not check signature */
|
|
struct tlv_offer *offer_decode_nosig(const tal_t *ctx,
|
|
const char *b12, size_t b12len,
|
|
const struct feature_set *our_features,
|
|
const struct chainparams *must_be_chain,
|
|
char **fail);
|
|
|
|
/**
|
|
* invrequest_encode - encode this complete bolt12 invreq TLV into text.
|
|
*/
|
|
char *invrequest_encode(const tal_t *ctx,
|
|
const struct tlv_invoice_request *bolt12_tlv);
|
|
|
|
/**
|
|
* invrequest_decode - decode this complete bolt12 text into a TLV.
|
|
* @ctx: the context to allocate return or *@fail off.
|
|
* @b12: the invoice_request string
|
|
* @b12len: the invoice_request string length
|
|
* @our_features: if non-NULL, feature set to check against.
|
|
* @must_be_chain: if non-NULL, chain to enforce.
|
|
* @fail: pointer to descriptive error string, set if this returns NULL.
|
|
*
|
|
* Note: invoice_request doesn't always have a signature, so no checking is done!
|
|
*/
|
|
struct tlv_invoice_request *invrequest_decode(const tal_t *ctx,
|
|
const char *b12, size_t b12len,
|
|
const struct feature_set *our_features,
|
|
const struct chainparams *must_be_chain,
|
|
char **fail);
|
|
|
|
/**
|
|
* invoice_encode - encode this complete bolt12 invoice TLV into text.
|
|
*/
|
|
char *invoice_encode(const tal_t *ctx, const struct tlv_invoice *bolt12_tlv);
|
|
|
|
/**
|
|
* invoice_decode - decode this complete bolt12 text into a TLV.
|
|
* @ctx: the context to allocate return or *@fail off.
|
|
* @b12: the invoice string
|
|
* @b12len: the invoice string length
|
|
* @our_features: if non-NULL, feature set to check against.
|
|
* @must_be_chain: if non-NULL, chain to enforce.
|
|
* @fail: pointer to descriptive error string, set if this returns NULL.
|
|
*
|
|
* Note: checks signature!
|
|
*/
|
|
struct tlv_invoice *invoice_decode(const tal_t *ctx,
|
|
const char *b12, size_t b12len,
|
|
const struct feature_set *our_features,
|
|
const struct chainparams *must_be_chain,
|
|
char **fail);
|
|
|
|
/* Variant which does not check signature */
|
|
struct tlv_invoice *invoice_decode_nosig(const tal_t *ctx,
|
|
const char *b12, size_t b12len,
|
|
const struct feature_set *our_features,
|
|
const struct chainparams *must_be_chain,
|
|
char **fail);
|
|
|
|
/* Given a tal_arr of chains, does it contain this chain? */
|
|
bool bolt12_chains_match(const struct bitcoin_blkid *chains,
|
|
const struct chainparams *must_be_chain);
|
|
|
|
#endif /* LIGHTNING_COMMON_BOLT12_H */
|
|
|