[#1] Add method get_private_key_from_wif
Signed-off-by: ilyas585 <niyazov2023@gmail.com>
This commit is contained in:
parent
480d288e2a
commit
97bc53c6f4
6 changed files with 68 additions and 0 deletions
0
frostfs_api/__init__.py
Normal file
0
frostfs_api/__init__.py
Normal file
11
frostfs_api/crypto/key_extension.py
Normal file
11
frostfs_api/crypto/key_extension.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
import base58
|
||||
|
||||
|
||||
class KeyExtension:
|
||||
def get_private_key_from_wif(self, wif: str):
|
||||
decoded = base58.b58decode_check(wif)
|
||||
if len(decoded) != 34 or decoded[0] != 0x80 or decoded[-1] != 0x01:
|
||||
raise ValueError("Incorrect WIF private key")
|
||||
|
||||
private_key = decoded[1:-1]
|
||||
return private_key
|
Loading…
Add table
Add a link
Reference in a new issue