{"name":"bolt01","version":"4.0.0","keywords":["lightning-network"],"author":{"url":"https://twitter.com/alexbosworth","name":"Alex Bosworth"},"license":"MIT","_id":"bolt01@4.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":"b38fab4d13a0c90b6aba0cc455b1c60c9e692960","tarball":"http://registry-npm.ywwl.com/bolt01/download/bolt01-4.0.0.tgz","fileCount":25,"integrity":"sha512-bb5vvtSmfub19MIJ/GmxcYUQfyjIzw8g63pgH0h02XtWQpaZg/2lesles5W7Yaq+HJLSXOK0fCpJjZx+Thahfg==","signatures":[{"sig":"MEYCIQCBA3DDwFDkBYrIll5GblgmsTlRJgZ/upeNseMoRp8Z5AIhANO2s3GhpNwbyoib4SljCbJLrLXSAvlMEO67iYAm91bv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33765,"size":7395,"noattachment":false,"key":"/bolt01/-/bolt01-4.0.0.tgz"},"main":"index.js","engines":{"node":">=22"},"gitHead":"79eea83985e5eb221931910d02cfd01aac4ed041","scripts":{"test":"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":"11.19.0","description":"Lightning Network BOLT-01 methods","directories":{},"_nodeVersion":"24.18.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/bolt01_4.0.0_1787433783359_0.5586837342080988","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":1787433783498,"_cnpm_publish_time":1787433783498,"dist-tags":{"latest":"4.0.1"}}