diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b065b11..27728a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,3 +43,60 @@ jobs: - if: runner.os == 'Linux' uses: ./.github/actions/linux-deps - run: cargo test --workspace --locked + # The lint job runs on Linux; Windows-only code needs its own pass. + - if: runner.os == 'Windows' + run: cargo clippy --workspace --all-targets --locked -- -D warnings + + askpass-release-windows: + # The release exe is a GUI-subsystem program, unlike the debug build the test job uses; + # ssh runs it as SSH_ASKPASS and reads the answer from its stdout. + name: askpass (windows release build) + runs-on: windows-latest + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - name: Rust toolchain (from rust-toolchain.toml) + run: rustup toolchain install || rustup show + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + with: + key: release + - name: ssh-keygen opens a key through the release exe as askpass + shell: bash + run: | + set -o pipefail + # Once with the ssh-keygen on PATH (Git for Windows' MSYS build) and once with Windows' + # own OpenSSH, which starts askpass differently (posix_spawnp) and is what most users run. + for keygen in "" 'C:\Windows\System32\OpenSSH\ssh-keygen.exe'; do + REDSHELL_TEST_SSH_KEYGEN="$keygen" cargo test --release --locked -p redshell-app --test askpass -- --nocapture 2>&1 | tee askpass.log + # The test skips itself without a usable ssh-keygen; here that must not pass silently. + if grep -q "skipped:" askpass.log; then echo "::error::the askpass test was skipped"; exit 1; fi + done + + server-arm64: + # The server's crates on the architecture of a Raspberry Pi. + name: test (server, linux arm64) + runs-on: ubuntu-22.04-arm + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - name: Rust toolchain (from rust-toolchain.toml) + run: rustup toolchain install || rustup show + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + - run: cargo test --locked -p redshell-server -p redshell-protocol -p redshell-terminal -p redshell-remote -p redshell-core + + web: + name: web (typecheck, lint, test, build) + runs-on: ubuntu-latest + defaults: + run: + working-directory: web + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0 + with: + node-version: 24 + cache: npm + cache-dependency-path: web/package-lock.json + - run: npm ci + - run: npm run typecheck + - run: npm run lint + - run: npm test + - run: npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fe43f4..5f0b988 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -247,8 +247,99 @@ jobs: name: ${{ matrix.name }} path: dist/* + server: + # redshell-server with the RedShell Remote PWA embedded: a tarball everywhere and a .deb + # (with the per-user systemd unit) on Linux. The aarch64 build is the one for a Raspberry Pi + # (64-bit Raspberry Pi OS). Linux builds run on 22.04 so the binaries need glibc 2.35. + needs: version + name: server (${{ matrix.name }}) + permissions: + contents: read + strategy: + fail-fast: false + matrix: + include: + - name: linux-x86_64 + os: ubuntu-22.04 + targets: x86_64-unknown-linux-gnu + deb-arch: amd64 + - name: linux-aarch64 + os: ubuntu-22.04-arm + targets: aarch64-unknown-linux-gnu + deb-arch: arm64 + - name: macos-universal + os: macos-15-intel + targets: aarch64-apple-darwin x86_64-apple-darwin + runs-on: ${{ matrix.os }} + env: + TARGETS: ${{ matrix.targets }} + BASE_NAME: redshell-server-${{ github.event.inputs.tag || github.ref_name }}-${{ matrix.name }} + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + - uses: actions/setup-node@8fccf151e3ba8038c300f83b40c8fd1e94f9c5ce # v7.2.0 + with: + node-version: 24 + cache: npm + cache-dependency-path: web/package-lock.json + - name: Build the PWA + working-directory: web + run: | + npm ci + npm run build + test -f dist/index.html + - name: Rust toolchain (from rust-toolchain.toml) + shell: bash + run: | + rustup toolchain install || rustup show + rustup target add $TARGETS + - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3 + with: + key: server-${{ matrix.name }} + - name: Build + shell: bash + run: | + set -euo pipefail + for target in $TARGETS; do + cargo build --release --locked --target "$target" -p redshell-server + done + mkdir -p out + set -- $TARGETS + if [ $# -gt 1 ]; then + lipo -create $(printf 'target/%s/release/redshell-server ' "$@") -output out/redshell-server + lipo -info out/redshell-server + else + cp "target/$1/release/redshell-server" out/redshell-server + fi + # The PWA must be in the binary, not the placeholder page. + if ! grep -q "manifest.webmanifest" out/redshell-server; then + echo "::error::the PWA was not embedded" + exit 1 + fi + out/redshell-server --version + - name: Package + shell: bash + run: | + set -euo pipefail + mkdir -p dist "$BASE_NAME" + cp out/redshell-server README.md LICENSE CHANGELOG.md docs/REMOTE.md "$BASE_NAME/" + cp "packaging/server/redshell-server@.service" "$BASE_NAME/" + tar -czf "dist/$BASE_NAME.tar.gz" "$BASE_NAME" + if [ -n "${{ matrix.deb-arch }}" ]; then + scripts/package-server-deb.sh out/redshell-server "${TAG#v}" "${{ matrix.deb-arch }}" "dist/$BASE_NAME.deb" + dpkg-deb -I "dist/$BASE_NAME.deb" | head -5 + fi + cd dist + for file in *; do + if command -v sha256sum >/dev/null; then sha256sum "$file"; else shasum -a 256 "$file"; fi > "$file.sha256" + done + ls -la + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: server-${{ matrix.name }} + path: dist/* + publish: - needs: [version, build] + needs: [version, build, server] permissions: contents: write # Publish whatever built, so one stuck runner doesn't block a release; re-run diff --git a/.gitignore b/.gitignore index bd003ec..9ae4076 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ target/ *.db *.db-journal .DS_Store +web/node_modules +web/dist +web/dev-dist diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c7d77d..8c98e3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,104 @@ All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and versions follow [Semantic Versioning](https://semver.org/). +## [0.0.3] - 2026-12-04 + +This release adds `redshell-server`, which keeps shells and coding agents running on an +always-on machine such as a Raspberry Pi, for the desktop and for RedShell Remote, the web app it +serves to phones. SSH hosts also get a home in the app: an editor instead of `config.toml`, +password dialogs backed by the system keychain, port forwards and a file browser. + +**Upgrading from 0.0.2.** `ssh.askpass` is on by default: with OpenSSH 8.4 or newer, ssh's +password, passphrase and host key prompts now appear in a RedShell dialog instead of the +terminal, and older clients, such as the OpenSSH 8.1 that ships with Windows 10, keep prompting +in the terminal. Set `ssh.askpass = false` to keep the terminal prompts everywhere. A host in +`[[ssh.hosts]]` whose `name` is also a `Host` alias in `~/.ssh/config` now connects through the +alias (while `ssh.import_ssh_config` is on), so the alias's `IdentityFile`, `ProxyJump` and other +options apply under the fields set in RedShell; rename the entry if it was meant to bypass the +alias. Entries RedShell adds to `config.toml` now list their keys in the order of the settings, +starting with an SSH host's `name`, and leave empty host fields out; existing entries are not +touched, so this is cosmetic. + +### Added +- SSH hosts are added and edited in a dialog: *Add SSH Host…* (also the "+" next to the + sidebar's SSH hosts), *Edit SSH Host…*, a right-click menu on each host in the sidebar to + connect, edit, duplicate or delete it, and Alt+E in the *Connect to SSH Host* picker. +- Hosts can be put in groups, which the sidebar and the host picker show. Editing a host from + `~/.ssh/config` keeps the changes in RedShell and leaves the file alone; *Reset to + ~/.ssh/config* drops them. +- RedShell asks for SSH passwords, passphrases and new host keys in its own dialog and can keep + passwords and passphrases in the system keychain (`ssh.askpass`, OpenSSH 8.4 or newer), also + for native tmux attach. The host editor shows, changes or removes a host's saved password. +- *Install Key on Server…* adds your public key to a host's `authorized_keys`, as `ssh-copy-id` + does, and creates an ed25519 key first if you have none. +- Port forwards (local, remote and SOCKS) on SSH hosts, run as background tunnels: start and stop + them from a host's *Port Forwarding* menu or *SSH Tunnels…*, open them with RedShell + (`auto_start`), and see in the sidebar which hosts have one up. +- The host editor sets agent forwarding (`forward_agent`) and a startup command that runs after + login, before the shell or the `attach_session` session. +- *Browse Files…* shows an SSH host's files over SFTP (from a host's or an SSH tab's menu, Alt+F + in the host picker, or *Browse SSH Host Files…*): download, upload by picking or dropping, + create, rename, delete, and open a terminal in the folder. Transfers outlive the dialog. +- `redshell-server` keeps shells, coding agents and SSH sessions running on an always-on machine, + set up in a `[server]` section of its `config.toml` ([docs/REMOTE.md](docs/REMOTE.md)). Releases + carry it for Linux (`.deb` with a per-user systemd unit, and `.tar.gz`) and for macOS. +- Behind Tailscale Serve or cloudflared on the same machine, the server trusts the proxy's + `X-Forwarded-For` without any `trusted_proxies`, so each client meets its own sign-in backoff. +- The server signs in with a password, with backoff, or a passkey (Face ID, Touch ID, Windows + Hello, a security key). Browsers and devices are listed with when they were last seen and can be + revoked, an account can turn password sign-in off, and `redshell-server user` manages accounts. +- Claude Code permission requests can be answered from any connected client or in Claude Code's + own dialog, whichever comes first, and Claude Code and Codex report when they work, wait for + input or finish. A Codex `notify` program of your own still runs. +- Web Push notifications when an agent asks for approval, waits for input or finishes, and when + a program fails or raises a notification, chosen per browser and held back while you are + typing into that session. +- RedShell Remote, the web app the server serves, for phones and browsers: an inbox of sessions + that need you, terminals with a key bar and a composer, approval sheets with diffs, new sessions + in any folder, passkeys, notifications and the server's SSH hosts, in two columns on wide screens. +- The desktop connects to RedShell servers: add them under *Settings → Servers* (`[remote]` in + `config.toml`) and sign in with a password or a short code you approve in a signed-in browser, + which says whether the request came from your own address. The token stays in the keychain. +- A *Servers* section in the sidebar lists a server's sessions with what their agents are doing. + They open as tabs that only detach when closed and come back on the next start, with an agent's + pending approval above the terminal. +- *Send to Server* in an SSH host's menu copies the host to a server, without its identity file, + through the server's hosts API, which edits its `config.toml` in place and keeps the comments. +- `redshell-protocol`, the wire types shared by the server, the desktop and (as TypeScript) + RedShell Remote. + +### Changed +- `ssh.askpass` is on by default, so ssh's prompts appear in RedShell's dialog where OpenSSH 8.4 or + newer is installed. +- A saved host named after a `~/.ssh/config` alias connects through the alias, with the fields + set in RedShell passed on top (`-p`, `-l`, `HostName`). +- New entries in `config.toml` list their keys in the order of the settings, and SSH hosts leave + empty fields out. +- Shift+Tab moves back through dialogs and lists, as Tab moves on. + +### Fixed +- Native tmux tabs get the right size on tmux 3.2, which ignores per-window sizes. +- Hosts listed from `ssh.ssh_config_path` connect: ssh now reads that file too (`-F`). + +### Security +- `redshell-server` accepts browser requests only from its own origin (exactly `public_url` when + that is https), needs `X-RedShell: 1` on every request that changes something (protocol + version 2), and sends HSTS whenever clients reach it over https. +- Adding or removing a passkey, turning passkey-only on or off, approving a pairing and signing + out another browser or device need a re-authentication within the last five minutes. +- Turning passkey-only on ends the password's sign-ins, a password change drops pairing approvals + still waiting, and `user passwd` lists the passkeys that still sign in and takes + `--revoke-passkeys`. +- Strangers cannot fill the server's memory, log or connections: passkey sign-ins are stateless, + limits count IPv6 by /64, bodies, names, pairing requests and connections are bounded, and slow + clients time out. The sign-in backoff stops at 15 minutes per address and 2 per name. +- Push messages go only to public https endpoints on port 443, and *Browse Files…* skips + downloaded names that could leave the target folder. +- RedShell Remote asks "Confirm it's you" (a passkey or the password) before a change that needs + a re-authentication and then makes the change, and its pairing page warns that approving signs + the device in as you, with the address the request came from and a warning when that is + another network. + ## [0.0.2] - 2026-12-01 This release gives RedShell its own title bar, makes it feel at home on Windows, and fixes the @@ -182,5 +280,6 @@ First public preview. themes; settings UI for fonts, opacity, background image, cursor, safety, history and keybindings; hot-reloaded `config.toml`. +[0.0.3]: https://github.com/redstone-md/RedShell/compare/v0.0.2...v0.0.3 [0.0.2]: https://github.com/redstone-md/RedShell/compare/v0.0.1...v0.0.2 [0.0.1]: https://github.com/redstone-md/RedShell/releases/tag/v0.0.1 diff --git a/Cargo.lock b/Cargo.lock index ccc924a..2f1293a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,26 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aead" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +dependencies = [ + "crypto-common 0.1.7", + "generic-array", +] + +[[package]] +name = "aead" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1973cfbc1a2daf9cf550e74e1f088c28e7f7d8c1e1418fb6c9dc5184b7e84c99" +dependencies = [ + "crypto-common 0.2.2", + "inout 0.2.6", +] + [[package]] name = "aes" version = "0.8.4" @@ -15,11 +35,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", - "cipher", + "cipher 0.4.4", "cpufeatures 0.2.17", "zeroize", ] +[[package]] +name = "aes" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fc36d7440d015b45468ba08a21e80e056ebbd014c611c6298bb7503e04bd1" +dependencies = [ + "cipher 0.5.2", + "cpubits", + "cpufeatures 0.3.1", +] + +[[package]] +name = "aes-gcm" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" +dependencies = [ + "aead 0.5.2", + "aes 0.8.4", + "cipher 0.4.4", + "ctr 0.9.2", + "ghash 0.5.1", + "subtle", +] + +[[package]] +name = "aes-gcm" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2b8006a0c83f52b62ba44a97b58bf76fe2f70a329e588f67f89691d93d498f" +dependencies = [ + "aead 0.6.1", + "aes 0.9.4", + "cipher 0.5.2", + "ctr 0.10.1", + "ctutils", + "ghash 0.6.0", +] + +[[package]] +name = "aes-keywrap" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf71a903b87eeef4903e7077cc9689f0c8449e093395db09dc48d1a39934e770" +dependencies = [ + "aes 0.9.4", + "byteorder", +] + +[[package]] +name = "aes-kw" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41ac571010bd60765c56085a4f1d412012a9be2663b1a2f2b19b49318653fd0d" +dependencies = [ + "aes 0.9.4", + "const-oid 0.10.3", +] + [[package]] name = "ahash" version = "0.8.15" @@ -50,7 +129,7 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda177466b9524d59f1b12f0dd30b68696788e9992a7e959021c4a0ed96fcf59" dependencies = [ - "base64", + "base64 0.22.1", "bitflags 2.13.2", "home", "libc", @@ -152,6 +231,17 @@ version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cb931c189b85683d69a5cfad41d4d418671e1ac413dd209f3f2fc31e3cfd902" +[[package]] +name = "apple-native-keyring-store" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e465454e78fda6f7cd9dab7eb47518ca28c59b1bc392ca865af61452741dd3" +dependencies = [ + "keyring-core", + "log", + "security-framework", +] + [[package]] name = "ar_archive_writer" version = "0.5.5" @@ -167,6 +257,15 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" +[[package]] +name = "arc-swap" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b5d51209f6de83d37a0b33d320acb8da88823e42a94c075140708f032a5" +dependencies = [ + "rustversion", +] + [[package]] name = "arg_enum_proc_macro" version = "0.3.4" @@ -178,6 +277,30 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "argon2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" +dependencies = [ + "base64ct", + "blake2 0.10.6", + "cpufeatures 0.2.17", + "password-hash 0.5.0", +] + +[[package]] +name = "argon2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c52ddac6d63c576bef8168db10c83c49c26444ecbc68060fef078925a901c" +dependencies = [ + "base64ct", + "blake2 0.11.0", + "cpufeatures 0.3.1", + "password-hash 0.6.1", +] + [[package]] name = "arrayref" version = "0.3.9" @@ -264,6 +387,45 @@ dependencies = [ "zbus", ] +[[package]] +name = "asn1-rs" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f43a50ac4fdca5df8e885c21b835997f0a1cdee65494a6847694a98652d9d8" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom 7.1.3", + "num-traits", + "rusticata-macros", + "thiserror 2.0.21", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3109e49b1e4909e9db6515a30c633684d68cdeaa252f215214cb4fa1a5bfee2c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure 0.13.2", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "async-broadcast" version = "0.7.2" @@ -454,7 +616,7 @@ dependencies = [ "futures-core", "futures-io", "futures-lite 2.6.1", - "gloo-timers", + "gloo-timers 0.3.0", "kv-log-macro", "log", "memchr", @@ -465,6 +627,28 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "async-task" version = "4.7.1" @@ -556,12 +740,120 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core", + "base64 0.22.1", + "bytes", + "form_urlencoded", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1 0.10.7", + "sync_wrapper", + "tokio", + "tokio-tungstenite", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-server" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3766086d344b8f8d2a9cf6fb211b581de5b160e052d7bc75a92e58cc41909054" +dependencies = [ + "arc-swap", + "bytes", + "either", + "fs-err", + "http", + "http-body", + "hyper", + "hyper-util", + "pin-project-lite", + "rustls", + "rustls-pki-types", + "socket2", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base16ct" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd307490d624467aa6f74b0eabb77633d1f758a7b25f12bceb0b22e08d9726f6" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + [[package]] name = "bindgen" version = "0.71.1" @@ -582,6 +874,12 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "binstring" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1c05f270702529040b45d3389e1245bc21c5e5df78b2a509e1e3d7bcd47a18e" + [[package]] name = "bit-set" version = "0.8.0" @@ -685,6 +983,34 @@ dependencies = [ "profiling", ] +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5d4d889834ee8ecfc0f8426ad30faf7cdcb10f741a8e6d7224d95325479f6f" +dependencies = [ + "digest 0.11.3", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3560a7b1951efe814fcd721938313adc56753ca39f4b23847d7e9a2402f5dbff" +dependencies = [ + "arrayvec", + "constant_time_eq", +] + [[package]] name = "block" version = "0.1.6" @@ -707,6 +1033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" dependencies = [ "hybrid-array", + "zeroize", ] [[package]] @@ -718,6 +1045,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-padding" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710f1dd022ef4e93f8a438b4ba958de7f64308434fa6a87104481645cc30068b" +dependencies = [ + "hybrid-array", +] + [[package]] name = "block2" version = "0.6.2" @@ -740,6 +1076,15 @@ dependencies = [ "piper", ] +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + [[package]] name = "bstr" version = "1.14.0" @@ -832,7 +1177,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" dependencies = [ - "cipher", + "cipher 0.4.4", +] + +[[package]] +name = "cbc" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce2dc9ee5f88d11e0beb842c88b33c8a5cf0d1329c4b19494af42b07dbfe8896" +dependencies = [ + "cipher 0.5.2", ] [[package]] @@ -842,7 +1196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eadd868a2ce9ca38de7eeafdcec9c7065ef89b42b32f0839278d55f35c54d1ff" dependencies = [ "heck 0.4.1", - "indexmap", + "indexmap 2.14.2", "log", "proc-macro2", "quote", @@ -931,10 +1285,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common 0.1.7", - "inout", + "inout 0.1.4", "zeroize", ] +[[package]] +name = "cipher" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" +dependencies = [ + "block-buffer 0.12.1", + "crypto-common 0.2.2", + "inout 0.2.6", +] + [[package]] name = "clang-sys" version = "1.9.1" @@ -946,6 +1311,63 @@ dependencies = [ "libloading", ] +[[package]] +name = "clap" +version = "4.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50066ca966813ca8957ee15361752f19424a8ff620dbe9c8993d9f99d99b04b3" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0ed97c96ef4efb3cc84e09fa388df4463e7cc3224ec38d7b1d9e45749333590" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "clap_lex" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79" + +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + +[[package]] +name = "coarsetime" +version = "0.1.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae63702c5627c75addbfb1ea9d1b3842205a6ffd43e4cce884a2a9eb1828fd7" +dependencies = [ + "libc", + "wasix", + "wasm-bindgen", +] + [[package]] name = "cocoa" version = "0.25.0" @@ -1066,6 +1488,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "const-oid" version = "0.10.3" @@ -1091,6 +1519,12 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + [[package]] name = "convert_case" version = "0.4.0" @@ -1261,6 +1695,12 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "cpubits" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b85f9c39137c3a891689859392b1bd49812121d0d61c9caf00d46ed5ce06ae" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -1337,6 +1777,35 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-bigint" +version = "0.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914c195c4d7fbc5ed7f88d14cbf85914d5c664967658d43404b263913a477e82" +dependencies = [ + "cpubits", + "ctutils", + "getrandom 0.4.3", + "hybrid-array", + "num-traits", + "rand_core 0.10.1", + "serdect", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -1354,9 +1823,74 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ + "getrandom 0.4.3", "hybrid-array", + "rand_core 0.10.1", +] + +[[package]] +name = "crypto-glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d90fe73514cb72a4ad8568a184472dfb4c2ffa65409a8e85720b83202cec83" +dependencies = [ + "aes 0.9.4", + "aes-gcm 0.11.1", + "aes-kw", + "argon2 0.6.0", + "base64 0.23.1", + "cbc 0.2.1", + "cipher 0.5.2", + "const-oid 0.10.3", + "crypto-common 0.2.2", + "cts", + "der 0.8.3", + "digest 0.11.3", + "ecdsa 0.17.0", + "elliptic-curve 0.14.3", + "hex", + "hkdf 0.13.0", + "hmac 0.13.0", + "hybrid-array", + "kbkdf", + "md5", + "p256 0.14.0", + "p384 0.14.0", + "p521", + "pbkdf2 0.13.0", + "pkcs8 0.11.0", + "rand 0.10.4", + "rsa", + "sec1 0.8.1", + "serde", + "sha1 0.11.0", + "sha2 0.11.2", + "signature 3.0.0", + "spki 0.8.1", + "subtle", + "tracing", + "uuid", + "wasm-bindgen", + "x509-cert", + "zeroize", +] + +[[package]] +name = "crypto-primes" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3633a51a39c69ebbaa4feaa694bd83d241e4093901c84a0963b19d9bb3f0cf8f" +dependencies = [ + "crypto-bigint 0.7.11", + "rand_core 0.10.1", ] +[[package]] +name = "ct-codecs" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd9f3db6f2cfef61c10613071955154ffdc9e515daebff26de4b54e35038fdd" + [[package]] name = "ctor" version = "0.4.3" @@ -1373,12 +1907,103 @@ version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2" +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher 0.4.4", +] + +[[package]] +name = "ctr" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaca1c4b237092596f64d571e9db6ce4109c4ef9742e27590f1709594461f21" +dependencies = [ + "cipher 0.5.2", +] + +[[package]] +name = "cts" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6ae47d18aa4f3701bc9b644cf9a74a45e6eace39feabeab15864728aa1e45a9" +dependencies = [ + "cipher 0.5.2", +] + +[[package]] +name = "ctutils" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" +dependencies = [ + "cmov", + "subtle", +] + [[package]] name = "cursor-icon" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f" +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.10", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dashmap" +version = "6.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6361d5c062261c78a176addb82d4c821ae42bed6089de0e12603cd25de2059c" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + [[package]] name = "data-url" version = "0.3.2" @@ -1391,6 +2016,64 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2" +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid 0.9.6", + "pem-rfc7468 0.7.0", + "zeroize", +] + +[[package]] +name = "der" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a996a108feb8b427a6e12fcf6af4aa83409b79d72c15337d7741368131ee004" +dependencies = [ + "const-oid 0.10.3", + "der_derive", + "flagset", + "pem-rfc7468 1.0.0", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07da5016415d5a3c4dd39b11ed26f915f52fc4e0dc197d87908bc916e51bc1a6" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom 7.1.3", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der_derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59600e2c2d636fde9b65e99cc6445ac770c63d3628195ff39932b8d6d7409903" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + [[package]] name = "derive_more" version = "0.99.20" @@ -1411,6 +2094,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid 0.9.6", "crypto-common 0.1.7", "subtle", ] @@ -1422,8 +2106,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer 0.12.1", - "const-oid", + "const-oid 0.10.3", "crypto-common 0.2.2", + "ctutils", + "zeroize", ] [[package]] @@ -1569,12 +2255,105 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der 0.7.10", + "digest 0.10.7", + "elliptic-curve 0.13.8", + "rfc6979 0.4.0", + "signature 2.2.0", + "spki 0.7.3", +] + +[[package]] +name = "ecdsa" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0681a4fc24c767085329728d8dfba959af91228aa4610cca4f8ce317ba46ae0" +dependencies = [ + "der 0.8.3", + "digest 0.11.3", + "elliptic-curve 0.14.3", + "rfc6979 0.6.0", + "signature 3.0.0", + "spki 0.8.1", + "zeroize", +] + +[[package]] +name = "ece-native" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6911cc97c62febd8cbcb2cb49ed21c58ccd418a80c43f20df4973ee08484e65d" +dependencies = [ + "aes-gcm 0.10.3", + "hkdf 0.12.4", + "sha2 0.10.9", +] + +[[package]] +name = "ed25519-compact" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9547879431a90e352a35863a54416d92898a787b9af09e6ae2e09a96bd78be80" +dependencies = [ + "ct-codecs", + "getrandom 0.4.3", +] + [[package]] name = "either" version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.5", + "digest 0.10.7", + "ff 0.13.1", + "generic-array", + "group 0.13.0", + "hkdf 0.12.4", + "pem-rfc7468 0.7.0", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1 0.7.3", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900f37e7e18d74a2347389af6cd69e3a30d5cc9e697f40004865679aa75e9c7c" +dependencies = [ + "base16ct 1.0.0", + "crypto-bigint 0.7.11", + "crypto-common 0.2.2", + "digest 0.11.3", + "ff 0.14.0", + "group 0.14.0", + "hkdf 0.13.0", + "hybrid-array", + "pem-rfc7468 1.0.0", + "pkcs8 0.11.0", + "rand_core 0.10.1", + "sec1 0.8.1", + "subtle", + "zeroize", +] + [[package]] name = "embed-resource" version = "3.0.12" @@ -1649,7 +2428,7 @@ dependencies = [ "anstream", "anstyle", "env_filter", - "jiff", + "jiff 1.0.3", "log", ] @@ -1803,6 +2582,32 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "ff" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1f686ab92a9fb0eaf188f6c6c87b89490baa6fdb0db4544ba4dc47f7942489f" +dependencies = [ + "rand_core 0.10.1", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" + [[package]] name = "filedescriptor" version = "0.8.3" @@ -1830,6 +2635,12 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e44f110d1777dc6559a51e7d45083945ded4f1bf3305494350f693b6d20b9c8" +[[package]] +name = "flagset" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7ac824320a75a52197e8f2d787f6a38b6718bb6897a35142d749af3c0e8f4fe" + [[package]] name = "flate2" version = "1.1.11" @@ -1982,6 +2793,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "fs-err" +version = "3.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5c95b673b8f6f7235229ae11c5642d81b04c2e64c1e2fb417bc0cf73ca45f29" +dependencies = [ + "autocfg", + "tokio", +] + [[package]] name = "futf" version = "0.1.5" @@ -2116,6 +2937,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -2167,6 +2989,25 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" +dependencies = [ + "opaque-debug", + "polyval 0.6.2", +] + +[[package]] +name = "ghash" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eecf2d5dc9b66b732b97707a0210906b1d30523eb773193ab777c0c84b3e8d5" +dependencies = [ + "polyval 0.7.3", +] + [[package]] name = "gif" version = "0.14.2" @@ -2208,6 +3049,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "gloo-timers" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4460540da666acdb5722b2a62ac47d18f627fcfc0c728d04dc7226b3f6d40a7" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "glow" version = "0.16.0" @@ -2315,7 +3168,7 @@ dependencies = [ "rand 0.9.5", "raw-window-handle", "resvg", - "schemars", + "schemars 1.2.3", "seahash", "serde", "serde_json", @@ -2364,7 +3217,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae39dc6d3d201be97e4bc08d96dbef2bc5b5c3d5734e05786e8cc3043342351c" dependencies = [ - "indexmap", + "indexmap 2.14.2", "rustc-hash 2.1.3", ] @@ -2484,7 +3337,7 @@ dependencies = [ "nix 0.29.0", "regex", "rust-embed", - "schemars", + "schemars 1.2.3", "serde", "serde_json", "serde_json_lenient", @@ -2515,6 +3368,28 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12101ecc8225ea6d675bc70263074eab6169079621c2186fe0c66590b2df9681" +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff 0.13.1", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "group" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fd1a1c7a5206c5b7a3f5a0d7ccd3ff85d0c8f5133d62a02680255b0004af5f4" +dependencies = [ + "ff 0.14.0", + "rand_core 0.10.1", + "subtle", +] + [[package]] name = "h2" version = "0.4.21" @@ -2527,7 +3402,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap", + "indexmap 2.14.2", "slab", "tokio", "tokio-util", @@ -2546,6 +3421,12 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.14.5" @@ -2623,7 +3504,16 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "hmac", + "hmac 0.12.1", +] + +[[package]] +name = "hkdf" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018" +dependencies = [ + "hmac 0.13.0", ] [[package]] @@ -2635,6 +3525,44 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest 0.11.3", +] + +[[package]] +name = "hmac-sha1-compact" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5286b48a73829e3541cd9f533359c01150f7879e2716796eda0631ad5fe7e668" +dependencies = [ + "digest 0.11.3", +] + +[[package]] +name = "hmac-sha256" +version = "1.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad320b3b96fb2a455a0726d16efe0a5afdbd34b71dea5bc53b05ea057714d4e" +dependencies = [ + "digest 0.10.7", + "digest 0.11.3", +] + +[[package]] +name = "hmac-sha512" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66de62217b456dfbbba2bed965a134a4df57c48f0eac4c772018aee528e72244" +dependencies = [ + "digest 0.10.7", + "digest 0.11.3", +] + [[package]] name = "home" version = "0.5.12" @@ -2683,13 +3611,23 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + [[package]] name = "hybrid-array" version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" dependencies = [ + "ctutils", + "serde", + "subtle", "typenum", + "zeroize", ] [[package]] @@ -2706,6 +3644,7 @@ dependencies = [ "http", "http-body", "httparse", + "httpdate", "itoa", "pin-project-lite", "smallvec", @@ -2727,6 +3666,7 @@ dependencies = [ "tokio", "tokio-rustls", "tower-service", + "webpki-roots", ] [[package]] @@ -2735,6 +3675,7 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" dependencies = [ + "base64 0.23.1", "bytes", "futures-channel", "futures-util", @@ -2742,7 +3683,9 @@ dependencies = [ "http-body", "httparse", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", "tokio", @@ -2857,6 +3800,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.1.0" @@ -2924,6 +3873,17 @@ version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f" +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.14.2" @@ -2942,10 +3902,20 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "block-padding", + "block-padding 0.3.3", "generic-array", ] +[[package]] +name = "inout" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a580c13f0ffc335ef42dd3f6b1a41b726051c5e1656d9a3aa6fddb3c5dfbbf9" +dependencies = [ + "block-padding 0.4.2", + "hybrid-array", +] + [[package]] name = "instant" version = "0.1.13" @@ -3042,18 +4012,47 @@ version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" +[[package]] +name = "jiff" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175dc66334db3b9ab9985bf8b61cfed50dc16d20964bb47f9e479adcae984a7f" +dependencies = [ + "jiff-core 0.1.8", + "jiff-static 0.2.46", + "jiff-tzdb-platform 0.1.3", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link 0.2.1", +] + [[package]] name = "jiff" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "107f2e89536b6818514025f6787b0d94d819e54fe3b40365275fc753de485b3f" dependencies = [ - "jiff-core", - "jiff-static", + "jiff-core 1.0.2", + "jiff-static 1.0.3", + "jiff-tzdb-platform 1.0.0", + "js-sys", "log", "portable-atomic", "portable-atomic-util", "serde_core", + "wasm-bindgen", + "windows-link 0.2.1", +] + +[[package]] +name = "jiff-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e599b80292e597019b8b3e392de3f4bea2959ddfb8c7dff60e035e9e311a2c1b" +dependencies = [ + "log", ] [[package]] @@ -3065,18 +4064,60 @@ dependencies = [ "log", ] +[[package]] +name = "jiff-static" +version = "0.2.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b1af7547d47354bc438d797e3854601bde8f8d185780c5ba4ab27afa54f1ba" +dependencies = [ + "jiff-core 0.1.8", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "jiff-static" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4996f71e569e3a3e32b925c28ef8f0027dc30bb1d594b33eeda409eea185f5c8" dependencies = [ - "jiff-core", + "jiff-core 1.0.2", "proc-macro2", "quote", "syn 3.0.10", ] +[[package]] +name = "jiff-tzdb" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0980fca2cc272465bd60e82397607ba9f33add9e48defd77923301bbd03808f2" + +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb 0.1.10", +] + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb 1.0.0", +] + [[package]] name = "jobserver" version = "0.1.35" @@ -3098,6 +4139,74 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jwt-simple" +version = "0.12.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06a4207b9d1f423858853fb9ee8b34aebc2b661f3b446ca4efda46c4b3700a2f" +dependencies = [ + "anyhow", + "binstring", + "blake2b_simd", + "coarsetime", + "ct-codecs", + "ed25519-compact", + "hmac-sha1-compact", + "hmac-sha256", + "hmac-sha512", + "k256", + "p256 0.13.2", + "p384 0.13.1", + "rand 0.8.8", + "serde", + "serde_json", + "superboring", + "thiserror 2.0.21", + "zeroize", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "once_cell", + "sha2 0.10.9", + "signature 2.2.0", +] + +[[package]] +name = "kbkdf" +version = "0.1.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ac93c9768b8d587407881c98b0c3a5d3e3049daa73408ebe5bfb1ab1cb9c84" +dependencies = [ + "digest 0.11.3", +] + +[[package]] +name = "keccak" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8f198d1db720e4940b5a493201d199d9f24f568f8f746bd13706243a2f71598" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", +] + +[[package]] +name = "keyring-core" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "281c851dbae0de36d405299dd463126df4826dc32665c1314e931696b8cdee77" +dependencies = [ + "log", +] + [[package]] name = "khronos-egl" version = "6.0.0" @@ -3329,6 +4438,12 @@ dependencies = [ "libc", ] +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + [[package]] name = "maybe-rayon" version = "0.1.1" @@ -3349,6 +4464,12 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "md5" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebb8d8732c6a6df3d8f032a82911cfc747e00efb95cc46e8d0acd5b5b88570c" + [[package]] name = "memchr" version = "2.8.3" @@ -3456,6 +4577,33 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "ml-dsa" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6d49c3f3f0e10e18ca975ffda66f8da0ec36521c1d911adcbc521bf0743f5c" +dependencies = [ + "const-oid 0.10.3", + "crypto-common 0.2.2", + "ctutils", + "hybrid-array", + "module-lattice", + "pkcs8 0.11.0", + "shake", + "signature 3.0.0", +] + +[[package]] +name = "module-lattice" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e412c8ee83a1c678f427806219c49c96b2511b9f07497514f0e43fb26155" +dependencies = [ + "ctutils", + "hybrid-array", + "num-traits", +] + [[package]] name = "moxcms" version = "0.8.1" @@ -3508,7 +4656,7 @@ dependencies = [ "half", "hashbrown 0.15.5", "hexf-parse", - "indexmap", + "indexmap 2.14.2", "log", "num-traits", "once_cell", @@ -3663,6 +4811,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + [[package]] name = "num-derive" version = "0.4.2" @@ -3860,6 +5014,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f40cff3dde1b6087cc5d5f5d4d65712f34016a03ed60e9c08dcc392736b5b7" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.21.4" @@ -3878,25 +5041,25 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3299dd401feaf1d45afd8fd1c0586f10fcfb22f244bb9afa942cec73503b89d" dependencies = [ - "aes", + "aes 0.8.4", "ashpd 0.12.3", "async-fs", "async-io", "async-lock", "blocking", - "cbc", - "cipher", + "cbc 0.1.2", + "cipher 0.4.4", "digest 0.10.7", "endi", "futures-lite 2.6.1", "futures-util", "getrandom 0.3.4", - "hkdf", - "hmac", + "hkdf 0.12.4", + "hmac 0.12.1", "md-5", "num", "num-bigint-dig", - "pbkdf2", + "pbkdf2 0.12.2", "rand 0.9.5", "serde", "sha2 0.10.9", @@ -3907,6 +5070,12 @@ dependencies = [ "zvariant", ] +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "open" version = "5.4.5" @@ -3939,6 +5108,71 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "primeorder 0.13.6", + "sha2 0.10.9", +] + +[[package]] +name = "p256" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2c9239b2dbc807adbbe147e8cf72ea7450c3a0aabe62cb8e75ff4ec22e1f72a" +dependencies = [ + "ecdsa 0.17.0", + "elliptic-curve 0.14.3", + "primefield", + "primeorder 0.14.0", + "sha2 0.11.2", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "ecdsa 0.16.9", + "elliptic-curve 0.13.8", + "primeorder 0.13.6", + "sha2 0.10.9", +] + +[[package]] +name = "p384" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d17b851e6b3e378ab4ecb07fa2ed23f4d15f075735f8fec9fa1e7bdce5f8301f" +dependencies = [ + "ecdsa 0.17.0", + "elliptic-curve 0.14.3", + "fiat-crypto", + "primefield", + "primeorder 0.14.0", + "sha2 0.11.2", +] + +[[package]] +name = "p521" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ad64cc32c2dc466317c12ee5853e61f159f9eab1fe7efade0395dc2e7b43449" +dependencies = [ + "base16ct 1.0.0", + "ecdsa 0.17.0", + "elliptic-curve 0.14.3", + "primefield", + "primeorder 0.14.0", + "sha2 0.11.2", +] + [[package]] name = "parking" version = "2.2.1" @@ -3968,6 +5202,27 @@ dependencies = [ "windows-link 0.2.1", ] +[[package]] +name = "password-hash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" +dependencies = [ + "base64ct", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "password-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aab41826031698d6ffcd9cff78ef56ef998e39dc7e5067cdfebe373842d4723b" +dependencies = [ + "getrandom 0.4.3", + "phc", +] + [[package]] name = "paste" version = "1.0.15" @@ -4006,7 +5261,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest 0.10.7", - "hmac", + "hmac 0.12.1", +] + +[[package]] +name = "pbkdf2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112d82ceb8c5bf524d9af484d4e4970c9fd5a0cc15ba14ad93dccd28873b0629" +dependencies = [ + "digest 0.11.3", + "hmac 0.13.0", +] + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "pem-rfc7468" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6305423e0e7738146434843d1694d621cce767262b2a86910beab705e4493d9" +dependencies = [ + "base64ct", ] [[package]] @@ -4015,6 +5298,17 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" +[[package]] +name = "phc" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44dc769b75f93afdddd8c7fa12d685292ddeff1e66f7f0f3a234cf1818afe892" +dependencies = [ + "base64ct", + "ctutils", + "getrandom 0.4.3", +] + [[package]] name = "pico-args" version = "0.5.0" @@ -4064,6 +5358,55 @@ dependencies = [ "futures-io", ] +[[package]] +name = "pkcs1" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6250dd7321adbe93d12b750aee0ced159fd13e77f625edcdf1cb6f83cd99f650" +dependencies = [ + "der 0.8.3", + "spki 0.8.1", +] + +[[package]] +name = "pkcs5" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63d440a804ec8d6fafbb6b84471e013286658d373248927692ab3366686220ca" +dependencies = [ + "aes 0.9.4", + "aes-gcm 0.11.1", + "cbc 0.2.1", + "der 0.8.3", + "pbkdf2 0.13.0", + "rand_core 0.10.1", + "scrypt", + "sha2 0.11.2", + "spki 0.8.1", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.10", + "spki 0.7.3", +] + +[[package]] +name = "pkcs8" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451913da69c775a56034ea8d9003d27ee8948e12443eae7c038ba100a4f21cb7" +dependencies = [ + "der 0.8.3", + "pkcs5", + "rand_core 0.10.1", + "spki 0.8.1", +] + [[package]] name = "pkg-config" version = "0.3.34" @@ -4116,6 +5459,29 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7" +[[package]] +name = "polyval" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "opaque-debug", + "universal-hash 0.5.1", +] + +[[package]] +name = "polyval" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0fa31d631f2b2cb2a544d0aa321ce847a94764d701ca2becc411138b93d49cd" +dependencies = [ + "cpubits", + "cpufeatures 0.3.1", + "universal-hash 0.6.1", +] + [[package]] name = "portable-atomic" version = "1.15.0" @@ -4178,6 +5544,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + [[package]] name = "ppv-lite86" version = "0.2.21" @@ -4197,6 +5569,42 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "primefield" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c555a6e4eb7d4e158fcb028c835c3b8642206ddc279b5c6b202ef9a8bdb592f4" +dependencies = [ + "crypto-bigint 0.7.11", + "crypto-common 0.2.2", + "ff 0.14.0", + "rand_core 0.10.1", + "subtle", + "zeroize", +] + +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve 0.13.8", +] + +[[package]] +name = "primeorder" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c9f42978c78a00e3d68f69fc03e57a234debae69da4020a4fb588fcdcd07b06" +dependencies = [ + "elliptic-curve 0.14.3", + "once_cell", + "primefield", + "serdect", + "wnaf", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -4425,6 +5833,16 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_chacha" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e6af7f3e25ded52c41df4e0b1af2d047e45896c2f3281792ed68a1c243daedb" +dependencies = [ + "ppv-lite86", + "rand_core 0.10.1", +] + [[package]] name = "rand_core" version = "0.6.4" @@ -4604,7 +6022,7 @@ dependencies = [ [[package]] name = "redshell-agents" -version = "0.0.2" +version = "0.0.3" dependencies = [ "redshell-core", "which 8.0.6", @@ -4612,46 +6030,60 @@ dependencies = [ [[package]] name = "redshell-app" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", + "apple-native-keyring-store", "chrono", "dirs 6.0.0", "embed-resource", "env_logger", "futures", + "getrandom 0.3.4", "gpui", "image", + "keyring-core", "log", "parking_lot", "redshell-agents", "redshell-core", "redshell-history", "redshell-plugin", + "redshell-protocol", "redshell-remote", + "redshell-server", "redshell-terminal", "redshell-theme", "redshell-ui", + "rustls", + "rustls-native-certs", "semver", "serde", "serde_json", + "shlex 1.3.0", "tempfile", "tokio", + "tokio-tungstenite", "uuid", "which 8.0.6", "windows 0.61.3", + "windows-native-keyring-store", + "zbus-secret-service-keyring-store", "zed-reqwest", + "zeroize", ] [[package]] name = "redshell-core" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", "dirs 6.0.0", + "redshell-protocol", "semver", "serde", "serde_json", + "shlex 1.3.0", "tempfile", "toml 0.9.12+spec-1.1.0", "toml_edit 0.25.21+spec-1.1.0", @@ -4661,7 +6093,7 @@ dependencies = [ [[package]] name = "redshell-history" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", "chrono", @@ -4679,7 +6111,7 @@ dependencies = [ [[package]] name = "redshell-plugin" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", "crossbeam-channel", @@ -4693,25 +6125,91 @@ dependencies = [ "toml 0.9.12+spec-1.1.0", ] +[[package]] +name = "redshell-protocol" +version = "0.0.3" +dependencies = [ + "serde", + "serde_json", + "ts-rs", +] + [[package]] name = "redshell-remote" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", "chrono", "crossbeam-channel", "dirs 6.0.0", + "libc", "log", "parking_lot", "redshell-core", + "russh-sftp", + "serde", + "serde_json", "tempfile", + "thiserror 2.0.21", + "tokio", "uuid", "which 8.0.6", + "windows-sys 0.61.2", + "zeroize", +] + +[[package]] +name = "redshell-server" +version = "0.0.3" +dependencies = [ + "anyhow", + "argon2 0.5.3", + "axum", + "axum-server", + "base64 0.22.1", + "clap", + "crossbeam-channel", + "dirs 6.0.0", + "env_logger", + "futures-util", + "hmac 0.12.1", + "http-body-util", + "hyper", + "hyper-util", + "libc", + "log", + "parking_lot", + "rand_core 0.6.4", + "redshell-agents", + "redshell-core", + "redshell-protocol", + "redshell-remote", + "redshell-terminal", + "reqwest", + "rpassword", + "rusqlite", + "rust-embed", + "rustls", + "serde", + "serde_json", + "sha2 0.10.9", + "tempfile", + "thiserror 2.0.21", + "tokio", + "tokio-tungstenite", + "toml 0.9.12+spec-1.1.0", + "tower-http", + "url", + "uuid", + "web-push-native", + "webauthn-authenticator-rs", + "webauthn-rs", + "webauthn-rs-proto", ] [[package]] name = "redshell-terminal" -version = "0.0.2" +version = "0.0.3" dependencies = [ "alacritty_terminal", "anyhow", @@ -4726,7 +6224,7 @@ dependencies = [ [[package]] name = "redshell-theme" -version = "0.0.2" +version = "0.0.3" dependencies = [ "anyhow", "gpui", @@ -4736,7 +6234,7 @@ dependencies = [ [[package]] name = "redshell-ui" -version = "0.0.2" +version = "0.0.3" dependencies = [ "gpui", "redshell-core", @@ -4793,6 +6291,44 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6" +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + [[package]] name = "resvg" version = "0.45.1" @@ -4807,6 +6343,26 @@ dependencies = [ "usvg", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle", +] + +[[package]] +name = "rfc6979" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4a459cddafb3fe76b31fd8f1108007566c40301feb64dc7b54656eb7388172b" +dependencies = [ + "crypto-bigint 0.7.11", + "hmac 0.13.0", +] + [[package]] name = "rgb" version = "0.8.53" @@ -4836,6 +6392,48 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" +[[package]] +name = "rpassword" +version = "7.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa2c5d9304b618df61ff17f3d3485c6e1854a3d94902a49abbb8d43dfbe0464" +dependencies = [ + "libc", + "rtoolbox", + "windows-sys 0.61.2", +] + +[[package]] +name = "rsa" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e77fd77e0dea28b3011fd62d15445b7de7959333b0276d930e03be0f755699" +dependencies = [ + "const-oid 0.10.3", + "crypto-bigint 0.7.11", + "crypto-common 0.2.2", + "crypto-primes", + "digest 0.11.3", + "hmac 0.13.0", + "pkcs1", + "pkcs8 0.11.0", + "rand_core 0.10.1", + "sha2 0.11.2", + "signature 3.0.0", + "spki 0.8.1", + "zeroize", +] + +[[package]] +name = "rtoolbox" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a1efe12a1469752d0e6ff5ebec0b6ef4924cc5c4c71046b0ec730040535819d" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + [[package]] name = "rusqlite" version = "0.37.0" @@ -4850,6 +6448,26 @@ dependencies = [ "smallvec", ] +[[package]] +name = "russh-sftp" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b8067d56cde438de09db20be974be92118b85d671c7f50ea3b37cf9011760f0" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "dashmap", + "gloo-timers 0.4.1", + "jiff 1.0.3", + "log", + "serde", + "serde_bytes", + "thiserror 2.0.21", + "tokio", + "tokio-util", + "wasm-bindgen-futures", +] + [[package]] name = "rust-embed" version = "8.14.0" @@ -4871,6 +6489,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", + "shellexpand", "syn 2.0.119", "walkdir", ] @@ -4882,6 +6501,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915e33dccbe7deb2b8a342dc4c517503fe85e0230ddbae40a4fb0220493dad9b" dependencies = [ "globset", + "mime_guess", "sha2 0.11.2", "walkdir", ] @@ -4907,6 +6527,15 @@ dependencies = [ "semver", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom 7.1.3", +] + [[package]] name = "rustix" version = "0.38.44" @@ -5047,6 +6676,16 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "salsa20" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f874456e72520ff1375a06c588eaf074b0f01f9e9e1aada45bd9b7954a6e42c" +dependencies = [ + "cfg-if", + "cipher 0.5.2", +] + [[package]] name = "same-file" version = "1.0.6" @@ -5065,6 +6704,18 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "schemars" version = "1.2.3" @@ -5072,7 +6723,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" dependencies = [ "dyn-clone", - "indexmap", + "indexmap 2.14.2", "ref-cast", "schemars_derive", "serde", @@ -5126,12 +6777,71 @@ dependencies = [ "once_cell", ] +[[package]] +name = "scrypt" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87af57419b594aa23fa95f09f0e06d80d84ba01c26148c43844cad6ff4485f0" +dependencies = [ + "cfg-if", + "pbkdf2 0.13.0", + "salsa20", + "sha2 0.11.2", +] + [[package]] name = "seahash" version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.10", + "generic-array", + "pkcs8 0.10.2", + "subtle", + "zeroize", +] + +[[package]] +name = "sec1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56d437c2f19203ce5f7122e507831de96f3d2d4d3be5af44a0b0a09d8a80e4d" +dependencies = [ + "base16ct 1.0.0", + "ctutils", + "der 0.8.3", + "hybrid-array", + "subtle", + "zeroize", +] + +[[package]] +name = "secret-service" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5107b24b91445dd2aa449a258a1807b63240942157292354dc5bfdbeb8bc6db8" +dependencies = [ + "aes 0.9.4", + "cbc 0.2.1", + "futures-util", + "getrandom 0.4.3", + "hkdf 0.13.0", + "hybrid-array", + "num", + "once_cell", + "serde", + "sha2 0.11.2", + "zbus", +] + [[package]] name = "security-framework" version = "3.7.0" @@ -5177,6 +6887,26 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_bytes" +version = "0.11.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde_cbor_2" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34aec2709de9078e077090abd848e967abab63c9fb3fdb5d4799ad359d8d482c" +dependencies = [ + "half", + "serde", +] + [[package]] name = "serde_core" version = "1.0.229" @@ -5224,7 +6954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "foldhash 0.2.0", - "indexmap", + "indexmap 2.14.2", "itoa", "memchr", "serde", @@ -5238,13 +6968,24 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e033097bf0d2b59a62b42c18ebbb797503839b26afdda2c4e1415cb6c813540" dependencies = [ - "indexmap", + "indexmap 2.14.2", "itoa", "memchr", "ryu", "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + [[package]] name = "serde_repr" version = "0.1.21" @@ -5286,6 +7027,50 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56cb1ca7c93ae63d6439b5250f6b6b040f7e121f32e5dd2f5d523dd4149b3204" +dependencies = [ + "base64 0.23.1", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.2", + "jiff 0.2.46", + "jiff 1.0.3", + "schemars 0.9.0", + "schemars 1.2.3", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff15a7c864bbec77d9586ca6822bc7c369bdf19e9243134a62b0b51ce26b31f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serdect" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66cf8fedced2fcf12406bcb34223dffb92eaf34908ede12fed414c82b7f00b3e" +dependencies = [ + "base16ct 1.0.0", + "serde", +] + [[package]] name = "serial2" version = "0.2.39" @@ -5297,6 +7082,28 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest 0.11.3", +] + [[package]] name = "sha1_smol" version = "1.0.1" @@ -5325,6 +7132,17 @@ dependencies = [ "digest 0.11.3", ] +[[package]] +name = "shake" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09057cb2149ad4cbd2da1e26b351f9a4c354219421229c69c3063e6f61947c4a" +dependencies = [ + "digest 0.11.3", + "keccak", + "sponge-cursor", +] + [[package]] name = "shared_library" version = "0.1.9" @@ -5341,6 +7159,15 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" +[[package]] +name = "shellexpand" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32824fab5e16e6c4d86dc1ba84489390419a39f97699852b66480bb87d297ed8" +dependencies = [ + "dirs 6.0.0", +] + [[package]] name = "shlex" version = "1.3.0" @@ -5373,6 +7200,26 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "signature" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d567dcbaf0049cb8ac2608a76cd95ff9e4412e1899d389ee400918ca7537f5" +dependencies = [ + "digest 0.11.3", + "rand_core 0.10.1", +] + [[package]] name = "simd-adler32" version = "0.3.10" @@ -5488,6 +7335,34 @@ dependencies = [ "bitflags 2.13.2", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der 0.7.10", +] + +[[package]] +name = "spki" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef958a98b9d5da290cfc78946e9f3e61e1e62a18db0d92cac0b83cc161491a9" +dependencies = [ + "base64ct", + "der 0.8.3", + "digest 0.11.3", + "sha2 0.11.2", +] + +[[package]] +name = "sponge-cursor" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0219bd7d979d58245a4f41f695e1ac9f8befdffadd7f61f1bae9e39abc6620" + [[package]] name = "stable_deref_trait" version = "1.2.1" @@ -5543,6 +7418,12 @@ dependencies = [ "float-cmp", ] +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "strum" version = "0.26.3" @@ -5592,6 +7473,23 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "superboring" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180c01a1d6c13ab0576bcd041ebfe0b66c455fa605de35909f3cee3f5bbf730f" +dependencies = [ + "aes-gcm 0.11.1", + "aes-keywrap", + "getrandom 0.4.3", + "hmac-sha1-compact", + "hmac-sha256", + "hmac-sha512", + "ml-dsa", + "rand 0.10.4", + "rsa", +] + [[package]] name = "sval" version = "2.22.0" @@ -5740,6 +7638,17 @@ dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "synstructure" version = "0.14.0" @@ -5905,17 +7814,47 @@ dependencies = [ ] [[package]] -name = "tiff" -version = "0.11.3" +name = "tiff" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +dependencies = [ + "fax", + "flate2", + "half", + "quick-error", + "weezl", + "zune-jpeg", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" dependencies = [ - "fax", - "flate2", - "half", - "quick-error", - "weezl", - "zune-jpeg", + "num-conv", + "time-core", ] [[package]] @@ -5969,6 +7908,27 @@ version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" +[[package]] +name = "tls_codec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de2e01245e2bb89d6f05801c564fa27624dbd7b1846859876c7dad82e90bf6b" +dependencies = [ + "tls_codec_derive", + "zeroize", +] + +[[package]] +name = "tls_codec_derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2e76690929402faae40aebdda620a2c0e25dd6d3b9afe48867dfd95991f4bd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "tokio" version = "1.54.1" @@ -5979,10 +7939,23 @@ dependencies = [ "libc", "mio", "pin-project-lite", + "signal-hook-registry", "socket2", + "tokio-macros", "windows-sys 0.61.2", ] +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + [[package]] name = "tokio-rustls" version = "0.26.6" @@ -6005,6 +7978,34 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c" +dependencies = [ + "futures-util", + "log", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tungstenite", +] + [[package]] name = "tokio-util" version = "0.7.20" @@ -6014,6 +8015,7 @@ dependencies = [ "bytes", "futures-core", "futures-sink", + "futures-util", "libc", "pin-project-lite", "tokio", @@ -6037,7 +8039,7 @@ version = "0.9.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" dependencies = [ - "indexmap", + "indexmap 2.14.2", "serde_core", "serde_spanned 1.1.3", "toml_datetime 0.7.5+spec-1.1.0", @@ -6052,7 +8054,7 @@ version = "1.2.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b1f26e9485c1fa43ee89fe76e9f3fb9e2e52bb227f8594b4d687496b83d073" dependencies = [ - "indexmap", + "indexmap 2.14.2", "serde_core", "serde_spanned 1.1.3", "toml_datetime 1.1.3+spec-1.1.0", @@ -6094,7 +8096,7 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap", + "indexmap 2.14.2", "serde", "serde_spanned 0.6.9", "toml_datetime 0.6.11", @@ -6108,7 +8110,7 @@ version = "0.25.21+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88497dab46de5bf343ec66b05c251e48c6213f3e9170c70a70a823f7abe886a4" dependencies = [ - "indexmap", + "indexmap 2.14.2", "toml_datetime 1.1.3+spec-1.1.0", "toml_parser", "toml_writer", @@ -6149,6 +8151,25 @@ dependencies = [ "tokio", "tower-layer", "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", ] [[package]] @@ -6169,6 +8190,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -6200,6 +8222,29 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "ts-rs" +version = "12.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756050066659291d47a554a9f558125db17428b073c5ffce1daf5dcb0f7231d8" +dependencies = [ + "serde_json", + "thiserror 2.0.21", + "ts-rs-macros", +] + +[[package]] +name = "ts-rs-macros" +version = "12.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d90eea51bc7988ef9e674bf80a85ba6804739e535e9cab48e4bb34a8b652aa" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "termcolor", +] + [[package]] name = "ttf-parser" version = "0.20.0" @@ -6221,6 +8266,24 @@ dependencies = [ "core_maths", ] +[[package]] +name = "tungstenite" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c01152af293afb9c7c2a57e4b559c5620b421f6d133261c60dd2d0cdb38e6b8" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.9.5", + "rustls", + "rustls-pki-types", + "sha1 0.10.7", + "thiserror 2.0.21", +] + [[package]] name = "typeid" version = "1.0.3" @@ -6292,6 +8355,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-properties" version = "0.1.5" @@ -6322,6 +8394,26 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca718471876992059f251e33aafc334346ada08042b7661dd1fe313a9bced557" +[[package]] +name = "universal-hash" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +dependencies = [ + "crypto-common 0.1.7", + "subtle", +] + +[[package]] +name = "universal-hash" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96" +dependencies = [ + "crypto-common 0.2.2", + "ctutils", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -6347,7 +8439,7 @@ version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80be9b06fbae3b8b303400ab20778c80bbaf338f563afe567cf3c9eea17b47ef" dependencies = [ - "base64", + "base64 0.22.1", "data-url", "flate2", "fontdb 0.23.0", @@ -6541,6 +8633,15 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "wasix" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae86f02046da16a333a9129d31451423e1657737ecdafed4193838a5f54c5cfe" +dependencies = [ + "wasi", +] + [[package]] name = "wasm-bindgen" version = "0.2.130" @@ -6706,6 +8807,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "web-push-native" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7628c93e39aeee4c0bca50ae333052b4f174c653e8fca1d0a8e34f9bc4879c0c" +dependencies = [ + "aes-gcm 0.10.3", + "base64ct", + "ece-native", + "hkdf 0.13.0", + "http", + "jwt-simple", + "p256 0.13.2", + "serde", + "sha2 0.11.2", +] + [[package]] name = "web-sys" version = "0.3.107" @@ -6726,6 +8844,111 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webauthn-attestation-ca" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29cf6bdd3a9dba27c82ccb27df26fe7d98d7593c0c45ddddf85166a117b50301" +dependencies = [ + "crypto-glue", + "serde", + "serde_with", + "tracing", + "uuid", +] + +[[package]] +name = "webauthn-authenticator-rs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bf162a8f7b5d6cd5448576d3468ae151428480a6f7d1a381ed84eaa3c8c5566" +dependencies = [ + "async-stream", + "async-trait", + "base64 0.21.7", + "bitflags 1.3.2", + "crypto-glue", + "futures", + "hex", + "nom 7.1.3", + "num-derive", + "num-traits", + "serde", + "serde_bytes", + "serde_cbor_2", + "serde_json", + "thiserror 1.0.69", + "tokio", + "tokio-stream", + "tracing", + "unicode-normalization", + "url", + "uuid", + "webauthn-rs-core", + "webauthn-rs-proto", +] + +[[package]] +name = "webauthn-rs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13a354e6b2ef6edc62835901fc18dd413b1370d624c8cd1aa328493bd809249b" +dependencies = [ + "serde", + "tracing", + "url", + "uuid", + "webauthn-rs-core", +] + +[[package]] +name = "webauthn-rs-core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d13e555c106095051abd70415b88546a0d3757a7990e05b4659b4fba19e46ac" +dependencies = [ + "base64 0.21.7", + "crypto-glue", + "der-parser", + "hex", + "nom 7.1.3", + "rand 0.10.4", + "rand_chacha 0.10.0", + "serde", + "serde_cbor_2", + "serde_json", + "serde_with", + "thiserror 1.0.69", + "tracing", + "url", + "uuid", + "webauthn-attestation-ca", + "webauthn-rs-proto", + "x509-parser", +] + +[[package]] +name = "webauthn-rs-proto" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5555714098cd069e3c8b31e58ac14250b9ae185e949c21416bccb55ce8ac8a5c" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", + "serde_with", + "url", +] + +[[package]] +name = "webpki-roots" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7265c9301c16a8711c992c2d8da90ee77ef54b1ed51482d6dfeb00dc756b1297" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "weezl" version = "0.1.12" @@ -6934,6 +9157,19 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" +[[package]] +name = "windows-native-keyring-store" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063426e76fdec7438d56bb777f67e318a84a25c707b07e575cb8b78e10c028f8" +dependencies = [ + "byteorder", + "keyring-core", + "regex", + "windows-sys 0.61.2", + "zeroize", +] + [[package]] name = "windows-numerics" version = "0.2.0" @@ -7309,6 +9545,18 @@ version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" +[[package]] +name = "wnaf" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "795ca18b3fdb5e62bf982199278341ddcf7ebf7d32e25e212ad05d496e95f6fa" +dependencies = [ + "ff 0.14.0", + "group 0.14.0", + "hybrid-array", + "primefield", +] + [[package]] name = "writeable" version = "0.6.4" @@ -7355,6 +9603,37 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd" +[[package]] +name = "x509-cert" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f58ad685a2945c7c063f5d69b5c27105d75bb85c740380d8fc64e79a098417" +dependencies = [ + "const-oid 0.10.3", + "der 0.8.3", + "sha1 0.11.0", + "signature 3.0.0", + "spki 0.8.1", + "tls_codec", +] + +[[package]] +name = "x509-parser" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d43b0f71ce057da06bc0851b23ee24f3f86190b07203dd8f567d0b706a185202" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom 7.1.3", + "oid-registry", + "rusticata-macros", + "thiserror 2.0.21", + "time", +] + [[package]] name = "xattr" version = "0.2.3" @@ -7465,7 +9744,7 @@ dependencies = [ "proc-macro2", "quote", "syn 3.0.10", - "synstructure", + "synstructure 0.14.0", ] [[package]] @@ -7503,6 +9782,17 @@ dependencies = [ "zvariant", ] +[[package]] +name = "zbus-secret-service-keyring-store" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74801d001b9e7729adb4f1825b67b398185fed424749aa3d8bacf70417137d9a" +dependencies = [ + "keyring-core", + "secret-service", + "zbus", +] + [[package]] name = "zbus_macros" version = "5.19.0" @@ -7583,7 +9873,7 @@ version = "0.12.15-zed" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac2d05756ff48539950c3282ad7acf3817ad3f08797c205ad1c34a2ce03b9970" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", @@ -7707,7 +9997,7 @@ dependencies = [ "proc-macro2", "quote", "syn 3.0.10", - "synstructure", + "synstructure 0.14.0", ] [[package]] @@ -7716,6 +10006,7 @@ version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" dependencies = [ + "serde", "zeroize_derive", ] diff --git a/Cargo.toml b/Cargo.toml index 467aec2..f893e39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,11 +10,13 @@ members = [ "crates/redshell-plugin", "crates/redshell-ui", "crates/redshell-app", + "crates/redshell-protocol", + "crates/redshell-server", ] default-members = ["crates/redshell-app"] [workspace.package] -version = "0.0.2" +version = "0.0.3" edition = "2024" license = "MIT" repository = "https://github.com/redstone-md/RedShell" @@ -29,6 +31,7 @@ redshell-remote = { path = "crates/redshell-remote" } redshell-agents = { path = "crates/redshell-agents" } redshell-plugin = { path = "crates/redshell-plugin" } redshell-ui = { path = "crates/redshell-ui" } +redshell-protocol = { path = "crates/redshell-protocol" } gpui = "0.2.2" alacritty_terminal = "0.26.0" @@ -37,7 +40,7 @@ rusqlite = { version = "0.37", features = ["bundled"] } serde = { version = "1", features = ["derive"] } serde_json = "1" semver = "1" -toml = "0.9" +toml = { version = "0.9", features = ["preserve_order"] } toml_edit = "0.25" anyhow = "1" thiserror = "2" diff --git a/README.md b/README.md index e0a6a55..499b675 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,12 @@ after a restart and keeps your SSH hosts, tmux sessions and AI coding agents a k > сохранением комментариев. Терминал спрашивает перед закрытием, только когда можно потерять > работу (Enter и Esc в диалоге *отменяют*), сам подхватывает интеграцию с bash, zsh, fish и > PowerShell и раз в день проверяет, не вышла ли новая версия. Есть плагины (Rust, `plugin.toml` -> или хук-процесс на любом языке) и темы shadcn/tweakcn (CSS вставляется как есть). +> или хук-процесс на любом языке) и темы shadcn/tweakcn (CSS вставляется как есть). SSH-хосты +> редактируются в диалоге, пароли спрашиваются в окне RedShell и хранятся в системной связке +> ключей, есть проброс портов и файловый браузер по SFTP. `redshell-server` держит оболочки и +> агентов на всегда включённой машине, например на Raspberry Pi: десктоп открывает их как вкладки, +> а с телефона они доступны через RedShell Remote, веб-приложение с push-уведомлениями и ответами +> на запросы разрешений Claude Code. ## Why RedShell @@ -77,13 +82,40 @@ bar. ### SSH, tmux and screen -Hosts come from `~/.ssh/config` and `[[ssh.hosts]]`. RedShell drives the system OpenSSH, so agent -forwarding, FIDO keys, ProxyJump and ControlMaster all work, and a host can drop you straight into -a remote tmux or screen session. The session manager lists, attaches, creates and kills sessions -on this computer, on any SSH host and, on Windows, through a native tmux build or WSL. It lists a -host in one connection and shows what it found last time while it asks again, and the sidebar's -tmux section also lists the sessions on the SSH hosts you have tabs open on, checking each about -once a minute. +Hosts come from `~/.ssh/config` and from RedShell's own list, where *Add SSH Host…* (or the "+" next +to the sidebar's SSH hosts) adds them and a host's right-click menu edits, duplicates or deletes +them; the sidebar lists them in the groups you give them. RedShell drives the system OpenSSH, so +agent forwarding, FIDO keys, ProxyJump and ControlMaster all work, and a host can drop you straight +into a remote tmux or screen session. The session manager lists, attaches, creates and kills +sessions on this computer, on any SSH host and, on Windows, through a native tmux build or WSL. It +lists a host in one connection and shows what it found last time while it asks again, and the +sidebar's tmux section also lists the sessions on the SSH hosts you have tabs open on, checking each +about once a minute. + +RedShell asks for passwords, key passphrases and new host keys in its own dialog, in the window of +the tab that connects, and can remember passwords and passphrases in the system keychain (Windows +Credential Manager, the macOS keychain or the Secret Service on Linux), where the host editor also +saves, changes or removes a host's password. This needs OpenSSH 8.4 or newer; older clients keep +prompting in the terminal (see [`ssh.askpass`](docs/CONFIG.md#passwords-and-passphrases)). +*Install Key on Server…* in a host's menu or editor does what `ssh-copy-id` does, which Windows +lacks: it adds your public key to the host's `authorized_keys`, creating a key first if you have +none. + +Each host can carry port forwards (local, remote or a SOCKS proxy) that run as background tunnels. +You start and stop them from the host's *Port Forwarding* menu or the *SSH Tunnels…* picker, those +marked to start with RedShell open on launch, and a host with a tunnel up shows a small mark in the +sidebar. A tunnel that fails tells you why and stays down until you start it again, and quitting +RedShell closes them all. The host editor also turns on agent forwarding and sets a startup command +that runs after login, before the shell or tmux session. + +*Browse Files…*, in a host's menu, an SSH tab's menu or the host picker (Alt+F), opens the host's +folders over SFTP, the way Termius and Tabby do, through the same OpenSSH login as a tab. You +move around with the breadcrumbs, a typed path or the keyboard, sort by name, size or date, and +download files and whole folders to your Downloads folder or anywhere else; files picked or dropped +on the dialog upload into the folder shown. Transfers show their progress, can be cancelled and +carry on while you browse other folders or close the dialog. New folders, renaming, deleting after +a confirmation that says how much goes, copying a path and *Terminal Here*, which opens a tab on +the host in that folder, cover the rest. *Open tmux Session as Tabs…*, or *Open as tabs* in the manager, drives tmux through control mode (`tmux -C`) the way iTerm2 does: every tmux window becomes a RedShell tab and every pane a @@ -91,7 +123,7 @@ native pane with its own scrollback, search and history. Splits follow tmux's la native pane splits it in tmux, and closing a tab asks whether to detach (the default) or kill the tmux window. After a restart RedShell attaches to the same sessions again, and if one has ended in the meantime it tells you instead of creating a new one. Native attach needs tmux 3.2 or newer, -and over SSH it needs key or agent authentication. +and over SSH it needs OpenSSH 8.4 or newer for password logins, or key or agent authentication. ![The tmux session manager with the local computer and three SSH hosts as targets, and three sessions with their windows](docs/screenshots/mux.png) @@ -104,6 +136,30 @@ agent repaints its screen, and mouse drags reach agents that track the mouse the agent runs on an SSH host, *Paste Image* uploads a screenshot from your clipboard and types its path into the prompt, [as described below](#pasting-images-into-remote-agents). +### Sessions that keep running elsewhere + +`redshell-server` keeps shells and agents running on an always-on machine such as a Raspberry Pi, +and RedShell opens them as ordinary tabs once you add the server under *Settings → Servers* and +sign in, with a password or by approving a short code from a browser. The sidebar lists each +server's sessions with what their agents are doing, an agent's permission request shows above its +terminal with *Allow*, *Deny* and *Answer in terminal*, and closing a tab only detaches, so the +session is still there from your phone or tomorrow morning. + +On a phone you reach the same sessions through RedShell Remote, the web app the server serves, +which you add to the home screen. Its inbox puts the agents that wait for you first, a Claude Code +permission request opens as a sheet with the command or the diff, and whichever device answers +first wins. The terminal has a key bar and a composer made for a thumb, push notifications tell +you when an agent needs approval, waits for input or finishes, and you sign in with a passkey +(Face ID, Touch ID, Windows Hello, a security key) or a password. The server is one small binary +that idles at about 10 MB of memory, and [REMOTE.md](docs/REMOTE.md) explains installing it and +reaching it through Tailscale or a Cloudflare tunnel. + +

