What Exists Today

BuddyDrive currently has these security layers:

Component Algorithm Purpose
Direct peer transportlibp2p NoiseEncrypt direct libp2p connections
Folder content encryptionlibsodium crypto_secretbox (XSalsa20-Poly1305)Encrypt filenames and file contents stored on buddy's machine
Path encryptionDeterministic nonce from folderKey + pathSame path always encrypts to same ciphertext (enables move detection)
Chunk encryptionRandom nonce per 64KB chunkPrevents nonce reuse across file versions
Recovery config backuplibsodium crypto_secretboxEncrypt config synced to relay
Pairing codeShared secretMatch buddies, derive discovery keys, HMAC-authenticate relay records, and relay fallback sessions
Recovery mnemonicStandard BIP39 (128-bit entropy + SHA-256 checksum)Re-derive recovery metadata on a new machine; checksum catches transcription errors
Mnemonic-to-seedArgon2i (moderate tier, 256 MB memory)Key derivation from mnemonic (stronger than BIP39's PBKDF2)
Master keyBLAKE2b-256 of seedDeterministic 32-byte key from 64-byte Argon2i output
Public key (lookup)BLAKE2b-256 of master key + Base58Relay API lookup key (not an asymmetric public key)
Relay API signingEd25519 (derived from master key)Authenticate relay API mutations
Content hashingBLAKE2b-256 (streaming, 64KB chunks)File change detection, move detection, restore verification

Recovery Phrase And Master Key

  1. BuddyDrive generates 128 bits of random entropy
  2. A SHA-256 checksum (4 bits) is appended, and the 132 bits are encoded as a 12-word mnemonic using the BIP39 English wordlist — this follows the standard BIP39 specification
  3. The mnemonic is fed through Argon2i (moderate tier, 256 MB memory) to produce a 64-byte seed
  4. The seed is hashed with BLAKE2b to produce the 32-byte master key
  5. Recovery metadata is stored in config.toml
  6. The serialized config is encrypted with the master key before syncing it to the relay

When you later run buddydrive recover, BuddyDrive uses the same 12 words to derive the same recovery material, fetches the encrypted config from the relay, decrypts it locally, and writes the restored config.

The checksum in the mnemonic catches most single-word transcription errors — if you write down one word incorrectly, validation fails rather than silently producing the wrong key.

Key derivation divergence: BuddyDrive uses Argon2i for mnemonic-to-seed instead of BIP39's standard PBKDF2-HMAC-SHA512. Argon2i is more resistant to GPU and ASIC attacks. The consequence is that other BIP39 tools cannot derive the same master key from a BuddyDrive mnemonic.

Control API Access

The control API binds to all interfaces (default port 17521):

The secret provides basic protection but is low-entropy (32 bits). Only access the web GUI on trusted networks or over localhost.

Pairing And Direct Connections

Current Scope And Limits

When encrypted = false (sharing mode), files are stored plaintext on the buddy's machine. Pair only with buddies you trust for unencrypted folders.

What Your Buddy Can See Today

When folder encryption is enabled (default):

Your buddy cannot see:

Your buddy can see:

When folder encryption is disabled (encrypted = false):

Threat Model

What We Protect Against

Network interception on direct libp2p connections: Noise protects direct peer transport.

Buddy reading your files: folder encryption (XSalsa20-Poly1305) makes filenames and content opaque to the storage buddy.

Relay compromise for config backup: the relay stores an encrypted config blob; without the recovery phrase-derived master key it should not be readable.

Lost machine: recovery lets you rebuild config on a replacement device and then resync missing files.

What We Do Not Protect Against

Untrusted buddies with unencrypted folders: if you pair with someone you do not trust and use encrypted = false, they can read your synced files.

Your machine compromised: malware on your machine can read files before or during sync.

Denial of service: an attacker can still prevent peers from connecting.

Secure Pairing Guidelines

  1. Share codes verbally or in person when possible
  2. Verify identity through a second channel
  3. Use unique codes for each buddy relationship
  4. Check buddy IDs on both machines

Security Checklist

Bottom Line

BuddyDrive protects direct libp2p transport with Noise, encrypts relay-backed recovery config with your master key, and encrypts folder filenames and contents with XSalsa20-Poly1305 before storing them on your buddy's machine. Your buddy sees only opaque encrypted blobs. Set encrypted = false only for active collaboration with buddies you trust.