Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Utilities for working with Lightning Network BOLT 07
Sample code for working with bolt07 utility functions:
x
delimited format designed to be readable.const {chanFormat} = require('bolt07');
const id = '15fbe70000260000';
const number = '1584113681139367936';
try {
const fromNumber = chanFormat({number}).channel;
// fromNumber === '1440743x38x0'
} catch (err) {
// valid channel, no error
}
try {
const fromId = chanFormat({id}).channel;
// fromId === '1440743x38x0'
} catch (err) {
// valid id, no error
}
const {chanNumber} = require('bolt07');
const channel = '1440743x38x0';
const id = '15fbe70000260000';
try {
const fromChannel = chanNumber({channel}).number;
// fromChannel === '1584113681139367936'
} catch (err) {
// valid channel, no error
}
try {
const fromId = chanNumber({id}).number;
// fromId === '1584113681139367936'
} catch (err) {
// valid id, no error
}
Returns components of a channel id or channel number.
const {decodeChanId} = require('bolt07');
const channel = '1440743x38x0';
const id = '15fbe70000260000';
const number = '1584113681139367936';
try {
const fromChannel = decodeChanId({channel});
// fromChannel.block_height === 1440743
// fromChannel.block_index === 38
// fromChannel.output_index === 0
} catch (err) {
// valid channel, no error
}
try {
const fromId = decodeChanId({id});
// fromId.block_height === 1440743
// fromId.block_index === 38
// fromId.output_index === 0
} catch (err) {
// valid id, no error
}
try {
const fromNumber = decodeChanId({channel});
// fromNumber.block_height === 1440743
// fromNumber.block_index === 38
// fromNumber.output_index === 0
} catch (err) {
// valid number, no error
}
Returns channel id when components are specified
const {encodeChanId} = require('bolt07');
try {
const encoded = encodeChanId({
block_height: 1440743,
block_index: 38,
output_index: 0,
});
// encoded.channel === '1440743x38x0'
// encoded.id === '15fbe70000260000'
// encoded.number === '1584113681139367936'
} catch (err) {
// valid components, no error
}
Returns a raw channel id in numeric format.
const {rawChanId} = require('bolt07');
const channel = '1440743x38x0';
const number = '1584113681139367936';
try {
const idFromNumber = rawChanId({number}).id;
// idFromNumber === '15fbe70000260000'
} catch (err) {
// valid number, no error
}
try {
const idFromChannel = rawChanId({channel}).id;
// idFromChannel === '15fbe70000260000'
} catch (err) {
// valid channel, no error
}
FAQs
Utilities for working with bolt07 data formats
We found that bolt07 demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.