Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Share

Secure P2P file sharing application with end-to-end encryption.

Project Structure

open-share/
├── src/                    # Rust library code
│   ├── api/               # API layer (Tauri commands)
│   ├── cli/               # CLI interface
│   ├── config/            # Configuration
│   ├── crypto/            # Cryptography (Ed25519, X25519, ChaCha20)
│   ├── discovery/         # mDNS peer discovery
│   ├── protocol/          # Server communication
│   ├── storage/           # Content-addressed storage
│   └── transport/         # QUIC/TCP transport
├── src-tauri/             # Tauri desktop app
│   ├── src/main.rs        # Tauri entry point
│   └── tauri.conf.json    # Tauri configuration
├── ui/                    # React frontend
│   ├── src/
│   │   ├── lib/api.ts     # TypeScript API bindings
│   │   └── pages/         # React pages
│   └── package.json
└── Cargo.toml             # Rust dependencies

Building

Prerequisites

  • Rust 1.70+
  • Node.js 18+
  • npm or yarn

CLI Only

cargo build --release
./target/release/open-share --help

GUI (Tauri)

# Install frontend dependencies
cd ui
npm install

# Build and run in development mode
cd ..
cargo tauri dev

# Build for production
cargo tauri build

CLI Usage

# Initialize (creates identity)
open-share init

# Discover peers
open-share discover

# Send a file
open-share send <file> --peer <device-id>

# Receive files
open-share receive

# List devices
open-share devices

# Show status
open-share status

GUI APIs

The GUI communicates with the Rust backend through Tauri commands. All APIs are available in ui/src/lib/api.ts.

Initialization

// Initialize the application
await initialize({ data_dir?: string, server_url?: string });

// Shutdown
await shutdown();

// Health check
const health = await healthCheck();
// Returns: { initialized, has_identity, is_logged_in, discovery_active, server_reachable, peers_count, active_transfers }

Identity & Authentication

// Get current device info
const device = await getDeviceInfo();
// Returns: { device_id, fingerprint, public_key_base64, created_at }

// Create new identity
const device = await createIdentity();

// Login to server
const result = await login({ email, password });
// Returns: { success, account_id?, message? }

// Logout
await logout();

// Register new account
const result = await registerAccount({ email, password });
// Returns: { account_id, message }

// Register device with account
const result = await registerDevice({ account_id, device_name });
// Returns: { device_id, certificate? }

Peer Discovery

// Start mDNS discovery
await startDiscovery();

// Stop discovery
await stopDiscovery();

// Get all discovered peers
const peers = await getPeers();

// Get only online peers
const peers = await getOnlinePeers();

// Get trusted peers
const peers = await getTrustedPeers();

// Trust a peer
await trustPeer({ device_id, fingerprint });

// Untrust a peer
await untrustPeer(deviceId);

// PeerResponse type:
// { device_id, fingerprint, account_hash, name?, addresses[], port, online, trusted, last_seen }

File Transfers

// Send a file to a peer
const result = await sendFile({ file_path, peer_device_id });
// Returns: { transfer_id, manifest_id }

// Get all transfers
const transfers = await getTransfers();

// Get specific transfer
const transfer = await getTransfer(transferId);

// Cancel transfer
await cancelTransfer(transferId);

// Pause transfer
await pauseTransfer(transferId);

// Resume transfer
await resumeTransfer(transferId);

// TransferResponse type:
// { transfer_id, manifest_id, filename, size, direction, peer_device_id, status, progress, bytes_transferred, started_at }

Storage Management

// Get storage statistics
const stats = await getStorageStats();
// Returns: { chunks_count, chunks_size_bytes, manifests_count, total_size_bytes }

// Cleanup old data
const result = await cleanupStorage({ max_age_days?: number, remove_completed?: boolean });
// Returns: { chunks_removed, bytes_freed }

Configuration

// Get current config
const config = await getConfig();
// Returns: { data_dir, server_url, discovery_port, transfer_port, chunk_size, max_concurrent_transfers, enable_relay, relay_url? }

// Update config
await updateConfig({
  server_url?: string,
  discovery_port?: number,
  transfer_port?: number,
  chunk_size?: number,
  max_concurrent_transfers?: number,
  enable_relay?: boolean,
  relay_url?: string
});

Device Management (Server)

// Get devices registered with server
const devices = await getServerDevices();
// Returns: [{ device_id, name, fingerprint, registered_at, last_seen?, is_current }]

// Revoke a device
await revokeDevice({ device_id, reason?: string });

// Refresh certificate revocation list
await refreshCrl();

QR Pairing

// Generate QR code for pairing
const result = await generateQrPairing();
// Returns: { qr_data, expires_at }

// Scan QR code to pair
const peer = await scanQrPairing({ qr_data });
// Returns: PeerResponse

Security

  • Identity: Ed25519 signing keys + X25519 key exchange
  • Encryption: ChaCha20-Poly1305 AEAD
  • Key Exchange: X3DH-style with ephemeral keys
  • Transport: QUIC with self-signed certificates
  • Storage: Content-addressed chunks with integrity verification

License

MIT

About

Rust workspace (library + CLI) providing discovery (mDNS), crypto primitives (Ed25519/X25519/HKDF/AEAD), handshake, transport and file-transfer examples for clients.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages