Key per-channel storage by PSK-derived channel ID

Channel messages, settings, region, order and images were persisted by
radio slot index, so a slot reused for a different channel inherited the
old channel's history and settings (#359).

- Channel.storageId: first 8 bytes of SHA-256("meshcore-channel:" + psk).
- All per-channel stores key by channel ID; in-memory state stays by slot.
- The connector keeps a slot -> channel ID map, diffs it against the saved
  map on every channel sync and reloads slots whose channel changed.
- Queued channel frames wait until this session's map is confirmed.
- One-shot per-radio migration from slot keys, using the cached channel
  list the legacy data was written under; rerun-safe if interrupted.
- Deleting a channel clears its data; a channel removed elsewhere keeps its
  history and gets it back when re-added. A PSK edit keeps its place in
  the custom order.
- Slots sharing a PSK share history and settings.
- Image entries record their channel ID; a slot change resets that slot's
  in-progress reassembly.
This commit is contained in:
zjs81 committed 2026-10-11 17:52:59 -07:00
1 parent d30744aa31
commit 679116ed03
24 files changed
+1794 -340

No files matched your search

+3 -2
View File
@@ -604,6 +604,7 @@ void main() {
() async {
final store = ChannelMessageStore()..publicKeyHex = '1234567890';
final channelIndex = 1;
const channelId = '0123456789abcdef';
final rawPath = Uint8List(64)
..[0] = 0xBB
@@ -623,11 +624,11 @@ void main() {
final prefs = PrefsManager.instance;
await prefs.setString(
'${store.keyFor}$channelIndex',
'${store.keyFor}_$channelId',
jsonEncode(messageJson),
);
final messages = await store.loadChannelMessages(channelIndex);
final messages = await store.loadChannelMessages(channelId);
expect(messages, hasLength(1));
expect(messages.first.pathLength, equals(1));
expect(