def _new_device_id() -> str: from trezorcrypto import random # avoid pulling in trezor.crypto return hexlify(random.bytes(12)).decode().upper()
def export_session_id(self) -> bytes: # generate a new session id if we don't have it yet if not self.session_id: self.session_id[:] = random.bytes(_SESSION_ID_LENGTH) # export it as immutable bytes return bytes(self.session_id)