from nvstore import settings if 1: # test file contents: completeness, syntax from backups import render_backup_contents comments = 0 blanks = 0 checklist = set( 'mnemonic chain xprv xpub raw_secret fw_date fw_version fw_timestamp serial ' 'setting.terms_ok setting.idle_to setting.chain'.split(' ')) optional = set( 'setting.pms setting.axi setting.nick setting.lgto setting.usr hsm_policy setting.words long_secret multisig setting.multisig setting.fee_limit' .split(' ')) for ln in render_backup_contents().split('\n'): ln = ln.strip() if not ln: blanks += 1 continue if ln[0] == '#': comments += 1 continue assert '=' in ln, ln k, v = ln.split(' = ', 1) assert v and k assert (k in checklist) or (k in optional), "Unknown key: " + k checklist.discard(k)
import backups RV.write(backups.render_backup_contents())