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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
python
DuniterPy
Commits
521e1847
Commit
521e1847
authored
6 years ago
by
Vincent Texier
Browse files
Options
Downloads
Patches
Plain Diff
[fix] fix pycharm alerts
Use staticmethod decorators on static methods Reformat code
parent
ce88ac46
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!52
#51: (E)WIF: add four methods: devine format, allow passing to the f() an hexadecimal string
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
duniterpy/key/signing_key.py
+7
-3
7 additions, 3 deletions
duniterpy/key/signing_key.py
with
7 additions
and
3 deletions
duniterpy/key/signing_key.py
+
7
−
3
View file @
521e1847
...
...
@@ -154,11 +154,13 @@ pub: {pubkey}
sec: {signkey}
"""
.
format
(
version
=
version
,
pubkey
=
base58_public_key
,
signkey
=
base58_signing_key
)
)
@staticmethod
def
from_wif_or_ewif_file
(
path
:
str
,
password
:
str
=
None
)
->
SigningKeyType
:
"""
Return SigningKey instance from Duniter WIF or EWIF file
:param path: Path to WIF of EWIF file
:param password: Password needed for EWIF file
"""
with
open
(
path
,
'
r
'
)
as
fh
:
wif_content
=
fh
.
read
()
...
...
@@ -173,6 +175,7 @@ sec: {signkey}""".format(version=version, pubkey=base58_public_key, signkey=base
wif_hex
=
match
.
groups
()[
0
]
return
SigningKey
.
from_wif_or_ewif_hex
(
wif_hex
,
password
)
@staticmethod
def
from_wif_or_ewif_hex
(
wif_hex
:
str
,
password
:
str
=
None
)
->
SigningKeyType
:
"""
Return SigningKey instance from Duniter WIF or EWIF in hexadecimal format
...
...
@@ -191,7 +194,7 @@ sec: {signkey}""".format(version=version, pubkey=base58_public_key, signkey=base
else
:
raise
Exception
(
"
Error: Bad format: not WIF nor EWIF
"
)
@staticmethod
def
from_wif_file
(
path
:
str
)
->
SigningKeyType
:
"""
Return SigningKey instance from Duniter WIF file
...
...
@@ -266,6 +269,7 @@ Version: {version}
Data: {data}
"""
.
format
(
version
=
version
,
data
=
wif_key
)
)
@staticmethod
def
from_ewif_file
(
path
:
str
,
password
:
str
)
->
SigningKeyType
:
"""
Return SigningKey instance from Duniter EWIF file
...
...
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