Skip to content
clach04 edited this page Nov 3, 2018 · 1 revision

Welcome to the pebble-authenticator wiki!

Gen code

num = 3



# f-strings does not appear to support escaping {}
# can't be bothered to use template
template = ''',
            {
                "type": "input",
                "label": "Name 0{num}",
                "description": "Name limited to 16 bytes",
                "messageKey": "S0{index_num}_NAME",
                "defaultValue": "",
                "attributes": {
                    "limit": 16
                }
            },
            {
                "type": "input",
                "label": "Secret 0{num}",
                "description": "Secret limited to 16 bytes. NOTE do NOT include padding '\\"'='",
                "messageKey": "S0{index_num}_SECRET",
                "defaultValue": "",
                "attributes": {
                    "limit": 16
                }
            }
'''

build_template = ''',
"S0{index_num}_NAME",
"S0{index_num}_SECRET"

'''

configload_template = '''
    DO_SETTINGS_NAME({index_num})
    DO_SETTINGS_SECRET({index_num})
'''

index_num = str(num - 1)
num = str(num)
t = template.replace('{index_num}', index_num).replace('{num}', num)
print(t)

t = build_template.replace('{index_num}', index_num).replace('{num}', num)
print(t)

t = configload_template.replace('{index_num}', index_num).replace('{num}', num)
print(t)
Clone this wiki locally