37 {
38 ilog(
"initializing wallet plugin");
39 try {
40 wallet_manager_ptr = std::make_unique<wallet_manager>();
41
42 if (options.count("wallet-dir")) {
43 auto dir = options.at("wallet-dir").as<boost::filesystem::path>();
44 if (dir.is_relative())
46 if( !bfs::exists(dir) )
47 bfs::create_directories(dir);
48 wallet_manager_ptr->set_dir(dir);
49 }
50 if (options.count("unlock-timeout")) {
51 auto timeout = options.at(
"unlock-timeout").as<
int64_t>();
52 SYS_ASSERT(timeout > 0, chain::invalid_lock_timeout_exception,
"Please specify a positive timeout ${t}", (
"t", timeout));
53 std::chrono::seconds t(timeout);
54 wallet_manager_ptr->set_timeout(t);
55 }
56 if (options.count("yubihsm-authkey")) {
58 string connector_endpoint = "http://localhost:12345";
59 if(options.count("yubihsm-url"))
60 connector_endpoint = options.at("yubihsm-url").as<string>();
61 try {
62 wallet_manager_ptr->own_and_use_wallet("YubiHSM", make_unique<yubihsm_wallet>(connector_endpoint, key));
64 }
66}
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
bfs::path data_dir() const
Get data directory.
#define FC_LOG_AND_RETHROW()