Commit Graph

159 Commits (master)

Author SHA1 Message Date
Johan Ouwerkerk 1a1c531dd3 Boyscout: fix a few compiler warnings about unused variables 2020-04-04 11:25:37 +02:00
Johan Ouwerkerk a23e5473a6 UI updates: prevent "invalid" accounts, better secret UI.
With this change the "Add" button in the "Add account" page is not enabled
until the entered account name and details are valid. Additionally, the UI
for entering the token secret now uses a password field with appropriate
hints for input methods.
2020-04-04 11:24:26 +02:00
Johan Ouwerkerk 768ccdba97 Refactor and update input validation
This change fixes input validation for the following cases:

 - Check that entered account names are still available
 - Working validation for time steps (input mask was completely broken)
 - Allow longer tokens: liboath is no longer used, Keysmith can handle it

Additionally the QML code is refactored significantly:

 - Extracted the main accounts overview page
 - Extracted the add an account page
 - Completed the internal renaming of "Oath" to "Keysmith" for QML types
2020-04-04 11:22:15 +02:00
Johan Ouwerkerk 2a9c80fff5 Add a custom validator that checks if the name is still available. 2020-04-04 10:51:39 +02:00
Johan Ouwerkerk 28454721df Do not fix up input during validation
This change is a workaround for behaviour of QML controls: when fixup is
called during input validation, the `acceptableInput` property is not
updated correctly.
2020-04-04 10:50:52 +02:00
Johan Ouwerkerk 19f457960e Fixup: comment about minimum HOTP token lengths. 2020-02-18 19:53:09 +01: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
Johan Ouwerkerk 6a06a2f5f0 Fixup HMAC key size sanity checking.
Key lengths should be checked against the output size of the hashing
algorithm (instead of block size, which was used previously).
2020-02-17 07:08:09 +00:00
Yuri Chornoivan 112b4bdf8b Fix minor typos 2020-02-13 20:27:57 +02:00
Nicolas Fella ce1b5e8db4 [android] bundle icons 2020-02-12 22:18:26 +01:00
Johan Ouwerkerk 0cc2fbc98e Fixup: signedness in comparison. 2020-02-08 17:10:17 +01:00
Johan Ouwerkerk e5929e7dd5 Fixups for the flatpak build 2020-02-08 16:54:52 +01:00
Johan Ouwerkerk 8bd765e385 Remove the dependency on oath-toolkit.
This resolves issue #9.
2020-02-08 14:46:55 +01:00
Johan Ouwerkerk f950526f8b Port HOTP/TOTP algorithms away from oath-toolkit. 2020-02-08 14:46:55 +01:00
Johan Ouwerkerk 8729b92b8b Provide a custom HOTP/TOTP primitives.
Provides a building block for re-implementing the HOTP/TOTP algorithms
without using oath-toolkit: see issue #9.
2020-02-08 14:46:55 +01:00
Johan Ouwerkerk 2fe3eb8083 Provide a custom HMAC implementation
Provide a building block towards re-implementing the HOTP/TOTP
algorithms without using oath-toolkit: see issue #9.

The hmac::compute function trades simplicity (having to pre-allocate
a scratch buffer) for avoding accidental leaks of key material
(security).

This particular trade-off will help with resolving issue #6.
2020-02-08 14:21:45 +01:00
Johan Ouwerkerk 26d6d62cbe Validate that an account secret is valid base32. 2020-02-08 14:21:45 +01:00
Johan Ouwerkerk ea81dafb8e Port base32 decoding away from liboath
Provide a custom base32 implementation; relates to issues: #9 and #6.

In particular being able to control memory allocation prior to
decoding base32 will help with resolving issue #6 in a (more) secure
fashion.
2020-02-08 14:21:45 +01:00
Johan Ouwerkerk 771ebccab5 Fixup reference error 2020-01-29 19:40:01 +01:00
Johan Ouwerkerk 6ae5f7be21 Rework main page UX:
- Get rid of cards in favour of a more plain list view
 - Implement removing (deleting) accounts
