Meshview does not appear to support Meshtastic's standard one-byte PSK shorthand values, such as Ag==, when they are configured in mqtt.secondary_keys.
Meshtastic expands these shorthand PSKs internally to the corresponding 16-byte AES key. Meshview currently base64-decodes the configured value directly and uses the result as an AES key.
As a result:
[mqtt]secondary_keys=Ag==
decodes to a single byte (0x02) instead of the expected AES-128 key.
Steps to reproduce
Configure a Meshtastic channel with the PSK:
Ag==
Enable MQTT uplink for the channel.
Configure Meshview with:
[mqtt]secondary_keys=Ag==
Send a message on that channel.
Observe that Meshview does not decode the packet.
Replace the Meshview configuration with the expanded AES key:
[mqtt]secondary_keys=1PG7OiApB1nwvP+rz05pAg==
Restart Meshview and send another message.
Observe that the packet is decoded successfully.
Expected behavior
Meshview should accept Meshtastic PSKs in their normal channel configuration representation.
For example:
secondary_keys=Ag==
should internally expand to:
1PG7OiApB1nwvP+rz05pAg==
before being passed to AES.
Existing AQ== behavior
The default AQ== PSK effectively works because Meshview already hardcodes its expanded AES key:
This makes the behavior inconsistent: the default shorthand PSK works implicitly, while other Meshtastic shorthand PSKs do not work through secondary_keys.
Suggested fix
When parsing secondary_keys, detect Meshtastic one-byte PSKs and expand them using Meshtastic's standard PSK expansion logic before adding them to the decryption keyring.
It would also be useful to validate decoded key lengths and log a clear configuration error for invalid AES keys.
Meshview does not appear to support Meshtastic's standard one-byte PSK shorthand values, such as `Ag==`, when they are configured in `mqtt.secondary_keys`.
Meshtastic expands these shorthand PSKs internally to the corresponding 16-byte AES key. Meshview currently base64-decodes the configured value directly and uses the result as an AES key.
As a result:
```ini
[mqtt]
secondary_keys = Ag==
```
decodes to a single byte (`0x02`) instead of the expected AES-128 key.
## Steps to reproduce
1. Configure a Meshtastic channel with the PSK:
```text
Ag==
```
2. Enable MQTT uplink for the channel.
3. Configure Meshview with:
```ini
[mqtt]
secondary_keys = Ag==
```
4. Send a message on that channel.
5. Observe that Meshview does not decode the packet.
6. Replace the Meshview configuration with the expanded AES key:
```ini
[mqtt]
secondary_keys = 1PG7OiApB1nwvP+rz05pAg==
```
7. Restart Meshview and send another message.
8. Observe that the packet is decoded successfully.
## Expected behavior
Meshview should accept Meshtastic PSKs in their normal channel configuration representation.
For example:
```ini
secondary_keys = Ag==
```
should internally expand to:
```text
1PG7OiApB1nwvP+rz05pAg==
```
before being passed to AES.
## Existing `AQ==` behavior
The default `AQ==` PSK effectively works because Meshview already hardcodes its expanded AES key:
```python
PRIMARY_KEY = base64.b64decode("1PG7OiApB1nwvP+rz05pAQ==")
```
This makes the behavior inconsistent: the default shorthand PSK works implicitly, while other Meshtastic shorthand PSKs do not work through `secondary_keys`.
## Suggested fix
When parsing `secondary_keys`, detect Meshtastic one-byte PSKs and expand them using Meshtastic's standard PSK expansion logic before adding them to the decryption keyring.
It would also be useful to validate decoded key lengths and log a clear configuration error for invalid AES keys.
<!-- github-sync-id:5234333930 -->
Thank you! Just pulled it at [Meshtastic Greece Network meshview](https://meshview.m-powered.gr/)! Looking good so far
<!-- github-comment-id:5608265664 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Meshview does not appear to support Meshtastic's standard one-byte PSK shorthand values, such as
Ag==, when they are configured inmqtt.secondary_keys.Meshtastic expands these shorthand PSKs internally to the corresponding 16-byte AES key. Meshview currently base64-decodes the configured value directly and uses the result as an AES key.
As a result:
decodes to a single byte (
0x02) instead of the expected AES-128 key.Steps to reproduce
Configure a Meshtastic channel with the PSK:
Enable MQTT uplink for the channel.
Configure Meshview with:
Send a message on that channel.
Observe that Meshview does not decode the packet.
Replace the Meshview configuration with the expanded AES key:
Restart Meshview and send another message.
Observe that the packet is decoded successfully.
Expected behavior
Meshview should accept Meshtastic PSKs in their normal channel configuration representation.
For example:
should internally expand to:
before being passed to AES.
Existing
AQ==behaviorThe default
AQ==PSK effectively works because Meshview already hardcodes its expanded AES key:This makes the behavior inconsistent: the default shorthand PSK works implicitly, while other Meshtastic shorthand PSKs do not work through
secondary_keys.Suggested fix
When parsing
secondary_keys, detect Meshtastic one-byte PSKs and expand them using Meshtastic's standard PSK expansion logic before adding them to the decryption keyring.It would also be useful to validate decoded key lengths and log a clear configuration error for invalid AES keys.
Just released version 3.0.8 with all your fixes. Thank you!!
Thank you! Just pulled it at Meshtastic Greece Network meshview! Looking good so far