Commit Graph

159 Commits (master)

Author SHA1 Message Date
Nate Graham e8c2d5c2cf Reduce default size of main window
The main window is sort of excessively large right now. This commit
reduces it to a more reasonable size.
2021-12-19 15:46:06 +00:00
Nate Graham 94d3eb3c13 Focus password field by default on launch 2021-12-19 14:59:11 +00:00
Devin Lin 818ed69022 app: lowercase dbus name 2021-07-20 12:11:29 +05:30
Tobias Fella db6d4742e3 feat: do not use QtWidgets on android and set platform style 2021-06-08 10:43:24 +05:30
Johan Ouwerkerk fb953ed677 feat!: respond to D-Bus activation
Minimal support for requesting window activation in response to
activation requests from D-Bus.

This provides minimal support for xdg D-Bus activation in Keysmith:
only the activation signal itself is handled; the DBus API for opening
URLs is not implemented.

Issues: #18
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 287cbcd480 feat!: register Keysmith with D-Bus
This change provides the most basic D-Bus support in Keysmith.
At start up, Keysmith will now register itself and abort if another
instance is already running. Full support for the xdg D-Bus activation
specification (such as URI opening) is not yet implemented.

By default this feature is disabled on Android, but enabled on 'all'
other platforms. Explicit control may be exercised by running CMake
with -DBUILD_DBUS_INTERFACE=<ON|OFF>.

Issues: #18
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 183651ed7e fix: improve i18n for add account buttons
Previously the existing main action (toolbar) button lacked comments,
and the placeholder message button lacked i18n entirely.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 8ddfdaba42 chore: simplify password unlocking via keyboard
Turns out it is not needed to check whether an action is enabled before
triggerin it: the trigger is automatically suppressed if the action is
not yet enabled.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk d00111edc9 chore: fix typo in debug logging statement 2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 75a167665b refactor: switch to page navigation from C++
Rework QML to use the ViewModel classes and use the C++ flow classes to
drive QML page navigation.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk ea19844300 refactor: proxy commandline arguments
Add a 'proxy' to forward external API calls into the main application
control flow. Right now it only supports forwarding commandline
arguments, but this construct is already useful as a starting point for
future D-Bus API support.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 7274dc4f25 refactor: introduce "view models"
This change prepares Keysmith for moving logic away from QML to C++

 - Added view model classes for each defined Navigation::Page instance
 - Added 'flows' to provide a C++ equivalent for control flow logic
   which currently still resides in QML

The purpose the view model classes is to provide data (properties) and
actions (methods to invoke) to the QML page UI. These are relatively
thin wrappers to expose the C++ state (Store) and logic (flows) as an
easy to use API for the QML UI.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk bdcdb85bb6 refactor: introduce store for application state
The 'Store' is a convenient wrapper for injecting a dependency on the
entire application state (root) so it can be re-used by independent
flows of C++ logic. It will be used both to provide data to the view
models for the QML UI, and as a way to record results of actions
dispatched from the UI.

With this change the following (additional) state is defined:

 - OverviewState, which will be used to track state that determines how
   the AccountsOverview QML UI should render and what features are
   enabled/disabled in it. This state may be manipulated as a a
   side-effect of various interactios with arbitrary pages.
 - FlowState, which will be used to track state about which control/
   logic flows have completed and whether or not something is currently
   running. This is will be used to avoid distracting the user from an
   active UX flow with random unrelated prompts.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 131e59aa3a refactor: move property assignments to main.qml
Ensure that all logic for property assignment is concentrated in
main.qml in preparation for the introduction of view model classes.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 12e060923e refactor: UI (page) navigation from C++ code
An app::Navigation class is introduced with an API very similar to the
Kirigami.PageRouter in QML. This new class is responsible for pusing
populated view model classes from C++ into QML ownership and triggering
appropriate navigation events. On the QML side a signal handler
forwards these calls to the Kirigami.PageRouter to perform the actual
navigation in the UI.

