From de217f75dfdefd21e21b4535a52ebda34bc4fae3 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Fri, 9 Mar 2018 17:13:18 +0200 Subject: [PATCH] trezor/utils: refactor 'serialize_identity()' --- src/apps/wallet/sign_identity.py | 17 +---------------- src/trezor/utils.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/apps/wallet/sign_identity.py b/src/apps/wallet/sign_identity.py index b915d550ae..e037bddbc6 100644 --- a/src/apps/wallet/sign_identity.py +++ b/src/apps/wallet/sign_identity.py @@ -2,7 +2,7 @@ from trezor import ui from trezor.crypto.hashlib import sha256 from trezor.messages.SignedIdentity import SignedIdentity from ustruct import pack, unpack -from trezor.utils import chunks +from trezor.utils import chunks, serialize_identity from apps.common.confirm import require_confirm from trezor.ui.text import Text @@ -51,21 +51,6 @@ async def require_confirm_sign_identity(ctx, identity, challenge_visual): await require_confirm(ctx, content) -def serialize_identity(identity): - s = '' - if identity.proto: - s += identity.proto + '://' - if identity.user: - s += identity.user + '@' - if identity.host: - s += identity.host - if identity.port: - s += ':' + identity.port - if identity.path: - s += identity.path - return s - - def get_identity_path(identity: str, index: int): identity_hash = sha256(pack('