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

https://github.com/dineshkn-dev/tora

A premium, security-first, macOS-native BitTorrent client built with Swift, SwiftUI, and libtorrent-rasterbar.
https://github.com/dineshkn-dev/tora

bittorrent bittorrent-client libtorrent macos native-app p2p swift swiftui torrent torrent-client

Last synced: 5 days ago
JSON representation

A premium, security-first, macOS-native BitTorrent client built with Swift, SwiftUI, and libtorrent-rasterbar.

Awesome Lists containing this project

README

          


Tora Logo

Tora


A premium, security-first, macOS-native BitTorrent client built with Swift, SwiftUI, and libtorrent-rasterbar.


Platform: macOS 14.0+
Language: Swift 5.10
License: MIT
Engine: Libtorrent 2.0


Tora App Interface Dashboard Mockup

---

## Status

Tora is currently in early active development. The security-first project skeleton, validation layers, dynamic bridge boundary, CI workflow, and automated production packaging pipelines are fully implemented and ready.

## Security Posture

Unlike generic clients, Tora is built on a fail-closed, secure-by-default architecture:

* 🔒 **Isolated Engine**: Libtorrent is strictly isolated behind a thin `TorrentService` boundary. No raw handles can escape.
* 🛡️ **Path Validation**: Download and save paths are recursively validated to prevent filesystem traversals or system directory pollution.
* 🚫 **No Auto-Opening**: Tora will never automatically open or execute downloaded files.
* 🔏 **Sandbox Boundary**: The app defaults to a dedicated downloads sandbox folder: `~/Downloads/Tora`.
* 🔌 **Fail-Closed Connections**: Local network-discovery settings (LPD, UPnP, NAT-PMP) are disabled by default and require explicit review to enable.

---

## Quick Start

### Build Requirements
* macOS Sonoma (14.0) or newer
* Xcode 15 / Swift 5.10+
* Homebrew (for libtorrent engine bindings)

### 1. Development Build (Fail-Closed)
To run a fast, fail-closed development build without installing external system dependencies:
```sh
swift test
swift run Tora
```
*Note: In this mode, calls requiring libtorrent will return a safe mock response until linked.*

### 2. Full Build (Libtorrent-Enabled)
Install libtorrent and build with linked bindings:
```sh
brew install libtorrent-rasterbar
TORA_LIBTORRENT_PREFIX="$(brew --prefix libtorrent-rasterbar)" swift build
```

---

## Interactive Developer Manual

🛠️ Local Development Automation Scripts

Tora includes shell commands and Finder-friendly shortcuts for key development tasks:

| Command | File Path | Description |
| :--- | :--- | :--- |
| **Run Dev** | `Commands/dev.sh` | Builds and runs Tora from SwiftPM. |
| **Build Prod** | `Commands/prod.sh` | Compiles a production `.app`, runs ad-hoc code-signing, and launches it. |
| **Run Tests** | `Commands/test.sh` | Runs unit tests (with libtorrent-enabled tests if library is installed). |
| **Watch Files** | `Commands/watch.sh` | Automatically rebuilds and restarts Tora when source files change. |

*Finder Launchers are also available in `Commands/` as `.command` scripts (e.g., `Commands/Prod.command`) for quick double-click launching.*

⚓ Local Git Automation (Pre-commit / Pre-push Hooks)

To set up pre-commit validation (runs unit tests) and pre-push validation (runs full libtorrent build):
```sh
Scripts/install-git-hooks.sh
```
These hooks run automatically to verify code correctness before syncing upstream.

⚡ Technical Architecture: Libtorrent Bridge

Tora isolates unsafe C++ bindings using a structured bridge boundary:
```mermaid
graph TD
ToraApp[Sources/ToraApp] --> ToraUI[Sources/ToraUI]
ToraUI --> ToraCore[Sources/ToraCore]
ToraCore --> ToraLibtorrentBridge[Sources/ToraLibtorrentBridge]
ToraLibtorrentBridge --> LibtorrentC["libtorrent-rasterbar (C++)"]
```
* **Protocol Isolation**: The Swift app depends exclusively on `TorrentServiceProtocol`.
* **Zero C++ Leaks**: All raw C++ pointers, standard containers (`std::vector`), and Libtorrent types are fully contained inside `Sources/ToraLibtorrentBridge` to prevent runtime undefined behaviors or memory leaks in Swift code.

---

## License

Tora is licensed under the [MIT License](LICENSE).
For security concerns, please refer to our [Security Policy](SECURITY.md).