The DHT powering Hyperswarm for Hugin.
npm install hyperdht-huginA fork of hyperdht with added connection signature verification for Hugin Messenger.
```
npm install hyperdht-hugin
This fork adds a signature verification layer to DHT connections:
- sig - A signature proving ownership of shared group keys
- dht_keys - DHT keypair for connections
- keychain - Shared keychain for signature verification
This prevents unauthorized connections even if topics are leaked.
`js
import DHT from 'hyperdht-hugin'
// Create DHT with signature verification
const node = new DHT({
bootstrap: ['host:port']
}, sig, dht_keys, keychain)
`
`js
const server = node.createServer()
server.on('connection', function (socket) {
console.log('Remote public key', socket.remotePublicKey)
process.stdin.pipe(socket).pipe(process.stdout)
})
const keyPair = DHT.keyPair()
await server.listen(keyPair)
`
`js
const socket = node.connect(publicKey)
socket.on('open', function () {
// socket fully open with the other peer
})
process.stdin.pipe(socket).pipe(process.stdout)
`
The API is identical to hyperdht with the extended constructor:
`js`
new DHT(options, sig, dht_keys, keychain)
| Parameter | Description |
|-----------|-------------|
| options | Standard hyperdht options (bootstrap, keyPair, etc.) |sig
| | Signature proving group membership |dht_keys
| | Keychain providing DHT keypair via .get() |keychain
| | Keychain for verifying signatures via .verify()` |
For full API documentation, see the original hyperdht docs.
Based on hyperdht by Holepunch (MIT License).
MIT