npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hyperdivision/heimdall-pairing

v6.0.7

Published

Pair a new user (initator) and an existing user (responder) in Heimdall

Downloads

2

Readme

heimdall-pairing

Pair a new user (initator) and an existing user (responder) in Heimdall

npm install @hyperdivision/heimdall-pairing

Usage

const { Initiator, Responder } = require('@hyperdivision/heimdall-pairing')

const i = new Initiator({
  keypair,
  profile
})

const r = new Responder({
  propose (key, profile, profileSignature, done) {
    // human validate the profile and propose it on the network
    // then reply back with the server key
    done(null, serverKey)
  })
})

// share the discovery key
r.setDiscoveryKey(i.discoveryKey)

r.on('pin', function (pin) {
  // communicate the security ping to i
  i.setPin(pin)
})

i.on('server-key', function (serverKey) {
  // and you are paired!
  // once the network approves you the server will
  // start replicating with you if you join the swarm using the above key
})

API

i.setProfile(profile)

Set the profile asynchrously in case you cannot pass one in the constructor

i.on('connected')

Emitted when it connects to the other peer before it is verified

i.on('verified')

Emitted when the other peer is verified (the pin matched)

i.on('server-key', serverKey)

Emitted when the pairing is done and the responder sends the server key

i.on('announcing')

Emitted when the initiator starts announcing on the network

i.on('error', err)

Emitted when there was an error in the pairing flow

i.discoveryKey

Share this discovery key with the responder (3 words)

i.setPin(pin)

Call this when the responder communicates the pin to you

i.destroy(err)

Call this to forcefully shutdown the pairing.

r.on('discovery-key', dk)

Emitted when the discovery key is set on the responder.

r.on('peer', peer)

Emitted when the responder founds a peer on the DHT that could be the initiator.

r.on('connecting', peer)

Emitted when the responder tries to connect to peer.

r.on('connected')

Emitted when the responder established connection with a potential initiator.

r.on('profile', key, profile, profileSignature)

Emitted when a profile is received from the initiator.

r.on('error', error)

Emitted when there was an error in the pairing flow.

r.on('server-key', serverKey)

Emitted when the responder sends the server key.

r.destroy(err)

Call this to forcefully shutdown the pairing.

bool = Responder.validateDiscoveryKey(dk)

Static helper to check if a discovery consists of valid words.

License

MIT