a9d3db7cf4
The server allows a wallet to store or restore wallet data, but it requires the application to have access to the identity address of the wallet. So it should be made clear that we do NOT expect anyone to store a wallet seed in here, as that would create a circular dependency. Can't get the wallet-identity without the seed and thus without the seed you can't find nor decrypt the actual file.
82 lines
2.8 KiB
C++
82 lines
2.8 KiB
C++
/*
|
|
* This file is part of the Flowee project
|
|
* Copyright (C) 2019-2025 Tom Zander <tom@flowee.org>
|
|
*
|
|
* 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/>.
|
|
*/
|
|
|
|
#include "StorageWebServer.h"
|
|
#include <QStandardPaths>
|
|
|
|
#include <FloweeServiceApplication.h>
|
|
#include <primitives/PrivateKey.h> // for ECC_Start()
|
|
|
|
namespace {
|
|
struct ECC_State
|
|
{
|
|
ECC_State() {
|
|
// Init crypto lib.
|
|
ECC_Start();
|
|
globalVerifyHandle.reset(new ECCVerifyHandle());
|
|
}
|
|
~ECC_State() {
|
|
globalVerifyHandle.reset();
|
|
ECC_Stop();
|
|
}
|
|
|
|
std::unique_ptr<ECCVerifyHandle> globalVerifyHandle;
|
|
};
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
FloweeServiceApplication app(argc, argv);
|
|
app.setOrganizationName("flowee");
|
|
app.setOrganizationDomain("flowee.org");
|
|
app.setApplicationName("storage-backup-server");
|
|
|
|
QCommandLineParser parser;
|
|
parser.setApplicationDescription("Wallet Storage Server");
|
|
parser.addHelpOption();
|
|
QCommandLineOption conf(QStringList() << "conf", "config file", "FILENAME");
|
|
parser.addOption(conf);
|
|
app.addServerOptions(parser);
|
|
parser.process(app.arguments());
|
|
|
|
app.setup("walletStorage.log", parser.value(conf));
|
|
|
|
QString confFile;
|
|
if (parser.isSet(conf)) {
|
|
confFile = parser.value(conf);
|
|
} else {
|
|
// the next one expects [configs]/flowee/bitcore-proxy/bitcore-proxy.conf
|
|
confFile = QStandardPaths::locate(QStandardPaths::AppConfigLocation, "walletStorage.conf");
|
|
if (confFile.isEmpty()) // the next one expects [configs]/flowee/bitcore-proxy.conf
|
|
confFile = QStandardPaths::locate(QStandardPaths::ConfigLocation, "flowee/walletStorage.conf");
|
|
if (confFile.isEmpty()) {
|
|
logCritical() << "No config file (walletStorage.conf) found, assuming defaults";
|
|
for (auto &dir : QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation)) {
|
|
logInfo() << " - not found in" << dir + '/';
|
|
}
|
|
}
|
|
}
|
|
StorageWebServer server;
|
|
server.loadConfig(confFile);
|
|
ECC_State crypo_state; // allows the secp256k1 to function.
|
|
|
|
QObject::connect (&app, SIGNAL(reparseConfig()), &server, SLOT(reparseConfig()));
|
|
|
|
return app.exec();
|
|
}
|