~sircmpwn/himitsu-devel

himitsu-totp: hitotp: convert secret to uppercase before use v1 APPLIED

Cowington Post: 1
 hitotp: convert secret to uppercase before use

 1 files changed, 3 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/himitsu-devel/patches/47404/mbox | git am -3
Learn more about email & git

[PATCH himitsu-totp] hitotp: convert secret to uppercase before use Export this patch

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
Pushed with mentioned fixes. Thanks!