Implement OTP clipboard and QR TUI

This commit is contained in:
Hermes Agent committed 2026-08-10 11:11:53 +00:00
1 parent 1850846696
commit 71bbff934e
8 files changed
+1021 -28

No files matched your search

+112
View File
@@ -52,6 +52,14 @@ pub enum Action {
CopyEntry,
GitPull,
GitPush,
OtpCode,
OtpCopyCode,
OtpUri,
OtpCopyUri,
OtpQr,
OtpInsert,
OtpAppend,
OtpValidate,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
@@ -567,6 +575,110 @@ pub static ACTIONS: &[ActionSpec] = &[
)),
modes: BROWSER_LIKE,
},
ActionSpec {
action: Action::OtpCode,
label: "generate OTP code",
command: "otp-code",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('c'),
KeyModifiers::NONE,
"o c"
)),
modes: &[Mode::Viewer],
},
ActionSpec {
action: Action::OtpCopyCode,
label: "copy OTP code",
command: "otp-copy-code",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('y'),
KeyModifiers::NONE,
"o y"
)),
modes: &[Mode::Viewer],
},
ActionSpec {
action: Action::OtpUri,
label: "show OTP URI",
command: "otp-uri",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('u'),
KeyModifiers::NONE,
"o u"
)),
modes: &[Mode::Viewer],
},
ActionSpec {
action: Action::OtpCopyUri,
label: "copy OTP URI",
command: "otp-copy-uri",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('x'),
KeyModifiers::NONE,
"o x"
)),
modes: &[Mode::Viewer],
},
ActionSpec {
action: Action::OtpQr,
label: "show OTP QR",
command: "otp-qr",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('q'),
KeyModifiers::NONE,
"o q"
)),
modes: &[Mode::Viewer],
},
ActionSpec {
action: Action::OtpInsert,
label: "insert OTP URI",
command: "otp-insert",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('i'),
KeyModifiers::NONE,
"o i"
)),
modes: &[Mode::Browser],
},
ActionSpec {
action: Action::OtpAppend,
label: "append OTP URI",
command: "otp-append",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('a'),
KeyModifiers::NONE,
"o a"
)),
modes: ENTRY_CONTEXT,
},
ActionSpec {
action: Action::OtpValidate,
label: "validate OTP URI",
command: "otp-validate",
bindings: sequences!((
KeyCode::Char('o'),
KeyModifiers::NONE,
KeyCode::Char('v'),
KeyModifiers::NONE,
"o v"
)),
modes: BROWSER_LIKE,
},
];
pub fn resolve_key(mode: Mode, code: KeyCode, modifiers: KeyModifiers) -> Option<Action> {