Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
447fb11
Hold GC1109 PA_POWER during deep sleep for LNA RX wake
weebl2000 Feb 6, 2026
d42588c
Add 1ms delay after powering PA (cold-boot)
weebl2000 Feb 8, 2026
671bb19
Update Heltec V4 code to support V4.3 with KCT8103L FEM
weebl2000 Feb 26, 2026
2d43be0
Save some more power when BLE/WiFi is disabled on the companion radio
weebl2000 Jan 8, 2026
fd7c82a
Fix millis() overflow in companion powersave sleep timing
weebl2000 Feb 11, 2026
65f1973
Short sleep cycle when phone disconnects from BLE companion radio
weebl2000 Feb 13, 2026
4886163
fix out_frame buffer overflow in companion radio response handlers
weebl2000 Feb 11, 2026
0473b6b
Fix sleep nRF52
weebl2000 Feb 16, 2026
ce99d64
Validate path length against max path size
weebl2000 Feb 26, 2026
61a125f
tighten TRACE path_len guard to account for SNR append
weebl2000 Feb 11, 2026
ed04bc0
Add ChaChaPoly AEAD-4 decryption support (Phase 1)
weebl2000 Feb 12, 2026
b61786e
Enable AEAD-4 sending to peers that advertise support
weebl2000 Feb 12, 2026
7ee53a8
Fix AEAD-4 payload size check and nonce wrap-around
weebl2000 Feb 12, 2026
13bd7c3
Fix AEAD-4 assoc data mismatch — route type bits set after encryption
weebl2000 Feb 12, 2026
f26b12c
Support AEAD responses in repeater/room/sensor
weebl2000 Feb 12, 2026
71469d1
Harden AEAD-4 bounds checks and add nonce wrap logging
weebl2000 Feb 12, 2026
50af9eb
Add comment about ECB path failure
weebl2000 Feb 12, 2026
4ddc3c3
Persist AEAD-4 nonces to flash across reboots
weebl2000 Feb 13, 2026
2a8df87
Implement session keys using
weebl2000 Feb 14, 2026
131af5b
Allow persisting more session to flash
weebl2000 Feb 14, 2026
c009607
Backup contacts to tmpFile before saving
Jan 10, 2026
d4057b4
Fix dirty session keys.
weebl2000 Feb 14, 2026
bb4234d
Only apply to devices with sufficient storage
weebl2000 Jan 22, 2026
1d6ae68
check if contact still exists
weebl2000 Feb 15, 2026
ff716be
Remove unnecessary backup deletion before rename
weebl2000 Feb 11, 2026
7397837
Address comments
weebl2000 Feb 16, 2026
f2f5021
Validate buffer length before reading fields in Packet::readFrom
weebl2000 Feb 11, 2026
f0e4050
use constant-time comparison for MAC verification
weebl2000 Feb 11, 2026
97a74ad
Use secure_compare
weebl2000 Feb 16, 2026
74cd840
Implement LRU cache for storing hashes to filter flood
weebl2000 Feb 6, 2026
1c05fbc
fix out-of-bounds read in TRACE packet hash matching
weebl2000 Feb 11, 2026
733cc39
Bounds-check reply_path in anonymous request handlers
weebl2000 Feb 11, 2026
89bf6e2
Pass rtc_clock to all MicroNMEALocationProvider instances
weebl2000 Jan 10, 2026
f19a825
fix bounds check on PAYLOAD_TYPE_PATH decrypted data
weebl2000 Feb 11, 2026
b436192
add debug log for malformed PATH payload
weebl2000 Feb 11, 2026
07b3d23
Add minimum payload_len check for TRACE packet parsing
weebl2000 Feb 11, 2026
1e179c2
Use hardware channel activity detection for checking interference
weebl2000 Feb 18, 2026
4f36d80
Also return busy if preamble detected
weebl2000 Feb 22, 2026
75da5d5
Just check for not channel free
weebl2000 Feb 22, 2026
d46fd6f
Validate PATH path_len against MAX_PATH_SIZE before use
weebl2000 Feb 11, 2026
7aae793
Sync time with GPS every 30 minutes
Jan 9, 2026
4ae839e
validate advert payload length before parsing
weebl2000 Feb 11, 2026
eb8c590
Default button polarity to active-LOW across all firmware types
weebl2000 Feb 7, 2026
762b0ec
Fix T1000E press=high
weebl2000 Feb 8, 2026
d5a512c
Make retry delay random between 50,501 to prevent collisions even more
weebl2000 Feb 16, 2026
e518469
Allow setting RTC clock backwards and fix elapsed-time underflow
weebl2000 Feb 6, 2026
f2c78c6
fix infinite loop in WiFi frame skip when read fails
weebl2000 Feb 11, 2026
a2108ec
Fix orphan blob accumulation on firmware upgrade
weebl2000 Feb 6, 2026
8e71508
Move cleanup logic to DataStore
weebl2000 Feb 6, 2026
a7e92f6
Save some more power when BLE/WiFi is disabled on the companion radio
weebl2000 Jan 8, 2026
0a09f73
Fix millis() overflow in companion powersave sleep timing
weebl2000 Feb 11, 2026
c089637
Fix sleep nRF52
weebl2000 Feb 16, 2026
a020315
Be more patient: increase companion timeouts
weebl2000 Feb 13, 2026
d41863a
Clarify bounds check comment in Packet::readFrom
weebl2000 Feb 11, 2026
a44f7fc
Fix 1970 date after crash/watchdog/brownout reset on ESP32
weebl2000 Mar 2, 2026
68f05d9
Merge remote-tracking branch 'weebl2000/allow-older-time' into dev_plus
weebl2000 Mar 2, 2026
927ed3d
Merge remote-tracking branch 'weebl2000/sync-gps-time-30min' into dev…
weebl2000 Mar 2, 2026
2eeb74c
Merge remote-tracking branch 'weebl2000/heltec_wireless_tracker_gps' …
weebl2000 Mar 2, 2026
253339f
Merge remote-tracking branch 'weebl2000/pass-rtc_clock-to-locationpro…
weebl2000 Mar 2, 2026
5d9e4cf
Merge remote-tracking branch 'weebl2000/LRU_cache_filterflood' into d…
weebl2000 Mar 2, 2026
1a12a3a
Merge remote-tracking branch 'weebl2000/robust-contacts' into dev_plus
weebl2000 Mar 2, 2026
b2a7b71
Merge remote-tracking branch 'weebl2000/heltec_deep_sleep_lna' into d…
weebl2000 Mar 2, 2026
8c769da
Merge remote-tracking branch 'weebl2000/fix/onetime-blob-cleanup' int…
weebl2000 Mar 2, 2026
2b45dfd
Merge remote-tracking branch 'weebl2000/default-button-low' into dev_…
weebl2000 Mar 2, 2026
eee4439
Merge remote-tracking branch 'weebl2000/fix/gps-uart-power-leak' into…
weebl2000 Mar 2, 2026
5b9106d
Merge remote-tracking branch 'weebl2000/fix/path-payload-bounds-check…
weebl2000 Mar 2, 2026
c3ce8a2
Merge remote-tracking branch 'weebl2000/fix/trace-oob-read' into dev_…
weebl2000 Mar 2, 2026
18e6692
Merge remote-tracking branch 'weebl2000/fix/constant-time-mac-compare…
weebl2000 Mar 2, 2026
2935f56
Merge remote-tracking branch 'weebl2000/fix/trace-path-len-bounds' in…
weebl2000 Mar 2, 2026
ec1c38a
Merge remote-tracking branch 'weebl2000/fix/out-frame-overflow' into …
weebl2000 Mar 2, 2026
c911048
Merge remote-tracking branch 'weebl2000/fix/wifi-skip-loop-hang' into…
weebl2000 Mar 2, 2026
860aa6b
Merge remote-tracking branch 'weebl2000/fix/advert-bounds-check-order…
weebl2000 Mar 2, 2026
f1409e0
Merge weebl2000/fix/path-len-max-size: keep both MAX_PATH_SIZE and pa…
weebl2000 Mar 2, 2026
81cdaed
Merge weebl2000/fix/trace-min-payload-len: keep both path_len+1 off-b…
weebl2000 Mar 2, 2026
fecd543
Merge remote-tracking branch 'weebl2000/fix/anon-req-reply-path-bound…
weebl2000 Mar 2, 2026
393e030
Merge remote-tracking branch 'weebl2000/fix/packet-readfrom-bounds' i…
weebl2000 Mar 2, 2026
2e4b1a3
Merge weebl2000/feature/aead-4-encryption: keep orphan blob cleanup +…
weebl2000 Mar 2, 2026
5e5fa28
Merge weebl2000/short-sleeps-when-phone-disconnects: add disconnect s…
weebl2000 Mar 2, 2026
c9ae1de
Merge remote-tracking branch 'weebl2000/be-more-patient' into dev_plus
weebl2000 Mar 2, 2026
cd0b5be
Merge remote-tracking branch 'weebl2000/random-backoff' into dev_plus
weebl2000 Mar 2, 2026
dc72896
Merge remote-tracking branch 'weebl2000/use-hardware-channel-activity…
weebl2000 Mar 2, 2026
5c05e15
Merge remote-tracking branch 'weebl2000/fixagcreset' into dev_plus
weebl2000 Mar 2, 2026
a7c4ace
Merge remote-tracking branch 'weebl2000/fix-rak3401-sky66122-11-fem' …
weebl2000 Mar 2, 2026
b64bf6e
Merge remote-tracking branch 'weebl2000/nit-prefs' into dev_plus
weebl2000 Mar 2, 2026
b7c5486
Merge weebl2000/multipath-fixes: keep both MAX_PATH_SIZE and data_len…
weebl2000 Mar 2, 2026
da6e811
Merge weebl2000/heltec_v4.3: take v4.3 FEM auto-detection (supersedes…
weebl2000 Mar 2, 2026
76798c7
Merge remote-tracking branch 'weebl2000/robust-time-esp32' into dev_plus
weebl2000 Mar 2, 2026
18e0d6b
Merge remote-tracking branch 'karvan/wessel_extras' into dev_plus
weebl2000 Mar 2, 2026
7983ae5
Merge remote-tracking branch 'ViezeVingertjes/feature/duty-cycle-toke…
weebl2000 Mar 2, 2026
db4e1f8
brads ikoka compile fix
andyshinn Feb 27, 2026
b504c00
fix Ikoka Handheld BLE LED state to properly blink
andyshinn Feb 27, 2026
f79bd02
use the green LED as a status LED since it is unused
andyshinn Feb 27, 2026
e05562a
completeness suggestion to set put output
andyshinn Feb 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
267 changes: 238 additions & 29 deletions examples/companion_radio/DataStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
#define MAX_BLOBRECS 20
#endif

// Atomic writes require ~2x storage for contacts file
// Only enable on platforms with sufficient flash
#if !defined(NRF52_PLATFORM) || defined(EXTRAFS) || defined(QSPIFLASH)
#define HAS_ATOMIC_WRITE_SUPPORT
#endif

DataStore::DataStore(FILESYSTEM& fs, mesh::RTCClock& clock) : _fs(&fs), _fsExtra(nullptr), _clock(&clock),
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
identity_store(fs, "")
Expand Down Expand Up @@ -271,42 +277,63 @@ void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_
}

