Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bolt09

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bolt09

BOLT 09 helper methods

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7K
increased by10.1%
Maintainers
1
Weekly downloads
 
Created
Source

Bolt 09

npm version Coverage Status Build Status

Utility methods for working with BOLT 09

Methods

featureFlagDetails

Feature flag details for feature flag bit

{
  bit: <Feature Flag Bit Number>
}

@throws
<Error>

@returns
{
  [type]: <Feature Flag Type String>
}

Example:

const {featureFlagDetails} = require('bolt09');

const {type} = featureFlagDetails({bit: 0});
// Type is string descriptor of feature bit

featureFlagsAsHex

Encode feature flags into hex serialized bytes

{
  features: [<Feature Bit Number>]
}

@throws
<Error>

@returns
{
  encoded: <Serialized Feature Bits Hex Encoded String>
}

Example:

const {featureFlagsAsHex} = require('bolt09');

const {encoded} = featureFlagsAsHex({features: [0]});
// Encoded is hex encoded string with a length uint16 prefix

featureFlagsAsWords

Encode feature flags into a serialized data buffer

{
  features: [<Feature Bit Number>]
}

@throws
<Error>

@returns
{
  words: [<Bech32 Word Number>]
}

Example:

const {featureFlagsAsWords} = require('bolt09');

const {words} = featureFlagsAsWords({features: [0]});
// Words are word numbers that can be used for encoding in a bolt11 payment req

featureFlagsFromHex

Feature flags from hex serialized feature flags

{
  [hex]: <Data Length Prefixed Hex Encoded String>
}

@throws
<Error>

@returns
{
  features: [{
    bit: <Feature Bit Number>
    is_required: <Feature Bit is Required Bool>
    type: <Feature Bit Type String>
  }]
}

Example:

const {featureFlagsFromHex} = require('bolt09');

const {features} = featureFlagsFromHex({hex: '00018C'});
// Features is an array of supported features

featureFlagsFromWords

Feature flags from BOLT 11 tag words

{
  words: [<BOLT11 Tag Word Number>]
}

@throws
<Error>

@returns
{
  features: [{
    bit: <Feature Bit Number>
    is_required: <Feature Bit is Required Bool>
    type: <Feature Bit Type String>
  }]
}

Example:

const {featureFlagsFromWords} = require('bolt09');

const {features} = featureFlagsFromWords({words: [16, 0]});
// Features is an array of supported features

Keywords

FAQs

Package last updated on 24 Mar 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc