Socket
Socket
Sign inDemoInstall

bolt12-decoder

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bolt12-decoder

Decode BOLT12 Offers


Version published
Maintainers
1
Created
Source

BOLT12 Decoder

Decode BOLT12 Offers, Invoice Requests and invoices.

The goal is to match the output of the CoreLN decode RPC response.

Code is mostly grabbed from Rusty's BOLT12 repo with some changes and fixes.

Install

yarn add bolt12-decoder npm i bolt12-decoder

Usage

import decodeBolt12 from 'bolt12-decoder'

const bolt12 =
  'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2q42xjurnyyfqys2zzcssx06thlxk00g0epvynxff5vj46p3en8hz8ax9uy4ckyyfuyet8eqg'

const decoded = decodeBolt12(bolt12)

console.log(decoded)

// {
//   offer_chains: ['06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f'],
//   offer_description: 'Tips!',
//   offer_id: '45880e501c65e9060d33128d2de1d23ff52ae768b2bcb62bef262d90b741b8cd',
//   offer_issuer: 'AB',
//   offer_node_id: '033f4bbfcd67bd0fc858499929a3255d063999ee23f4c5e12b8b1089e132b3e408',
//   type: 'bolt12 offer',
//   valid: true
// }

Caveats

  • Does not decode recurrence (will add once recurrence is added back in to the spec)
  • Does not decode invoice_paths and invoice_blindedpay as I could not get it working (I hope to fix this some time soon)

FAQs

Package last updated on 11 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc