Skip to content

Commit feca49f

Browse files
authored
Merge pull request #696 from fmoessbauer/master
fix base64 encoding of key field in config
2 parents da7fa31 + dfaf1a2 commit feca49f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

meshtastic/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,15 @@ def export_config(interface):
10341034
prefs[meshtastic.util.snake_to_camel(pref)] = config[pref]
10351035
else:
10361036
prefs[pref] = config[pref]
1037+
# mark base64 encoded fields as such
1038+
if pref == "security":
1039+
if 'privateKey' in prefs[pref]:
1040+
prefs[pref]['privateKey'] = 'base64:' + prefs[pref]['privateKey']
1041+
if 'publicKey' in prefs[pref]:
1042+
prefs[pref]['publicKey'] = 'base64:' + prefs[pref]['publicKey']
1043+
if 'adminKey' in prefs[pref]:
1044+
for i in range(len(prefs[pref]['adminKey'])):
1045+
prefs[pref]['adminKey'][i] = 'base64:' + prefs[pref]['adminKey'][i]
10371046
if mt_config.camel_case:
10381047
configObj["config"] = config
10391048
else:

0 commit comments

Comments
 (0)