import sys if sys.platform == 'trezor': # stmhal - use binary module (not working atm) from TrezorConfig import Config _config = Config() def get(app, key, default=None): v = _config.get(app, key) return v if v else default def set(app, key, value): return _config.set(app, key, value) else: # emulator (mock implementation using binary file) import ustruct _mock = {} _file = 'trezor.config' def _load(): try: with open(_file, 'rb') as f: while True: d = f.read(4) if len(d) != 4: break k, l = ustruct.unpack('