MCPcopy Create free account
hub / github.com/LUX-Core/lux / save

Method save

src/cpp-ethereum/libdevcrypto/SecretStore.cpp:179–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179void SecretStore::save(string const& _keysPath)
180{
181 fs::path p(_keysPath);
182 fs::create_directories(p);
183 DEV_IGNORE_EXCEPTIONS(fs::permissions(p, fs::owner_all));
184 for (auto& k: m_keys)
185 {
186 string uuid = toUUID(k.first);
187 string filename = (p / uuid).string() + ".json";
188 js::mObject v;
189 js::mValue crypto;
190 js::read_string(k.second.encryptedKey, crypto);
191 v["address"] = k.second.address.hex();
192 v["crypto"] = crypto;
193 v["id"] = uuid;
194 v["version"] = c_keyFileVersion;
195 writeFile(filename, js::write_string(js::mValue(v), true));
196 swap(k.second.filename, filename);
197 if (!filename.empty() && !fs::equivalent(filename, k.second.filename))
198 fs::remove(filename);
199 }
200}
201
202bool SecretStore::noteAddress(h128 const& _uuid, Address const& _address)
203{

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 6

writeFileFunction · 0.85
hexMethod · 0.80
read_stringFunction · 0.50
write_stringFunction · 0.50
swapFunction · 0.50
emptyMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.36