#include "cyborgdb_core/client.hpp"
#include "cyborgdb_core/encrypted_index.hpp"
#include <openssl/rand.h>
#include <array>
// Using `memory` storage for this example
cyborg::DBConfig index_location(cyborg::Location::kMemory);
cyborg::DBConfig config_location(cyborg::Location::kMemory);
// Get your API key
std::string api_key = "your_api_key_here"; // Replace with your actual API key
// Create a client
cyborg::Client client(api_key, index_location, config_location);
// Generate a 32-byte secure encryption key using OpenSSL
std::array<uint8_t, 32> index_key;
if (RAND_bytes(index_key.data(), index_key.size()) != 1) {
throw std::runtime_error("Failed to generate secure random key");
}
// Set max cache size at 1MB
std::size_t max_cache_size = 1000000;
// Create an encrypted index
auto index = client.LoadIndex("my_index", index_key, max_cache_size);