
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
lndconnect
Advanced tools
Generate and parse lndconnect uris https://github.com/LN-Zap/lndconnect ⚡️
This package provides utilities for generating and parsing lndconnect uris.
For more information take a look at the specification of the uri format.
npm install lndconnect --save
format({ host, cert, macaroon }):
Formats a host / cert / macaroon combo into an lndconnect link.
import { format } from 'lndconnect'
const connectionString = format({
host: '1.2.3.4:10009',
cert: 'MIICuDCCAl...',
macaroon: '0201036c6...',
})
expect(connectionString).toEqual('lndconnect://1.2.3.4:10009?cert=MIICuDCCAl...&macaroon=0201036c6...')
encode({ host, cert, macaroon }):
Encodes a host / cert / macaroon combo and formats into an lndconnect link.
import { encode } from 'lndconnect'
const connectionString = encode({
host: '1.2.3.4:10009',
cert: '-----BEGIN CERTIFICATE-----\n...',
macaroon: '0201036c6...',
})
expect(connectionString).toEqual('lndconnect://1.2.3.4:10009?cert=MIICuDCCAl...&macaroon=AgEDbG5kAr...')
decode(lndconnectUri):
Decodes an lndconnect link into it's component parts (host / cert as utf8 / macaroon as hex)
import { decode } from 'lndconnect'
const { host, cert, macaroon } = decode('lndconnect://1.2.3.4:10009?cert=MIICuDCCAl...&macaroon=AgEDbG5kAr...')
expect(host).toEqual('1.2.3.4:10009')
expect(cert).toEqual('MIICuDCCAl...')
expect(macaroon).toEqual('0201036c6...')
encodeCert(cert, format):
Encodes a certificate (String or Buffer) to base64url encoded DER format.
import { encodeCert } from 'lndconnect'
const certPath = path.join(__dirname, 'tls.cert')
const cert = encodeCert(certPath)
// returns base64url encoded DER cert.
expect(cert).toEqual('MIICuDCCAl...')
decodeCert(encodedCert):
Decodes a certificate from base64url encoded DER format to a string.
import { decodeCert } from 'lndconnect'
// pass a base64url encoded DER cert
const cert = decodeCert(encodedCert)
// returns utf8 encoded PEM cert.
expect(cert).toEqual('-----BEGIN CERTIFICATE-----\n...')
encodeMacaroon(macaroon, format):
Encodes a binary macaroon (String or Buffer) to base64url encoded string.
import { encodeMacaroon } from 'lndconnect'
const macaroonPath = path.join(__dirname, 'admin.macaroon')
const macaroon = encodeMacaroon(macaroonPath)
// returns base64url encoded macaroon.
expect(macaroon).toEqual('AgEDbG5kAr...')
decodeMacaroon(encodedMacaroon):
Decodes a base64url encoded macaroon to a hex encoded macaroon.
import { decodeMacaroon } from 'lndconnect'
// pass a base64url encoded macaroon
const macaroon = decodeMacaroon(encodedMacaroon)
// returns hex encoded macaroon.
expect(macaroon).toEqual('0201036c6...')
Run the tests suite:
npm test
Feel free to dive in! Open an issue or submit PRs.
lndconnect follows the Contributor Covenant Code of Conduct.
MIT © Tom Kirkpatrick
FAQs
Generate and parse lndconnect uris
The npm package lndconnect receives a total of 2,176 weekly downloads. As such, lndconnect popularity was classified as popular.
We found that lndconnect 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.