Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DuniterPy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
bb07b1f7
Commit
bb07b1f7
authored
6 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
issue
#52
Fix code and tests
parent
e685da93
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
duniterpy/api/ws2p/network.py
+9
-1
9 additions, 1 deletion
duniterpy/api/ws2p/network.py
duniterpy/documents/ws2p/heads.py
+2
-2
2 additions, 2 deletions
duniterpy/documents/ws2p/heads.py
duniterpy/key/verifying_key.py
+4
-3
4 additions, 3 deletions
duniterpy/key/verifying_key.py
with
15 additions
and
6 deletions
duniterpy/api/ws2p/network.py
+
9
−
1
View file @
bb07b1f7
...
@@ -54,4 +54,12 @@ WS2P_HEADS_SCHEMA = {
...
@@ -54,4 +54,12 @@ WS2P_HEADS_SCHEMA = {
"
required
"
:
[
"
heads
"
]
"
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
)
This diff is collapsed.
Click to expand it.
duniterpy/documents/ws2p/heads.py
+
2
−
2
View file @
bb07b1f7
...
@@ -22,8 +22,8 @@ class API:
...
@@ -22,8 +22,8 @@ class API:
data
=
API
.
re_inline
.
match
(
inline
)
data
=
API
.
re_inline
.
match
(
inline
)
if
data
is
None
:
if
data
is
None
:
raise
MalformedDocumentError
(
"
WS2P API Document
"
)
raise
MalformedDocumentError
(
"
WS2P API Document
"
)
private
=
data
.
group
(
1
)
private
=
""
if
data
.
group
(
1
)
is
None
else
data
.
group
(
1
)
public
=
data
.
group
(
2
)
public
=
""
if
data
.
group
(
2
)
is
None
else
data
.
group
(
2
)
return
cls
(
private
,
public
)
return
cls
(
private
,
public
)
def
__str__
(
self
)
->
str
:
def
__str__
(
self
)
->
str
:
...
...
This diff is collapsed.
Click to expand it.
duniterpy/key/verifying_key.py
+
4
−
3
View file @
bb07b1f7
...
@@ -5,11 +5,12 @@ duniter public and private keys
...
@@ -5,11 +5,12 @@ duniter public and private keys
"""
"""
import
base64
import
base64
from
typing
import
Any
import
libnacl.sign
import
libnacl.sign
import
libnacl.encode
import
libnacl.encode
from
duniterpy.documents
import
Document
from
duniterpy.documents
import
Document
from
duniterpy.documents.ws2p.heads
import
HeadV2
from
.base58
import
Base58Encoder
from
.base58
import
Base58Encoder
...
@@ -41,10 +42,10 @@ class VerifyingKey(libnacl.sign.Verifier):
...
@@ -41,10 +42,10 @@ class VerifyingKey(libnacl.sign.Verifier):
except
ValueError
:
except
ValueError
:
return
False
return
False
def
verify_ws2p_head
(
self
,
head
:
HeadV2
)
->
bool
:
def
verify_ws2p_head
(
self
,
head
:
Any
)
->
bool
:
"""
"""
Check specified document
Check specified document
:param
HeadV2
head:
:param
Any
head:
:return:
:return:
"""
"""
signature
=
base64
.
b64decode
(
head
.
signature
)
signature
=
base64
.
b64decode
(
head
.
signature
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment