11 lines
330 B
Python
11 lines
330 B
Python
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
|