Skip to content

Commit

Permalink
sec_mod_linux update
Browse files Browse the repository at this point in the history
  • Loading branch information
sinev-valentine committed Feb 6, 2019
1 parent 122b401 commit bb1b5b6
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 16 deletions.
2 changes: 1 addition & 1 deletion keychain_lib/src/export_import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

using namespace keychain_app;

namespace secmod_commands = keychain_app::secmod_commands;
//namespace secmod_commands = keychain_app::secmod_commands;

fc_light::variant create_secmod_cmd()
{
Expand Down
49 changes: 48 additions & 1 deletion keychain_linux/passentry_cmd/sec_mod_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,64 @@
//

#include "sec_mod_linux.hpp"
#include <keychain_lib/secmod_parser_cmd.hpp>


using namespace keychain_app;

#include <pass_entry_term.hpp>
#include <cmd.hpp>

namespace sm_cmd = keychain_app::secmod_commands;


std::string sec_mod_linux::exec_cmd(const std::string& json_cmd) const
{
sm_cmd::secmod_parser_f parser;
auto etype = parser(json_cmd);
int unlock_time = 0;
switch (etype)
{
case sm_cmd::events_te::sign_hex:
{
auto cmd = parser.params<sm_cmd::events_te::sign_hex>();
unlock_time = cmd.unlock_time;
}
break;
case sm_cmd::events_te::unlock:
{
auto cmd = parser.params<sm_cmd::events_te::unlock>();
unlock_time = cmd.unlock_time;
}
break;
}

keychain_app::byte_seq_t result_pass;
result_pass.reserve(512);

std::string result;
result_pass = { 'b', 'l', 'a', 'n', 'k' };
sm_cmd::secmod_resonse_common response;
if (result_pass.empty())
{
response.etype = sm_cmd::response_te::null;
result = fc_light::json::to_pretty_string(response);
}
else
{
response.etype = sm_cmd::response_te::password;
response.params = result_pass;
result = fc_light::json::to_pretty_string(response);
}
return result;
}

sec_mod_linux::sec_mod_linux()
{}

sec_mod_linux::~sec_mod_linux()
{}

/*
void sec_mod_linux::print_mnemonic(const string_list& mnemonic) const
{
Expand Down Expand Up @@ -52,3 +98,4 @@ byte_seq_t sec_mod_linux::get_passwd_on_create(const std::string& keyname) const
auto pass = pass_entry.fork_gui(map_instance.map, mes);
return pass;
}
*/
8 changes: 2 additions & 6 deletions keychain_linux/passentry_cmd/sec_mod_linux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ namespace keychain_app
public:
sec_mod_linux();
virtual ~sec_mod_linux();
virtual keychain_app::byte_seq_t get_passwd_trx(const std::string& raw_trx) const override;
virtual keychain_app::byte_seq_t get_passwd_unlock(const std::string& keyname, int unlock_time) const override;
virtual keychain_app::byte_seq_t get_passwd_on_create(const std::string& keyname = std::string("")) const override;
virtual void print_mnemonic(const string_list& mnemonic) const override;
private:
static constexpr const char* pass_str = "blank_password";
virtual std::string exec_cmd(const std::string& json_cmd) const override;
};

}

#endif //KEYCHAINAPP_SEC_MOD_LINUX_HPP

2 changes: 2 additions & 0 deletions keychain_linux/passentry_gui/src/BitcoinWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ BitcoinWidget::BitcoinWidget(Transaction &transaction, QWidget * parent)
//}
secmod_parser_f cmd_parse;
auto cmd_type = cmd_parse(transaction.getTransactionText().toStdString());
/*
auto bitcoin_trx = cmd_parse.to_bitcoin();
auto bitcoin_data = bitcoin_trx.trx_info;
Expand Down Expand Up @@ -82,6 +83,7 @@ BitcoinWidget::BitcoinWidget(Transaction &transaction, QWidget * parent)
}
expertModeElement = new ExpertModeElement(this);
expertModeElement->SetExpertModeText(QString::fromStdString(cmd_parse.to_expert_mode_string()));
*/
}

