An open API service indexing awesome lists of open source software.

https://github.com/dozyio/js-libp2p-blind-rendezvous

Blind Rendezvous Points with JS libp2p
https://github.com/dozyio/js-libp2p-blind-rendezvous

dht libp2p rendezvous

Last synced: 21 days ago
JSON representation

Blind Rendezvous Points with JS libp2p

Awesome Lists containing this project

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

```console
npm i @dozyio/libp2p-blind-rendezvous
```

## Usage

```ts
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 {
// 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`: `15m`
- `clockSkewMs`: `3m`
- `derivationDomain`: `libp2p-blind-rendezvous/v1`
- `publishIntervalMs`: equal to `epochLengthMs`
- `pollIntervalMs`: `30s`
- `publishJitterMs`: `30s..90s`
- `logPrefix`: `libp2p:blind-rendezvous`
- `startingEpochMs`: `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 `startingEpochMs` when 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.