This construct paves the way for moving state transition and related
logic out of QML and towards C++, since this logic is currently mostly
concerned with page navigation in Keysmith. Ultimately that transition
should make the QML (page) views more easily re-usable.
2021-05-03 04:03:24 +00:00
Johan Ouwerkerk 571afeacdf refactor: port navigation to Kirigami.PageRouter
Replace existing manual manipulation of the application page stack with
a more declarative setup using Kirigami.PageRouter. This change does
not yet address the control flow: pages are not yet properly decoupled.
2021-05-03 04:03:24 +00:00
Devin Lin e3564e3bd7 Add placeholder message when accounts list is empty 2021-03-05 18:23:15 +00:00
Devin Lin dcfa16025e Improve password form look 2021-02-28 18:38:02 +00:00
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 ad4308793b fix: show an appropriate error when a provided password fails its challenge
With this change the user now gets appropriate error feedback when trying to unlock their accounts using an incorrect password.

Additionally password entry is temporarily suspended in the UI while key derivation (etc.) is in progress.
This should help convey the idea that "something is happening", or rather avoid the impression that "nothing happens" or "this is broken" when in fact key derivation may simply be slow depending on the machine.
2021-01-20 06:17:48 +00:00
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 eb39c18fe2 chore: further code cleanups suggested by clazy in the oath module
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 0a74440fe4 fix: oath::Encoder base clase should not be used via pointers and not via value types.
This bug was caught by clazy, and prevents invalid password detection/error 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 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 f25ae7ffda chore: update SPDX copyright to include Carl Schwan 2020-11-11 20:28:47 +01:00
Carl Schwan 57f13956b4 padding inline message 2020-11-11 20:15:53 +01:00
Carl Schwan d440689e99 fix: make Kirigami relayout the unlock accounts page with proper word wrapping for the banner text
This is a hack/work-around for a deficiency in Kirigami pending a proper fix upstream.

See-Also: https://invent.kde.org/frameworks/kirigami/-/merge_requests/159
2020-11-11 20:15:53 +01:00
Carl Schwan cda7ace071 Fix layout of UnlockAccounts page on mobile 2020-11-11 20:15:53 +01:00
Carl Schwan 5c5a7e1ca0 fix: make Kirigami relayout the password setup page with proper word wrapping for the banner text
This is a hack/work-around for a deficiency in Kirigami pending a proper fix upstream.

See-Also: https://invent.kde.org/frameworks/kirigami/-/merge_requests/159
2020-11-11 20:15:47 +01:00
Carl Schwan abd2319a34 Better keyboard navigation 2020-11-11 20:09:11 +01:00
Carl Schwan 74ca38d318 Refresh setup password screen 2020-11-11 20:09:11 +01:00
Carl Schwan 33e1be37eb Fix incorrect spacing between forms 2020-11-10 10:19:17 +01:00
Carl Schwan 9865863dbd Fix mobile UI for addAccount page 2020-11-10 10:17:43 +01:00
Johan Ouwerkerk 8d1a88b8df fix: make sure to display password setup page again when appropriate
The feature to accept accounts from the command line via otpauth:// URI inadvertently broke the initial password setup flow.
With this change password setup and unlocking should now work correctly again in all cases/flows.

Issues: #14
2020-11-09 19:20:08 +01:00
Johan Ouwerkerk d7c8eb4be4 feat: support Qt application version attribute
Automatically pick up on the CMake project version and forward it to the applicationVersion attribute of Qt.
2020-11-04 16:54:29 +01:00
Johan Ouwerkerk bc91de7e5b feat: support receiving a new account via otpauth:// URI from the commandline in the UI
This change implements necessary control flow to pick up on accounts being passed to Keysmith via commandline options.

This change covers UX only for the happy flow case in which the received account is a valid otpauth:// URI.
If such an URI is passed to Keysmith, then the Add Account form is automatically pushed on the page stack and pre-populated with data received from the commandline.
With this UX, if the account is valid the user may either accept it immediately or tweak settings (most likely account name/issuer) to make it valid.

