From 343fb028f24734e5abea7af28962cb5b94243953 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 17 Aug 2015 14:39:09 +0200 Subject: [PATCH] use bytesCondtRef version of import secret --- test/libdevcrypto/SecretStore.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/libdevcrypto/SecretStore.cpp b/test/libdevcrypto/SecretStore.cpp index 32dcd3206..c1da40f3c 100644 --- a/test/libdevcrypto/SecretStore.cpp +++ b/test/libdevcrypto/SecretStore.cpp @@ -131,6 +131,31 @@ BOOST_AUTO_TEST_CASE(import_secret) } } +BOOST_AUTO_TEST_CASE(import_secret_bytesConstRef) +{ + for (string const& password: {"foobar", ""}) + { + TransientDirectory storeDir; + string priv = "0202020202020202020202020202020202020202020202020202020202020202"; + + h128 uuid; + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 0); + bytes privateBytes = fromHex(priv); + uuid = store.importSecret(&privateBytes, password); + BOOST_CHECK(!!uuid); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }).makeInsecure())); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + } + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }).makeInsecure())); + } + } +} + BOOST_AUTO_TEST_CASE(wrong_password) { TransientDirectory storeDir;