{"name":"bolt01","version":"2.0.0","keywords":["lightning-network"],"author":{"url":"https://twitter.com/alexbosworth","name":"Alex Bosworth"},"license":"MIT","_id":"bolt01@2.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":"38663ad5e033ddd2e77f5df251ae8eaea086186c","tarball":"http://registry-npm.ywwl.com/bolt01/download/bolt01-2.0.0.tgz","fileCount":25,"integrity":"sha512-861g8sEe0p7ILyADnpwJ8xAMkILDPHXWx3FXBDdc0rqz2D16YtrRUATmyvP8vu/WBH93wNBr6ak0s+2XzNeOyA==","signatures":[{"sig":"MEQCIF0RXuC/am7q6rIYGavgb7/qiig8u2w1sdbEROh+++gLAiAG7+0FfYcO+HbENdObgWvXiMIju1Pp/LK5dc3/vbZwjQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27453,"size":6544,"noattachment":false,"key":"/bolt01/-/bolt01-2.0.0.tgz"},"main":"index.js","engines":{"node":">=16"},"gitHead":"e07f634ed4bd441a761d784c318d1dca4d57fd29","scripts":{"test":"npx nyc@15.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":"20.3.1","dependencies":{"bn.js":"5.2.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/bolt01_2.0.0_1687737584713_0.39852457962351306","host":"s3://npm-registry-packages"},"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":1687737584873,"_cnpm_publish_time":1687737584873,"dist-tags":{"latest":"4.0.1"}}