Skip to content
Snippets Groups Projects
Commit 7f2f0991 authored by Vincent Texier's avatar Vincent Texier
Browse files

[enh] #58 move get_ws2p_challenge() in ws2p helper

parent 68e84cb2
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ from typing import Optional ...@@ -4,7 +4,7 @@ from typing import Optional
from duniterpy.documents import Document from duniterpy.documents import Document
from duniterpy.key import VerifyingKey, SigningKey from duniterpy.key import VerifyingKey, SigningKey
from duniterpy.tools import get_ws2p_challenge from duniterpy.helpers.ws2p import get_ws2p_challenge
class Connect(Document): class Connect(Document):
......
import uuid
import jsonschema import jsonschema
from duniterpy.api import ws2p from duniterpy.api import ws2p
...@@ -87,3 +89,12 @@ async def handshake( ...@@ -87,3 +89,12 @@ async def handshake(
# exit loop # exit loop
break break
def get_ws2p_challenge() -> str:
"""
Return two uuid v4 concatened as ws2p challenge
:rtype str:
"""
return str(uuid.uuid4()) + str(uuid.uuid4())
import uuid
from typing import Union from typing import Union
from libnacl.encode import hex_decode, hex_encode from libnacl.encode import hex_decode, hex_encode
...@@ -61,12 +60,3 @@ def convert_seed_to_seedhex(seed: bytes) -> str: ...@@ -61,12 +60,3 @@ def convert_seed_to_seedhex(seed: bytes) -> str:
:rtype str: :rtype str:
""" """
return hex_encode(seed).decode("utf-8") 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())
...@@ -8,10 +8,9 @@ import aiohttp ...@@ -8,10 +8,9 @@ import aiohttp
import jsonschema import jsonschema
from jsonschema import ValidationError from jsonschema import ValidationError
from duniterpy.tools import get_ws2p_challenge
from duniterpy.key import SigningKey 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.ws2p import requests
from duniterpy.api.client import Client from duniterpy.api.client import Client
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment