refactor directory

This commit is contained in:
LiBr
2026-04-10 08:53:51 +08:00
parent 41d3f700b9
commit 8d31144741
215 changed files with 938 additions and 1836 deletions

View File

@@ -1,68 +1,30 @@
# WebMuxD
# sideload.js
`webmuxd` is a WebUSB implementation of Apple's `usbmuxd` protocol, compatible with [libimobiledevice/usbmuxd](https://github.com/libimobiledevice/usbmuxd).
This repository is organized as a Bun workspace with four top-level areas:
## Usage
- `frontend/`: browser signing UI
- `backend/`: Cloudflare Workers Wisp proxy demo
- `dependencies/webmuxd/`: the publishable `webmuxd` package consumed by the frontend
- `wasm/openssl/`: the Rust/WASM OpenSSL bridge whose build artifacts are copied into `dependencies/webmuxd/lib/openssl-wasm`
Yarn:
`yarn add webmuxd`
## Install
NPM:
`npm add webmuxd`
```bash
bun install
```
## iMobileDevice Interaction Module
## Validate
This package now includes a browser-side high-level module for direct iOS interaction:
```bash
bun run build
bun run lint
bun run test
cd frontend && bun run build
cd backend && bun run check
```
- `DirectUsbMuxClient`: usbmux + lockdownd + AFC + installation_proxy lifecycle
- `installIpaViaInstProxy`: staging IPA via AFC and installing with InstProxy
- Pairing helpers: `createHostId`, `createSystemBuid`, pair record encode/decode helpers
## Workspace Notes
Import from root package:
`import { DirectUsbMuxClient, installIpaViaInstProxy } from "webmuxd"`
When device session requires TLS/pairing, inject your own `tlsFactory` and `pairRecordFactory` in `DirectUsbMuxClient` options.
## How it Works
In this repo you will find `webmuxd.ts`. This is a node module that provides the client side implementation of
connecting to the WebUSB API surface and configuring the message pump. You can see a more complete example and
implementation of this by looking at [webmuxd-example](https://github.com/webmuxd/webmuxd-example) and it's
corresponding server component [go-webmuxd](https://github.com/webmuxd/go-webmuxd). The example connects up this
component to a WebSocket and pipes the USB content back and forth to the `go-webmuxd` server, which finally passes
it to `libimobiledevice` via a UNIX socket on disk.
## Building
If you wish to create your own build it's rather simple:
`yarn run build`
## Developing
The simplest way to build, develop and diagnose is using the `XHC20` USB capture on macOS, and optionally `demuxusb`
https://www.umpah.net/how-to-sniff-usb-traffic-reverse-engineer-usb-device-interactions/
Using a Chromebook as an endpoint:
https://blog.rickmark.me/puppeteer-with-chromeos/
## Contributing and License
This project is happy to accept PRs and other contributions. It is free for commercial use under the MIT license,
I would love to see it credited if so!
## Roadmap
To make this component "production ready" and less of a proof of concept the following should be completed:
* Handle all `usbmuxd` framing, and ACKs in script to reduce RTT (round trip time)
* Create a standardized WebSocket protocol and move it from `webmuxd-example` to `webmuxd` keeping only the UI
* Move `MobileDevice.ts`
* Move `RemoteChannel.ts`
* Move `transport.proto` / `transport.ts`
* Factor out "common UI elements" to `webmuxd-ui`
* Device Picker
* Device Info
* Improve `go-webmuxd` as a multi-session "meet me" service
- `frontend/src/main.ts` must consume `webmuxd` package exports instead of duplicating usbmux/lockdown/AFC/InstProxy logic.
- Changes to device communication, pairing, or TLS behavior belong in `dependencies/webmuxd/src/` first.
- `wasm/openssl/pkg` is treated as a build artifact source for the package copy step.