Commit 5872869d authored by Moul's avatar Moul
Browse files

[enh] #7: Auth: Seedhex, Seedhex file, PubSec

- masked Seedhex
parent 51963040
......@@ -15,9 +15,8 @@ You should have received a copy of the GNU Affero General Public License
along with Silkaj. If not, see <>.
from silkaj.crypto_tools import get_publickey_from_seed, b58_decode
from silkaj.crypto_tools import get_publickey_from_seed
from import message_exit
from nacl import encoding
from getpass import getpass
from os import path
from re import compile, search
......@@ -60,29 +59,26 @@ def auth_by_auth_file(cli_args):
message_exit('Error: the file "' + file + '" does not exist')
with open(file) as f:
filetxt =
regex_seed = compile("^[0-9a-fA-F]{64}$")
regex_gannonce = compile(
"^pub: [1-9A-HJ-NP-Za-km-z]{43,44}\nsec: [1-9A-HJ-NP-Za-km-z]{88,90}.*$"
# Seed Format
if search(regex_seed, filetxt):
seed = filetxt[0:64]
return SigningKey.from_seedhex_file(file)
# Format
elif search(regex_gannonce, filetxt):
private_key = filetxt.split("sec: ")[1].split("\n")[0]
seed = encoding.HexEncoder.encode(b58_decode(private_key))[0:64].decode("utf-8")
return SigningKey.from_pubsec_file(file)
message_exit("Error: the format of the file is invalid")
return seed
def auth_by_seed():
seed = input("Please enter your seed on hex format: ")
regex = compile("^[0-9a-fA-F]{64}$")
if not search(regex, seed):
message_exit("Error: the format of the seed is invalid")
return seed
seedhex = getpass("Please enter your seed on hex format: ")
return SigningKey.from_seedhex(seedhex)
except Exception as error:
def auth_by_scrypt(cli_args):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment