python icon indicating copy to clipboard operation
python copied to clipboard

ch-set PSK should accept base64 by default or demonstrate base64 example in help

Open fastalan opened this issue 1 year ago • 1 comments

The info command and the UI display the channel keys as base64, and therefore the PSK command should accept and assume base64 encoding from the user on the CLI. Currently the example on the cli doesn't explain how to set that. Intuitively a user is going to pass the key as its displayed to the command. Ideally, the command should assume this format and accept it without any prefix, if that is not possible we should demonstrate the example.

Info shows: Channels: Index 0: PRIMARY psk=secret { "psk": "X8QAlvQebtEkvrPf2vMilXNjfVDg6RtByJZRBCipxCY=", "moduleSettings": { "positionPrecision": 13, "isClientMuted": false }, "channelNum": 0, "name": "", "id": 0, "uplinkEnabled": false, "downlinkEnabled": false }

Current implementation expects to set; meshtastic --ch-set psk "base64:X8QAlvQebtEkvrPf2vMilXNjfVDg6RtByJZRBCipxCY=" --ch-index 0

Implementation should accept: meshtastic --ch-set psk X8QAlvQebtEkvrPf2vMilXNjfVDg6RtByJZRBCipxCY= --ch-index 0

Alternatively, the help should say:

--ch-set FIELD VALUE Set a channel parameter. To see channel settings available:'--ch-set all all --ch-index 0'. Can set the 'psk' using this command. To disable encryption on primary channel:'--ch-set psk none --ch-index 0'. To set encryption with a new random key on second channel:'--ch-set psk random --ch-index 1'. To set encryption back to the default:'--ch-set psk default --ch- index 0'. To set encryption with your own key: '--ch-set psk "base64:X8QAlvQebtEkvrPf2vMilXNjfVDg6RtByJZRBCipxCY=" --ch-index 0'.

fastalan avatar Dec 19 '24 14:12 fastalan

https://meshtastic.org/docs/configuration/radio/channels/#psk

caveman99 avatar Dec 19 '24 15:12 caveman99