Commit Graph

21 Commits (master)

Author SHA1 Message Date
Johan Ouwerkerk 653e0b4b44 chore: code fixups suggested by static analysis 2021-02-06 18:13:08 +01:00
Johan Ouwerkerk 82ebbdf4f9 hack: bypass password challenge verification
Needed to support automatic migration of old Keysmith storage format.

This is unfortunate, but we have users and we cannot simply break
backwards compatibility with the old storage format (yet).
2021-02-02 18:41:45 +01:00
Bhushan Shah 12375e997a chore: disable the NewDeleteLeaks clang analyzer check
This seems to provide a false positives with the QTimer::singleShot,
this would fix the CI.
2021-01-21 12:29:21 +05:30
Johan Ouwerkerk cbd069085e fix!: guard against incorrect password inputs using an encrypted challenge
Previously entering an incorrect password would appear to successfully "unlock" accounts, contrary to expectations.
By introducing a challenge object as part of the master key parameters, an incorrect password can now be detected and signalled accordingly.

This fix introduces a backwards incompatible change to the accounts data as stored on disk, meaning old Keysmith accounts configuration will no longer load and must be recreated from scratch.
2021-01-20 06:17:48 +00:00
Johan Ouwerkerk c31aa8df52 chore: perform some code cleanups suggested by clazy
These cleanups block the invalid password detection/retry UX feature from landing.

See-Also: https://invent.kde.org/utilities/keysmith/-/merge_requests/71
2020-11-23 21:45:30 +01:00
Johan Ouwerkerk 369593f33d chore: clean up use of string.h includes. 2020-11-22 16:12:08 +01:00
Johan Ouwerkerk f1dbd0c4b7 feat: reduce apparent latency when re-computing tokens by computing the 'next' token in advance.
One downside of offloading the token computation to a worker thread and having to do token decryption is an increase in latency.
For the case with a few accounts this latency does not matter, but in case of many accounts it can induce a significant delay when refreshing tokens in the UI.

To hide this latency, when computing an OTP token for the current state of the account the logical 'next' token is also computed as well and cached in the Account object.
When the next (re)computation of the OTP token is requested, the cached 'next' value is reused if still valid before the next pair of tokens is being computed.
This way the apparent latency of a token update is reduced to an near immediate property update in the UI, hiding the actual latency of the computation itself.

This 'optimisation' is implemented in the dumbest possible fashion that can still work.
This means that the code complexity of the change is quite limited, at the cost of rougly doubling the actual work being performed in the worker thread.
2020-09-16 04:54:15 +00:00
Johan Ouwerkerk 09df98d3a4 refactor: prepare AccountStorage for more complex tokens
With this the AccountStorage module now fully supports some HOTP/TOTP parameters which are uncommon (but still part of HOTP/TOTP specifications).

 - Better types for offset, tokenLength. Make this consistent throughout
 - Finish support for offset, checksum parameters for HOTP tokens in AccountStorage
 - Finish support for hashing algorithm, epoch parameters for TOTP tokens in AccountStorage
 - Better API for creating oath::Algorithm instances
 - Code formatting (break up long lines)

Issues: #7
2020-08-08 09:17:55 +02:00
Johan Ouwerkerk 0d40912360 feat: Add basic support for account 'issuer' in Keysmith.
With this change account storage and model work with accounts for which an issuer is recorded.
This is a prerequisite for fully supporting otpauth:// URIs (necessary for QR code support) in Keysmith.

Issues: #7, #13
See-Also: https://github.com/google/google-authenticator/wiki/Key-Uri-Format
2020-07-23 18:24:13 +02:00
Johan Ouwerkerk b70feaf620 Track loaded/error state of AccountStorage objects
Two bits of boolean state are introduces to track whether or not:

 - an error has occurred
 - accounts have been loaded from storage yet

This change paves the way for having error handling UX.
2020-04-24 18:05:05 +02:00
Johan Ouwerkerk 035348caa5 Implement encryption/decryption of token secrets
With this change token secrets are encrypted prior to writing them to
storage, and decrypted as and when needed to generate tokens. Additional
validation is performed to verify that token secrets can be decrypted
successfully when loading accounts from storage.

With this change issue #6 should finally be resolved.
2020-04-24 18:01:34 +02:00
Johan Ouwerkerk 4d966c3926 Add support for a master key in account storage
With this change an unlock stage is introduced to loading account storage.
Key derivation parameters for a master key are recorded, and the master
password may be supplied to "unlock" the account secret(s) in storage.

This change paves the way for actually decrypting encrypted account
secrets later, and finally solving issue #6.
2020-04-23 18:59:17 +02:00
Johan Ouwerkerk f04b15340f Fix TODO items about logging for C++ code 2020-04-14 19:45:29 +02:00
Johan Ouwerkerk ecf3476faa Fix up outdated token length validation
Keysmith can generate up to 10 digit HOTP/TOTP tokens and with this change
token length validation also permits it.
2020-04-11 21:46:19 +02:00
Johan Ouwerkerk b451bd2556 Fix up licensing for REUSE compliance.
This adds licensing and copyright information where missing and normalises
existing licensing/copyright statements to SPDX metadata tags.
2020-04-10 13:34:31 +02:00
Johan Ouwerkerk 1a1c531dd3 Boyscout: fix a few compiler warnings about unused variables 2020-04-04 11:25:37 +02:00
Johan Ouwerkerk 8b3fd592b7 Fix: always call endGroup()
Make sure to call endGroup() even if the account is rejected before
moving on to examine the next (possible) account.
2020-02-18 19:49:45 +01:00
Yuri Chornoivan 112b4bdf8b Fix minor typos 2020-02-13 20:27:57 +02:00
Johan Ouwerkerk f950526f8b Port HOTP/TOTP algorithms away from oath-toolkit. 2020-02-08 14:46:55 +01:00
Johan Ouwerkerk 26d6d62cbe Validate that an account secret is valid base32. 2020-02-08 14:21:45 +01:00
Johan Ouwerkerk 0d5b792637 Rewrite Account (storage) management as a separate (sub)module within Keysmtih
This provides the ground work to finally fix issue #2
2020-01-28 06:49:06 +00:00