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
Merge requests
!89
#113
Implement block signature verification
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
#113
Implement block signature verification
113_block_sign_verification
into
dev
Overview
1
Commits
4
Pipelines
1
Changes
2
Merged
Moul
requested to merge
113_block_sign_verification
into
dev
5 years ago
Overview
1
Commits
4
Pipelines
1
Changes
2
Expand
[feat]
#113 (closed)
: Handle block signature verification
[test]
#113 (closed)
: Add test for block signature verification
[test]
#113 (closed)
: Add test for transaction signature verification
[mod] Remove useless cotes
0
0
Merge request reports
Compare
dev
dev (base)
and
latest version
latest version
6d257b15
4 commits,
5 years ago
2 files
+
68
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
duniterpy/key/verifying_key.py
+
8
−
1
Options
@@ -11,6 +11,7 @@ import libnacl.sign
import
libnacl.encode
from
duniterpy.documents
import
Document
from
duniterpy.documents.block
import
Block
from
.base58
import
Base58Encoder
@@ -34,7 +35,13 @@ class VerifyingKey(libnacl.sign.Verifier):
:return:
"""
signature
=
base64
.
b64decode
(
document
.
signatures
[
0
])
prepended
=
signature
+
bytes
(
document
.
raw
(),
"
ascii
"
)
if
isinstance
(
document
,
Block
):
content_to_verify
=
"
InnerHash: {0}
\n
Nonce: {1}
\n
"
.
format
(
document
.
inner_hash
,
document
.
nonce
)
else
:
content_to_verify
=
document
.
raw
()
prepended
=
signature
+
bytes
(
content_to_verify
,
"
ascii
"
)
try
:
self
.
verify
(
prepended
)
Loading