2020-01-28 17:56:39 +01:00
Johan Ouwerkerk a0caf83da2 Use the new Account models.
Drop the AccountDetailsPage instead of trying to update it: see issue #7

With this change issue #2 should be fixed
2020-01-28 06:49:06 +00:00
Johan Ouwerkerk 1f15fb6e08 Introduce an 'application context' (sub)module for Keysmtih.
This module is meant to simplify consumption of various Keysmith objects in QML by not having to expose/manage all C++ dependencies.
2020-01-28 06:49:06 +00:00
Johan Ouwerkerk a813810dfe Rewrite Account model(s) as a separate (sub)module within Keysmith, layered on top of the new Account (storage) module.
This fixes the model part in issue #2
2020-01-28 06:49:06 +00: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
Johan Ouwerkerk 40a5491026 Remove application title property binding: it is redundant and causes QML warnings at runtime. 2019-12-31 18:20:58 +01:00
Bhushan Shah 78240a9efb
Rename binary to keysmith
org.kde prefix is definitely unusual so get rid of it.
2019-12-31 20:04:35 +05:30
Bhushan Shah f4264b9c8c app: add i18n support 2019-12-31 19:34:33 +05:30
Johan Ouwerkerk a5794e02da Refactor: turn the base32 wrapper into a static library
This library is meant for private use by Keysmith, to simplify linking to the base32 functionality in CMake files.
2019-12-28 06:40:31 +00:00
Yuri Chornoivan 38bb10de49 Fix minor typos 2019-12-18 18:49:58 +02:00
Friedrich W. H. Kossebau 7daddb524c Cleanup CMakeLists.txt a bit
* do cmake_minimum_required as first thing, as recommended
* bump KF to 5.37, first release with Kirigami (Qt 5.7 matching min dep)
* use KF5_MIN_VERSION also with ECM
* include KDE CMake settings as first
* remove unused cmake includes
* remove duplicated enable_testing()
* use correct KDEInstallDirs variables
2019-12-18 17:29:13 +01:00
Johan Ouwerkerk e6a53b6f3b Rebrand otpclient as Keysmith 2019-10-21 19:16:51 +02:00
Johan Ouwerkerk 4d7bf2f975 Add a rudimentary details page for accounts and wire up navigation to/from it.
The account details page has a kind of modality:

 - hide mode: in which the user is shown the account info but sensitive information such as secret keys should not be displayed openly visible.
 - show mode: the same, but in this case all details are openly visible. This will be useful for showing QR codes explicitly.
 - edit mode: in which the user may edit account details (all except the name).
2019-10-20 14:09:39 +02:00
Johan Ouwerkerk c64273355a Refactor: extract the token details form UI to its own re-usable component. 2019-10-20 14:09:39 +02:00
Johan Ouwerkerk ba4d370ee6 Refactor: prefer Q_ENUM for declaring C++ enums to the Qt meta type system 2019-10-20 14:09:39 +02:00
Johan Ouwerkerk 3734e908a9 Hide main 'Add' action if the add account form is already opened.
In this way we can avoid the confusing situation with multiple add account forms open by mistake.
2019-10-20 14:06:22 +02:00
Johan Ouwerkerk 042b51d183 Use the unsigned long long validator for the HOTP counter input field in the QML UI. 2019-10-02 21:56:58 +02:00
Johan Ouwerkerk 543766b819 Introduce a validator for the HOTP counter field. 2019-10-02 21:56:58 +02:00
Johan Ouwerkerk f0b5f8121f Refactor: extract strip_spaces() utility function. 2019-10-02 21:34:33 +02:00
Johan Ouwerkerk 668e912dfe Apply the name validator to the account name input field in the QML UI. 2019-09-30 20:25:56 +02:00
Johan Ouwerkerk 3bc3a14575 Introduce a validator for name input fields (account name). 2019-09-30 20:25:56 +02:00
Johan Ouwerkerk 73acbb68ae Add the new base32 secret validator to the UI: attach it to the secret input field. 2019-09-29 12:57:07 +02:00
Johan Ouwerkerk b791bbad45 Add QML bindings for custom validators
- Add convenience function to set up QML bindings under the Oath.Validators namespace
 - Wire up the validator library in the otpclient application