void DataStore::loadContacts(DataStoreHost* host) {
File file = openRead(_getContactsChannelsFS(), "/contacts3");
if (file) {
bool full = false;
while (!full) {
ContactInfo c;
uint8_t pub_key[32];
uint8_t unused;

bool success = (file.read(pub_key, 32) == 32);
success = success && (file.read((uint8_t *)&c.name, 32) == 32);
success = success && (file.read(&c.type, 1) == 1);
success = success && (file.read(&c.flags, 1) == 1);
success = success && (file.read(&unused, 1) == 1);
success = success && (file.read((uint8_t *)&c.sync_since, 4) == 4); // was 'reserved'
success = success && (file.read((uint8_t *)&c.out_path_len, 1) == 1);
success = success && (file.read((uint8_t *)&c.last_advert_timestamp, 4) == 4);
success = success && (file.read(c.out_path, 64) == 64);
success = success && (file.read((uint8_t *)&c.lastmod, 4) == 4);
success = success && (file.read((uint8_t *)&c.gps_lat, 4) == 4);
success = success && (file.read((uint8_t *)&c.gps_lon, 4) == 4);

if (!success) break; // EOF
FILESYSTEM* fs = _getContactsChannelsFS();
File file = openRead(fs, "/contacts3");

#ifdef HAS_ATOMIC_WRITE_SUPPORT
// If main file doesn't exist or is empty, try backup
if (!file || file.size() == 0) {
if (file) file.close();
if (fs->exists("/contacts3.bak")) {
MESH_DEBUG_PRINTLN("WARN: contacts3 missing/empty, loading from backup");
file = openRead(fs, "/contacts3.bak");
}
}
#endif

c.id = mesh::Identity(pub_key);
if (!host->onContactLoaded(c)) full = true;
}
file.close();
if (file) {
bool full = false;
while (!full) {
ContactInfo c;
uint8_t pub_key[32];
uint8_t unused;

bool success = (file.read(pub_key, 32) == 32);
success = success && (file.read((uint8_t *)&c.name, 32) == 32);
success = success && (file.read(&c.type, 1) == 1);
success = success && (file.read(&c.flags, 1) == 1);
success = success && (file.read(&unused, 1) == 1);
success = success && (file.read((uint8_t *)&c.sync_since, 4) == 4); // was 'reserved'
success = success && (file.read((uint8_t *)&c.out_path_len, 1) == 1);
success = success && (file.read((uint8_t *)&c.last_advert_timestamp, 4) == 4);
success = success && (file.read(c.out_path, 64) == 64);
success = success && (file.read((uint8_t *)&c.lastmod, 4) == 4);
success = success && (file.read((uint8_t *)&c.gps_lat, 4) == 4);
success = success && (file.read((uint8_t *)&c.gps_lon, 4) == 4);

if (!success) break; // EOF

c.id = mesh::Identity(pub_key);
if (!host->onContactLoaded(c)) full = true;
}
file.close();
}
}

void DataStore::saveContacts(DataStoreHost* host) {
File file = openWrite(_getContactsChannelsFS(), "/contacts3");
FILESYSTEM* fs = _getContactsChannelsFS();

#ifdef HAS_ATOMIC_WRITE_SUPPORT
File file = openWrite(fs, "/contacts3.tmp");
#else
File file = openWrite(fs, "/contacts3");
#endif

if (file) {
uint32_t idx = 0;
ContactInfo c;
uint8_t unused = 0;
bool write_success = true;

while (host->getContactForSave(idx, c)) {
bool success = (file.write(c.id.pub_key, 32) == 32);
Expand All @@ -322,11 +349,26 @@ void DataStore::saveContacts(DataStoreHost* host) {
success = success && (file.write((uint8_t *)&c.gps_lat, 4) == 4);
success = success && (file.write((uint8_t *)&c.gps_lon, 4) == 4);

if (!success) break; // write failed
if (!success) {
write_success = false;
break; // write failed
}

idx++; // advance to next contact
}
file.flush();
file.close();

#ifdef HAS_ATOMIC_WRITE_SUPPORT
if (write_success) {
fs->rename("/contacts3", "/contacts3.bak");
fs->rename("/contacts3.tmp", "/contacts3");
fs->remove("/contacts3.bak");
} else {
fs->remove("/contacts3.tmp");
MESH_DEBUG_PRINTLN("ERROR: saveContacts write failed");
}
#endif
}
}

Expand Down Expand Up @@ -375,6 +417,140 @@ void DataStore::saveChannels(DataStoreHost* host) {
}
}

void DataStore::loadNonces(DataStoreHost* host) {
File file = openRead(_getContactsChannelsFS(), "/nonces");
if (file) {
uint8_t rec[6]; // 4-byte pub_key prefix + 2-byte nonce
while (file.read(rec, 6) == 6) {
uint16_t nonce;
memcpy(&nonce, &rec[4], 2);
host->onNonceLoaded(rec, nonce);
}
file.close();
}
}

bool DataStore::saveNonces(DataStoreHost* host) {
File file = openWrite(_getContactsChannelsFS(), "/nonces");
if (file) {
int idx = 0;
uint8_t pub_key_prefix[4];
uint16_t nonce;
while (host->getNonceForSave(idx, pub_key_prefix, &nonce)) {
file.write(pub_key_prefix, 4);
file.write((uint8_t*)&nonce, 2);
idx++;
}
file.close();
return true;
}
return false;
}

void DataStore::loadSessionKeys(DataStoreHost* host) {
File file = openRead(_getContactsChannelsFS(), "/sess_keys");
if (!file) return;
while (true) {
uint8_t rec[SESSION_KEY_RECORD_MIN_SIZE];
if (file.read(rec, SESSION_KEY_RECORD_MIN_SIZE) != SESSION_KEY_RECORD_MIN_SIZE) break;
uint8_t flags = rec[4];
uint16_t nonce;
memcpy(&nonce, &rec[5], 2);
uint8_t prev_key[SESSION_KEY_SIZE];
if (flags & SESSION_FLAG_PREV_VALID) {
if (file.read(prev_key, SESSION_KEY_SIZE) != SESSION_KEY_SIZE) break;
} else {
memset(prev_key, 0, SESSION_KEY_SIZE);
}
host->onSessionKeyLoaded(rec, flags, nonce, &rec[7], prev_key);
}
file.close();
}

bool DataStore::saveSessionKeys(DataStoreHost* host) {
FILESYSTEM* fs = _getContactsChannelsFS();

// 1. Read old flash file into buffer (variable-length records)
uint8_t old_buf[MAX_SESSION_KEYS_FLASH * SESSION_KEY_RECORD_SIZE];
int old_len = 0;
File rf = openRead(fs, "/sess_keys");
if (rf) {
while (true) {
if (old_len + SESSION_KEY_RECORD_MIN_SIZE > (int)sizeof(old_buf)) break;
if (rf.read(&old_buf[old_len], SESSION_KEY_RECORD_MIN_SIZE) != SESSION_KEY_RECORD_MIN_SIZE) break;
uint8_t flags = old_buf[old_len + 4];
int rec_len = SESSION_KEY_RECORD_MIN_SIZE;
if (flags & SESSION_FLAG_PREV_VALID) {
if (old_len + SESSION_KEY_RECORD_SIZE > (int)sizeof(old_buf)) break;
if (rf.read(&old_buf[old_len + SESSION_KEY_RECORD_MIN_SIZE], SESSION_KEY_SIZE) != SESSION_KEY_SIZE) break;
rec_len = SESSION_KEY_RECORD_SIZE;
}
old_len += rec_len;
}
rf.close();
}

// 2. Write merged file
File wf = openWrite(fs, "/sess_keys");
if (!wf) return false;

// Write kept old records (variable-length)
int pos = 0;
while (pos + SESSION_KEY_RECORD_MIN_SIZE <= old_len) {
uint8_t* rec = &old_buf[pos];
uint8_t flags = rec[4];
int rec_len = (flags & SESSION_FLAG_PREV_VALID) ? SESSION_KEY_RECORD_SIZE : SESSION_KEY_RECORD_MIN_SIZE;
if (pos + rec_len > old_len) break;
if (!host->isSessionKeyInRAM(rec) && !host->isSessionKeyRemoved(rec)) {
wf.write(rec, rec_len);
}
pos += rec_len;
}
// Write current RAM entries (variable-length)
for (int idx = 0; idx < MAX_SESSION_KEYS_RAM; idx++) {
uint8_t pk[4]; uint8_t fl; uint16_t n; uint8_t sk[32]; uint8_t psk[32];
if (!host->getSessionKeyForSave(idx, pk, &fl, &n, sk, psk)) continue;
wf.write(pk, 4); wf.write(&fl, 1); wf.write((uint8_t*)&n, 2);
wf.write(sk, 32);
if (fl & SESSION_FLAG_PREV_VALID) {
wf.write(psk, 32);
}
}
wf.close();
return true;
}

bool DataStore::loadSessionKeyByPrefix(const uint8_t* prefix,
uint8_t* flags, uint16_t* nonce, uint8_t* session_key, uint8_t* prev_session_key) {
File f = openRead(_getContactsChannelsFS(), "/sess_keys");
if (!f) return false;
while (true) {
uint8_t rec[SESSION_KEY_RECORD_MIN_SIZE];
if (f.read(rec, SESSION_KEY_RECORD_MIN_SIZE) != SESSION_KEY_RECORD_MIN_SIZE) break;
uint8_t rec_flags = rec[4];
bool has_prev = (rec_flags & SESSION_FLAG_PREV_VALID);
if (memcmp(rec, prefix, 4) == 0) {
*flags = rec_flags;
memcpy(nonce, &rec[5], 2);
memcpy(session_key, &rec[7], SESSION_KEY_SIZE);
if (has_prev) {
if (f.read(prev_session_key, SESSION_KEY_SIZE) != SESSION_KEY_SIZE) break;
} else {
memset(prev_session_key, 0, SESSION_KEY_SIZE);
}
f.close();
return true;
}
// Skip prev_key if present
if (has_prev) {
uint8_t skip[SESSION_KEY_SIZE];
if (f.read(skip, SESSION_KEY_SIZE) != SESSION_KEY_SIZE) break;
}
}
f.close();
return false;
}

#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)

#define MAX_ADVERT_PKT_LEN (2 + 32 + PUB_KEY_SIZE + 4 + SIGNATURE_SIZE + MAX_ADVERT_DATA_SIZE)
Expand Down Expand Up @@ -565,6 +741,7 @@ bool DataStore::putBlobByKey(const uint8_t key[], int key_len, const uint8_t src
bool DataStore::deleteBlobByKey(const uint8_t key[], int key_len) {
return true; // this is just a stub on NRF52/STM32 platforms
}
void DataStore::cleanOrphanBlobs(DataStoreHost* host) {}
#else
inline void makeBlobPath(const uint8_t key[], int key_len, char* path, size_t path_size) {
char fname[18];
Expand Down Expand Up @@ -608,7 +785,39 @@ bool DataStore::deleteBlobByKey(const uint8_t key[], int key_len) {
makeBlobPath(key, key_len, path, sizeof(path));

_fs->remove(path);

return true; // return true even if file did not exist
}

void DataStore::cleanOrphanBlobs(DataStoreHost* host) {
if (_fs->exists("/bl/.cleaned")) return;
MESH_DEBUG_PRINTLN("Cleaning orphan blobs...");
File root = openRead("/bl");
if (root) {
for (File f = root.openNextFile(); f; f = root.openNextFile()) {
const char* name = f.name();
f.close();
if (name[0] == '.' || strlen(name) != 16) continue;
uint8_t file_key[8];
if (!mesh::Utils::fromHex(file_key, 8, name)) continue;
bool found = false;
ContactInfo c;
for (uint32_t i = 0; host->getContactForSave(i, c) && !found; i++) {
found = (memcmp(file_key, c.id.pub_key, 8) == 0);
}
if (!found) {
char path[24];
sprintf(path, "/bl/%s", name);
_fs->remove(path);
}
}
root.close();
}
#if defined(ESP32)
File m = _fs->open("/bl/.cleaned", "w", true);
#else
File m = _fs->open("/bl/.cleaned", "w");
#endif
if (m) m.close();
}
#endif
15 changes: 15 additions & 0 deletions examples/companion_radio/DataStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ class DataStoreHost {
virtual bool getContactForSave(uint32_t idx, ContactInfo& contact) =0;
virtual bool onChannelLoaded(uint8_t channel_idx, const ChannelDetails& ch) =0;
virtual bool getChannelForSave(uint8_t channel_idx, ChannelDetails& ch) =0;
virtual bool onNonceLoaded(const uint8_t* pub_key_prefix, uint16_t nonce) { return false; }
virtual bool getNonceForSave(int idx, uint8_t* pub_key_prefix, uint16_t* nonce) { return false; }
virtual bool onSessionKeyLoaded(const uint8_t* pub_key_prefix, uint8_t flags, uint16_t nonce,
const uint8_t* session_key, const uint8_t* prev_session_key) { return false; }
virtual bool getSessionKeyForSave(int idx, uint8_t* pub_key_prefix, uint8_t* flags, uint16_t* nonce,
uint8_t* session_key, uint8_t* prev_session_key) { return false; }
virtual bool isSessionKeyInRAM(const uint8_t* pub_key_prefix) { return false; }
virtual bool isSessionKeyRemoved(const uint8_t* pub_key_prefix) { return false; }
};

class DataStore {
Expand Down Expand Up @@ -39,10 +47,17 @@ class DataStore {
void saveContacts(DataStoreHost* host);
void loadChannels(DataStoreHost* host);
void saveChannels(DataStoreHost* host);
void loadNonces(DataStoreHost* host);
bool saveNonces(DataStoreHost* host);
void loadSessionKeys(DataStoreHost* host);
bool saveSessionKeys(DataStoreHost* host);
bool loadSessionKeyByPrefix(const uint8_t* prefix,
uint8_t* flags, uint16_t* nonce, uint8_t* session_key, uint8_t* prev_session_key);
void migrateToSecondaryFS();
uint8_t getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]);
bool putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], uint8_t len);
bool deleteBlobByKey(const uint8_t key[], int key_len);
void cleanOrphanBlobs(DataStoreHost* host);
File openRead(const char* filename);
File openRead(FILESYSTEM* fs, const char* filename);
bool removeFile(const char* filename);
Expand Down
Loading
Loading