mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-08-07 05:52:33 -04:00

Refactors the Passkey implementation to include more checks and a structure that is more aligned with the official specification. Notable changes: - _BrowserService_ no longer does the checks by itself. A new class _BrowserPasskeysClient_ constructs the relevant objects, acting as a client. _BrowserService_ only acts as a bridge between the client and _BrowserPasskeys_ (authenticator) and calls the relevant popups for user interaction. - A new helper class _PasskeyUtils_ includes the actual checks and parses the objects. - _BrowserPasskeys_ is pretty much intact, but some functions have been moved to PasskeyUtils. - Fixes Ed25519 encoding in _BrowserCBOR_. - Adds new error messages. - User confirmation for Passkey retrieval is also asked even if `discouraged` is used. This goes against the specification, but currently there's no other way to verify the user. - `cross-platform` is also accepted for compatibility. This could be removed if there's a potential issue with it. - Extension data is now handled correctly during Authentication. - Allowed and excluded credentials are now handled correctly. - `KPEX_PASSKEY_GENERATED_USER_ID` is renamed to `KPEX_PASSKEY_CREDENTIAL_ID` - Adds a new option "Allow localhost with Passkeys" to Browser Integration -> Advanced tab. By default it's not allowed to access HTTP sites, but `http://localhost` can be allowed for debugging and testing purposes for local servers. - Add tag `Passkey` to a Passkey entry, or an entry with an imported Passkey. Fixes #10287.
97 lines
3.3 KiB
C++
97 lines
3.3 KiB
C++
/*
|
|
* Copyright (C) 2024 KeePassXC Team <team@keepassxc.org>
|
|
* Copyright (C) 2017 Sami Vänttinen <sami.vanttinen@protonmail.com>
|
|
* Copyright (C) 2013 Francois Ferrand
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef KEEPASSXC_BROWSERSETTINGS_H
|
|
#define KEEPASSXC_BROWSERSETTINGS_H
|
|
|
|
#include "NativeMessageInstaller.h"
|
|
|
|
class BrowserSettings
|
|
{
|
|
public:
|
|
explicit BrowserSettings() = default;
|
|
static BrowserSettings* instance();
|
|
|
|
bool isEnabled();
|
|
void setEnabled(bool enabled);
|
|
|
|
bool showNotification(); // TODO!!
|
|
void setShowNotification(bool showNotification);
|
|
bool bestMatchOnly();
|
|
void setBestMatchOnly(bool bestMatchOnly);
|
|
bool unlockDatabase();
|
|
void setUnlockDatabase(bool unlockDatabase);
|
|
bool matchUrlScheme();
|
|
void setMatchUrlScheme(bool matchUrlScheme);
|
|
bool alwaysAllowAccess();
|
|
void setAlwaysAllowAccess(bool alwaysAllowAccess);
|
|
bool alwaysAllowUpdate();
|
|
void setAlwaysAllowUpdate(bool alwaysAllowUpdate);
|
|
bool searchInAllDatabases();
|
|
void setSearchInAllDatabases(bool searchInAllDatabases);
|
|
bool httpAuthPermission();
|
|
void setHttpAuthPermission(bool httpAuthPermission);
|
|
bool supportKphFields();
|
|
void setSupportKphFields(bool supportKphFields);
|
|
bool noMigrationPrompt();
|
|
void setNoMigrationPrompt(bool prompt);
|
|
bool allowLocalhostWithPasskeys();
|
|
void setAllowLocalhostWithPasskeys(bool enabled);
|
|
|
|
bool useCustomProxy();
|
|
void setUseCustomProxy(bool enabled);
|
|
QString customProxyLocation();
|
|
void setCustomProxyLocation(const QString& location);
|
|
QString proxyLocation();
|
|
QString proxyLocationAsInstalled() const;
|
|
#ifdef QT_DEBUG
|
|
QString customExtensionId();
|
|
void setCustomExtensionId(const QString& id);
|
|
#endif
|
|
bool updateBinaryPath();
|
|
void setUpdateBinaryPath(bool enabled);
|
|
bool allowGetDatabaseEntriesRequest();
|
|
void setAllowGetDatabaseEntriesRequest(bool enabled);
|
|
bool allowExpiredCredentials();
|
|
void setAllowExpiredCredentials(bool enabled);
|
|
|
|
bool browserSupport(BrowserShared::SupportedBrowsers browser);
|
|
void setBrowserSupport(BrowserShared::SupportedBrowsers browser, bool enabled);
|
|
bool customBrowserSupport();
|
|
void setCustomBrowserSupport(bool enabled);
|
|
int customBrowserType();
|
|
void setCustomBrowserType(int type);
|
|
QString customBrowserLocation();
|
|
void setCustomBrowserLocation(const QString& location);
|
|
void updateBinaryPaths();
|
|
QString replaceHomePath(QString location);
|
|
QString replaceTildeHomePath(QString location);
|
|
|
|
private:
|
|
static BrowserSettings* m_instance;
|
|
|
|
NativeMessageInstaller m_nativeMessageInstaller;
|
|
};
|
|
|
|
inline BrowserSettings* browserSettings()
|
|
{
|
|
return BrowserSettings::instance();
|
|
}
|
|
|
|
#endif // KEEPASSXC_BROWSERSETTINGS_H
|