1
0
forked from iarv/Meck
Files
Meck/src/helpers/IdentityStore.h
Scott Powell 00a9e93754 * simple_secure_chat now with a proper CLI
* new: BaseChatMesh class, for abstract chat client
2025-01-25 22:03:25 +11:00

27 lines
747 B
C++

#pragma once
#if defined(ESP32)
#include <FS.h>
#define FILESYSTEM fs::FS
#elif defined(NRF52_PLATFORM)
#include <Adafruit_LittleFS.h>
#define FILESYSTEM Adafruit_LittleFS
using namespace Adafruit_LittleFS_Namespace;
#endif
#include <Identity.h>
class IdentityStore {
FILESYSTEM* _fs;
const char* _dir;
public:
IdentityStore(FILESYSTEM& fs, const char* dir): _fs(&fs), _dir(dir) { }
void begin() { _fs->mkdir(_dir); }
bool load(const char *name, mesh::LocalIdentity& id);
bool load(const char *name, mesh::LocalIdentity& id, char display_name[], int max_name_sz);
bool save(const char *name, const mesh::LocalIdentity& id);
bool save(const char *name, const mesh::LocalIdentity& id, const char display_name[]);
};