2019-09-29 12:53:49 +02:00
Johan Ouwerkerk eeeac7511c Introduce a custom base32 secret validator to perform input validation.
- Add a new static library "validator_lib" covering the "validators" namespace in C++
 - Introduce the Base32Validator to perform input field validation with fixup support
2019-09-29 12:48:25 +02:00
Johan Ouwerkerk c37bf03b8e Fix typo: OAth -> Oath (the name is oath or OATH). 2019-09-29 12:40:22 +02:00
Johan Ouwerkerk 8d40008201 Use a SpinBox for more appropriate UI/UX when entering token lengths
Due to our use of liboath for generating the actual tokens, we also support only a limited range of valid token lengths.
This means that it is more user friendly to express those limits  directly in the UI through a SpinBox instead of allowing the user type in values we do not currently support.
2019-09-28 00:22:55 +02:00
Johan Ouwerkerk 29e9348097 Modernise AccountModel C++ code a bit 2019-09-25 15:38:25 +02:00
Johan Ouwerkerk 8b03fe5123 Modernise Account C++ code a bit 2019-09-25 14:40:53 +02:00
Johan Ouwerkerk 4cff5519ed Automatically show the "add OTP" form when there are no OTP tokens yet on start up.
This is a small UX improvement to make it a little easier to get started with the app.
2019-09-25 11:17:48 +02:00
Johan Ouwerkerk 3a4df16a1c Make the 'clock' an injectable dependency via the Account constructor.
In this way we can fake the current date/time during tests, making it possible to reliably test TOTP and derivative type tokens.
2019-09-11 09:40:44 +02:00
Johan Ouwerkerk 750025f05c Fixup Account to make sure all HOTP/TOTP algorithm properties are properly initialised by the constructor. 2019-09-11 09:40:44 +02:00
Johan Ouwerkerk 960c96bb90 Minimal refactoring to move Account away from its previous base32 decoding implementation. 2019-09-11 09:40:44 +02:00
Johan Ouwerkerk 71180195e6 Add dedicated base32 helper utilities in its own namespace. 2019-09-11 09:40:44 +02:00
Johan Ouwerkerk 4f4d1c93f8 Fixup: add license information to oath_p.h 2019-09-11 09:40:27 +02:00
Johan Ouwerkerk d372ba2a74 Create a 'private' header for interfacing with the oath library that does the C interop stuff. 2019-09-09 11:26:09 +02:00
Bhushan Shah 24457c878a Remove the leftover code to migrate config format 2019-03-25 19:31:48 +05:30
Bhushan Shah 5a1d26e3b8 Add animation for showing and timeout 2019-03-25 19:30:45 +05:30
Bhushan Shah 75e171a11a Show refresh button only if type is the HOTP 2019-03-25 17:50:05 +05:30
Bhushan Shah 2b013ac8c9 Use model.roleName instead of the roleName
This seems to workaround the issue with the Kirigami, and makes OTP
refresh correctly. Now it is actually usable :)
2019-03-25 17:19:34 +05:30
Bhushan Shah 8819d205f9 Initial code for OTP client
It uses the oath-toolkit[1] provided library liboath to generate the 2FA
codes, both TOTP and HOTP based. Currently it is largely untested. From
initial rough testing it seems that auto-refreshing of code is not
working. Also button to refresh token for HOTP is also dummy at moment.

Some todo items include,

- Verify the generated oath code is correct
- Make refreshing token work
- QR code scanning
- Backup and Restore of accounts
- Clipboard support to automatically copy code.
- Encrypted storage of the secret token

This code is largely based on the authenticator-ng[2] application by the
Rodney Dawes and Michael Zanetti for the Ubuntu Touch.

[1] https://www.nongnu.org/oath-toolkit/
[2] https://github.com/dobey/authenticator-ng
2019-03-25 02:58:56 +05:30