Skip to content

Commit 659c47e

Browse files
committed
UI updates
1 parent 11904f2 commit 659c47e

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/app/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ mod tests {
234234
fn test_slurp_file_nonexistent() {
235235
let file_name = "nonexistent.txt";
236236

237-
slurp_file(file_name).unwrap();
237+
slurp_file(file_name.to_string()).unwrap();
238238
}
239239

240240
#[test]

src/ui/decoder.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn draw_secret_block(f: &mut Frame<'_>, app: &mut App, area: Rect) {
5959
app.update_block_map(get_route(ActiveBlock::DecoderSecret), area);
6060

6161
let block = get_selectable_block(
62-
"Verify Signature",
62+
check_verification_status(app.data.decoder.signature_verified),
6363
*app.data.decoder.blocks.get_active_block() == ActiveBlock::DecoderSecret,
6464
Some(&app.data.decoder.secret.input_mode),
6565
app.light_theme,
@@ -81,6 +81,14 @@ fn draw_secret_block(f: &mut Frame<'_>, app: &mut App, area: Rect) {
8181
render_input_widget(f, chunks[1], &app.data.decoder.secret, app.light_theme);
8282
}
8383

84+
fn check_verification_status(signature_verified: bool) -> &'static str {
85+
if signature_verified {
86+
"Signature: ✅ Valid"
87+
} else {
88+
"Signature: ❌ Invalid"
89+
}
90+
}
91+
8492
fn draw_header_block(f: &mut Frame<'_>, app: &mut App, area: Rect) {
8593
app.update_block_map(get_route(ActiveBlock::DecoderHeader), area);
8694

@@ -183,7 +191,7 @@ mod tests {
183191
r#"││ │││ "name": "John Doe", │"#,
184192
r#"│└──────────────────────────────────────────────┘││ "sub": "1234567890" │"#,
185193
r#"└────────────────────────────────────────────────┘│} │"#,
186-
r#"┌ Verify Signature ──────────────────────────────┐│ │"#,
194+
r#"┌ Signature: ✅ Valid ───────────────────────────┐│ │"#,
187195
r#"│Prepend 'b64:' for base64 encoded secret. Prepen││ │"#,
188196
r#"│┌──────────────────────────────────────────────┐││ │"#,
189197
r#"││secret │││ │"#,
@@ -202,7 +210,7 @@ mod tests {
202210
.add_modifier(Modifier::BOLD),
203211
);
204212
}
205-
(51..=82, 0) | (51..=67, 8) | (1..=18, 14) => {
213+
(51..=82, 0) | (51..=67, 8) | (1..=21, 14) => {
206214
expected.get_mut(col, row).set_style(
207215
Style::default()
208216
.fg(COLOR_WHITE)

src/ui/encoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fn draw_secret_block(f: &mut Frame<'_>, app: &mut App, area: Rect) {
7373
app.update_block_map(get_route(ActiveBlock::EncoderSecret), area);
7474

7575
let block = get_selectable_block(
76-
"Verify Signature",
76+
"Signing Secret",
7777
*app.data.encoder.blocks.get_active_block() == ActiveBlock::EncoderSecret,
7878
Some(&app.data.encoder.secret.input_mode),
7979
app.light_theme,
@@ -188,7 +188,7 @@ mod tests {
188188
.unwrap();
189189

190190
let mut expected = Buffer::with_lines(vec![
191-
r#"┌ Header: Algorithm & Token Type (<enter> edit | ┐┌ Verify Signature ──────────────────────────────┐"#,
191+
r#"┌ Header: Algorithm & Token Type (<enter> edit | ┐┌ Signing Secret ────────────────────────────────┐"#,
192192
r#"│┌──────────────────────────────────────────────┐││Prepend 'b64:' for base64 encoded secret. Prepen│"#,
193193
r#"││{ │││┌──────────────────────────────────────────────┐│"#,
194194
r#"││ "alg": "HS256", ││││secret ││"#,
@@ -228,7 +228,7 @@ mod tests {
228228
.add_modifier(Modifier::BOLD),
229229
);
230230
}
231-
(51..=68, 0) | (51..=65, 6) | (1..=17, 8) => {
231+
(51..=66, 0) | (51..=65, 6) | (1..=17, 8) => {
232232
expected.get_mut(col, row).set_style(
233233
Style::default()
234234
.fg(COLOR_WHITE)

0 commit comments

Comments
 (0)