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

bittorrent-dht-sodium

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bittorrent-dht-sodium

Sodium wrapper for working with BEP44 on bittorrent-dht

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29
decreased by-21.62%
Maintainers
1
Weekly downloads
 
Created
Source

bittorrent-dht-sodium

Build Status

Sodium wrapper for working with BEP44 on bittorrent-dht

Usage

var eddsa = require('bittorrent-dht-sodium')
const DHT = require('bittorrent-dht')
const dht = new DHT({
  verify: eddsa.verify
})

const keys = eddsa.keygen()

dht.put({
  v: Buffer.from('Hello world'),
  k: keys.pk,
  seq: 0,
  sign: (msg) => {
    return eddsa.sign(msg, keys.sk)
  }
}, function (err, hash) {
  // ...
})

API

const { pk, sk } = eddsa.keygen([sk])

Derive a Ed25519 keypair, optionally deriving the pk from an exisiting sk. Returns pk as Public Key, sk as Secret Key. The sk here is not compatible with ed25519-supercop, as the encoding is different, but signatures will be the same.

const sig = eddsa.sign(msg, sk)

Sign Buffer msg with sk returning the signature as a Buffer

const valid = eddsa.verify(sig, msg, pk)

Verify Buffer sig against Buffer msg with pk returning boolean whether valid or not.

const salt = eddsa.salt()

Generate a 64 byte random salt. This is equal to the block size of SHA-1, the hash function used by the DHT.

Install

npm install bittorrent-dht-sodium

License

ISC

FAQs

Package last updated on 20 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