Issues: #7, #14
2020-10-30 13:27:32 +01:00
Johan Ouwerkerk b0bc89810e feat: add actions to dismiss/cancel the add account form
Users may now cancel adding an account and dismiss the page.
This change is particularly relevant in the context of an account that is being added via URI passed on the commandline: the user may now explicitly reject it.

Additionally quitting Keysmith from the add account form is now also supported, hidden behding a boolean flag.
This will be useful for the initial page when receiving an account via URI from the commandline: the user may reject the account and quit Keysmith via a single action.

Issues: #7, #14
2020-10-30 13:25:33 +01:00
Johan Ouwerkerk 92e92557fa feat: add a page to recover when an account turns out to be already used while adding it
This page is a bit of a bodge for the fact that the current Accounts model must be 'unlocked' before it can be used.
In turn, this means that it is not straightforward to check that an account is still 'available' when presenting the user with the option to add an account received via URI from the commandline.
The solution implemented here is to check and let the user recover after unlocking, if necessary.

Issues: #7, #14
2020-10-30 13:24:39 +01:00
Johan Ouwerkerk 72cfaee9bf feat: introduce a generic "error page" component
This new component can be used to inject an interstitial page, letting the user know something went wrong and allowing them to decide whether to continue or to quit Keysmith.
This is especially useful when Keysmith was launched automatically from some other context (i.e. another app) without the user necessarily being fully aware of it.

Issues: #7, #14
2020-10-27 18:59:03 +01:00
Johan Ouwerkerk 30e66ef978 refactor: support validating account names without checking account availability
With this change AccountNameValidator can now be used without having a functional Accounts model.
This allows the existing AddAccount page to be re-used for context without a valid Accounts model, e.g. when receiving accounts via URI from the commandline.

Issues: #7, #14
2020-10-27 18:08:31 +01:00
Johan Ouwerkerk 9288f041c8 refactor: add support for ValidatedAccountInput being passed in from outside of the add account forms.
With this change top-level QML code may pass a (populated) ValidatedAccountInput object to pre-populate fields in the add account forms.

Issues: #7, #14
2020-10-27 18:08:31 +01:00
Johan Ouwerkerk d33d2c777d feat: allow QML UI to reset a model::AccountInput object
Being able to reset an account input model to the default state allows for QML UI to safely reuse an account input.
This lets it delegate populating to other code and then finally forward it to other QML code when control returns to the UI.

Issues: #7, #14
2020-10-27 18:08:31 +01:00
Johan Ouwerkerk cb9032d1c3 feat: pick up on commandline options passed to Keysmith during start up.
This change provides minimal plumbing to pick up on commandline options, it does not yet provide the UI to take appropriate action(s).

Issues: #7, #14
2020-10-27 18:08:31 +01:00
Johan Ouwerkerk 4425795211 feat: add basic support for accepting otpauth:// URIs from the commandline
This change is a building block towards receiving decoded QR codes from other applications and adding corresponding accounts in Keysmith.

Issues: #7, #14
2020-10-27 18:08:31 +01:00
Johan Ouwerkerk 937a48bed7 chore: prune a few CMakeLists.txt files 2020-10-27 18:08:31 +01:00
Johan Ouwerkerk 420198c49a feat: add basic support for otpauth:// URI parameter model
Add support converting an otpauth:// URI into a model object.
Validation is quite lax and focused on what Keysmith can recover from within the scope of UI/UX for adding accounts via QR codes.

See-Also: https://github.com/google/google-authenticator/wiki/Key-Uri-Format
Issues: #14
2020-10-27 18:08:31 +01:00
Johan Ouwerkerk db51ce9e3f feat: add basic support for otpauth:// URI parsing
This change provides a bare minimum implementation to parse an otpauth:// type URI into its component parts.
Parsing is quite lax, and focused on what Keysmith can support or recover from in the intended UI/UX for adding accounts via QR codes.

See-Also: https://github.com/google/google-authenticator/wiki/Key-Uri-Format
Issues: #14
2020-10-27 18:08:31 +01:00