forked from axiom-team/astroport
43 lines
947 B
Python
Executable File
43 lines
947 B
Python
Executable File
#!/usr/bin/env python3
|
|
import sys
|
|
from duniterpy.key import SigningKey
|
|
|
|
|
|
def generate_public_key(salt: str, password: str) -> str:
|
|
"""
|
|
Return public key from credentials
|
|
|
|
:param salt: Salt passphrase, using quotes if space in it
|
|
:param password: Password
|
|
"""
|
|
# Create key object
|
|
# key = SigningKey(salt, password)
|
|
key = SigningKey.from_credentials(salt, password)
|
|
# SigningKey.save_private_key("private.key", "./")
|
|
return key.pubkey
|
|
|
|
if __name__ == '__main__':
|
|
|
|
# if bad number of arguments...
|
|
if len(sys.argv) != 3:
|
|
|
|
# display command usage
|
|
print("""
|
|
Usage:
|
|
python gen_pubkey.py salt password
|
|
""")
|
|
|
|
# exit with status code error
|
|
exit(1)
|
|
|
|
# capture arguments
|
|
_salt = sys.argv[1]
|
|
_password = sys.argv[2]
|
|
|
|
# display the public key
|
|
print(generate_public_key(_salt, _password))
|
|
|
|
# exit with status code ok
|
|
exit(0)
|
|
|