From 6cf9bb1d93d1fb154396f890b9f227c38263ec92 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 12 Mar 2018 15:01:13 +0100 Subject: [PATCH] src/apps/common: refactor new_device_id function --- src/apps/common/storage.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apps/common/storage.py b/src/apps/common/storage.py index f612883ba3..cd56a0c689 100644 --- a/src/apps/common/storage.py +++ b/src/apps/common/storage.py @@ -21,10 +21,14 @@ _FLAGS = const(0x08) # int _U2F_COUNTER = const(0x09) # int +def _new_device_id() -> str: + return hexlify(random.bytes(12)).decode().upper() + + def get_device_id() -> str: dev_id = config.get(_APP, _DEVICE_ID, True).decode() # public if not dev_id: - dev_id = new_device_id() + dev_id = _new_device_id() config.set(_APP, _DEVICE_ID, dev_id.encode(), True) # public return dev_id @@ -117,7 +121,3 @@ def set_u2f_counter(cntr: int): def wipe(): config.wipe() cache.clear() - - -def new_device_id() -> str: - return hexlify(random.bytes(12)).decode().upper()