updated build system

This commit is contained in:
2024-08-20 08:48:29 -05:00
parent d83de7bb91
commit 734dab801d
26 changed files with 2440 additions and 277 deletions

View File

@ -24,8 +24,8 @@
#if defined(PROJECT_ENABLE_LIBSODIUM)
namespace repertory {
static const std::string token{"moose"};
static const std::wstring token_w{L"moose"};
static constexpr const std::string_view token{"moose"};
static constexpr const std::wstring_view token_w{L"moose"};
TEST(utils_encryption, generate_key) {
auto key1 =
@ -244,6 +244,39 @@ TEST(utils_encryption, decryption_failure) {
std::string data;
EXPECT_FALSE(utils::encryption::decrypt_data(key, result, data));
}
TEST(utils_encryption, decrypt_file_name) {
auto &source_file = test::create_random_file(
8U * utils::encryption::encrypting_reader::get_data_chunk_size());
EXPECT_TRUE(source_file);
if (source_file) {
stop_type stop_requested{false};
utils::encryption::encrypting_reader reader(
"test.dat", source_file.get_path(), stop_requested, token,
std::nullopt);
auto file_name = reader.get_encrypted_file_name();
EXPECT_EQ(true, utils::encryption::decrypt_file_name(token, file_name));
EXPECT_STREQ("test.dat", file_name.c_str());
}
}
TEST(utils_encryption, decrypt_file_path) {
auto &source_file = test::create_random_file(
8U * utils::encryption::encrypting_reader::get_data_chunk_size());
EXPECT_TRUE(source_file);
if (source_file) {
stop_type stop_requested{false};
utils::encryption::encrypting_reader reader(
"test.dat", source_file.get_path(), stop_requested, token, "moose/cow");
auto file_path = reader.get_encrypted_file_path();
EXPECT_EQ(true, utils::encryption::decrypt_file_path(token, file_path));
EXPECT_STREQ("/moose/cow/test.dat", file_path.c_str());
}
}
#endif // defined(PROJECT_ENABLE_BOOST)
} // namespace repertory