+ RedShell Remote's inbox with a Claude Code session waiting for approval first and two shells below + A Claude Code permission request as a sheet with the command and Allow, Always allow, Deny and Answer in terminal + A shell session on the phone with the composer and the key bar +

+ ### Asks before you lose work Closing a tab asks while a program is running in it, and closing a window or quitting asks when @@ -178,6 +234,20 @@ RedShell checks GitHub for a newer release once a day and tells you when there i download and install it yourself. Turn this off with `updates.check = false` (see [docs/CONFIG.md](docs/CONFIG.md#updates)). +**RedShell Server.** Releases also carry `redshell-server` for Linux on x86_64 and on aarch64 +(64-bit Raspberry Pi OS), each as a `.deb` and a `.tar.gz`, and for macOS as a `.tar.gz`. On a +Raspberry Pi, install the package and start the server as your own user, so that sessions see your +files, SSH keys and agent sign-ins, then open the one-time setup link it logs on the first start: + +```sh +sudo apt install ./redshell-server--linux-aarch64.deb +sudo systemctl enable --now redshell-server@$USER +sudo journalctl -u redshell-server@$USER +``` + +[REMOTE.md](docs/REMOTE.md) covers the other ways to install it and how to reach it from your +phone over HTTPS, which passkeys and push notifications need. + ## Build ```sh @@ -313,11 +383,17 @@ crates/ redshell-theme shadcn token model, tweakcn CSS importer (oklch/hsl/hex), registry redshell-terminal PTY + VT engine, input/mouse encoding, render snapshots, OSC 7/9;9/133 redshell-history SQLite + FTS5 recorder, search, restore, asciicast export - redshell-remote SSH profiles, ~/.ssh/config, tmux/screen over local/SSH/WSL + redshell-remote SSH hosts, askpass, tunnels, SFTP, tmux/screen over local/SSH/WSL redshell-agents AI agent detection and launch profiles redshell-plugin Plugin trait, plugin.toml manifests, JSON-lines hook processes redshell-ui shadcn-style GPUI components (Button, Input, Modal, Toast, …) and Lucide icons - redshell-app the application (workspace, terminal view, palette, settings) + redshell-app the application (workspace, terminal view, palette, settings, server tabs) + redshell-protocol wire types shared by the server, the desktop and RedShell Remote + redshell-server headless server: sessions, accounts, passkeys, push, agent hooks, hosts API +web/ RedShell Remote, the web app the server serves (React, TypeScript) +shell-integration/ the scripts that report a shell's folder and prompts +packaging/ the server's systemd unit +examples/plugins/ an example plugin ``` [Architecture](docs/ARCHITECTURE.md) explains how the crates fit together. Screenshots are taken diff --git a/assets/icon/redshell-badge.svg b/assets/icon/redshell-badge.svg new file mode 100644 index 0000000..74e85f6 --- /dev/null +++ b/assets/icon/redshell-badge.svg @@ -0,0 +1,7 @@ + + + + + diff --git a/assets/icon/redshell-maskable.svg b/assets/icon/redshell-maskable.svg new file mode 100644 index 0000000..6c5aff3 --- /dev/null +++ b/assets/icon/redshell-maskable.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + diff --git a/crates/redshell-app/Cargo.toml b/crates/redshell-app/Cargo.toml index f8e3012..f82e8b8 100644 --- a/crates/redshell-app/Cargo.toml +++ b/crates/redshell-app/Cargo.toml @@ -20,6 +20,7 @@ redshell-remote.workspace = true redshell-agents.workspace = true redshell-plugin.workspace = true redshell-ui.workspace = true +redshell-protocol.workspace = true gpui.workspace = true anyhow.workspace = true log.workspace = true @@ -35,10 +36,23 @@ image = "0.25" which.workspace = true dirs.workspace = true semver.workspace = true +# Splits and quotes the extra ssh arguments of a host the way a shell would. +shlex = "1.3" # The HTTP client gpui already builds (through gpui_http_client), with features it already # enables, so the update check compiles nothing new. Keep the version in step with gpui's. reqwest = { package = "zed-reqwest", version = "0.12.15-zed", default-features = false, features = ["rustls-tls-native-roots"] } -tokio = { version = "1", default-features = false, features = ["rt"] } +tokio = { version = "1", default-features = false, features = ["rt", "net", "time", "macros"] } +# The WebSocket to RedShell servers (src/remote/), over the rustls with ring that +# the HTTP client already builds: no OpenSSL. +tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect", "rustls-tls-native-roots"] } +rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] } +rustls-native-certs = "0.8" +# The OS keychain that keeps SSH passwords and passphrases (src/secrets.rs), with one +# store per platform below. +keyring-core = "1" +zeroize = "1" +# Askpass tokens. +getrandom = "0.3" [target.'cfg(windows)'.dependencies] # gpui's copy, with features gpui already enables (nothing is rebuilt): reads @@ -49,12 +63,23 @@ windows = { version = "0.61", features = [ "Win32_System_Memory", "Win32_System_Ole", ] } +windows-native-keyring-store = "1" + +[target.'cfg(target_os = "macos")'.dependencies] +apple-native-keyring-store = { version = "1", features = ["keychain"] } + +[target.'cfg(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "android"))))'.dependencies] +# zbus (already built for gpui) rather than libdbus, so no extra system library is needed. +zbus-secret-service-keyring-store = { version = "1", features = ["rt-async-io-crypto-rust"] } [build-dependencies] embed-resource = "3" [dev-dependencies] tempfile.workspace = true +# The client tests run a real server in-process. +redshell-server = { path = "../redshell-server" } +tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "io-util", "time"] } # Installers built by cargo-packager (pinned in .github/workflows/release.yml): NSIS setup # on Windows, .deb and AppImage on Linux, a .dmg holding RedShell.app on macOS. The version diff --git a/crates/redshell-app/src/askpass.rs b/crates/redshell-app/src/askpass.rs new file mode 100644 index 0000000..67a654f --- /dev/null +++ b/crates/redshell-app/src/askpass.rs @@ -0,0 +1,662 @@ +//! The askpass broker: answers the RedShell askpass helpers that ssh runs +//! (see `redshell_remote::askpass`). +//! +//! Every ssh process RedShell starts gets a fresh token ([`Broker::issue`]) +//! naming the host it was pointed at and whether the user may be asked. A +//! helper presents that token with ssh's prompt over a loopback socket; +//! [`Policy`] decides between a stored secret, a refusal and asking the user. +//! +//! # For the UI +//! +//! Questions for the user arrive as [`AskpassEvent`]s on the receiver from +//! [`Broker::take_events`] (one consumer). Show each +//! [`AskpassEvent::Request`] and finish it with [`AskpassRequest::answer`], +//! [`AskpassRequest::confirm`] or [`AskpassRequest::cancel`] (dropping it +//! cancels). [`AskpassEvent::Closed`] withdraws a request still on screen: +//! ssh went away or it waited too long. A request names the pane whose ssh +//! asks ([`AskpassRequest::pane`], bound to the token when the pane spawned +//! ssh), so it can be shown in that pane's window. + +use std::collections::{BTreeMap, HashMap, HashSet}; +use std::io::{BufRead, BufReader, Read, Write}; +use std::net::{Ipv4Addr, Shutdown, SocketAddr, TcpListener, TcpStream}; +use std::path::PathBuf; +use std::sync::Arc; +use std::sync::atomic::{AtomicU64, Ordering}; +use std::time::{Duration, Instant}; + +use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender, unbounded}; +use parking_lot::Mutex; +use redshell_core::SessionId; +use redshell_remote::askpass::{CHANNEL_ENV, Channel, HelperReply, HelperRequest, OpenSshVersion}; +use redshell_remote::{AskpassBroker, AskpassGrant, AskpassMode, AskpassTarget, Prompt}; +use std::sync::mpsc::{SyncSender, sync_channel}; +use zeroize::Zeroizing; + +use crate::secrets::{Secrets, normalize_key_path, passphrase_account, password_account}; + +/// How long a token is honoured after its ssh process started: long enough +/// for every prompt of a login (servers give up after two minutes). +const TOKEN_LIFETIME: Duration = Duration::from_secs(10 * 60); +/// How long a question waits for the user before it is withdrawn. +const QUESTION_TIMEOUT: Duration = Duration::from_secs(5 * 60); +/// How long a helper may take to send its request. +const REQUEST_TIMEOUT: Duration = Duration::from_secs(5); +/// Longest request line read from a helper. +const MAX_REQUEST: u64 = 64 * 1024; + +/// What one prompt is about: a secret's account (or the prompt text) and +/// the process asking, so a ProxyJump child loading the same key is not +/// taken for a retry. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +struct Subject { + what: String, + process: Option, +} + +/// Who gave an answer. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum AnsweredBy { + /// A secret saved in the keychain. + Store, + /// The user typed it. + User, +} + +/// What one token allows. +struct Grant { + target: AskpassTarget, + mode: AskpassMode, + expires: Instant, + answered: HashMap, + cancelled: HashSet, +} + +/// A question for the user, before it is sent to the UI. +#[derive(Debug)] +pub struct Question { + pub token: String, + pub host: String, + /// The pane whose ssh asks, if a pane started it. + pub pane: Option, + pub prompt: Prompt, + /// The account a typed secret may be remembered under. + pub account: Option, + /// The previous answer to this prompt was refused; who gave it. + pub rejected: Option, + subject: Subject, +} + +/// The policy's answer to one helper request. +#[derive(Debug)] +pub enum Decision { + Answer(Zeroizing), + Refuse, + Ask(Question), +} + +/// Which prompts get which answers. Pure: no sockets, no UI. +/// +/// * A stored password goes only to a prompt naming the user and host the +/// token was issued for (prompt text is the server's, and a ProxyJump +/// child shares the token: the jump host never sees the target's +/// password). A passphrase goes to a prompt naming its key. +/// * Each subject gets at most one automatic answer per token; asked again, +/// the answer was refused: a stored password is marked stale, and the +/// user is asked with the rejection flagged. +/// * Background tokens never ask the user. +#[derive(Default)] +pub struct Policy { + grants: HashMap, +} + +impl Policy { + pub fn issue(&mut self, token: String, target: AskpassTarget, mode: AskpassMode, now: Instant) { + self.grants.retain(|_, g| g.expires > now); + let grant = + Grant { target, mode, expires: now + TOKEN_LIFETIME, answered: HashMap::new(), cancelled: HashSet::new() }; + self.grants.insert(token, grant); + } + + /// The account whose stored secret may answer `request`. Look it up + /// outside any lock (keychain reads can block) and pass the result to + /// [`Self::decide`]. + pub fn account(&self, request: &HelperRequest) -> Option { + let grant = self.grants.get(&request.token)?; + account_for(&grant.target, &Prompt::classify(&request.prompt, request.hint.as_deref())) + } + + /// Decides `request`; `stored` is the secret of [`Self::account`], if any. + pub fn decide( + &mut self, + request: &HelperRequest, + stored: Option>, + secrets: &Secrets, + now: Instant, + ) -> Decision { + let Some(grant) = self.grants.get_mut(&request.token).filter(|g| g.expires > now) else { + return Decision::Refuse; + }; + let prompt = Prompt::classify(&request.prompt, request.hint.as_deref()); + let account = account_for(&grant.target, &prompt); + let subject = + Subject { what: account.clone().unwrap_or_else(|| request.prompt.clone()), process: request.ppid }; + if grant.cancelled.contains(&subject) { + return Decision::Refuse; + } + let previous = grant.answered.get(&subject).copied(); + if let (Some(AnsweredBy::Store), Some(account)) = (previous, &account) { + secrets.mark_stale(account); + } + if previous.is_none() + && let Some(secret) = stored.filter(|_| account.is_some()) + { + grant.answered.insert(subject, AnsweredBy::Store); + return Decision::Answer(secret); + } + match grant.mode { + AskpassMode::Background => Decision::Refuse, + AskpassMode::Interactive { pane } => Decision::Ask(Question { + token: request.token.clone(), + host: grant.target.host.clone(), + pane, + prompt, + account, + rejected: previous, + subject, + }), + } + } + + /// The user answered `question`. + pub fn answered(&mut self, question: &Question) { + if let Some(grant) = self.grants.get_mut(&question.token) { + grant.answered.insert(question.subject.clone(), AnsweredBy::User); + } + } + + /// The user cancelled `question`: ssh asking the same again is refused. + pub fn cancelled(&mut self, question: &Question) { + if let Some(grant) = self.grants.get_mut(&question.token) { + grant.cancelled.insert(question.subject.clone()); + } + } + + /// The process holding `token` ended. A login the server `denied` after a + /// stored password was sent means that password is wrong. + pub fn finished(&mut self, token: &str, denied: bool, secrets: &Secrets) { + let Some(grant) = self.grants.remove(token) else { return }; + if denied { + let stored = grant.answered.iter().filter(|(_, by)| **by == AnsweredBy::Store); + for (subject, _) in stored.filter(|(s, _)| s.what == password_account(&grant.target.host)) { + secrets.mark_stale(&subject.what); + } + } + } +} + +/// The account of the secret that answers `prompt` for `target`: its +/// password only when the prompt names the target's user and host. +fn account_for(target: &AskpassTarget, prompt: &Prompt) -> Option { + match prompt { + Prompt::Password { user, host } if target.is(user, host) => Some(password_account(&target.host)), + Prompt::Passphrase { key } => { + key_path(key.as_deref(), target.identity.as_deref()).map(|key| passphrase_account(&key)) + } + _ => None, + } +} + +/// The key a passphrase prompt is about: the path it names (ssh cuts paths +/// at 100 characters, so a cut-off prefix of `identity` means `identity`), +/// or `identity` when it names none. +fn key_path(named: Option<&str>, identity: Option<&str>) -> Option { + let (named, identity) = (named.map(normalize_key_path), identity.map(normalize_key_path)); + match (named.as_deref(), identity.as_deref()) { + (Some(named), Some(identity)) if named.chars().count() == 100 && identity.starts_with(named) => { + Some(identity.to_owned()) + } + (Some(named), _) => Some(named.to_owned()), + (None, identity) => identity.map(str::to_owned), + } +} + +/// Identifies a request while it is shown. +pub type RequestId = u64; + +/// What the broker tells the UI. +#[derive(Debug)] +pub enum AskpassEvent { + Request(AskpassRequest), + /// The request is void (ssh went away, or nobody answered in time): + /// close its dialog. + Closed(RequestId), +} + +/// A question for the user from an ssh process they started. +#[derive(Debug)] +pub struct AskpassRequest { + pub id: RequestId, + /// The RedShell host the ssh process was started for (a ProxyJump hop + /// may be asking about another host: see the prompt). + pub host: String, + /// The session of the pane whose ssh asks; `None` for processes no pane + /// owns (a tmux control attach, a key install). + pub pane: Option, + pub prompt: Prompt, + /// A "remember" checkbox applies: the answer can be kept in the keychain. + pub remember: bool, + /// The previous answer to this question was refused: the saved secret + /// or what the user typed. + pub rejected: Option, + responder: Responder, +} + +impl AskpassRequest { + /// Answers with what the user typed (password, passphrase, code). With + /// `remember` (honoured when [`Self::remember`] is set) it is stored in + /// the keychain. + pub fn answer(mut self, secret: Zeroizing, remember: bool) { + self.responder.send(Reply::Answer { secret, remember }); + } + + /// Answers a host key or yes/no question. + pub fn confirm(self, yes: bool) { + match yes { + true => self.answer(Zeroizing::new("yes".into()), false), + false => self.cancel(), + } + } + + pub fn cancel(mut self) { + self.responder.send(Reply::Cancel); + } +} + +#[derive(Debug)] +enum Reply { + Answer { + secret: Zeroizing, + remember: bool, + }, + Cancel, + /// The helper disconnected (ssh killed it or exited). + Gone, +} + +/// Sends the UI's reply once; dropped unanswered, it cancels. +#[derive(Debug)] +struct Responder(Option>); + +impl Responder { + fn send(&mut self, reply: Reply) { + if let Some(tx) = self.0.take() { + let _ = tx.send(reply); + } + } +} + +impl Drop for Responder { + fn drop(&mut self) { + self.send(Reply::Cancel); + } +} + +enum Probe { + Running, + Done(Option), +} + +struct Shared { + address: SocketAddr, + helper: PathBuf, + secrets: Arc, + policy: Mutex, + versions: Mutex>, + events: UnboundedSender, + next_id: AtomicU64, +} + +/// The broker: a loopback listener on a thread of its own, one thread per +/// helper connection. +pub struct Broker { + shared: Arc, + events: Mutex>>, +} + +impl Broker { + /// Starts listening. `helper` is the executable ssh runs as askpass + /// (RedShell itself). + pub fn start(secrets: Arc, helper: PathBuf) -> std::io::Result { + let listener = TcpListener::bind((Ipv4Addr::LOCALHOST, 0))?; + let (tx, rx) = unbounded(); + let shared = Arc::new(Shared { + address: listener.local_addr()?, + helper, + secrets, + policy: Mutex::default(), + versions: Mutex::default(), + events: tx, + next_id: AtomicU64::new(1), + }); + let serving = shared.clone(); + std::thread::Builder::new().name("redshell-askpass".into()).spawn(move || { + for stream in listener.incoming().flatten() { + let shared = serving.clone(); + let spawned = std::thread::Builder::new() + .name("redshell-askpass-conn".into()) + .spawn(move || shared.serve(stream)); + if let Err(err) = spawned { + log::warn!("askpass: {err}"); + } + } + })?; + Ok(Self { shared, events: Mutex::new(Some(rx)) }) + } + + /// Questions for the user; the first caller gets the receiver. + pub fn take_events(&self) -> Option> { + self.events.lock().take() + } + + /// Finds out, off this thread, whether `program` is an ssh that honours + /// `SSH_ASKPASS_REQUIRE`. Until it is known, ssh runs without askpass. + pub fn probe(&self, program: &str) { + self.shared.honours_askpass(program); + } + + /// Whether the probe of `program` is done, so its processes get askpass + /// if it honours it. + pub fn probed(&self, program: &str) -> bool { + matches!(self.shared.versions.lock().get(program), Some(Probe::Done(_))) + } + + /// The askpass environment for one process pointed at `target`, without + /// checking the ssh version. + pub fn issue(&self, target: AskpassTarget, mode: AskpassMode) -> BTreeMap { + let token = new_token(); + let channel = Channel { address: self.shared.address, token: token.clone() }; + self.shared.policy.lock().issue(token, target, mode, Instant::now()); + BTreeMap::from([ + ("SSH_ASKPASS".to_owned(), self.shared.helper.display().to_string()), + ("SSH_ASKPASS_REQUIRE".to_owned(), "force".to_owned()), + (CHANNEL_ENV.to_owned(), channel.to_string()), + ]) + } +} + +impl AskpassBroker for Broker { + fn grant(&self, program: &str, target: &AskpassTarget, mode: AskpassMode) -> Option { + if !self.shared.honours_askpass(program) { + return None; + } + let password = match mode { + AskpassMode::Interactive { .. } => true, + AskpassMode::Background => self.shared.secrets.usable(&password_account(&target.host)).is_some(), + }; + Some(AskpassGrant { env: self.issue(target.clone(), mode), password }) + } + + fn finished(&self, env: &BTreeMap, denied: bool) { + if let Some(token) = Channel::token_in(env) { + self.shared.policy.lock().finished(&token, denied, &self.shared.secrets); + } + } +} + +/// 128 random bits, hex encoded. +fn new_token() -> String { + let mut bytes = [0u8; 16]; + getrandom::fill(&mut bytes).expect("the OS random source works"); + bytes.iter().map(|b| format!("{b:02x}")).collect() +} + +impl Shared { + fn honours_askpass(self: &Arc, program: &str) -> bool { + let mut versions = self.versions.lock(); + match versions.get(program) { + Some(Probe::Done(version)) => version.is_some_and(OpenSshVersion::honours_askpass_require), + Some(Probe::Running) => false, + None => { + versions.insert(program.to_owned(), Probe::Running); + let (shared, program) = (self.clone(), program.to_owned()); + std::thread::spawn(move || { + let version = OpenSshVersion::detect(&program); + log::debug!("askpass: `{program}` is {version:?}"); + shared.versions.lock().insert(program, Probe::Done(version)); + }); + false + } + } + } + + /// Answers one helper connection. + fn serve(&self, stream: TcpStream) { + if let Err(err) = self.answer(&stream) { + log::debug!("askpass: {err}"); + } + let _ = stream.shutdown(Shutdown::Both); + } + + fn answer(&self, stream: &TcpStream) -> std::io::Result<()> { + stream.set_read_timeout(Some(REQUEST_TIMEOUT))?; + let mut line = String::new(); + BufReader::new(stream.take(MAX_REQUEST)).read_line(&mut line)?; + let request: HelperRequest = serde_json::from_str(&line)?; + stream.set_read_timeout(None)?; + // Two steps, so the keychain is never read under the policy lock. + let account = self.policy.lock().account(&request); + let stored = account.and_then(|a| self.secrets.usable(&a)); + let decision = self.policy.lock().decide(&request, stored, &self.secrets, Instant::now()); + let answer = match decision { + Decision::Answer(secret) => Some(secret), + Decision::Refuse => None, + Decision::Ask(question) => self.ask_user(stream, question)?, + }; + let mut writer = stream; + writer.write_all(&HelperReply { answer }.to_line()) + } + + /// Shows `question` to the user and waits for the answer. + fn ask_user(&self, stream: &TcpStream, question: Question) -> std::io::Result>> { + let id = self.next_id.fetch_add(1, Ordering::Relaxed); + let (tx, rx) = sync_channel(2); + let request = AskpassRequest { + id, + host: question.host.clone(), + pane: question.pane, + prompt: question.prompt.clone(), + remember: question.account.is_some() && self.secrets.persistent(), + rejected: question.rejected, + responder: Responder(Some(tx.clone())), + }; + if self.events.unbounded_send(AskpassEvent::Request(request)).is_err() { + return Ok(None); + } + // The helper sends nothing more: end of stream means it is gone. + let mut watched = stream.try_clone()?; + std::thread::spawn(move || { + let _ = watched.read(&mut [0u8; 1]); + let _ = tx.send(Reply::Gone); + }); + match rx.recv_timeout(QUESTION_TIMEOUT) { + Ok(Reply::Answer { secret, remember }) => { + if let Some(account) = question.account.as_deref().filter(|_| remember) { + self.secrets.remember(account, &secret); + } + self.policy.lock().answered(&question); + Ok(Some(secret)) + } + Ok(Reply::Cancel) => { + self.policy.lock().cancelled(&question); + Ok(None) + } + Ok(Reply::Gone) | Err(_) => { + let _ = self.events.unbounded_send(AskpassEvent::Closed(id)); + Ok(None) + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::secrets::MemoryStore; + + const TARGET_PASSWORD: &str = "target-pw"; + + fn secrets() -> Secrets { + Secrets::new( + MemoryStore::default() + .with(&password_account("prod"), TARGET_PASSWORD) + .with(&passphrase_account("/home/me/.ssh/id_ed25519"), "key-pp"), + ) + } + + fn issued(mode: AskpassMode) -> Policy { + let target = AskpassTarget { + host: "prod".into(), + user: Some("deploy".into()), + address: "prod.example.com".into(), + identity: Some("/home/me/.ssh/id_ed25519".into()), + }; + let mut policy = Policy::default(); + policy.issue("t".into(), target, mode, Instant::now()); + policy + } + + fn ask(policy: &mut Policy, secrets: &Secrets, prompt: &str, ppid: u32) -> Decision { + let request = HelperRequest { token: "t".into(), prompt: prompt.into(), hint: None, ppid: Some(ppid) }; + decide(policy, secrets, &request, Instant::now()) + } + + fn decide(policy: &mut Policy, secrets: &Secrets, request: &HelperRequest, now: Instant) -> Decision { + let stored = policy.account(request).and_then(|a| secrets.usable(&a)); + policy.decide(request, stored, secrets, now) + } + + fn answer(decision: Decision) -> String { + match decision { + Decision::Answer(secret) => secret.to_string(), + other => panic!("expected an answer, got {other:?}"), + } + } + + const PASSWORD: &str = "deploy@prod.example.com's password: "; + + #[test] + fn a_password_goes_only_to_the_host_it_belongs_to() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Background)); + assert!(matches!(ask(&mut policy, &secrets, "deploy@jump.example.com's password: ", 1), Decision::Refuse)); + assert!(matches!(ask(&mut policy, &secrets, "root@prod.example.com's password: ", 1), Decision::Refuse)); + assert_eq!(answer(ask(&mut policy, &secrets, "(deploy@PROD.example.com) Password: ", 1)), TARGET_PASSWORD); + + let mut interactive = issued(AskpassMode::Interactive { pane: None }); + let Decision::Ask(question) = ask(&mut interactive, &secrets, "me@jump's password: ", 1) else { panic!() }; + assert_eq!(question.account, None, "a jump host's password is not remembered under the target"); + } + + #[test] + fn an_unknown_or_expired_token_is_refused() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Background)); + let request = HelperRequest { token: "nope".into(), prompt: PASSWORD.into(), hint: None, ppid: None }; + assert!(matches!(decide(&mut policy, &secrets, &request, Instant::now()), Decision::Refuse)); + let later = Instant::now() + TOKEN_LIFETIME + Duration::from_secs(1); + let request = HelperRequest { token: "t".into(), ..request }; + assert!(matches!(decide(&mut policy, &secrets, &request, later), Decision::Refuse)); + } + + #[test] + fn asked_twice_means_the_stored_password_was_refused() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Interactive { pane: None })); + assert_eq!(answer(ask(&mut policy, &secrets, PASSWORD, 7)), TARGET_PASSWORD); + let Decision::Ask(question) = ask(&mut policy, &secrets, PASSWORD, 7) else { panic!("the user is asked") }; + assert_eq!(question.rejected, Some(AnsweredBy::Store)); + assert_eq!(question.account.as_deref(), Some("ssh-password:prod")); + assert!(secrets.usable("ssh-password:prod").is_none(), "stale"); + + // A new token does not use the stale password either. + let mut background = issued(AskpassMode::Background); + assert!(matches!(ask(&mut background, &secrets, PASSWORD, 8), Decision::Refuse)); + + // Until the user enters (and remembers) a new one. + secrets.remember("ssh-password:prod", "new-pw"); + let mut next = issued(AskpassMode::Background); + assert_eq!(answer(ask(&mut next, &secrets, PASSWORD, 9)), "new-pw"); + } + + #[test] + fn a_background_login_the_server_denied_marks_the_password_stale() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Background)); + assert_eq!(answer(ask(&mut policy, &secrets, PASSWORD, 7)), TARGET_PASSWORD); + policy.finished("t", true, &secrets); + assert!(secrets.usable("ssh-password:prod").is_none()); + assert!(matches!(ask(&mut policy, &secrets, PASSWORD, 7), Decision::Refuse), "the token is gone"); + } + + #[test] + fn a_proxy_jump_child_loading_the_same_key_is_not_a_retry() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Background)); + let prompt = "Enter passphrase for key '/home/me/.ssh/id_ed25519': "; + assert_eq!(answer(ask(&mut policy, &secrets, prompt, 10)), "key-pp"); + assert_eq!(answer(ask(&mut policy, &secrets, prompt, 11)), "key-pp"); + assert!(matches!(ask(&mut policy, &secrets, prompt, 10), Decision::Refuse), "a retry by the same process"); + } + + #[test] + fn a_prompt_naming_no_key_is_about_the_hosts_identity() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Background)); + assert_eq!(answer(ask(&mut policy, &secrets, "Enter passphrase: ", 1)), "key-pp"); + let cut = &"/home/me/.ssh/id_ed25519".repeat(5)[..100]; + assert_eq!(key_path(Some(cut), Some(&"/home/me/.ssh/id_ed25519".repeat(5))).unwrap().len(), 120); + } + + #[test] + fn background_never_asks() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Background)); + let host_key = "The authenticity of host 'x' can't be established.\nAre you sure you want to continue connecting (yes/no)? "; + for prompt in [host_key, "(deploy@prod.example.com) Verification code: ", "Enter passphrase for key '/other': "] + { + assert!(matches!(ask(&mut policy, &secrets, prompt, 1), Decision::Refuse), "{prompt}"); + } + } + + #[test] + fn interactive_asks_and_a_cancel_sticks() { + let (secrets, mut policy) = (secrets(), issued(AskpassMode::Interactive { pane: None })); + let code = "(deploy@prod.example.com) Verification code: "; + let Decision::Ask(question) = ask(&mut policy, &secrets, code, 1) else { panic!("asked") }; + assert!( + matches!(question.prompt, Prompt::Other { .. }) + && question.rejected.is_none() + && question.account.is_none() + ); + policy.cancelled(&question); + assert!(matches!(ask(&mut policy, &secrets, code, 1), Decision::Refuse)); + } + + #[test] + fn a_question_names_the_pane_whose_ssh_asks() { + let pane = redshell_core::new_session_id(); + let (secrets, mut policy) = (secrets(), Policy::default()); + policy.issue( + "t".into(), + AskpassTarget::default(), + AskpassMode::Interactive { pane: Some(pane) }, + Instant::now(), + ); + let Decision::Ask(question) = ask(&mut policy, &secrets, "Verification code: ", 1) else { panic!() }; + assert_eq!(question.pane, Some(pane)); + } + + #[test] + fn a_typed_answer_refused_is_flagged_without_staling_the_store() { + let secrets = Secrets::new(MemoryStore::default()); + let mut policy = issued(AskpassMode::Interactive { pane: None }); + let Decision::Ask(first) = ask(&mut policy, &secrets, PASSWORD, 1) else { panic!() }; + policy.answered(&first); + let Decision::Ask(second) = ask(&mut policy, &secrets, PASSWORD, 1) else { panic!() }; + assert_eq!(second.rejected, Some(AnsweredBy::User)); + } +} diff --git a/crates/redshell-app/src/closing.rs b/crates/redshell-app/src/closing.rs index 611ef88..d8edec3 100644 --- a/crates/redshell-app/src/closing.rs +++ b/crates/redshell-app/src/closing.rs @@ -15,7 +15,8 @@ pub struct Work { pub tabs: usize, /// Live panes whose session ends with them. pub sessions: usize, - /// Live multiplexer panes: closing only detaches from their session. + /// Live multiplexer and server panes: closing only detaches from their + /// session. pub detached: usize, /// Panes in which a program other than an idle shell runs. pub programs: usize, @@ -36,7 +37,7 @@ impl Work { /// What closing one tab (or pane) made of `views` would end. pub fn of(views: &[Entity], cx: &App) -> Self { let live: Vec<_> = views.iter().map(|v| v.read(cx)).filter(|v| v.is_alive()).collect(); - let detached = live.iter().filter(|v| v.kind() == LaunchKind::Multiplexer).count(); + let detached = live.iter().filter(|v| matches!(v.kind(), LaunchKind::Multiplexer | LaunchKind::Remote)).count(); Self { tabs: usize::from(!live.is_empty()), sessions: live.len() - detached, @@ -69,8 +70,8 @@ impl Work { } match self.detached { 0 => {} - 1 => parts.push("A tmux or screen session only detaches and keeps running.".to_owned()), - n => parts.push(format!("{n} tmux or screen sessions only detach and keep running.")), + 1 => parts.push("A tmux, screen or server session only detaches and keeps running.".to_owned()), + n => parts.push(format!("{n} tmux, screen or server sessions only detach and keep running.")), } parts.extend(kept.sentence().map(str::to_owned)); parts.join(" ") @@ -139,9 +140,12 @@ mod tests { ); assert_eq!( (BUSY + TMUX).summary(Kept::Tabs), - "A program is running and will be stopped. 2 sessions will end. A tmux or screen session only \ - detaches and keeps running. Your tabs come back next time, with their output." + "A program is running and will be stopped. 2 sessions will end. A tmux, screen or server session \ + only detaches and keeps running. Your tabs come back next time, with their output." + ); + assert_eq!( + (TMUX + TMUX).summary(Kept::Nothing), + "2 tmux, screen or server sessions only detach and keep running." ); - assert_eq!((TMUX + TMUX).summary(Kept::Nothing), "2 tmux or screen sessions only detach and keep running."); } } diff --git a/crates/redshell-app/src/commands.rs b/crates/redshell-app/src/commands.rs index c583aab..daaa9a3 100644 --- a/crates/redshell-app/src/commands.rs +++ b/crates/redshell-app/src/commands.rs @@ -126,6 +126,10 @@ commands! { LaunchPalette => "palette.launch", "Launch", "Open Profile…", &["cmd-o"], &["ctrl-shift-o"]; LaunchAgent => "agent.launch", "Launch", "Launch AI Agent…", &["cmd-shift-i"], &["ctrl-shift-i"]; ConnectSsh => "ssh.connect", "Launch", "Connect to SSH Host…", &["cmd-shift-s"], &["ctrl-shift-s"]; + AddSshHost => "ssh.add_host", "Launch", "Add SSH Host…", &[], &[]; + EditSshHost => "ssh.edit_host", "Launch", "Edit SSH Host…", &[], &[]; + SshTunnels => "ssh.tunnels", "Launch", "SSH Tunnels…", &[], &[]; + BrowseSshFiles => "ssh.files", "Launch", "Browse SSH Host Files…", &[], &[]; SelectTheme => "theme.select", "Appearance", "Select Theme…", &[], &[]; ImportTheme => "theme.import_clipboard", "Appearance", "Import tweakcn Theme from Clipboard", &[], &[]; InsertSnippet => "snippet.insert", "Terminal", "Insert Snippet…", &["cmd-shift-e"], &["ctrl-shift-e"]; diff --git a/crates/redshell-app/src/confirm.rs b/crates/redshell-app/src/confirm.rs index 4720300..fe1acb5 100644 --- a/crates/redshell-app/src/confirm.rs +++ b/crates/redshell-app/src/confirm.rs @@ -33,6 +33,29 @@ pub enum ConfirmAction { DetachNative(usize), /// Close a native tmux tab and kill its tmux window. KillNative(usize), + /// Delete the saved SSH host `name`; `from_editor` when asked from its + /// editor, which is reopened on cancel. + DeleteHost { + name: String, + from_editor: bool, + }, + /// Create a key pair (there is none yet) and install it on SSH host `host`. + CreateKey { + host: String, + }, + /// Delete `paths` (folders with their contents) on the host of the file + /// browser `browser`, which is shown again either way. + DeleteFiles { + browser: gpui::Entity, + paths: Vec, + }, + /// Kill a session on a RedShell server. + KillServerSession(redshell_app::remote::SessionRef), + /// Replace server `server`'s host of that name with `host`. + ReplaceServerHost { + server: String, + host: Box, + }, /// Delete a recorded session; `reopen` is the list to return to. DeleteSession { session: redshell_core::SessionId, @@ -107,7 +130,10 @@ impl ConfirmDialog { (None, None) } }; - let destructive = !matches!(action, ConfirmAction::Paste { .. } | ConfirmAction::DetachNative(_)); + let destructive = !matches!( + action, + ConfirmAction::Paste { .. } | ConfirmAction::DetachNative(_) | ConfirmAction::CreateKey { .. } + ); Self { title: title.into(), body: body.into(), diff --git a/crates/redshell-app/src/file_rows.rs b/crates/redshell-app/src/file_rows.rs new file mode 100644 index 0000000..99925b3 --- /dev/null +++ b/crates/redshell-app/src/file_rows.rs @@ -0,0 +1,168 @@ +//! How a folder listing is ordered and worded: folders first, sorted by +//! a column, names that don't clash, and times and permissions as people +//! read them. + +use std::time::SystemTime; + +use redshell_remote::sftp::Entry; + +/// The column a listing is sorted by. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum SortKey { + Name, + Size, + Modified, +} + +/// How a listing is ordered; folders always come first. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Sort { + pub key: SortKey, + pub ascending: bool, +} + +impl Sort { + /// Sorting by `key` again flips the order; a new column starts + /// ascending by name, newest or largest first otherwise. + pub fn toggled(self, key: SortKey) -> Self { + if self.key == key { + Self { key, ascending: !self.ascending } + } else { + Self { key, ascending: key == SortKey::Name } + } + } +} + +/// The entries a listing shows, in order: dot files only with `hidden`. +pub fn arrange(entries: &[Entry], sort: Sort, hidden: bool) -> Vec { + let mut rows: Vec = entries.iter().filter(|e| hidden || !e.is_hidden()).cloned().collect(); + rows.sort_by(|a, b| { + let by_name = || a.name.to_lowercase().cmp(&b.name.to_lowercase()).then_with(|| a.name.cmp(&b.name)); + let order = match sort.key { + // Folders have no size of their own: they stay in name order. + SortKey::Size if a.is_dir() && b.is_dir() => return by_name(), + SortKey::Name => by_name(), + SortKey::Size => a.size.cmp(&b.size).then_with(by_name), + SortKey::Modified => a.modified.cmp(&b.modified).then_with(by_name), + }; + let order = if sort.ascending { order } else { order.reverse() }; + b.is_dir().cmp(&a.is_dir()).then(order) + }); + rows +} + +/// `name`, or `name (1)`, `name (2)`… (before its extension) when `taken`. +pub fn free_name(name: &str, taken: impl Fn(&str) -> bool) -> String { + if !taken(name) { + return name.to_owned(); + } + let (stem, ext) = match name.rfind('.') { + Some(dot) if dot > 0 => name.split_at(dot), + _ => (name, ""), + }; + (1..).map(|n| format!("{stem} ({n}){ext}")).find(|candidate| !taken(candidate)).unwrap_or_default() +} + +/// When a file changed, as people say it: `just now`, `5 min ago`, `3 h +/// ago`, `yesterday`, `4 days ago`, then the date. +pub fn relative_time(time: SystemTime, now: SystemTime) -> String { + let secs = now.duration_since(time).map(|d| d.as_secs()).unwrap_or(0); + match secs { + 0..60 => "just now".into(), + 60..3_600 => format!("{} min ago", secs / 60), + 3_600..86_400 => format!("{} h ago", secs / 3_600), + 86_400..172_800 => "yesterday".into(), + 172_800..604_800 => format!("{} days ago", secs / 86_400), + _ => { + let date = chrono::DateTime::::from(time); + let this_year = chrono::DateTime::::from(now).format("%Y").to_string(); + if date.format("%Y").to_string() == this_year { + date.format("%b %-d").to_string() + } else { + date.format("%b %-d, %Y").to_string() + } + } + } +} + +/// `rwxr-xr-x` for the permission bits `mode`. +pub fn permission_string(mode: u32) -> String { + (0..9).rev().map(|bit| if mode & (1 << bit) == 0 { '-' } else { b"xwr"[bit % 3] as char }).collect() +} + +#[cfg(test)] +mod tests { + use std::time::Duration; + + use redshell_remote::sftp::EntryKind; + + use super::*; + + fn entry(name: &str, kind: EntryKind, size: u64, age_secs: u64) -> Entry { + Entry { + name: name.into(), + path: format!("/x/{name}"), + kind, + size, + modified: Some(SystemTime::UNIX_EPOCH + Duration::from_secs(1_000_000 - age_secs)), + permissions: None, + link_target: None, + } + } + + fn names(rows: &[Entry]) -> Vec<&str> { + rows.iter().map(|e| e.name.as_str()).collect() + } + + #[test] + fn folders_come_first_in_any_order() { + let entries = [ + entry("b.txt", EntryKind::File, 10, 50), + entry("A.log", EntryKind::File, 300, 10), + entry("src", EntryKind::Dir, 0, 5), + entry(".env", EntryKind::File, 1, 1), + entry("link", EntryKind::Link { to_dir: true }, 0, 70), + ]; + let by = |key, ascending, hidden| arrange(&entries, Sort { key, ascending }, hidden); + assert_eq!(names(&by(SortKey::Name, true, false)), ["link", "src", "A.log", "b.txt"]); + assert_eq!(names(&by(SortKey::Name, false, true)), ["src", "link", "b.txt", "A.log", ".env"]); + assert_eq!(names(&by(SortKey::Size, false, false)), ["link", "src", "A.log", "b.txt"]); + assert_eq!(names(&by(SortKey::Modified, false, false)), ["src", "link", "A.log", "b.txt"]); + } + + #[test] + fn sorting_a_column_again_flips_it() { + let name = Sort { key: SortKey::Name, ascending: true }; + assert_eq!(name.toggled(SortKey::Name), Sort { key: SortKey::Name, ascending: false }); + assert_eq!(name.toggled(SortKey::Size), Sort { key: SortKey::Size, ascending: false }); + } + + #[test] + fn free_names_keep_the_extension() { + let taken = ["a.txt", "a (1).txt", "dir", ".bashrc"]; + let free = |name| free_name(name, |n| taken.contains(&n)); + assert_eq!(free("new.txt"), "new.txt"); + assert_eq!(free("a.txt"), "a (2).txt"); + assert_eq!(free("dir"), "dir (1)"); + assert_eq!(free(".bashrc"), ".bashrc (1)"); + } + + #[test] + fn times_read_as_people_say_them() { + let now = SystemTime::UNIX_EPOCH + Duration::from_secs(1_800_000_000); + let ago = |secs| relative_time(now - Duration::from_secs(secs), now); + assert_eq!(ago(5), "just now"); + assert_eq!(ago(300), "5 min ago"); + assert_eq!(ago(3 * 3_600), "3 h ago"); + assert_eq!(ago(30 * 3_600), "yesterday"); + assert_eq!(ago(4 * 86_400), "4 days ago"); + assert!(ago(400 * 86_400).contains(", 20"), "{}", ago(400 * 86_400)); + assert_eq!(relative_time(now + Duration::from_secs(60), now), "just now"); + } + + #[test] + fn permissions_read_like_ls() { + assert_eq!(permission_string(0o755), "rwxr-xr-x"); + assert_eq!(permission_string(0o640), "rw-r-----"); + } +} diff --git a/crates/redshell-app/src/files.rs b/crates/redshell-app/src/files.rs new file mode 100644 index 0000000..61a889f --- /dev/null +++ b/crates/redshell-app/src/files.rs @@ -0,0 +1,105 @@ +//! "Browse Files…" in a window: the file browser of an SSH host as an +//! overlay (see [`crate::sftp_view`]), its toasts, the confirmation before a +//! delete and "Terminal Here". +//! +//! A browser lives while it is shown and, once closed, as long as it has +//! transfers running; then it is dropped, which closes its connection. +//! Opening the same host again picks it up with its transfers. +//! +//! This is a child module of `workspace` so it can manage the overlay +//! directly. + +use std::path::PathBuf; + +use redshell_remote::MuxTarget; + +use super::*; +use crate::sftp_view::{FileBrowser, FilesEvent}; + +impl Workspace { + /// Shows the file browser of SSH host `name`. + pub(super) fn browse_files(&mut self, name: &str, window: &mut Window, cx: &mut Context) { + let kept = self.files.iter().map(|(browser, _)| browser).find(|b| b.read(cx).host == name).cloned(); + let browser = match kept { + Some(browser) => browser, + None => { + let Some(ssh) = cx.global::().ssh.find(name).cloned() else { return }; + cx.new(|cx| FileBrowser::new(ssh, window, cx)) + } + }; + self.show_files(browser, window, cx); + } + + /// Shows `browser` as the overlay, listening to it from now on. + pub(super) fn show_files(&mut self, browser: Entity, window: &mut Window, cx: &mut Context) { + if !self.files.iter().any(|(kept, _)| *kept == browser) { + let sub = cx.subscribe_in(&browser, window, Self::on_files_event); + self.files.push((browser.clone(), sub)); + } + window.focus(&browser.focus_handle(cx)); + self.set_overlay(Overlay::Files(browser), None, window, cx); + } + + /// Drops the browsers neither shown nor transferring, closing their + /// connections. One a confirmation is about holds on through it. + pub(super) fn prune_files(&mut self, cx: &App) { + let shown = match &self.overlay { + Some(Overlay::Files(browser)) => Some(browser.entity_id()), + _ => None, + }; + self.files.retain(|(browser, _)| Some(browser.entity_id()) == shown || browser.read(cx).busy()); + } + + fn on_files_event( + &mut self, + browser: &Entity, + ev: &FilesEvent, + window: &mut Window, + cx: &mut Context, + ) { + let shown = matches!(&self.overlay, Some(Overlay::Files(b)) if b == browser); + match ev.clone() { + FilesEvent::Close if shown => self.close_overlay(window, cx), + FilesEvent::Close => {} + FilesEvent::ConfirmDelete { paths, title, body } => { + let action = ConfirmAction::DeleteFiles { browser: browser.clone(), paths }; + self.confirm(title, body, "Delete", action, None, window, cx); + } + FilesEvent::OpenTerminal { dir } => { + let host = browser.read(cx).host.clone(); + self.close_overlay(window, cx); + self.open_terminal_in(&host, &dir, window, cx); + } + FilesEvent::Notify { kind, title, body, reveal } => { + self.toasts.push_with_action(kind, title, body, reveal.map(reveal_action)); + cx.notify(); + } + FilesEvent::Idle => self.prune_files(cx), + } + } + + /// Opens a tab on SSH host `host` with a shell in the folder `dir`. + fn open_terminal_in(&mut self, host: &str, dir: &str, window: &mut Window, cx: &mut Context) { + let state = cx.global::(); + let (Some(ssh), Some(mut profile)) = (state.ssh.find(host), state.find_profile(&format!("ssh:{host}"))) else { + return; + }; + profile.command = ssh.shell_in(dir); + self.open_profile(profile, window, cx); + } + + /// The SSH host the program of tab `tab_id` runs on, for its menu. + pub(super) fn tab_host(&self, tab_id: usize, cx: &App) -> Option { + let tab = self.tabs.iter().find(|t| t.id == tab_id)?; + let state = cx.global::(); + match MuxTarget::of_profile(&tab.active.read(cx).profile, &state.settings.multiplexer, &state.ssh)? { + MuxTarget::Remote(ssh) => Some(ssh.host.name.clone()), + _ => None, + } + } +} + +/// Shows a downloaded file in the system's file manager. +fn reveal_action(path: PathBuf) -> ToastAction { + ToastAction::new("Show in Folder", move |_, cx| cx.reveal_path(&path)) +} diff --git a/crates/redshell-app/src/find_bar.rs b/crates/redshell-app/src/find_bar.rs index d91535e..d22b0bf 100644 --- a/crates/redshell-app/src/find_bar.rs +++ b/crates/redshell-app/src/find_bar.rs @@ -52,7 +52,7 @@ impl FindBar { InputEvent::Submit | InputEvent::Up => cx.emit(FindEvent::Step(SearchDirection::Older)), InputEvent::Down => cx.emit(FindEvent::Step(SearchDirection::Newer)), InputEvent::Cancel => cx.emit(FindEvent::Close), - InputEvent::SubmitStrong | InputEvent::Tab => {} + InputEvent::SubmitStrong | InputEvent::Tab | InputEvent::BackTab => {} }); input.read(cx).focus(window); Self { input, case_sensitive: false, regex: false, status: FindStatus::Idle, _sub: sub } diff --git a/crates/redshell-app/src/forward_list.rs b/crates/redshell-app/src/forward_list.rs new file mode 100644 index 0000000..7224a33 --- /dev/null +++ b/crates/redshell-app/src/forward_list.rs @@ -0,0 +1,405 @@ +//! The host editor's port forwards: a compact list with one forward open +//! for editing at a time, inline. It holds the forwards as text +//! ([`ForwardForm`]); the host editor reads them on Save, and the checks are +//! those of [`ssh_hosts`](crate::ssh_hosts). +//! +//! In an open forward, Enter closes it (once it is valid) and Escape undoes +//! what was changed since it opened (a new one goes away again). + +use gpui::prelude::*; +use gpui::{AnyElement, App, Context, Entity, FocusHandle, SharedString, Subscription, Window, div, px}; +use redshell_core::settings::{ForwardKind, ssh}; +use redshell_ui::{ + Button, ButtonSize, ButtonVariant, IconName, InputEvent, Segmented, Switch, TextInput, ThemeExt, alpha, space, +}; + +use crate::ssh_hosts::{ForwardField, ForwardForm, HostError, Place, parse_forwards}; + +/// The forward open for editing. +struct Open { + index: usize, + /// What it was when it opened; `None` for one just added. + before: Option, +} + +pub struct ForwardList { + forwards: Vec, + open: Option, + /// One input per field of the open forward, in [`ForwardField::ALL`] order. + inputs: Vec>, + /// The errors shown: set by a check, then following every edit. + errors: Vec, + /// Gets the keyboard back when a forward closes. + home: FocusHandle, + _subs: Vec, +} + +impl ForwardList { + /// The forwards `forwards`; `home` gets the keyboard when one closes. + pub fn new(forwards: Vec, home: FocusHandle, window: &mut Window, cx: &mut Context) -> Self { + let mut subs = Vec::new(); + let inputs = + ForwardField::ALL + .into_iter() + .map(|field| { + let input = cx.new(|cx| TextInput::new(cx).placeholder(placeholder(field))); + subs.push(cx.subscribe_in(&input, window, move |this, _, ev, window, cx| { + this.on_input(field, ev, window, cx) + })); + input + }) + .collect(); + Self { forwards, open: None, inputs, errors: Vec::new(), home, _subs: subs } + } + + pub fn forwards(&self) -> &[ForwardForm] { + &self.forwards + } + + fn input(&self, field: ForwardField) -> &Entity { + &self.inputs[field as usize] + } + + /// Shows `errors` (the host editor's, of which this list shows the + /// forwards') and opens the first faulty forward at its field. + pub fn show_errors(&mut self, errors: Vec, window: &mut Window, cx: &mut Context) { + self.errors = errors; + let first = self.errors.iter().find_map(|e| match e.place() { + Place::Forward(index, field) => Some((index, field)), + Place::Field(_) => None, + }); + if let Some((index, field)) = first { + if self.open.as_ref().is_none_or(|open| open.index != index) { + self.open_forward(index, Some(self.forwards[index].clone()), cx); + } + self.input(field).read(cx).focus(window); + } + cx.notify(); + } + + /// The errors of the forwards as they are now. + fn check(&self) -> Vec { + parse_forwards(&self.forwards).1 + } + + fn add(&mut self, window: &mut Window, cx: &mut Context) { + if !self.close(window, cx) { + return; + } + self.forwards.push(ForwardForm::default()); + self.open_forward(self.forwards.len() - 1, None, cx); + self.input(ForwardField::BindPort).read(cx).focus(window); + } + + fn edit(&mut self, index: usize, window: &mut Window, cx: &mut Context) { + if self.close(window, cx) { + self.open_forward(index, Some(self.forwards[index].clone()), cx); + self.input(ForwardField::BindPort).read(cx).focus(window); + } + } + + /// Opens forward `index` and fills the inputs with it. + fn open_forward(&mut self, index: usize, before: Option, cx: &mut Context) { + self.open = Some(Open { index, before }); + let form = self.forwards[index].clone(); + for field in ForwardField::ALL { + self.input(field).update(cx, |input, cx| input.set_value(form.get(field), cx)); + } + cx.notify(); + } + + /// Closes the open forward if it is valid, else shows what is wrong; + /// `true` when nothing is open any more. + fn close(&mut self, window: &mut Window, cx: &mut Context) -> bool { + let Some(index) = self.open.as_ref().map(|open| open.index) else { return true }; + let errors = self.check(); + if errors.iter().any(|e| matches!(e.place(), Place::Forward(i, _) if i == index)) { + self.show_errors(errors, window, cx); + return false; + } + self.errors = errors; + self.open = None; + self.home.focus(window); + cx.notify(); + true + } + + /// Undoes the changes to the open forward and closes it. + fn cancel(&mut self, window: &mut Window, cx: &mut Context) { + let Some(open) = self.open.take() else { return }; + match open.before { + Some(before) => self.forwards[open.index] = before, + None => _ = self.forwards.remove(open.index), + } + self.refresh_errors(); + self.home.focus(window); + cx.notify(); + } + + fn remove(&mut self, index: usize, window: &mut Window, cx: &mut Context) { + self.forwards.remove(index); + self.open = match self.open.take() { + Some(open) if open.index == index => { + self.home.focus(window); + None + } + Some(open) if open.index > index => Some(Open { index: open.index - 1, ..open }), + open => open, + }; + self.refresh_errors(); + cx.notify(); + } + + /// Changes the open forward with `f`. + fn change(&mut self, cx: &mut Context, f: impl FnOnce(&mut ForwardForm)) { + if let Some(open) = &self.open { + f(&mut self.forwards[open.index]); + self.refresh_errors(); + cx.notify(); + } + } + + /// Errors once shown follow the edits. + fn refresh_errors(&mut self) { + if !self.errors.is_empty() { + self.errors = self.check(); + } + } + + fn on_input(&mut self, field: ForwardField, ev: &InputEvent, window: &mut Window, cx: &mut Context) { + match ev { + InputEvent::Changed(value) => self.change(cx, |form| form.set(field, value.clone())), + InputEvent::Submit | InputEvent::SubmitStrong => _ = self.close(window, cx), + InputEvent::Cancel => self.cancel(window, cx), + InputEvent::Tab | InputEvent::BackTab => { + let kind = self.open.as_ref().map(|open| self.forwards[open.index].kind).unwrap_or_default(); + let fields: Vec<_> = ForwardField::ALL.into_iter().filter(|f| f.applies(kind)).collect(); + let at = fields.iter().position(|f| *f == field).unwrap_or_default(); + let len = fields.len(); + let next = if *ev == InputEvent::Tab { (at + 1) % len } else { (at + len - 1) % len }; + self.input(fields[next]).read(cx).focus(window); + } + InputEvent::Up | InputEvent::Down => {} + } + } + + /// A closed forward: its kind, what it says, and its buttons. + fn render_row(&self, index: usize, form: &ForwardForm, cx: &mut Context) -> AnyElement { + let t = cx.theme(); + let ui = *t.ui(); + let forward = form.parse(); + let complete = ssh::forward_errors(std::slice::from_ref(&forward)).is_empty(); + let (title, detail) = match (&forward.label, complete) { + (_, false) => ("Incomplete".to_owned(), None), + (Some(label), true) => (label.clone(), Some(forward.route())), + (None, true) => (forward.route(), None), + }; + let detail = [detail, forward.auto_start.then(|| "starts with RedShell".to_owned())] + .into_iter() + .flatten() + .collect::>() + .join(" · "); + let icon_button = |id: &'static str, icon, tip: &'static str, variant| { + Button::new((id, index)).icon(icon).size(ButtonSize::Xs).variant(variant).tooltip(tip) + }; + div() + .flex() + .items_center() + .gap(space::S3) + .py(space::S2) + .border_b_1() + .border_color(alpha(ui.border, 0.6)) + .child(kind_tag(form.kind, cx)) + .child( + div() + .flex() + .flex_col() + .flex_1() + .min_w_0() + .gap(px(2.)) + .child(div().text_size(t.text_sm()).font_weight(gpui::FontWeight::MEDIUM).child(title)) + .when(!detail.is_empty(), |d| { + d.child(div().text_size(t.text_xs()).text_color(ui.muted_foreground).child(detail)) + }), + ) + .child( + icon_button("forward-edit", IconName::Pencil, "Edit", ButtonVariant::Ghost) + .on_click(cx.listener(move |this, _, window, cx| this.edit(index, window, cx))), + ) + .child( + icon_button("forward-remove", IconName::Trash, "Remove", ButtonVariant::Ghost) + .on_click(cx.listener(move |this, _, window, cx| this.remove(index, window, cx))), + ) + .into_any_element() + } + + /// The open forward: its kind, where it listens and leads, its label + /// and whether it starts with RedShell. + fn render_open(&self, index: usize, form: &ForwardForm, cx: &mut Context) -> AnyElement { + let t = cx.theme(); + let ui = *t.ui(); + let kinds = ForwardKind::ALL.map(|k| (kind_value(k).into(), k.label().into())).to_vec(); + let this = cx.entity().downgrade(); + let segmented = Segmented::new("forward-kind", kinds, kind_value(form.kind)).on_select(move |value, _, cx| { + let kind = ForwardKind::ALL.into_iter().find(|k| kind_value(*k) == value.as_ref()).unwrap_or_default(); + this.update(cx, |this, cx| this.change(cx, |form| form.kind = kind)).ok(); + }); + let this = cx.entity().downgrade(); + let auto_start = Switch::new("forward-auto-start", form.auto_start).on_toggle(move |on, _, cx| { + this.update(cx, |this, cx| this.change(cx, |form| form.auto_start = on)).ok(); + }); + let pair = |host: ForwardField, port: ForwardField| { + div() + .flex() + .w_full() + .gap(space::S1_5) + .child(div().flex_1().min_w_0().child(self.input(host).clone())) + .child(div().w(px(84.)).child(self.input(port).clone())) + }; + let errors = |fields: &[ForwardField]| -> Vec { + self.errors + .iter() + .filter(|e| matches!(e.place(), Place::Forward(i, f) if i == index && fields.contains(&f))) + .map(|e| e.message().to_owned()) + .collect() + }; + let (listen, to) = match form.kind { + ForwardKind::Remote => ("Listen on host", "Forward to"), + ForwardKind::Local | ForwardKind::Dynamic => ("Listen on", "Forward to"), + }; + let line = + |label: &'static str, control: AnyElement, errors: Vec| field_line(label, control, errors, cx); + div() + .flex() + .flex_col() + .gap(space::S2_5) + .my(space::S2) + .p(space::S3) + .rounded(t.radius_md()) + .border_1() + .border_color(ui.border) + .child(line("Type", segmented.into_any_element(), Vec::new())) + .child(div().text_size(t.text_xs()).text_color(ui.muted_foreground).child(explanation(form.kind))) + .child(line( + listen, + pair(ForwardField::BindAddress, ForwardField::BindPort).into_any_element(), + errors(&[ForwardField::BindAddress, ForwardField::BindPort]), + )) + .when(form.kind != ForwardKind::Dynamic, |d| { + d.child(line( + to, + pair(ForwardField::TargetHost, ForwardField::TargetPort).into_any_element(), + errors(&[ForwardField::TargetHost, ForwardField::TargetPort]), + )) + }) + .child(line( + "Label", + div().w_full().child(self.input(ForwardField::Label).clone()).into_any_element(), + Vec::new(), + )) + .child(line("Start with RedShell", auto_start.into_any_element(), Vec::new())) + .child( + div().flex().justify_end().gap(space::S1_5).child( + Button::new("forward-done") + .label("Done") + .variant(ButtonVariant::Outline) + .size(ButtonSize::Sm) + .on_click(cx.listener(|this, _, window, cx| _ = this.close(window, cx))), + ), + ) + .into_any_element() + } +} + +impl Render for ForwardList { + fn render(&mut self, _window: &mut Window, cx: &mut Context) -> impl IntoElement { + let open = self.open.as_ref().map(|open| open.index); + let rows: Vec = + self.forwards + .clone() + .iter() + .enumerate() + .map(|(index, form)| { + if open == Some(index) { + self.render_open(index, form, cx) + } else { + self.render_row(index, form, cx) + } + }) + .collect(); + let empty = self.forwards.is_empty().then(|| { + let t = cx.theme(); + div() + .py(space::S2) + .text_size(t.text_sm()) + .text_color(t.ui().muted_foreground) + .child("Reach ports through this host, or open a SOCKS proxy.") + }); + div().flex().flex_col().children(rows).children(empty).child( + div().flex().pt(space::S2).child( + Button::new("forward-add") + .label("Add Forward") + .icon(IconName::Plus) + .variant(ButtonVariant::Outline) + .size(ButtonSize::Sm) + .on_click(cx.listener(|this, _, window, cx| this.add(window, cx))), + ), + ) + } +} + +/// A labelled control of the open forward, with its errors underneath. +fn field_line(label: &'static str, control: AnyElement, errors: Vec, cx: &App) -> AnyElement { + let t = cx.theme(); + div() + .flex() + .items_start() + .gap(space::S3) + .child(div().w(px(128.)).flex_none().pt(space::S1_5).text_size(t.text_sm()).child(label)) + .child( + div().flex().flex_col().items_start().flex_1().min_w_0().gap(space::S1).child(control).children( + errors.into_iter().map(|e| div().text_size(t.text_xs()).text_color(t.ui().destructive).child(e)), + ), + ) + .into_any_element() +} + +/// The short tag in front of a closed forward. +fn kind_tag(kind: ForwardKind, cx: &App) -> AnyElement { + let t = cx.theme(); + div() + .flex_none() + .w(px(56.)) + .text_size(t.text_xs()) + .font_weight(gpui::FontWeight::MEDIUM) + .text_color(t.ui().muted_foreground) + .child(kind.label().to_uppercase()) + .into_any_element() +} + +fn kind_value(kind: ForwardKind) -> &'static str { + match kind { + ForwardKind::Local => "local", + ForwardKind::Remote => "remote", + ForwardKind::Dynamic => "dynamic", + } +} + +/// What a forward of `kind` does, in a line. +fn explanation(kind: ForwardKind) -> SharedString { + match kind { + ForwardKind::Local => "A port on this computer reaches a host the server can see.", + ForwardKind::Remote => "A port on the server reaches a host this computer can see.", + ForwardKind::Dynamic => "A SOCKS proxy on this computer that connects out from the server.", + } + .into() +} + +fn placeholder(field: ForwardField) -> &'static str { + match field { + ForwardField::BindAddress | ForwardField::TargetHost => "localhost", + ForwardField::BindPort => "8080", + ForwardField::TargetPort => "80", + ForwardField::Label => "Optional", + } +} diff --git a/crates/redshell-app/src/host_editor.rs b/crates/redshell-app/src/host_editor.rs new file mode 100644 index 0000000..ffa2cdb --- /dev/null +++ b/crates/redshell-app/src/host_editor.rs @@ -0,0 +1,681 @@ +//! The dialog that adds or edits an SSH host. It only collects the form: +//! checking and saving go through [`ssh_hosts`](crate::ssh_hosts). +//! +//! The host's password lives in the system keychain, not in the form: the +//! editor shows whether one is saved, and a new one (or its removal) is +//! applied on Save, so Cancel changes nothing. + +use gpui::prelude::*; +use gpui::{ + AnyElement, App, Context, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, KeyDownEvent, + PathPromptOptions, ScrollHandle, SharedString, Subscription, Window, div, point, px, +}; +use redshell_core::settings::{MultiplexerKind, SshHost}; +use redshell_ui::{ + Button, ButtonSize, ButtonVariant, IconName, InputEvent, Menu, MenuEntry, Modal, Select, SelectOption, Switch, + TextInput, ThemeExt, key_hints, modal_footer, modal_header, section_label, setting_row, space, +}; + +use redshell_app::secrets::Secrets; +use zeroize::Zeroizing; + +use crate::forward_list::ForwardList; +use crate::ssh_hosts::{self, Field, HostBook, HostError, HostForm, PasswordChange, Place, Source}; +use crate::state::AppState; + +#[derive(Debug, Clone, PartialEq)] +pub enum HostEditorEvent { + Close, + /// The host was saved under `name`, and `then` is what to do with it. + Saved { + name: String, + then: AfterSave, + }, + /// Asks to delete the saved host `name`; `reset` when that hands it + /// back to its `~/.ssh/config` entry. + Remove { + name: String, + reset: bool, + }, +} + +/// What the editor asks for once the host is saved. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum AfterSave { + Nothing, + Connect, + /// Install the user's public key on the host. + InstallKey, +} + +/// One row of the form. +enum Row { + Section(&'static str), + Input(Field), + Password, + InstallKey, + ForwardAgent, + Multiplexer, + Forwards, +} + +/// The form, top to bottom. +const LAYOUT: [Row; 21] = [ + Row::Section("Connection"), + Row::Input(Field::Name), + Row::Input(Field::Address), + Row::Input(Field::Port), + Row::Input(Field::User), + Row::Input(Field::JumpHost), + Row::Section("Authentication"), + Row::Input(Field::KeyFile), + Row::Password, + Row::InstallKey, + Row::ForwardAgent, + Row::Section("Organize"), + Row::Input(Field::Group), + Row::Input(Field::Tags), + Row::Section("Session"), + Row::Multiplexer, + Row::Input(Field::AttachSession), + Row::Input(Field::StartupCommand), + Row::Input(Field::ExtraArgs), + Row::Section("Port forwarding"), + Row::Forwards, +]; + +/// The host's password, as the Authentication section shows it. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +enum PasswordRow { + /// Asking the keychain. + Checking, + /// There is no keychain to save it in. + Unavailable, + Saved, + /// A password is being typed, to save or (`replaces`) to replace the + /// saved one. Left empty it changes nothing. + Typing { + replaces: bool, + }, + /// The saved password goes on Save. + Removing, +} + +impl PasswordRow { + /// What the keychain holds for host `name`. Blocking. + fn of(secrets: &Secrets, name: &str) -> Self { + if !secrets.persistent() { + Self::Unavailable + } else if !name.is_empty() && secrets.has_password(name) { + Self::Saved + } else { + Self::Typing { replaces: false } + } + } +} + +pub struct HostEditor { + book: HostBook, + source: Source, + /// One input per text field, in [`Field::ALL`] order. + inputs: Vec<(Field, Entity)>, + multiplexer: Option, + forward_agent: bool, + forwards: Entity, + password: Entity, + password_row: PasswordRow, + errors: Vec, + /// Set by the first save attempt; the errors then follow every edit. + checked: bool, + focus: FocusHandle, + group_menu: Option<(Entity, Subscription)>, + /// Scrolls the form, which is taller than small windows. + scroll: ScrollHandle, + _subs: Vec, +} + +impl EventEmitter for HostEditor {} + +impl Focusable for HostEditor { + fn focus_handle(&self, cx: &App) -> FocusHandle { + self.input(Field::Name).focus_handle(cx) + } +} + +/// Width of the column of inputs. +const CONTROL_WIDTH: f32 = 300.; + +impl HostEditor { + pub fn new(book: HostBook, source: Source, window: &mut Window, cx: &mut Context) -> Self { + let host = book.host(&source); + let form = HostForm::from_host(&host); + let alias = book.alias(&host.name).cloned().unwrap_or_default(); + let mut subs = Vec::new(); + let inputs: Vec<_> = Field::ALL + .into_iter() + .map(|field| { + let input = cx.new(|cx| { + let mut input = TextInput::new(cx).placeholder(placeholder(field, &alias)); + input.set_value(form.get(field), cx); + input + }); + subs.push(cx.subscribe_in(&input, window, Self::on_input)); + (field, input) + }) + .collect(); + inputs[0].1.read(cx).focus(window); + let password = cx.new(|cx| TextInput::new(cx).masked(true).placeholder("Password")); + subs.push(cx.subscribe_in(&password, window, Self::on_password_input)); + Self::check_password(host.name, cx); + let focus = cx.focus_handle(); + let forwards = cx.new(|cx| ForwardList::new(form.forwards.clone(), focus.clone(), window, cx)); + Self { + book, + source, + inputs, + multiplexer: form.multiplexer, + forward_agent: form.forward_agent, + forwards, + password, + password_row: PasswordRow::Checking, + errors: Vec::new(), + checked: false, + focus, + group_menu: None, + scroll: ScrollHandle::new(), + _subs: subs, + } + } + + /// Finds out, off the UI thread, whether host `name` has a saved password. + fn check_password(name: String, cx: &mut Context) { + let secrets = cx.global::().secrets.clone(); + let check = cx.background_spawn(async move { PasswordRow::of(&secrets, &name) }); + cx.spawn(async move |this, cx| { + let row = check.await; + this.update(cx, |this, cx| { + this.password_row = row; + cx.notify(); + }) + .ok(); + }) + .detach(); + } + + fn input(&self, field: Field) -> &Entity { + &self.inputs[field as usize].1 + } + + /// Focuses the input of `field` and scrolls it into view. + fn focus_field(&self, field: Field, window: &mut Window, cx: &App) { + self.input(field).read(cx).focus(window); + self.scroll_to(&Row::Input(field)); + } + + /// Scrolls the first row like `row` into view. + fn scroll_to(&self, row: &Row) { + let same = |other: &Row| match (row, other) { + (Row::Input(a), Row::Input(b)) => a == b, + _ => std::mem::discriminant(row) == std::mem::discriminant(other), + }; + if let Some(at) = LAYOUT.iter().position(same) { + self.scroll.scroll_to_item(at); + } + } + + fn form(&self, cx: &App) -> HostForm { + let mut form = HostForm::default(); + form.multiplexer = self.multiplexer; + form.forward_agent = self.forward_agent; + form.forwards = self.forwards.read(cx).forwards().to_vec(); + for (field, input) in &self.inputs { + form.set(*field, input.read(cx).value()); + } + form + } + + fn on_input(&mut self, input: &Entity, ev: &InputEvent, window: &mut Window, cx: &mut Context) { + match ev { + InputEvent::Submit => self.save(AfterSave::Nothing, window, cx), + InputEvent::SubmitStrong => self.save(AfterSave::Connect, window, cx), + InputEvent::Cancel => cx.emit(HostEditorEvent::Close), + InputEvent::Tab | InputEvent::BackTab => { + let at = self.inputs.iter().position(|(_, i)| i == input).unwrap_or_default(); + let len = self.inputs.len(); + let next = if *ev == InputEvent::Tab { (at + 1) % len } else { (at + len - 1) % len }; + // The password input sits between the key file and the group. + let password = matches!(self.password_row, PasswordRow::Typing { .. }) + && matches!( + (ev, self.inputs[at].0), + (InputEvent::Tab, Field::KeyFile) | (InputEvent::BackTab, Field::Group) + ); + if password { + self.password.read(cx).focus(window); + } else { + self.focus_field(self.inputs[next].0, window, cx); + } + } + InputEvent::Changed(_) if self.checked => { + self.errors = self.book.check(&self.source, &self.form(cx)).err().unwrap_or_default(); + cx.notify(); + } + InputEvent::Changed(_) | InputEvent::Up | InputEvent::Down => {} + } + } + + fn on_password_input( + &mut self, + _: &Entity, + ev: &InputEvent, + window: &mut Window, + cx: &mut Context, + ) { + match ev { + InputEvent::Submit => self.save(AfterSave::Nothing, window, cx), + InputEvent::SubmitStrong => self.save(AfterSave::Connect, window, cx), + InputEvent::Cancel => cx.emit(HostEditorEvent::Close), + InputEvent::Tab => self.focus_field(Field::Group, window, cx), + InputEvent::BackTab => self.focus_field(Field::KeyFile, window, cx), + InputEvent::Changed(_) | InputEvent::Up | InputEvent::Down => {} + } + } + + /// Moves the password row to `row`; typing a password focuses its input. + fn set_password_row(&mut self, row: PasswordRow, window: &mut Window, cx: &mut Context) { + self.password_row = row; + self.password.update(cx, |input, cx| input.set_value("", cx)); + if matches!(row, PasswordRow::Typing { .. }) { + self.password.read(cx).focus(window); + } + cx.notify(); + } + + /// What saving does to the keychain. + fn password_change(&self, cx: &App) -> PasswordChange { + let typed = self.password.read(cx).value(); + match self.password_row { + PasswordRow::Typing { .. } if !typed.is_empty() => PasswordChange::Set(Zeroizing::new(typed.to_owned())), + PasswordRow::Removing => PasswordChange::Remove, + _ => PasswordChange::Keep, + } + } + + /// Escape and Enter when no input has the keyboard. + fn on_key(&mut self, ev: &KeyDownEvent, window: &mut Window, cx: &mut Context) { + match ev.keystroke.key.as_str() { + "escape" => cx.emit(HostEditorEvent::Close), + "enter" => self.save(AfterSave::Nothing, window, cx), + _ => return, + } + cx.stop_propagation(); + } + + /// Saves the host, or shows what is wrong and focuses the first such field. + fn save(&mut self, then: AfterSave, window: &mut Window, cx: &mut Context) { + let (form, password) = (self.form(cx), self.password_change(cx)); + match ssh_hosts::save(cx, &self.book, &self.source, &form, password) { + Ok(name) => cx.emit(HostEditorEvent::Saved { name, then }), + Err(errors) => { + self.forwards.update(cx, |list, cx| list.show_errors(errors.clone(), window, cx)); + match errors.first().map(|e| e.place()) { + Some(Place::Field(field)) => self.focus_field(field, window, cx), + Some(Place::Forward(..)) => self.scroll_to(&Row::Forwards), + None => {} + } + self.errors = errors; + self.checked = true; + cx.notify(); + } + } + } + + fn browse_key_file(&mut self, cx: &mut Context) { + let rx = cx.prompt_for_paths(PathPromptOptions { + files: true, + directories: false, + multiple: false, + prompt: Some("Use key".into()), + }); + let input = self.input(Field::KeyFile).clone(); + cx.spawn(async move |_, cx| { + if let Ok(Ok(Some(paths))) = rx.await + && let Some(path) = paths.into_iter().next() + { + input.update(cx, |input, cx| input.set_value(path.display().to_string(), cx)).ok(); + } + }) + .detach(); + } + + /// The menu of the groups other hosts are in, below the group input. + fn open_group_menu(&mut self, window: &mut Window, cx: &mut Context) { + let input = self.input(Field::Group).clone(); + let current = input.read(cx).value().trim().to_owned(); + let groups = self.book.groups(); + let menu = Menu::build(window, cx, |menu| { + groups.into_iter().fold(menu.offset(point(px(0.), px(40.))), |menu, group| { + let (input, checked) = (input.clone(), group == current); + menu.entry( + MenuEntry::new(group.clone(), move |window, cx| { + input.update(cx, |input, cx| input.set_value(group.clone(), cx)); + input.read(cx).focus(window); + }) + .checked(checked), + ) + }) + }); + let sub = cx.subscribe(&menu, |this, _, _: &DismissEvent, cx| { + this.group_menu = None; + cx.notify(); + }); + self.group_menu = Some((menu, sub)); + cx.notify(); + } + + fn render_row(&self, row: &Row, cx: &mut Context) -> AnyElement { + match row { + Row::Section(label) => section_label(*label, cx).into_any_element(), + Row::Input(field) => self.field_row(*field, cx), + Row::Password => self.password_row(cx), + Row::InstallKey => self.install_key_row(cx), + Row::ForwardAgent => self.forward_agent_row(cx), + Row::Multiplexer => self.multiplexer_row(cx), + Row::Forwards => div().pb(space::S2).child(self.forwards.clone()).into_any_element(), + } + } + + /// A labelled input with its error (if any) underneath. The key file + /// has a Browse button, and the group a menu of the existing groups. + fn field_row(&self, field: Field, cx: &mut Context) -> AnyElement { + let trailing = match field { + Field::KeyFile => Some( + Button::new("host-browse") + .label("Browse…") + .variant(ButtonVariant::Outline) + .on_click(cx.listener(|this, _, _, cx| this.browse_key_file(cx))) + .into_any_element(), + ), + Field::Group => self.groups_button(cx), + _ => None, + }; + let t = cx.theme(); + let error = self.errors.iter().find(|e| e.place() == Place::Field(field)).map(|e| e.message()); + let menu = self.group_menu.as_ref().filter(|_| field == Field::Group).map(|(menu, _)| menu.clone()); + let input = div() + .flex() + .gap(space::S1_5) + .children(menu) + .child(div().flex_1().min_w_0().child(self.input(field).clone())); + let control = div() + .flex() + .flex_col() + .gap(space::S1) + .w(px(CONTROL_WIDTH)) + .child(input.children(trailing)) + .children(error.map(|e| div().text_size(t.text_xs()).text_color(t.ui().destructive).child(e))); + let (label, description) = label(field); + setting_row(label, description, control, cx) + } + + /// Opens the menu of existing groups, when there are any. While the + /// menu is open, a click on the button only closes it. + fn groups_button(&self, cx: &mut Context) -> Option { + let open = self.group_menu.is_some(); + (!self.book.groups().is_empty()).then(|| { + Button::new("host-groups") + .icon(IconName::ChevronDown) + .variant(ButtonVariant::Ghost) + .selected(open) + .when(!open, |b| { + b.tooltip("Existing groups") + .on_click(cx.listener(|this, _, window, cx| this.open_group_menu(window, cx))) + }) + .into_any_element() + }) + } + + /// "Saved in keychain" with Change and Remove, or the input for a new + /// password; nothing to do without a keychain. + fn password_row(&self, cx: &mut Context) -> AnyElement { + let button = |id: &'static str, label: &'static str, variant, row: PasswordRow| { + Button::new(id) + .label(label) + .variant(variant) + .size(ButtonSize::Sm) + .on_click(cx.listener(move |this, _, window, cx| this.set_password_row(row, window, cx))) + .into_any_element() + }; + let t = cx.theme(); + let muted = + |text: &'static str| div().flex_1().text_size(t.text_sm()).text_color(t.ui().muted_foreground).child(text); + let (description, control): (Option<&str>, AnyElement) = match self.password_row { + PasswordRow::Checking => (None, muted("Checking the keychain…").into_any_element()), + PasswordRow::Unavailable => { + (Some("No system keychain to save it in"), muted("Keychain unavailable").into_any_element()) + } + PasswordRow::Saved => ( + None, + div() + .flex() + .items_center() + .gap(space::S1_5) + .child(div().flex_1().text_size(t.text_sm()).child("Saved in keychain")) + .child(button( + "host-password-change", + "Change", + ButtonVariant::Outline, + PasswordRow::Typing { replaces: true }, + )) + .child(button( + "host-password-remove", + "Remove", + ButtonVariant::GhostDestructive, + PasswordRow::Removing, + )) + .into_any_element(), + ), + PasswordRow::Typing { replaces } => ( + Some(if replaces { "Replaces the saved one" } else { "Kept in the system keychain" }), + div() + .flex() + .gap(space::S1_5) + .child(div().flex_1().min_w_0().child(self.password.clone())) + .when(replaces, |d| { + d.child(button("host-password-keep", "Keep", ButtonVariant::Ghost, PasswordRow::Saved)) + }) + .into_any_element(), + ), + PasswordRow::Removing => ( + None, + div() + .flex() + .items_center() + .gap(space::S1_5) + .child(muted("Removed when you save")) + .child(button("host-password-undo", "Undo", ButtonVariant::Ghost, PasswordRow::Saved)) + .into_any_element(), + ), + }; + setting_row("Password", description, div().w(px(CONTROL_WIDTH)).child(control), cx) + } + + /// Saves the host, then installs the user's public key on it. + fn install_key_row(&self, cx: &mut Context) -> AnyElement { + let button = Button::new("host-install-key") + .label("Save & Install Key…") + .icon(IconName::KeyRound) + .variant(ButtonVariant::Outline) + .size(ButtonSize::Sm) + .on_click(cx.listener(|this, _, window, cx| this.save(AfterSave::InstallKey, window, cx))); + let description = Some("Adds your public key to its authorized_keys"); + setting_row("Install key on server", description, button, cx) + } + + fn forward_agent_row(&self, cx: &mut Context) -> AnyElement { + let this = cx.entity().downgrade(); + let switch = Switch::new("host-forward-agent", self.forward_agent).on_toggle(move |on, _, cx| { + this.update(cx, |this, cx| { + this.forward_agent = on; + cx.notify(); + }) + .ok(); + }); + setting_row("Forward agent", Some("The host can sign in elsewhere with your local keys"), switch, cx) + } + + fn multiplexer_row(&self, cx: &mut Context) -> AnyElement { + let options = vec![ + SelectOption::new("default", "Default"), + SelectOption::new("tmux", "tmux"), + SelectOption::new("screen", "GNU screen"), + ]; + let selected = match self.multiplexer { + None => "default", + Some(MultiplexerKind::Tmux) => "tmux", + Some(MultiplexerKind::Screen) => "screen", + }; + let this = cx.entity().downgrade(); + let select = Select::new("host-mux", options, selected).on_select(move |value, _, cx| { + let kind = match value.as_ref() { + "tmux" => Some(MultiplexerKind::Tmux), + "screen" => Some(MultiplexerKind::Screen), + _ => None, + }; + this.update(cx, |this, cx| { + this.multiplexer = kind; + cx.notify(); + }) + .ok(); + }); + setting_row("Multiplexer", Some("Whose sessions the session manager lists here"), select, cx) + } + + /// What the dialog is about, under its title. + fn description(&self) -> Option { + match &self.source { + Source::Imported(_) => { + Some("From ~/.ssh/config. Your changes are kept in RedShell, the file stays as it is.".into()) + } + Source::Saved(name) if self.book.alias(name).is_some() => { + Some("Named after a ~/.ssh/config alias: empty fields come from the file.".into()) + } + Source::Saved(_) | Source::New => None, + } + } + + /// Delete…, or Reset for a host that overrides a `~/.ssh/config` alias; + /// nothing for a new host or one only in the file. + fn remove_button(&self, cx: &mut Context) -> Option + + + ); +} diff --git a/web/src/app/router.tsx b/web/src/app/router.tsx new file mode 100644 index 0000000..7d76754 --- /dev/null +++ b/web/src/app/router.tsx @@ -0,0 +1,48 @@ +import { createBrowserRouter, Navigate } from "react-router"; +import { SignIn } from "../features/auth/SignIn"; +import { AppLayout, Home } from "./AppLayout"; + +/** + * Routes. The inbox and sign-in are in the main chunk; everything else loads on first visit, + * the terminal (xterm.js) above all. + */ +export const router = createBrowserRouter([ + { path: "/signin", element: }, + { path: "/setup", lazy: async () => ({ Component: (await import("../features/auth/Setup")).Setup }) }, + { + element: , + children: [ + { index: true, element: }, + { path: "s/:id", lazy: async () => ({ Component: (await import("../features/session/SessionView")).SessionView }) }, + { path: "pair", lazy: async () => ({ Component: (await import("../features/auth/Pair")).Pair }) }, + { + path: "settings", + lazy: async () => ({ Component: (await import("../features/settings/Settings")).Settings }), + }, + { + path: "settings/passkeys", + lazy: async () => ({ Component: (await import("../features/settings/Passkeys")).Passkeys }), + }, + { + path: "settings/password", + lazy: async () => ({ Component: (await import("../features/settings/Password")).Password }), + }, + { + path: "settings/devices", + lazy: async () => ({ Component: (await import("../features/settings/Devices")).Devices }), + }, + { + path: "settings/devices/:kind/:id", + lazy: async () => ({ Component: (await import("../features/settings/Devices")).DeviceDetail }), + }, + { + path: "settings/notifications", + lazy: async () => ({ Component: (await import("../features/settings/Notifications")).Notifications }), + }, + { path: "hosts", lazy: async () => ({ Component: (await import("../features/hosts/Hosts")).Hosts }) }, + { path: "hosts/new", lazy: async () => ({ Component: (await import("../features/hosts/HostDetail")).NewHost }) }, + { path: "hosts/:name", lazy: async () => ({ Component: (await import("../features/hosts/HostDetail")).HostDetail }) }, + ], + }, + { path: "*", element: }, +]); diff --git a/web/src/components/Button.tsx b/web/src/components/Button.tsx new file mode 100644 index 0000000..8c77724 --- /dev/null +++ b/web/src/components/Button.tsx @@ -0,0 +1,46 @@ +import type { ComponentProps, ReactNode } from "react"; +import { cx } from "../lib/platform"; +import { buttonClass, type ButtonSize, type ButtonVariant } from "./styles"; +import { Spinner } from "./Spinner"; + +type ButtonProps = ComponentProps<"button"> & { + variant?: ButtonVariant; + size?: ButtonSize; + /** A request is running: a spinner replaces the label (or the icon, with `keepLabel`), keeping the width. */ + pending?: boolean; + keepLabel?: boolean; + icon?: ReactNode; +}; + +/** Buttons of §3.1. One primary per screen or sheet. */ +export function Button({ + variant = "secondary", + size = "default", + pending = false, + keepLabel = false, + icon, + className, + children, + type = "button", + disabled, + ...props +}: ButtonProps) { + const hideLabel = pending && !keepLabel; + return ( + + ); +} diff --git a/web/src/components/Dialog.tsx b/web/src/components/Dialog.tsx new file mode 100644 index 0000000..1916840 --- /dev/null +++ b/web/src/components/Dialog.tsx @@ -0,0 +1,75 @@ +import { type ReactNode, useId } from "react"; +import { cx } from "../lib/platform"; +import { Button } from "./Button"; +import { InlineError } from "./InlineError"; +import type { ButtonVariant } from "./styles"; + +const showModal = (dialog: HTMLDialogElement | null) => { + if (dialog && !dialog.open) dialog.showModal(); +}; + +interface DialogProps { + title: string; + children?: ReactNode; + onClose: () => void; + className?: string; +} + +/** A centred dialog on the native ``: focus trap, Esc and the top layer come free. */ +export function Dialog({ title, children, onClose, className }: DialogProps) { + const titleId = useId(); + return ( + { + event.preventDefault(); + onClose(); + }} + onClick={(event) => { + if (event.target === event.currentTarget) onClose(); + }} + className={cx( + "m-auto w-[calc(100%-2rem)] max-w-[22rem] animate-[dialog-in_var(--dur-base)_var(--ease-out)_both] rounded-xl border border-border bg-popover p-0 text-foreground shadow-dialog", + "backdrop:bg-(--scrim-dialog)", + className, + )} + > +
+

