From 7f2f09918b0498e351bda73f491cbf465e85821d Mon Sep 17 00:00:00 2001
From: vtexier <vit@free.fr>
Date: Sun, 3 Nov 2019 15:44:50 +0100
Subject: [PATCH] [enh] #58 move get_ws2p_challenge() in ws2p helper

---
 duniterpy/documents/ws2p/messages.py |  2 +-
 duniterpy/helpers/ws2p.py            | 11 +++++++++++
 duniterpy/tools.py                   | 10 ----------
 examples/request_ws2p.py             |  3 +--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/duniterpy/documents/ws2p/messages.py b/duniterpy/documents/ws2p/messages.py
index ff80fc6a..175dc7d2 100644
--- a/duniterpy/documents/ws2p/messages.py
+++ b/duniterpy/documents/ws2p/messages.py
@@ -4,7 +4,7 @@ from typing import Optional
 
 from duniterpy.documents import Document
 from duniterpy.key import VerifyingKey, SigningKey
-from duniterpy.tools import get_ws2p_challenge
+from duniterpy.helpers.ws2p import get_ws2p_challenge
 
 
 class Connect(Document):
diff --git a/duniterpy/helpers/ws2p.py b/duniterpy/helpers/ws2p.py
index 16cf4b89..8355bd14 100644
--- a/duniterpy/helpers/ws2p.py
+++ b/duniterpy/helpers/ws2p.py
@@ -1,3 +1,5 @@
+import uuid
+
 import jsonschema
 
 from duniterpy.api import ws2p
@@ -87,3 +89,12 @@ async def handshake(
 
             # exit loop
             break
+
+
+def get_ws2p_challenge() -> str:
+    """
+    Return two uuid v4 concatened as ws2p challenge
+
+    :rtype str:
+    """
+    return str(uuid.uuid4()) + str(uuid.uuid4())
diff --git a/duniterpy/tools.py b/duniterpy/tools.py
index f2bb3b2a..d24ce395 100644
--- a/duniterpy/tools.py
+++ b/duniterpy/tools.py
@@ -1,4 +1,3 @@
-import uuid
 from typing import Union
 from libnacl.encode import hex_decode, hex_encode
 
@@ -61,12 +60,3 @@ def convert_seed_to_seedhex(seed: bytes) -> str:
     :rtype str:
     """
     return hex_encode(seed).decode("utf-8")
-
-
-def get_ws2p_challenge() -> str:
-    """
-    Return two uuid v4 concatened as ws2p challenge
-
-    :rtype str:
-    """
-    return str(uuid.uuid4()) + str(uuid.uuid4())
diff --git a/examples/request_ws2p.py b/examples/request_ws2p.py
index 55671ac2..c6238fd1 100644
--- a/examples/request_ws2p.py
+++ b/examples/request_ws2p.py
@@ -8,10 +8,9 @@ import aiohttp
 import jsonschema
 from jsonschema import ValidationError
 
-from duniterpy.tools import get_ws2p_challenge
 from duniterpy.key import SigningKey
 
-from duniterpy.helpers.ws2p import handshake
+from duniterpy.helpers.ws2p import handshake, get_ws2p_challenge
 from duniterpy.api.ws2p import requests
 from duniterpy.api.client import Client
 
-- 
GitLab