{"name":"bolt01","version":"3.0.0","keywords":["lightning-network"],"author":{"url":"https://twitter.com/alexbosworth","name":"Alex Bosworth"},"license":"MIT","_id":"bolt01@3.0.0","maintainers":[{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"}],"homepage":"https://github.com/alexbosworth/bolt01#readme","bugs":{"url":"https://github.com/alexbosworth/bolt01/issues"},"dist":{"shasum":"4b134a7820c473f257de8730ea715dfa5304eafa","tarball":"http://registry-npm.ywwl.com/bolt01/download/bolt01-3.0.0.tgz","fileCount":25,"integrity":"sha512-6y8pyn4eZ/b7r3DVtL4ww/AC+0x3McZDdRn/zq6JHTx0szy9o61te8i+80fqR4V10t1RcR1liFEccFKSK3Jtyg==","signatures":[{"sig":"MEYCIQCuQmFrZ1FssVyTw8x8F1rtbNqbJr2TBVSSu+PZldGgWQIhAJHEbwUHpaahib63o0iEXDfKyjjbNfkZBP1H1JvQYtci","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27504,"size":6568,"noattachment":false,"key":"/bolt01/-/bolt01-3.0.0.tgz"},"main":"index.js","engines":{"node":">=20"},"gitHead":"0bf07eb0e99f4d47640b028d51f8fdf89e3fd56d","scripts":{"test":"npx nyc@17.1.0 node --experimental-test-coverage --test test/arrays/*.js test/big_size/*.js test/tlv_record/*.js test/tlv_stream/*.js"},"_npmUser":{"name":"alexbosworth","email":"alex.bosworth+npm@gmail.com"},"repository":{"url":"git+https://github.com/alexbosworth/bolt01.git","type":"git"},"_npmVersion":"8.13.1","description":"Lightning Network BOLT-01 methods","directories":{},"_nodeVersion":"24.12.0","dependencies":{"bn.js":"5.2.3"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/bolt01_3.0.0_1771711756269_0.21475195807165925","host":"s3://npm-registry-packages-npm-production"},"readme":"# BOLT 01\n\n[![npm version](https://badge.fury.io/js/bolt01.svg)](https://badge.fury.io/js/bolt01)\n\nMethods relating to Lightning Network\n[BOLT 01](https://github.com/lightningnetwork/lightning-rfc/blob/master/01-messaging.md).\n\n## decodeBigSize\n\nGiven BOLT 01 \"BigSize\" bytes, return a corresponding numeric value\n\n    {\n      encoded: <BigSize Encoded Value Hex String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      decoded: <Decoded Number String>\n      length: <Encoding Byte Length Number>\n    }\n\nExample:\n\n```node\nconst {decodeBigSize} = require('bolt01');\n\n// Decode a zero value BigSize number\nconst {decoded} = decodeBigSize({encoded: '00'});\n```\n\n## decodeTlvRecord\n\nDecode an encoded TLV record\n\n    {\n      encoded: <Encoded TLV Record Hex String>\n      [offset]: <Record Offset By Bytes Number>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      length: <Total Record Byte Length Number>\n      type: <Message Type Number String>\n      value: <Raw Value Hex String>\n    }\n\nExample:\n\n```node\nconst {decodeTlvRecord} = require('bolt01');\n\n// Type '1' and value '01'\nconst {type, value} = decodeTlvRecord({encoded: '010101'});\n```\n\n## decodeTlvStream\n\nDecode a TLV stream as key value pairs\n\n    {\n      encoded: <TLV Records Stream Hex Encoded String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      records: [{\n        type: <Message Type Number String>\n        value: <Raw Value Hex String>\n      }]\n    }\n\nExample:\n\n```node\nconst {decodeTlvStream} = require('bolt01');\n\n// {records: [{type: '1', value: '01}]}\nconst {records} = decodeTlvRecord({encoded: '010101'});\n```\n\n## encodeBigSize\n\nGiven a numeric value, encode it as BOLT 01 \"BigSize\" bytes\n\n    {\n      number: <Number String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <BigSize Encoded Value Hex String>\n    }\n\nExample:\n\n```node\nconst {encodeBigSize} = require('bolt01');\n\n// Encode a zero value BigSize number\nconst {encoded} = encodeBigSize({number: '0'});\n```\n\n## encodeTlvRecord\n\nEncode data as a TLV record\n\n    {\n      type: <Message Type Number String>\n      value: <Raw Value Hex String>\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <Encoded TLV Record Hex String>\n    }\n\nExample:\n\n```node\nconst {encodeTlvRecord} = require('bolt01');\n\n// encoded: '010101'\nconst {encoded} = encodeTlvRecord({type: '1', value: '01'});\n```\n\n## encodeTlvStream\n\nEncode key value pairs as a TLV stream\n\n    {\n      records: [{\n        type: <Message Type Number String>\n        value: <Raw Value Hex String>\n      }]\n    }\n\n    @throws\n    <Error>\n\n    @returns\n    {\n      encoded: <TLV Records Stream Hex Encoded String>\n    }\n\nExample:\n\n```node\nconst {encodeTlvStream} = require('bolt01');\n\n// encoded: '010101'\nconst {encoded} = encodeTlvStream({records: [{type: '1', value: '01'}]});\n```\n","publish_time":1771711756413,"_cnpm_publish_time":1771711756413,"dist-tags":{"latest":"4.0.1"}}