#pragma once #include "common.h" #include #include #include #include constexpr i16 VERSION = 1; constexpr u64 AFTER_HEADER_OFFSET = 22; struct FileHeader { std::string name; u64 name_ciphertext_size; u64 content_size; std::vector content_nonce; }; class Vault { public: explicit Vault(std::string path, const std::string &password); std::vector read_file_headers(); std::optional read_file(const std::string &name); void create_file(const std::string &name, const std::string &content); void delete_file(const std::string &name); void update_file(const std::string &name, const std::string &content); private: std::string m_path; std::fstream m_file; Botan::secure_vector m_key; std::optional read_file_header(); };