Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Using the BitTorrent DHT to store IoT data
I am using my forked version of the bitTorrent-dht module : https://github.com/EtienneV/bittorrent-dht
npm install dht-iot
var DHT_IOT = require('dht-iot')
var keypair = {publicKey:Buffer.from("xxxxxxxxxxxxxxxxxxxx", 'hex'),
secretKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxxxx", 'hex')}
var dht_iot = new DHT_IOT({keypair: keypair})
Initiate a dht-iot instance with a specified keypair.
var DHT_IOT = require('dht-iot')
var dht_iot = new DHT_IOT()
Initiate a dht-iot instance with a random keypair.
dht_iot.new_keypair()
It will display a new random keypair.
Send data over the DHT at the hash corresponding to the specified keypair.
dht_iot.put(val).then(function(hash) {})
IN val : Value to publish on the DHT
OUT hash : the hash corresponding to the value published
var DHT_IOT = require('dht-iot')
var keypair = {publicKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxx", 'hex'),
secretKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxxxxx", 'hex')}
var dht_iot = new DHT_IOT({keypair: keypair})
dht_iot.put(50).then(function(hash) {
console.log(hash)
dht_iot.destroy()
})
Get data at the hash corresponding to the specified keypair.
dht_iot.get().then(function(val) {})
OUT val.v : the value val.t : the date of the value (UNIX timestamp in seconds)
var DHT_IOT = require('dht-iot')
var keypair = {publicKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxxxxxxx", 'hex'),
secretKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'hex')}
var dht_iot = new DHT_IOT({keypair: keypair})
dht_iot.get().then(function(val) {
console.log(val.value)
dht_iot.destroy()
})
Get notified at every new message. The checking resolution is about 3 seconds.
dht_iot.get_notified() // Launch notification system
Everytime there is a new value an "new_value" event is fired
var DHT_IOT = require('dht-iot')
var keypair = {publicKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'hex'),
secretKey:Buffer.from("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'hex')}
var dht_iot = new DHT_IOT({keypair: keypair})
var notif = dht_iot.get_notified()
dht_iot.on('new_value', function(hash, data){
console.log('Hash : '+hash)
console.log('Timestamp : '+data.timestamp)
console.log('Value : '+data.value)
console.log()
})
FAQs
The BitTorrent DHT for IoT communication
We found that dht-iot 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.