$ show majd/ipatool
ipatool is a cross-platform command-line tool that acts as an unofficial Apple App Store client. It enables searching, purchasing, and downloading iOS/iPadOS/tvOS/watchOS/visionOS/macOS applications and packages directly from Apple's servers. The tool implements Apple's private SAP authentication and signing protocol by emulating Apple's StoreAgent binary in-process using the Unicorn CPU emulator, allowing it to generate kbsync blobs and decrypt macOS packages. It also includes low-level parsers for Apple's proprietary formats (AEA encrypted archives, APFS filesystems, dyld shared caches) to extract assets from macOS restore images. The architecture is modular: a CLI layer (using cobra) dispatches to domain logic in pkg/appstore, which relies on a generic HTTP client (pkg/http), keychain storage (pkg/keychain), and platform abstractions (pkg/util). An MCP (Model Context Protocol) server subcommand exposes the same functionality over stdio. The codebase is heavily tested with unit and integration tests, and CI builds for macOS, Linux, Windows, and iOS. While primarily an application, it contains significant reverse-engineering and protocol-analysis components, giving it a hybrid character.
The LLM identified 5 files worth highlighting for reuse:
A generic, type-parameterized HTTP client that supports multiple payload encodings (XML, URL-encoded, raw), per-request timeouts, retry with backoff, and transport error classification. It is fully mockable via an interface and can be extracted and reused in any Go project requiring a robust HTTP client with custom result types.
A clean abstraction for secure credential storage with get/set/remove operations, backed by platform-specific keyrings (macOS Keychain, Linux Secret Service, Windows Credential Manager). The interface is minimal and self-contained, making it easy to extract and adapt for any application needing cross-platform credential management.
A structured logging module with configurable log levels, multiple output writers (console, file), and a clean interface. It is independent of the rest of the codebase and can be reused in any Go application for consistent logging.
A cross-platform MAC address retrieval utility that uses platform-specific backends (IOKit on macOS, sysfs on Linux, MIB_IF_ROW2 on Windows) with graceful fallbacks. The abstraction is isolated and can be extracted for any project needing deterministic machine identity without external dependencies.
A content-addressed runtime artifact cache that downloads, verifies SHA-256 digests, and handles concurrent installation with file locking. It is self-contained and can be reused for any application that needs to cache and verify external binaries or data files with integrity guarantees.