euxis-memory-cpp¶
C++23 tier-bound encrypted memory store with AAD-based isolation.
README¶
euxis::memory
Tier-bound encrypted memory storage for euxis. XChaCha20-Poly1305 AEAD with tier-bound additional authenticated data prevents horizontal access across tiers and agents. Entries written before the `alg` field were sealed with AES-256-GCM; they stay readable on CPUs with AES instructions, and `migrate_legacy_entries()` re-encrypts them.
Contents¶
Install¶
add_subdirectory(libs/memory)
target_link_libraries(my_app PRIVATE euxis-memory-cpp)
Quick start¶
#include <iostream>
#include <vector>
#include "euxis/memory/store.hpp"
#include "euxis/memory/tier.hpp"
int main() {
using namespace euxis::memory;
std::array<std::byte, 32> key{}; // from libs/crypto
EncryptedMemoryStore store{key};
EncryptedMemoryEntry e;
e.agent_id = "scan-agent";
e.tier = MemoryTier::Hot;
e.payload = /* serialise your memory entry */ {};
auto rc = store.put("entry-001", e);
if (!rc) std::cerr << "put failed\n";
auto got = store.get("entry-001", "scan-agent", MemoryTier::Hot);
std::cout << "round-trip: " << got.has_value() << '\n';
}
Public surface¶
Header |
What it owns |
|---|---|
|
|
|
|
|
|
Examples¶
Tier promotion (move an entry from Hot to Warm)¶
auto hot_entry = store.get("entry-001", "scan-agent", MemoryTier::Hot);
if (hot_entry) {
auto warm = *hot_entry;
warm.tier = MemoryTier::Warm;
store.put("entry-001", warm); // re-encrypts with new AAD
store.remove("entry-001", "scan-agent", MemoryTier::Hot);
}
License¶
AGPL-3.0-only. See LICENSE.