Send files directly between devices over the internet - no cloud storage, no size limits.
TypeScript cross-platformdata-transferdecentralizedfile-sharingfile-transferhole-punchingopen-sourcep2ppeer-to-peerprivacyprivacy-tools
equire topic auth before serving a file
Denis Lupookovb86f340a72da
diff --git a/docs/architecture.md b/docs/architecture.mdindex 707fa3e..7699a92 100644--- a/docs/architecture.md+++ b/docs/architecture.md@@ -99,7 +99,7 @@ The DHT **discovery topic** is only a hash — observable on the network, and (fThe sender sends a random `challenge` nonce; the receiver must reply with `topicProof(joinCode, nonce)` — a BLAKE2b hash of the code + nonce (`worklet/transfer/topic-auth.ts`). The join code never crosses the wire.-A valid proof releases the offers (even if late); a wrong proof drops the connection. A peer silent past 10 s isn't dropped — it's flagged **"Update to connect"** (`peer-unauthenticated`) and can still auth late (`peer-authenticated` clears it), so a busy sender never aborts a legit receiver. Receiving from an older sender is unaffected — a receiver only answers a challenge, never requires one.+A valid proof releases the offers (even if late) and is required to serve a file — `serve()` refuses a download request from an unauthenticated peer, so reaching the topic is not enough even if a file id leaks. A wrong proof drops the connection. A peer silent past 10 s isn't dropped — it's flagged **"Update to connect"** (`peer-unauthenticated`) and can still auth late (`peer-authenticated` clears it), so a busy sender never aborts a legit receiver. Receiving from an older sender is unaffected — a receiver only answers a challenge, never requires one.## Relay fallbackdiff --git a/packages/core/src/worklet/transfer/orchestrator.ts b/packages/core/src/worklet/transfer/orchestrator.tsindex 0134772..03f8ac1 100644--- a/packages/core/src/worklet/transfer/orchestrator.ts+++ b/packages/core/src/worklet/transfer/orchestrator.ts@@ -372,6 +372,10 @@ export class TransferOrchestrator implements TransferRPC {}private serve(message: DownloadRequest, session: PeerSession): void {+ if (!this.authedPeers.has(session.peerKey)) {+ console.warn('TransferOrchestrator: refused download from unauthenticated peer')+ return+ }if (!session.drive) returnsession.drive.serve(message.fileId, message.fileName, this.storage.sender.localPath(message.fileId))diff --git a/packages/drive/README.md b/packages/drive/README.mdindex 11b1d7f..6035fdb 100644--- a/packages/drive/README.md+++ b/packages/drive/README.md@@ -28,15 +28,17 @@ For a non-disk source, pass your own reader/writer to `SenderSession` /```start { transferId, name, size, chunkSize } sender → receiverneed { indices } receiver → sender-<chunk> header{ index, hash } + bytes sender → receiver-complete { fileHash } sender → receiver+<chunk> header{ index } + bytes sender → receiver+complete { } sender → receiverack { savedTo } receiver → sendercancel { reason? } either```Chunk size is derived from file size, so both sides compute the same geometry-from `start`. Each chunk carries a blake2b hash, verified on arrival. `fileHash`-hashes the chunk hashes; the receiver checks it on resume.+from `start`. The engine verifies geometry only — it does not hash content, so a+receiver cannot detect a peer serving the wrong bytes. That is fine while the+only source is the authenticated sender; a seeder would need a commitment the+receiver can check independently.## Interfaces