invoices
Version:
Methods for working with BOLT 11 payment requests
24 lines (18 loc) • 416 B
JavaScript
const {bech32} = require('bech32');
const encoding = 'utf8';
const {toWords} = bech32;
/** Description string as words
{
[description]: <Payment Request Description String>
}
@returns
{
[words]: [<Bech32 Word Number>]
}
*/
module.exports = ({description}) => {
if (description === undefined) {
return {};
}
return {words: toWords(Buffer.from(description || String(), encoding))};
};