void BitcoinWidget::SetPosition(int x, int y, int width)
Expand Down
8 changes: 6 additions & 2 deletions keychain_linux/passentry_gui/src/EthereumSwapWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ EthereumSwapWidget::EthereumSwapWidget(Transaction &transaction, QWidget * paren

//QList<QString> fieldList({ "From","To","Amount" });

/*
secmod_parser_f cmd_parse;
auto cmd_type = cmd_parse(transaction.getTransactionText().toStdString());
auto swap_trx = cmd_parse.to_ethereum_swap();
Expand All @@ -28,9 +29,11 @@ EthereumSwapWidget::EthereumSwapWidget(Transaction &transaction, QWidget * paren
}
action->SetLabelAndValue("Action", "(action)");
/*create_swap = 0,
*/
/*create_swap = 0,
refund,
withdraw*/
withdraw*//*
hash = new SecureWindowElement(this);
hash->SetLabelStyle(labelStyle);
Expand Down Expand Up @@ -73,6 +76,7 @@ EthereumSwapWidget::EthereumSwapWidget(Transaction &transaction, QWidget * paren
expertModeElement = new ExpertModeElement(this);
expertModeElement->SetExpertModeText(QString::fromStdString(cmd_parse.to_expert_mode_string()));
*/

}

Expand Down
4 changes: 3 additions & 1 deletion keychain_linux/passentry_gui/src/EthereumWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
EthereumWidget::EthereumWidget(Transaction &transaction, QWidget * parent)
:KeychainWidget(parent)
{
/*
QMetaObject::connectSlotsByName(this);
cryptoType = new SecureWindowElement(this);
Expand Down Expand Up @@ -43,7 +44,8 @@ EthereumWidget::EthereumWidget(Transaction &transaction, QWidget * parent)
expertModeElement = new ExpertModeElement(this);
expertModeElement->SetExpertModeText(QString::fromStdString(cmd_parse.to_expert_mode_string()));

*/

}

void EthereumWidget::SetPosition(int x, int y, int width)
Expand Down
4 changes: 2 additions & 2 deletions keychain_linux/passentry_gui/src/RawHashWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RawHashWidget::RawHashWidget(Transaction &transaction, QWidget * parent)

QString valueStyle("font:16px \"Segoe UI\";background:transparent;color:rgb(123,141,167);");
QString labelStyle("font:16px \"Segoe UI\";background:transparent;");

/*
secmod_parser_f cmd_parse;
auto cmd_type = cmd_parse(transaction.getTransactionText().toStdString());
auto raw_hash = cmd_parse.to_rawhash();
Expand Down Expand Up @@ -46,7 +46,7 @@ RawHashWidget::RawHashWidget(Transaction &transaction, QWidget * parent)
//expertModeElement = new ExpertModeElement(this);
//expertModeElement->SetExpertModeText(QString::fromStdString(cmd_parse.to_expert_mode_string()), false);

*/
}

void RawHashWidget::SetPosition(int x, int y, int width)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ UnparsedTransactionWidget::UnparsedTransactionWidget(Transaction &transaction, Q

QString valueStyle("font:16px \"Segoe UI\";background:transparent;color:rgb(123,141,167);");
QString labelStyle("font:16px \"Segoe UI\";background:transparent;");

/*
secmod_parser_f cmd_parse;
auto cmd_type = cmd_parse(transaction.getTransactionText().toStdString());
Expand All @@ -19,6 +19,7 @@ UnparsedTransactionWidget::UnparsedTransactionWidget(Transaction &transaction, Q
unlockTime = new PrivateKeyInMemory(this);
unlockTime->SetTime(QString::number(cmd_parse.unlock_time()));
}
*/
}

void UnparsedTransactionWidget::SetPosition(int x, int y, int width)
Expand Down
4 changes: 2 additions & 2 deletions keychain_linux/passentry_gui/src/keychain_gui_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void keychain_gui_win::refresh(Transaction& transaction)
if (transaction.isCreatePassword()) {
warningMessage.SetWarning(KeychainWarningMessage::WarningType::CreateWarning);
descriptionLabel->setText("Enter the password for the new key");
}
}/*
if (!transaction.isCreatePassword() && transaction.isUnlockKey() == -1)
{
secmod_parser_f cmd_parse;
Expand Down Expand Up @@ -186,7 +186,7 @@ void keychain_gui_win::refresh(Transaction& transaction)
// connect(password, &PasswordEnterElement::finishEnterPassword, this, &keychain_gui_win::transaction_sign);
// if (transaction.isCreatePassword()) {
// connect(password, &PasswordEnterElement::changePassword, this, &keychain_gui_win::_disableSignButton);
// }
// }*/
}


Expand Down

0 comments on commit bb1b5b6

Please sign in to comment.