diff options
author | Tad Fisher <tadfisher@gmail.com> | 2022-02-12 19:15:05 -0800 |
---|---|---|
committer | Tad Fisher <129148+tadfisher@users.noreply.github.com> | 2022-02-12 19:20:15 -0800 |
commit | 3ba564ca9f2c5d894a9ef7ef6b827d95e21d2104 (patch) | |
tree | 94c81fac802f67569bf52cd4661766294a02cec6 /test/code.t | |
parent | 1b30683e9574965ff3bbff12f69e8eede9c99540 (diff) |
Handle otpauth:// URIs with port numbers
Diffstat (limited to 'test/code.t')
-rwxr-xr-x | test/code.t | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/code.t b/test/code.t index 19b4754..1752d77 100755 --- a/test/code.t +++ b/test/code.t @@ -65,4 +65,24 @@ EOF [[ $("$PASS" show passfile) == "$expected" ]] ' +test_expect_success 'Generates TOTP code for URI with port number' ' + uri="otpauth://totp/Example:alice@domain.com:443?secret=JBSWY3DPEHPK3PXP&issuer=Example" + + test_pass_init && + "$PASS" otp insert passfile <<< "$uri" && + code=$("$PASS" otp passfile) && + [[ ${#code} -eq 6 ]] +' + +test_expect_success 'Generates HOTP code for URI with port number' ' + uri="otpauth://hotp/Example:alice@google.com:443?secret=JBSWY3DPEHPK3PXP&counter=10&issuer=Example" + inc="otpauth://hotp/Example:alice@google.com:443?secret=JBSWY3DPEHPK3PXP&counter=11&issuer=Example" + + test_pass_init && + "$PASS" otp insert passfile <<< "$uri" && + code=$("$PASS" otp passfile) && + [[ ${#code} -eq 6 ]] && + [[ $("$PASS" otp uri passfile) == "$inc" ]] +' + test_done |