knockknock

An offline desktop API client for REST, GraphQL and WebSocket. No account, no cloud, no telemetry. Collections are folders of YAML files that live in your git repository. **Documentation:** https://docs.joshicodes.de/b/knock/introduction · **Downloads:** [Releases](https://github.com/JoshiCodes/knock/releases) ## What makes it different - **JSON bodies without typing brackets.** Every JSON body has a form view (keys, types, values, drag to reorder) and a code view on the same text. Switching is lossless: key order, `{{variables}}` as raw values and numbers larger than 2^53 survive. Attach a JSON Schema and the form suggests fields, marks required ones and validates while you type. - **OAuth that shows its work.** Enter the issuer, knock runs discovery. The redirect URI sits at the top with a copy button. Log in once; knock refreshes tokens, retries once after a 401 and attaches them. When something fails, the auth debugger marks the step, shows the raw exchange, offers it as cURL and explains the provider's error in plain words. ## Features - HTTP/1.1 and HTTP/2, every method, query and path parameters synced with the URL, all body types, timeouts, redirect chain, TLS options, proxies, extra CA bundles, client certificates (PEM, PKCS#12), cookie jar per collection - Auth: Basic, Bearer, API key, Digest, JWT, AWS SigV4, OAuth 1.0a, OAuth 2.0 (authorization code + PKCE, client credentials, device code, password), OpenID Connect with ID token validation against the JWKS - Variables in every field with scopes runtime → request → folder → environment → collection → global, hover for value and origin, dynamic values (`{{$uuid}}`, `{{$timestamp}}`, …), extract rules for chaining - Secrets in the system keyring (Secret Service / KWallet) or a gitignored `*.secrets.yaml`, masked in history and exports - Response viewer with JSON tree, search and JSONPath filter, previews for HTML, images and PDF, diff against the previous response, timeline, bodies up to 50 MB without freezing - GraphQL with schema introspection, autocomplete and an explorer; WebSocket with composer, saved messages and a live log - Assertions, a runner for folders and collections, JUnit and JSON reports - Import from Postman, Bruno, Insomnia, OpenAPI and cURL; code snippets for cURL, fetch, Python, HTTPie, Go and PowerShell ## Collection format ``` my-api/ knock.yaml # name, collection auth, headers, variables environments/ local.yaml prod.yaml prod.secrets.yaml # gitignored users/ folder.yaml # folder auth, headers, variables, order create-user.yaml ``` ```yaml name: Create user type: http method: POST url: "{{baseUrl}}/users" auth: inherit body: type: json content: | { "name": "{{userName}}", "roles": ["admin"] } extract: - { var: userId, from: json, path: $.id } assert: - { on: status, equals: 201 } ``` Unknown fields are kept when knock saves a file, and changes from git or an editor are picked up live. ## Command line ```sh knock send users/create-user.yaml --env local knock run . --env staging --reporter junit --output report.xml knock auth login users --env prod # browser login, token shared with the app knock auth debug users --env prod --verbose ``` `knock run` exits with 1 when an assertion fails. In CI, secrets come from `KNOCK_SECRET_` environment variables (set `KNOCK_NO_KEYRING=1` where no keyring exists). ## Install - **Arch Linux / CachyOS:** `packaging/arch/knock-bin` (release package), `packaging/arch/knock` (from source) or `packaging/arch/knock-git` (latest `main`); `makepkg -si` in the folder - **Ubuntu 22.04+ / Debian:** the `.deb` from the [latest release](https://github.com/JoshiCodes/knock/releases/latest) - **Fedora and others:** the `.rpm` or the AppImage - **macOS:** the universal `.dmg` (not notarized: open it once with right click → Open) - **Windows:** the `.msi` or setup `.exe` (best effort) If the window stays blank on Wayland, WebKitGTK's DMA-BUF renderer is the usual cause; knock turns it off by default. Set `KNOCK_DMABUF=1` to turn it back on. ## Development Requirements: Rust (stable), Node.js 20+, and on Linux `webkit2gtk-4.1`, `gtk3`, `libsecret`. ```sh npm ci npm run tauri dev # run the app cargo test -p knock-core # tests npx svelte-check # frontend types npm run dev # frontend only; open http://localhost:1420/?mock for a fake backend ``` `.github/workflows/ci.yml` checks every push and pull request. ## Releasing ```sh scripts/release.sh 0.2.0 ``` The script sets the version in Cargo, npm, Tauri and the PKGBUILDs, commits, tags `v0.2.0` and pushes. The tag starts `.github/workflows/release.yml`, which builds Linux (deb, rpm, AppImage), macOS (universal dmg) and Windows (msi, exe) plus the CLI for each, and publishes a GitHub release with generated notes and `SHA256SUMS`. A version with a suffix (`0.2.0-rc1`) becomes a pre-release. To try the builds without releasing: `gh workflow run release.yml -f platforms=linux` (or `macos`, `windows`, `all`). ## License MIT