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

@libp2p/auto-tls

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/auto-tls

Automatically acquire a .libp2p.direct TLS certificate

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@libp2p/auto-tls

libp2p.io Discuss codecov CI

Automatically acquire a .libp2p.direct TLS certificate

About

When a publicly dialable address is detected, use the p2p-forge service at https://registration.libp2p.direct to acquire a valid Let's Encrypted-backed TLS certificate, which the node can then use with the relevant transports.

The node must be configured with a listener for at least one of the following transports:

  • TCP or WS or WSS, (along with the Yamux multiplexer and TLS or Noise encryption)
  • QUIC-v1
  • WebTransport

It also requires the Identify protocol.

Example - Use UPnP to hole punch and auto-upgrade to Secure WebSockets

import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { autoTLS } from '@libp2p/auto-tls'
import { webSockets } from '@libp2p/websockets'
import { uPnPNAT } from '@libp2p/upnp-nat'
import { createLibp2p } from 'libp2p'

const node = await createLibp2p({
  addresses: {
    listen: [
      '/ip4/0.0.0.0/tcp/0/ws'
    ]
  },
  transports: [
    webSockets()
  ],
  connectionEncrypters: [
    noise()
  ],
  streamMuxers: [
    yamux()
  ],
  services: {
    autoTLS: autoTLS(),
    upnp: uPnPNAT()
  }
})

// ...time passes

console.info(node.getMultiaddrs())
// includes public WSS address:
// [ '/ip4/123.123.123.123/tcp/12345/wss ]

Install

$ npm i @libp2p/plaintext

Browser <script> tag

Loading this module through a script tag will make it's exports available as Libp2pPlaintext in the global namespace.

<script src="https://unpkg.com/@libp2p/plaintext/dist/index.min.js"></script>

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 02 Nov 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