Commit bb07b1f7 authored by Vincent Texier's avatar Vincent Texier

issue #52 Fix code and tests

parent e685da93
......@@ -54,4 +54,12 @@ WS2P_HEADS_SCHEMA = {
"required": ["heads"]
}
# todo: support ws2p v1 api
def heads(client: Client):
"""
GET Certification data over a member
:param client: Client to connect to the api
:rtype: dict
"""
return client.get(MODULE + '/ws2p/heads', schema=WS2P_HEADS_SCHEMA)
......@@ -22,8 +22,8 @@ class API:
data = API.re_inline.match(inline)
if data is None:
raise MalformedDocumentError("WS2P API Document")
private = data.group(1)
public = data.group(2)
private = "" if data.group(1) is None else data.group(1)
public = "" if data.group(2) is None else data.group(2)
return cls(private, public)
def __str__(self) -> str:
......
......@@ -5,11 +5,12 @@ duniter public and private keys
"""
import base64
from typing import Any
import libnacl.sign
import libnacl.encode
from duniterpy.documents import Document
from duniterpy.documents.ws2p.heads import HeadV2
from .base58 import Base58Encoder
......@@ -41,10 +42,10 @@ class VerifyingKey(libnacl.sign.Verifier):
except ValueError:
return False
def verify_ws2p_head(self, head: HeadV2) -> bool:
def verify_ws2p_head(self, head: Any) -> bool:
"""
Check specified document
:param HeadV2 head:
:param Any head:
:return:
"""
signature = base64.b64decode(head.signature)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment