From 2f440f17d365efe1eb91adeb1b1250815c7e65aa Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Sun, 11 Mar 2018 22:57:39 +0100 Subject: [PATCH] Revert "trezor/utils: refactor 'serialize_identity()'" This reverts commit de217f75dfdefd21e21b4535a52ebda34bc4fae3. --- 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 e037bddbc6..b915d550ae 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, serialize_identity +from trezor.utils import chunks from apps.common.confirm import require_confirm from trezor.ui.text import Text @@ -51,6 +51,21 @@ 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('