@dozyio/libp2p-blind-rendezvous
v1.0.1
Published
Epoch-based blind rendezvous helper for js-libp2p
Maintainers
Readme
@dozyio/libp2p-blind-rendezvous
Epoch-based blind rendezvous for js-libp2p.
This package derives blinded rendezvous CIDs from:
- shared
secret namespace- epoch index
It then publishes provider records for active epochs via content routing.
Install
npm i @dozyio/libp2p-blind-rendezvousUsage
import { createLibp2p } from 'libp2p'
import { kadDHT } from '@libp2p/kad-dht'
import { blindRendezvous } from '@dozyio/libp2p-blind-rendezvous'
import type { BlindRendezvousPointInit } from '@dozyio/libp2p-blind-rendezvous'
async function loadPairedPointConfig (): Promise<BlindRendezvousPointInit> {
// Out of scope for this package (pairing/secret exchange)
return {
secret: crypto.getRandomValues(new Uint8Array(32)),
namespace: 'dozyio/prod/chat'
}
}
const pairedPoint = await loadPairedPointConfig()
const node = await createLibp2p({
services: {
dht: kadDHT(),
blindRendezvous: blindRendezvous({
addressChangeDebounceMs: 30 * 1000
})
}
})
await node.start()
await node.services.blindRendezvous.upsertPoint('paired-device', pairedPoint, {
publish: true
})
for await (const candidate of node.services.blindRendezvous.findPointProviders('paired-device')) {
console.log('found blind rendezvous candidate', candidate)
}Defaults
epochLengthMs:15mclockSkewMs:3mderivationDomain:libp2p-blind-rendezvous/v1publishIntervalMs: equal toepochLengthMspollIntervalMs:30spublishJitterMs:30s..90slogPrefix:libp2p:blind-rendezvousstartingEpochMs:0(Unix epoch timestamp)
Notes
- On start, the service publishes provider records for configured points.
- A single service instance can manage multiple rendezvous points via
upsertPoint/removePoint. - It republishes periodically and also debounced on
self:peer:update. - Use
startingEpochMswhen you want epochs anchored to pairing time (or another custom timestamp). - Provider discovery results are only rendezvous candidates; authentication/authorization of discovered peers is required and intentionally out of scope for this package.
