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

@libp2p/config

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/config

Helper functions to make dealing with libp2p config easier

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
decreased by-22.22%
Maintainers
0
Weekly downloads
 
Created
Source

@libp2p/config

libp2p.io Discuss codecov CI

Helper functions to make dealing with libp2p config easier

About

Example - Load or create the "self" private key in a datastore

Most nodes will want to persist the same private key between restarts so this function helps you extract one from a datastore if it exists, otherwise it will create a new one and save it in the keystore.

The options you pass to this function should be the same as those passed to the @libp2p/keychain service you configure your node with.

import { loadOrCreateSelfKey } from '@libp2p/config'
import { keychain } from '@libp2p/keychain'
import { LevelDatastore } from 'datastore-level'
import { createLibp2p } from 'libp2p'

const datastore = new LevelDatastore('/path/to/db')
await datastore.open()

const keychainInit = {
 pass: 'yes-yes-very-secure'
}

const privateKey = await loadOrCreateSelfKey(datastore, keychainInit)

const node = await createLibp2p({
  privateKey,
  services: {
    datastore,
    keychain: keychain(keychainInit)
  }
})

Install

$ npm i @libp2p/config

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

FAQs

Package last updated on 12 Dec 2024

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