73 lines
2.0 KiB
C
Raw Normal View History

2022-01-06 15:29:19 -04:00
#pragma once
#include "account.h"
#include "generated_account.h"
#include "service_interface.h"
#include <QString>
#include <QVector>
namespace Accounts
{
class Service : public ServiceInterface
{
private:
QVector<GeneratedAccountDto> m_generatedAccounts;
2022-01-06 15:29:19 -04:00
bool m_isFirstTimeAccountLogin;
AccountDto m_loggedInAccount;
GeneratedAccountDto m_importedAccount;
2022-01-06 15:29:19 -04:00
public:
Service();
2022-01-06 15:29:19 -04:00
void init() override;
2022-01-06 15:29:19 -04:00
virtual QVector<AccountDto> openedAccounts() override;
2022-01-06 15:29:19 -04:00
QVector<GeneratedAccountDto> generatedAccounts() override;
2022-01-06 15:29:19 -04:00
bool setupAccount(QString accountId, QString password) override;
2022-01-06 15:29:19 -04:00
AccountDto getLoggedInAccount() override;
2022-01-06 15:29:19 -04:00
GeneratedAccountDto getImportedAccount() override;
2022-01-06 15:29:19 -04:00
bool isFirstTimeAccountLogin() override;
2022-01-06 15:29:19 -04:00
QString validateMnemonic(QString mnemonic) override;
2022-01-06 15:29:19 -04:00
bool importMnemonic(QString mnemonic) override;
2022-01-06 15:29:19 -04:00
QString login(AccountDto account, QString password) override;
2022-01-06 15:29:19 -04:00
void clear() override;
2022-01-06 15:29:19 -04:00
QString generateAlias(QString publicKey) override;
2022-01-06 15:29:19 -04:00
QString generateIdenticon(QString publicKey) override;
2022-01-06 15:29:19 -04:00
bool verifyAccountPassword(QString account, QString password) override;
2022-01-06 15:29:19 -04:00
DerivedAccounts storeDerivedAccounts(QString accountId, QString hashedPassword, QVector<QString> paths);
2022-01-06 15:29:19 -04:00
QJsonObject getAccountDataForAccountId(QString accountId);
2022-01-06 15:29:19 -04:00
QJsonArray getSubaccountDataForAccountId(QString accountId);
2022-01-06 15:29:19 -04:00
QJsonObject getAccountSettings(QString accountId, QString installationId);
2022-01-06 15:29:19 -04:00
QJsonObject getDefaultNodeConfig(QString installationId);
2022-01-06 15:29:19 -04:00
QJsonObject prepareAccountJsonObject(const GeneratedAccountDto account);
2022-01-06 15:29:19 -04:00
QJsonArray prepareSubaccountJsonObject(GeneratedAccountDto account);
2022-01-06 15:29:19 -04:00
QJsonObject prepareAccountSettingsJsonObject(const GeneratedAccountDto account, QString installationId);
2022-01-06 15:29:19 -04:00
AccountDto saveAccountAndLogin(
QString hashedPassword, QJsonObject account, QJsonArray subaccounts, QJsonObject settings, QJsonObject config);
2022-01-06 15:29:19 -04:00
};
} // namespace Accounts