+ {title} +

+ {children} +
+
+ ); +} + +interface ConfirmProps { + title: string; + body?: ReactNode; + confirmLabel: string; + confirmVariant?: Extract; + pending?: boolean; + error?: string | null; + onConfirm: () => void; + onCancel: () => void; +} + +/** "Sign out of pi?" with Cancel and the action. */ +export function Confirm({ title, body, confirmLabel, confirmVariant = "destructive", pending, error, onConfirm, onCancel }: ConfirmProps) { + return ( + + {body &&

{body}

} + {error && {error}} +
+ + +
+
+ ); +} diff --git a/web/src/components/EmptyState.tsx b/web/src/components/EmptyState.tsx new file mode 100644 index 0000000..671a234 --- /dev/null +++ b/web/src/components/EmptyState.tsx @@ -0,0 +1,31 @@ +import type { ReactNode } from "react"; +import { cx } from "../lib/platform"; + +interface EmptyStateProps { + /** A Lucide glyph; it is drawn at 40px in `--muted-foreground`. */ + icon: ReactNode; + title: string; + body?: ReactNode; + /** The action (or a command block), 16px under the text. */ + children?: ReactNode; + /** `h1` when the state is the whole page, without a header of its own. */ + heading?: "h1" | "h2"; + className?: string; +} + +/** + * The one template for empty and error screens (§3.13): glyph, heading, muted body, action. + * Callers place it (centred in the page, or 18vh down a screen with a header). + */ +export function EmptyState({ icon, title, body, children, heading: Heading = "h2", className }: EmptyStateProps) { + return ( +
+ + {icon} + + {title} + {body &&

{body}

} + {children &&
{children}
} +
+ ); +} diff --git a/web/src/components/Field.tsx b/web/src/components/Field.tsx new file mode 100644 index 0000000..19da399 --- /dev/null +++ b/web/src/components/Field.tsx @@ -0,0 +1,73 @@ +import { Eye, EyeOff } from "lucide-react"; +import { type ComponentProps, type ReactNode, useId, useState } from "react"; +import { cx } from "../lib/platform"; +import { InlineError } from "./InlineError"; +import { inputClass } from "./styles"; + +type FieldProps = ComponentProps<"input"> & { + label: string; + helper?: ReactNode; + error?: ReactNode; + /** Hostnames and paths: mono, still 16px so iOS never zooms. */ + mono?: boolean; + trailing?: ReactNode; +}; + +/** A labelled input (§3.2): label above, helper or error below, linked by aria-describedby. */ +export function Field({ label, helper, error, mono = false, trailing, className, id, ...props }: FieldProps) { + const fallbackId = useId(); + const inputId = id ?? fallbackId; + const noteId = `${inputId}-note`; + const note = error ?? helper; + return ( +
+ +
+ + {trailing &&
{trailing}
} +
+ {error ? ( + {error} + ) : ( + helper && ( +

+ {helper} +

+ ) + )} +
+ ); +} + +/** A password field with the 44px eye toggle inside it. */ +export function PasswordField(props: Omit) { + const [visible, setVisible] = useState(false); + return ( + setVisible((v) => !v)} + > + {visible ? : } + + } + /> + ); +} diff --git a/web/src/components/InlineError.tsx b/web/src/components/InlineError.tsx new file mode 100644 index 0000000..d9689a6 --- /dev/null +++ b/web/src/components/InlineError.tsx @@ -0,0 +1,21 @@ +import { CircleAlert } from "lucide-react"; +import type { ReactNode } from "react"; +import { cx } from "../lib/platform"; + +interface InlineErrorProps { + children: ReactNode; + id?: string; + /** Announced as it appears: for errors that answer a tap rather than sit under a field. */ + alert?: boolean; + className?: string; +} + +/** An inline error (§3.2): a footnote in `--destructive` after a 14px `circle-alert`. */ +export function InlineError({ children, id, alert = false, className }: InlineErrorProps) { + return ( +

+ + {children} +

+ ); +} diff --git a/web/src/components/List.tsx b/web/src/components/List.tsx new file mode 100644 index 0000000..af05c30 --- /dev/null +++ b/web/src/components/List.tsx @@ -0,0 +1,159 @@ +import { ChevronRight } from "lucide-react"; +import { type ComponentProps, type ReactNode, useId } from "react"; +import { Link } from "react-router"; +import { cx } from "../lib/platform"; + +/** A section header: sentence case, footnote 500, muted, with an optional count. */ +export function SectionHeader({ children, count, id }: { children: ReactNode; count?: number; id?: string }) { + return ( +

+ {children} + {count !== undefined && {count}} +

+ ); +} + +/** Explanations live under groups, not in rows. */ +export function Footnote({ children, className, id }: { children: ReactNode; className?: string; id?: string }) { + return ( +

+ {children} +

+ ); +} + +type FieldRowProps = Omit, "className"> & { + label: string; + /** Hosts, ports and paths: mono, still 16px so iOS never zooms. */ + mono?: boolean; +}; + +/** + * An editable single-line row (§3.4): the label on the left and the value as a right-aligned + * input, as a read-only row shows it. The row tints while its field has focus. Helpers and + * errors go under the group, linked with `aria-describedby`. + */ +export function FieldRow({ label, mono = false, ...input }: FieldRowProps) { + const id = useId(); + return ( +
+ + +
+ ); +} + +/** A list group (§3.4): card, hairline, 14px radius, inset 16px; rows separated by inset hairlines. */ +export function Group({ children, className, ...props }: ComponentProps<"div">) { + return ( +
*+*]:relative [&>*+*]:before:absolute [&>*+*]:before:top-0 [&>*+*]:before:right-0 [&>*+*]:before:left-(--row-inset,1rem) [&>*+*]:before:h-px [&>*+*]:before:bg-border", + className, + )} + {...props} + > + {children} +
+ ); +} + +/** A labelled block of the settings screens: header, group, footnote; groups are 24px apart. */ +export function Section({ title, footnote, children, className }: { title?: ReactNode; footnote?: ReactNode; children: ReactNode; className?: string }) { + return ( +
+ {title && {title}} + {children} + {footnote && {footnote}} +
+ ); +} + +interface RowContent { + /** A 20px glyph for action rows (Add port forward). */ + icon?: ReactNode; + /** The 32px agent tile that leads the rows of things (sessions, hosts). */ + tile?: ReactNode; + label: ReactNode; + subtitle?: ReactNode; + /** Mono subtitle for hosts and paths. */ + monoSubtitle?: boolean; + value?: ReactNode; + /** Detail rows end in a chevron; action rows don't. */ + chevron?: boolean; + trailing?: ReactNode; + tone?: "default" | "destructive"; +} + +const rowClass = (interactive: boolean, twoLine: boolean) => + cx( + "flex w-full items-center gap-3 px-4 text-left", + twoLine ? "min-h-15 py-2.5" : "min-h-12 py-2", + interactive && "transition-colors duration-(--dur-press) pressed:bg-accent hover:bg-accent", + ); + +function RowBody({ icon, tile, label, subtitle, monoSubtitle, value, chevron, trailing, tone = "default" }: RowContent) { + return ( + <> + {tile} + {icon && {icon}} + + {label} + {subtitle && ( + {subtitle} + )} + + {value !== undefined && {value}} + {trailing} + {chevron && } + + ); +} + +/** A row that navigates. */ +export function LinkRow({ to, ...content }: RowContent & { to: string }) { + return ( +
+ + + +
+ ); +} + +/** A row that does something on tap. */ +export function ButtonRow({ onClick, disabled, ...content }: RowContent & { onClick: () => void; disabled?: boolean }) { + return ( +
+ +
+ ); +} + +/** A row that only shows a value, or holds a control (a whole-row `