mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:19:41 +01:00
- A folder can share its parent's cookie jar, keep its own, or use no cookies; sub folders follow. The Cookies tab shows the jar a request used. Jars are stored per collection and folder. - The release workflow builds knock-bin from the deb and uploads it to the Gitea pacman repository (needs the GITEA_PACKAGES_TOKEN secret) - knock-bin installs the desktop entry as knock-app.desktop - README: install for Arch (signed pacman repo), Ubuntu/Debian, Fedora/openSUSE, AppImage, macOS (quarantine) and Windows (SmartScreen) - release.sh works when the version is already set
149 lines
6.6 KiB
Markdown
149 lines
6.6 KiB
Markdown
<p><img src="logo/knock-wordmark-on-light.svg#gh-light-mode-only" alt="knock" height="48"><img src="logo/knock-wordmark-on-dark.svg#gh-dark-mode-only" alt="knock" height="48"></p>
|
|
|
|
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_<NAME>` environment variables (set `KNOCK_NO_KEYRING=1` where no keyring exists).
|
|
|
|
## Install
|
|
|
|
Downloads are on the [releases page](https://github.com/JoshiCodes/knock/releases/latest). Every package contains the app (`knock-app`) and the command line tool (`knock`).
|
|
|
|
### Arch Linux, CachyOS, Manjaro
|
|
|
|
From the pacman repository (signed). Once:
|
|
|
|
```sh
|
|
curl -fsSL https://git.joshicodes.de/api/packages/JoshiCodes/arch/repository.key | sudo pacman-key --add - && sudo pacman-key --lsign-key B500A6315A9D97708BF6241F10CECFC71020FEB1
|
|
printf '\n[joshicodes]\nServer = https://git.joshicodes.de/api/packages/JoshiCodes/arch/$repo/$arch\n' | sudo tee -a /etc/pacman.conf >/dev/null && sudo pacman -Sy knock-bin
|
|
```
|
|
|
|
Updates then come with `sudo pacman -Syu`. Building yourself: `makepkg -si` in `packaging/arch/knock` (release from source) or `packaging/arch/knock-git` (latest `main`).
|
|
|
|
### Ubuntu 22.04+, Debian, Linux Mint, Pop!_OS
|
|
|
|
Download `knock_<version>_amd64.deb` from the release and install it:
|
|
|
|
```sh
|
|
sudo apt install ./knock_*_amd64.deb
|
|
```
|
|
|
|
### Fedora, openSUSE
|
|
|
|
```sh
|
|
sudo dnf install ./knock-*.x86_64.rpm # openSUSE: sudo zypper install ./knock-*.x86_64.rpm
|
|
```
|
|
|
|
### Any other Linux
|
|
|
|
The AppImage runs without installing:
|
|
|
|
```sh
|
|
chmod +x knock_*_amd64.AppImage && ./knock_*_amd64.AppImage
|
|
```
|
|
|
|
It needs `libsecret` (or another Secret Service) for secrets. If the window stays blank on Wayland, start it with `WEBKIT_DISABLE_DMABUF_RENDERER=1` (the packages set this already).
|
|
|
|
### macOS
|
|
|
|
Open the universal `knock_<version>_universal.dmg` (Apple Silicon and Intel) and drag knock to Applications. The app is not notarized by Apple, so macOS blocks the first start. Allow it once:
|
|
|
|
```sh
|
|
xattr -dr com.apple.quarantine /Applications/knock.app
|
|
```
|
|
|
|
(or System Settings → Privacy & Security → **Open Anyway** after the first attempt). The command line tool is in `knock-cli-macos-universal.tar.gz`: unpack it and move `knock` to a folder on your `PATH`, e.g. `/usr/local/bin`.
|
|
|
|
### Windows (best effort)
|
|
|
|
Run the `.msi` or the setup `.exe`. Windows SmartScreen warns about apps without a code signing certificate: click **More info → Run anyway**. The command line tool is in `knock-cli-windows-x64.zip`.
|
|
|
|
## 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
|