Privacy-Preserving, Decentralized Encrypted Backup Agent
A privacy-first, decentralized backup solution with military-grade encryption
All data is encrypted locally using AES-256-GCM before storage or transmission. Your passphrase never leaves your machine, and peers can't read your data without it.
Built on libp2p for peer-to-peer communication. No central servers, no single point of failure. Peers gossip and sync directly via PubSub and direct streams.
Content-addressed storage with SHA-256 hashing ensures only unique chunks are stored. Saves bandwidth and storage across all snapshots.
Every snapshot is signed with Ed25519 keys. Verify authenticity and prevent tampering with cryptographic proof of origin.
Peers automatically discover and fetch missing chunks through gossip protocols. Multi-source downloads improve resilience and speed.
Built-in support for auto-relay and hole punching. Works behind NATs and firewalls without manual port forwarding.
Built with cutting-edge technologies for maximum security and performance
Comprehensive workflow from snapshot creation to peer synchronization and restoration
Get up and running in minutes
# Clone the repository
git clone https://github.com/hoangsonww/ShadowVault-Go-Encryptor.git
cd ShadowVault-Go-Encryptor
# Build all binaries
make build
# Run tests
make test
This creates three binaries: backup-agent, restore-agent, and peerctl.
# Use the entry point script (builds + configures + starts daemon)
./entrypoint.sh config.yaml /path/to/backup
# Or manually start the daemon
./bin/backup-agent daemon -c config.yaml -p "your-secure-passphrase"
# Take a snapshot of a directory
./bin/backup-agent snapshot /path/to/important/data -c config.yaml -p "passphrase"
# Using the helper script
./scripts/snapshot.sh /path/to/important/data
# List known peers
./bin/peerctl list -c config.yaml -p "passphrase"
# Add a peer by multiaddr
./bin/peerctl add /ip4/192.168.1.100/tcp/9000/p2p/QmPeerID -c config.yaml -p "passphrase"
# Remove a peer
./bin/peerctl remove QmPeerID -c config.yaml -p "passphrase"
# Restore a snapshot by ID
./bin/restore-agent restore <snapshot-id> /path/to/restore -c config.yaml -p "passphrase"
# Using the helper script
./scripts/restore.sh <snapshot-id> /path/to/restore
Run ShadowVault in containers for easy deployment and scaling
# Build the Docker image
docker build -t shadowvault:latest .
# Or use make
make docker
# Run daemon in container
docker run --rm \
-v "$(pwd)/data":/data \
-v "$(pwd)/config.yaml":/app/config.yaml:ro \
-e PASSPHRASE=yourpass \
shadowvault:latest
# Start multiple nodes with compose
docker compose up
# Scale to N nodes
docker compose up --scale node1=3
Customize ShadowVault with config.yaml
repository_path: "./data"
listen_port: 9000
# Bootstrap peers for initial connection
peer_bootstrap:
- "/ip4/127.0.0.1/tcp/9001/p2p/QmSomePeerID"
# NAT traversal settings
nat_traversal:
enable_auto_relay: true
enable_hole_punching: true
# Chunking configuration
snapshot:
min_chunk_size: 2048
max_chunk_size: 65536
avg_chunk_size: 8192
# Access control list
acl:
admins:
- "base64-ed25519-pubkey-1"
- "base64-ed25519-pubkey-2"
| Parameter | Description | Default |
|---|---|---|
repository_path |
Local storage path for snapshots and metadata | ./data |
listen_port |
Port for libp2p connections | 9000 |
peer_bootstrap |
List of bootstrap peer multiaddrs | [] |
enable_auto_relay |
Enable automatic relay for NAT traversal | true |
enable_hole_punching |
Enable DCUtR hole punching | true |
min_chunk_size |
Minimum chunk size in bytes | 2048 |
max_chunk_size |
Maximum chunk size in bytes | 65536 |
avg_chunk_size |
Target average chunk size | 8192 |
Military-grade security with multiple layers of protection
All data chunks are encrypted with AES-256 in Galois/Counter Mode, providing both confidentiality and authenticated encryption. Keys are derived using Argon2id/scrypt from your passphrase.
Every snapshot and protocol message is cryptographically signed using Ed25519, ensuring authenticity and preventing tampering. Signatures are verified before acceptance.
Each peer has a stable libp2p identity based on a persistent private key. This enables trust establishment and reputation tracking across sessions.
ACLs govern which Ed25519 public keys are authorized to introduce peers, create snapshots, or perform administrative operations, preventing unauthorized actions.
SHA-256 hashing ensures chunk integrity. Hash mismatches automatically trigger rejection and re-fetch from alternate sources, protecting against corruption.
Peers can't decrypt your data without the passphrase. The network operates on encrypted blobs, maintaining privacy even with malicious participants.
Efficient, type-safe serialization for all network communication
| File | Purpose | Key Messages |
|---|---|---|
common.proto |
Shared types and acknowledgments | Ack |
snapshot.proto |
Snapshot metadata and file entries | FileEntry, SnapshotMetadata, SnapshotAnnouncement |
block.proto |
Chunk transfer protocol | BlockAnnounce, BlockRequest, BlockResponse |
peer.proto |
Peer management messages | PeerInfo, PeerAdd, PeerRemove, PeerList |
auth.proto |
Authentication and authorization | ACL, SignedMessage |
identity.proto |
Identity records | Identity |
service.proto |
gRPC service definitions | ShadowVault service RPCs |
# Install protobuf compiler plugins
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
# Generate Go bindings from proto files
protoc --go_out=. --go-grpc_out=. proto/*.proto
Complete reference for all command-line tools
Main daemon and snapshot creation tool.
./bin/backup-agent daemon -c <config> -p <passphrase>
Start the daemon for continuous operation and peer communication
./bin/backup-agent snapshot <path> -c <config> -p <passphrase>
Create a new snapshot of the specified directory
./bin/backup-agent list -c <config> -p <passphrase>
List all local snapshots with metadata
Snapshot restoration and data recovery tool.
./bin/restore-agent restore <snapshot-id> <target-dir> -c <config> -p <passphrase>
Restore a snapshot to the target directory
./bin/restore-agent verify <snapshot-id> -c <config> -p <passphrase>
Verify snapshot integrity without restoring
Peer network management utility.
./bin/peerctl list -c <config> -p <passphrase>
List all known peers with their connection status
./bin/peerctl add <multiaddr> -c <config> -p <passphrase>
Manually add a peer by multiaddr (e.g., /ip4/1.2.3.4/tcp/9000/p2p/QmPeerID)
./bin/peerctl remove <peer-id> -c <config> -p <passphrase>
Remove a peer from the stored peer list
./bin/peerctl info <peer-id> -c <config> -p <passphrase>
Get detailed information about a specific peer
| Flag | Short | Description | Required |
|---|---|---|---|
--config |
-c |
Path to config.yaml file | Yes |
--pass |
-p |
Encryption passphrase | Yes |
--verbose |
-v |
Enable verbose logging | No |
--help |
-h |
Show help message | No |
Comprehensive test suite for reliability and correctness
# Run all tests
make test
# Run with coverage
go test ./... -cover
# Verbose output
go test ./... -v
Critical modules tested:
# Format code
make fmt
# Check formatting
make check-fmt
# Run linter (if configured)
golangci-lint run
Common issues and their solutions
| Problem | Likely Cause | Solution |
|---|---|---|
| Snapshot creation fails | File permissions or missing files | Check file access rights, run with appropriate privileges |
| Cannot fetch chunk from peer | Peer offline or no announcement | Verify peer connection with peerctl list, check network |
| Signature validation fails | Wrong passphrase or tampered data | Verify passphrase, reject corrupted snapshots |
| Identity changes unexpectedly | identity.key deleted or corrupted | Restore from backup, avoid deleting identity.key |
| Peer not discovered | Bootstrap misconfig or network issue | Check bootstrap addresses, verify firewall settings |
| High memory usage | Large files or many concurrent ops | Adjust chunk sizes, limit concurrent snapshots |
| Port already in use | Another instance running | Change listen_port in config or stop other instance |
| Database corruption | Unclean shutdown or disk error | Restore metadata.db from backup, use fsck |
-v flag for verbose loggingrepository_path/logs/ping and telnetdocker logs for containerized deploymentsHelp make ShadowVault better
git clone https://github.com/YOUR_USERNAME/ShadowVault-Go-Encryptor.git
cd ShadowVault-Go-Encryptor
git checkout -b feature/amazing-feature
Write clean, tested code following the project's style guide. Add tests for new features.
make test
make check-fmt
git add .
git commit -m "feat: add amazing feature"
git push origin feature/amazing-feature
Then open a Pull Request on GitHub with a clear description.
Understanding the codebase organization
ShadowVault-Go-Encryptor/
โโโ cmd/ # Command-line applications
โ โโโ backup-agent/ # Main daemon & snapshot CLI
โ โโโ backup-agent-restore/ # Restore agent CLI
โ โโโ peerctl/ # Peer management CLI
โโโ internal/ # Internal packages
โ โโโ agent/ # Core agent logic
โ โโโ auth/ # Authentication & ACL
โ โโโ chunker/ # Content-defined chunking
โ โโโ crypto/ # Encryption primitives
โ โโโ identity/ # Identity management
โ โโโ p2p/ # libp2p networking
โ โโโ persistence/ # bbolt database wrappers
โ โโโ protocol/ # Protocol message handlers
โ โโโ snapshots/ # Snapshot creation/restoration
โ โโโ storage/ # Content-addressed storage
โ โโโ versioning/ # Snapshot versioning
โโโ proto/ # Protocol Buffer definitions
โ โโโ common.proto
โ โโโ snapshot.proto
โ โโโ block.proto
โ โโโ peer.proto
โ โโโ auth.proto
โ โโโ identity.proto
โ โโโ service.proto
โโโ scripts/ # Helper shell scripts
โ โโโ bootstrap.sh # Initial setup
โ โโโ snapshot.sh # Snapshot wrapper
โ โโโ restore.sh # Restore wrapper
โโโ tools/ # Utility programs
โ โโโ hashfile.c # SHA-256 verification tool
โโโ packages/ # Web assets (this wiki)
โ โโโ styles.css
โ โโโ script.js
โโโ config.yaml # Configuration file
โโโ docker-compose.yml # Multi-node orchestration
โโโ Dockerfile # Container image definition
โโโ entrypoint.sh # Main entry point script
โโโ Makefile # Build automation
โโโ go.mod # Go module definition
โโโ LICENSE # MIT License
โโโ README.md # Project documentation
โโโ index.html # This wiki page
Open source under the MIT License
MIT License
Copyright (c) 2025 Son Nguyen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.