
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
Methods relating to Lightning Network BOLT 01.
Given BOLT 01 "BigSize" bytes, return a corresponding numeric value
{
encoded: <BigSize Encoded Value Hex String>
}
@throws
<Error>
@returns
{
decoded: <Decoded Number String>
length: <Encoding Byte Length Number>
}
Example:
const {decodeBigSize} = require('bolt01');
// Decode a zero value BigSize number
const {decoded} = decodeBigSize({encoded: '00'});
Decode an encoded TLV record
{
encoded: <Encoded TLV Record Hex String>
[offset]: <Record Offset By Bytes Number>
}
@throws
<Error>
@returns
{
length: <Total Record Byte Length Number>
type: <Message Type Number String>
value: <Raw Value Hex String>
}
Example:
const {decodeTlvRecord} = require('bolt01');
// Type '1' and value '01'
const {type, value} = decodeTlvRecord({encoded: '010101'});
Decode a TLV stream as key value pairs
{
encoded: <TLV Records Stream Hex Encoded String>
}
@throws
<Error>
@returns
{
records: [{
type: <Message Type Number String>
value: <Raw Value Hex String>
}]
}
Example:
const {decodeTlvStream} = require('bolt01');
// {records: [{type: '1', value: '01}]}
const {records} = decodeTlvRecord({encoded: '010101'});
Given a numeric value, encode it as BOLT 01 "BigSize" bytes
{
number: <Number String>
}
@throws
<Error>
@returns
{
encoded: <BigSize Encoded Value Hex String>
}
Example:
const {encodeBigSize} = require('bolt01');
// Encode a zero value BigSize number
const {encoded} = encodeBigSize({number: '0'});
Encode data as a TLV record
{
type: <Message Type Number String>
value: <Raw Value Hex String>
}
@throws
<Error>
@returns
{
encoded: <Encoded TLV Record Hex String>
}
Example:
const {encodeTlvRecord} = require('bolt01');
// encoded: '010101'
const {encoded} = encodeTlvRecord({type: '1', value: '01'});
Encode key value pairs as a TLV stream
{
records: [{
type: <Message Type Number String>
value: <Raw Value Hex String>
}]
}
@throws
<Error>
@returns
{
encoded: <TLV Records Stream Hex Encoded String>
}
Example:
const {encodeTlvStream} = require('bolt01');
// encoded: '010101'
const {encoded} = encodeTlvStream({records: [{type: '1', value: '01'}]});
2.0.0
FAQs
Lightning Network BOLT-01 methods
The npm package bolt01 receives a total of 305 weekly downloads. As such, bolt01 popularity was classified as not popular.
We found that bolt01 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.