This prevents hitotp from crashing when it's given a lowercase secret.
---
cmd/hitotp/main.ha | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmd/hitotp/main.ha b/cmd/hitotp/main.ha
index f3a5198..2a21368 100644
--- a/cmd/hitotp/main.ha
+++ b/cmd/hitotp/main.ha
@@ -1,3 +1,4 @@
+use ascii;
use dirs;
use encoding::base32;
use fmt;
@@ -86,7 +87,7 @@ fn do_totp(q: *query::query) (str, uint) = {
case "label" =>
label = pair.value;
case "secret" =>
- key = base32::decodestr(&base32::std_encoding, pair.value)!;
+ key = base32::decodestr(&base32::std_encoding, ascii::strupper(pair.value))!;
case =>
void;
};
@@ -162,7 +163,7 @@ export fn main() void = {
if (len(label) != 0) {
fmt::printf("{}: ", label)!;
};
- fmt::printfln("{:06}", code)!;
+ fmt::printfln("{:6}", code)!;
};
};
};
--
2.43.0