Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
bittorrent-dht-store-keypair
Advanced tools
create and load signing keys for bittorrent-dht dht_store
Setting up elliptic curve keys and signing properly for BEP44 can be tricky, especially since bittorrent uses the more obscure supercop/ref10 instead of sodium/nacl ed25519 key formatting.
var KP = require('bittorrent-dht-store-keypair')
var DHT = require('bittorrent-dht')
var dht = new DHT({ verify: KP.verify })
var kp = KP()
var value = 'beep boop'
dht.once('ready', function () {
dht.put(kp.store(value), function (errors, hash) {
if (errors.length) errors.forEach(console.log)
else console.log(kp.id)
})
})
var KP = require('bittorrent-dht-store-keypair')
var kp = KP()
console.log(JSON.stringify({
publicKey: kp.publicKey.toString('hex'),
secretKey: kp.secretKey.toString('hex')
}))
$ node generate.js > keypair.json
var KP = require('bittorrent-dht-store-keypair')
var DHT = require('bittorrent-dht')
var path = require('path')
var concat = require('concat-stream')
var dht = new DHT({ verify: KP.verify })
var kp = KP(require(path.resolve(process.argv[2])))
dht.once('ready', function () {
process.stdin.pipe(concat(function (value) {
dht.put(kp.store(value), function (errors, hash) {
if (errors.length) errors.forEach(console.log)
else console.log(kp.id)
})
}))
})
$ echo wow cool | node put.js keypair.json
var KP = require('bittorrent-dht-store-keypair')
opts.publicKey
- create kp
with a buffer or hex string public keyopts.secretKey
- create kp
with a buffer or hex string private keyopts.seq
- sequence to start at in kp.store()
Sign a buffer or string value
with the private key.
Create the putOpts
for a value
to pass into bittorrent-dht's put()
function.
kp.seq
is incremented here unless opts.seq
is provided.
public key (32 bytes)
private key (64 bytes)
sha1 hash of the kp.publicKey
sequence number
The underlying ed25519-supercop verify function.
This is handy to pass into the bittorrent-dht constructor as the verify
parameter:
var DHT = require('bittorrent-dht')
var KP = require('bittorrent-dht-store-keypair')
var dht = new DHT({ verify: KP.verify })
npm install bittorrent-dht-store-keypair
MIT
FAQs
create and load signing keys for bittorrent-dht dht_store
The npm package bittorrent-dht-store-keypair receives a total of 0 weekly downloads. As such, bittorrent-dht-store-keypair popularity was classified as not popular.
We found that bittorrent-dht-store-keypair demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.