Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
deepu105 committed Jan 10, 2024
1 parent 786e392 commit c29d65d
Show file tree
Hide file tree
Showing 24 changed files with 64 additions and 222 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ features = ["user-hooks"]
[[bin]]
bench = false
path = "src/main.rs"
name = "jwt-ui"
name = "jwtui"

[profile.release]
lto = true
Expand Down
43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@

[![Follow Deepu K Sasidharan (deepu105)](https://img.shields.io/twitter/follow/deepu105?label=Follow%20Deepu%20K%20Sasidharan%20%28deepu105%29&style=social)](https://twitter.com/intent/follow?screen_name=deepu105)

<!--![logo](artwork/logo.png)-->

A terminal UI for decoding/encoding JSON Web Tokens inspired by [JWT.io](https://jwt.io/) and [jwt-cli](https://github.com/mike-engel/jwt-cli)

<!-- ![UI](screenshots/ui.gif) -->
![UI](screenshots/decoder.png)

Crafted by

<img src="artwork/Auth0byOkta_logo.svg" alt="Auth0 by Okta" style="width:120px;"/>

## Installation

<!-- ### Homebrew (Mac & Linux)
### Homebrew (Mac & Linux)

```bash
brew tap jwt-rs/jwt-ui
Expand Down Expand Up @@ -59,14 +61,14 @@ Binaries for macOS, Linux and Windows are available on the [releases](https://gi
1. Download the latest [binary](https://github.com/jwt-rs/jwt-ui/releases) for your OS.
1. For Linux/macOS:
1. `cd` to the file you just downloaded and run `tar -C /usr/local/bin -xzf downloaded-file-name`. Use sudo if required.
2. Run with `jwt-ui`
2. Run with `jwtui`
1. For Windows:
1. Use 7-Zip or TarTool to unpack the tar file.
2. Run the executable file `jwt-ui.exe`
-->
2. Run the executable file `jwtui.exe`

### Cargo

If you have Cargo installed then you install jwt-ui from crates.io
If you have Cargo installed then you install JWT UI from crates.io

```bash
cargo install jwt-ui
Expand All @@ -81,46 +83,47 @@ You can also clone the repo and run `cargo run` or `make` to build and run the a
## USAGE:

```bash
jwt-ui
jwtui

#or

jwt-ui [OPTIONS] [TOKEN]
jwtui [OPTIONS] [TOKEN]
```

Press `?` while running the app to see keybindings

Arguments:
[TOKEN] JWT token to decode [mandatory for stdout mode, optional for TUI mode]
[TOKEN] JWT token to decode [mandatory for stdout mode, optional for TUI mode]

Options:
`-s, --stdout` whether the CLI should run in TUI mode or just print to stdout
`-j, --json` whether stdout should be formatted as JSON
`-t, --tick-rate <TICK_RATE>` Set the tick rate (milliseconds): the lower the number the higher the FPS. Must be less than 1000 [default: 250]
`-S, --secret <SECRET>` secret for validating the JWT [default: ]
`-h, --help` Print help
`-V, --version` Print version
`-s, --stdout` whether the CLI should run in TUI mode or just print to stdout
`-j, --json` whether stdout should be formatted as JSON
`-t, --tick-rate <TICK_RATE>` Set the tick rate (milliseconds): the lower the number the higher the FPS. Must be less than 1000 [default: 250]
`-S, --secret <SECRET>` secret for validating the JWT [default: ]
`-h, --help` Print help
`-V, --version` Print version

## Limitations/Known issues

## Features

- Fully offline
- Dark/Light themes
- Sensible keyboard shortcuts

## Screenshots

### Decoder screen

<!--![UI](screenshots/overview.png)-->
![UI](screenshots/decoder.png)

### Encoder screen

<!--![UI](screenshots/overview.png)-->
![UI](screenshots/encoder.png)

### Stdout

<!--![UI](screenshots/overview.png)-->
![UI](screenshots/stdout.png)

## Libraries used

Expand Down
Binary file added artwork/Auth0byOkta_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions artwork/Auth0byOkta_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed artwork/icon-2x.png
Binary file not shown.
Binary file removed artwork/icon.jpg
Binary file not shown.
Binary file removed artwork/icon.png
Binary file not shown.
Binary file removed artwork/logo-2x.png
Binary file not shown.
112 changes: 0 additions & 112 deletions artwork/logo-icon.svg

This file was deleted.

Binary file removed artwork/logo.jpg
Binary file not shown.
Binary file removed artwork/logo.png
Binary file not shown.
84 changes: 0 additions & 84 deletions artwork/logo.svg

This file was deleted.

Binary file removed screenshots/contexts.png
Binary file not shown.
Binary file added screenshots/decoder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/describe.png
Binary file not shown.
Binary file added screenshots/encoder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/logs.png
Binary file not shown.
Binary file removed screenshots/overview.png
Binary file not shown.
Binary file added screenshots/stdout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshots/ui.gif
Binary file not shown.
Binary file removed screenshots/utilization.png
Binary file not shown.
9 changes: 7 additions & 2 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl App {
pub fn refresh(&mut self) {
self.data.error = String::new();
self.data = Data::default();
self.route_home();
self.route_decoder();
}

pub fn handle_error(&mut self, e: JWTError) {
Expand Down Expand Up @@ -202,11 +202,16 @@ impl App {
self.push_navigation_route(route);
}

pub fn route_home(&mut self) {
pub fn route_decoder(&mut self) {
let route = self.main_tabs.set_index(0).route.clone();
self.push_navigation_route(route);
}

pub fn route_encoder(&mut self) {
let route = self.main_tabs.set_index(1).route.clone();
self.push_navigation_route(route);
}

pub fn on_tick(&mut self) {
match self.get_current_route().id {
RouteId::Decoder => decode_jwt_token(self),
Expand Down
14 changes: 12 additions & 2 deletions src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ pub fn handle_key_events(key: Key, key_event: KeyEvent, app: &mut App) {
{
app.push_navigation_stack(RouteId::Help, ActiveBlock::Help);
}
_ if key == DEFAULT_KEYBINDING.jump_to_decoder.key
&& app.get_current_route().id != RouteId::Decoder =>
{
app.route_decoder();
}
_ if key == DEFAULT_KEYBINDING.jump_to_encoder.key
&& app.get_current_route().id != RouteId::Encoder =>
{
app.route_encoder();
}
_ if key == DEFAULT_KEYBINDING.cycle_main_views.key => app.cycle_main_routes(),

_ if key == DEFAULT_KEYBINDING.toggle_input_edit.key => handle_edit_event(app),
Expand Down Expand Up @@ -270,7 +280,7 @@ mod tests {
fn test_handle_key_events_for_editor() {
let mut app = App::default();

app.route_home();
app.route_decoder();
assert_eq!(app.data.decoder.encoded.input_mode, InputMode::Normal);

let key_evt = KeyEvent::from(KeyCode::Char('e'));
Expand All @@ -293,7 +303,7 @@ mod tests {

app.data.decoder.encoded.input_mode = InputMode::Editing;

app.route_home();
app.route_decoder();
assert_eq!(app.data.decoder.encoded.input_mode, InputMode::Editing);

let key_evt = KeyEvent::from(KeyCode::Char('e'));
Expand Down
Loading

0 comments on commit c29d65d

Please sign in to comment.