Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonathan White <support@dmapps.us>2019-10-14 16:25:45 +0300
committerJonathan White <support@dmapps.us>2019-10-21 00:57:51 +0300
commit99a2d66086456ae0953db1e923fe82e55dfd93c7 (patch)
tree7788219c9299d784a11db5ce111e028874615036 /tests
parent71085838db9122a7dcdd08752c2fa28f2fcb8cd5 (diff)
Correct issues with TOTP Setup
* Fix #3142 - Warn user when entering invalid TOTP secret key. * Fix #773 - The TOTP dialog now listens for the copy shortcut without having to press the Copy button. * Add ability to choose hash algorithm from the TOTP setup dialog * Add upgrade to "otp" attribute when custom attributes are chosen to prevent data loss Ran make format
Diffstat (limited to 'tests')
-rw-r--r--tests/TestTotp.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/TestTotp.cpp b/tests/TestTotp.cpp
index c44cd4e8c..5eb9f6e53 100644
--- a/tests/TestTotp.cpp
+++ b/tests/TestTotp.cpp
@@ -39,9 +39,10 @@ void TestTotp::testParseSecret()
QVERIFY(!settings.isNull());
QCOMPARE(settings->key, QString("HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ"));
QCOMPARE(settings->custom, false);
+ QCOMPARE(settings->format, Totp::StorageFormat::OTPURL);
QCOMPARE(settings->digits, 6u);
QCOMPARE(settings->step, 30u);
- QCOMPARE(settings->hashType, Totp::HashType::Sha1);
+ QCOMPARE(settings->algorithm, Totp::Algorithm::Sha1);
// OTP URL with non-default hash type
secret = "otpauth://totp/"
@@ -50,10 +51,11 @@ void TestTotp::testParseSecret()
settings = Totp::parseSettings(secret);
QVERIFY(!settings.isNull());
QCOMPARE(settings->key, QString("HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ"));
- QCOMPARE(settings->custom, false);
+ QCOMPARE(settings->custom, true);
+ QCOMPARE(settings->format, Totp::StorageFormat::OTPURL);
QCOMPARE(settings->digits, 6u);
QCOMPARE(settings->step, 30u);
- QCOMPARE(settings->hashType, Totp::HashType::Sha512);
+ QCOMPARE(settings->algorithm, Totp::Algorithm::Sha512);
// KeeOTP Parsing
secret = "key=HXDMVJECJJWSRBY%3d&step=25&size=8&otpHashMode=Sha256";
@@ -61,9 +63,10 @@ void TestTotp::testParseSecret()
QVERIFY(!settings.isNull());
QCOMPARE(settings->key, QString("HXDMVJECJJWSRBY="));
QCOMPARE(settings->custom, true);
+ QCOMPARE(settings->format, Totp::StorageFormat::KEEOTP);
QCOMPARE(settings->digits, 8u);
QCOMPARE(settings->step, 25u);
- QCOMPARE(settings->hashType, Totp::HashType::Sha256);
+ QCOMPARE(settings->algorithm, Totp::Algorithm::Sha256);
// Semi-colon delineated "TOTP Settings"
secret = "gezdgnbvgy3tqojqgezdgnbvgy3tqojq";
@@ -71,9 +74,10 @@ void TestTotp::testParseSecret()
QVERIFY(!settings.isNull());
QCOMPARE(settings->key, QString("gezdgnbvgy3tqojqgezdgnbvgy3tqojq"));
QCOMPARE(settings->custom, true);
+ QCOMPARE(settings->format, Totp::StorageFormat::LEGACY);
QCOMPARE(settings->digits, 8u);
QCOMPARE(settings->step, 30u);
- QCOMPARE(settings->hashType, Totp::HashType::Sha1);
+ QCOMPARE(settings->algorithm, Totp::Algorithm::Sha1);
// Bare secret (no "TOTP Settings" attribute)
secret = "gezdgnbvgy3tqojqgezdgnbvgy3tqojq";
@@ -81,9 +85,10 @@ void TestTotp::testParseSecret()
QVERIFY(!settings.isNull());
QCOMPARE(settings->key, QString("gezdgnbvgy3tqojqgezdgnbvgy3tqojq"));
QCOMPARE(settings->custom, false);
+ QCOMPARE(settings->format, Totp::StorageFormat::LEGACY);
QCOMPARE(settings->digits, 6u);
QCOMPARE(settings->step, 30u);
- QCOMPARE(settings->hashType, Totp::HashType::Sha1);
+ QCOMPARE(settings->algorithm, Totp::Algorithm::Sha1);
}
void TestTotp::testTotpCode()
@@ -119,6 +124,7 @@ void TestTotp::testSteamTotp()
QCOMPARE(settings->key, QString("63BEDWCQZKTQWPESARIERL5DTTQFCJTK"));
QCOMPARE(settings->encoder.shortName, Totp::STEAM_SHORTNAME);
+ QCOMPARE(settings->format, Totp::StorageFormat::OTPURL);
QCOMPARE(settings->digits, Totp::STEAM_DIGITS);
QCOMPARE(settings->step, 30u);