mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-10-22 20:21:17 +00:00
Go ingestor never had channel decryption — GRP_TXT packets were stored with raw encrypted data while Node.js decoded them successfully. Changes: - decoder.go: Add decryptChannelMessage() implementing MeshCore channel crypto (HMAC-SHA256 MAC verification + AES-128-ECB decryption), matching the algorithm in @michaelhart/meshcore-decoder. Update decodeGrpTxt(), decodePayload(), and DecodePacket() to accept and pass channel keys. Add Payload fields: ChannelHashHex, DecryptionStatus, Channel, Text, Sender, SenderTimestamp. - config.go: Add ChannelKeysPath and ChannelKeys fields to Config struct. - main.go: Add loadChannelKeys() that loads channel-rainbow.json (same file used by Node.js server) from beside the config file, with env var and config overrides. Pass loaded keys through the decoder pipeline. - decoder_test.go: Add 14 channel decryption tests covering valid decryption, MAC failure, wrong key, no-sender messages, bracket sender exclusion, key iteration, channelHashHex formatting, and decryption status states. Cross-validated against Node.js output. - Update all DecodePacket/decodePayload/decodeGrpTxt/handleMessage call sites in test files to pass the new channelKeys parameter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>