diff --git a/app/routes/api.py b/app/routes/api.py index da0c39e..1d75dc8 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -67,14 +67,20 @@ def compute_pkt_payload(channel_secret_hex, sender_timestamp, txt_type, text, at Reconstructs the encrypted GRP_TXT payload: channel_hash(1) + HMAC-MAC(2) + AES-128-ECB(plaintext) - where plaintext = timestamp(4 LE) + flags(1) + text(UTF-8) + null + zero-pad. + where plaintext = timestamp(4 LE) + flags(1) + text(UTF-8) [+ null + zero-pad]. + Firmware omits null+padding when header+text exactly fills an AES block boundary. """ secret = bytes.fromhex(channel_secret_hex) flags = ((txt_type & 0x3F) << 2) | (attempt & 0x03) - plaintext = struct.pack('