Skip to content
Snippets Groups Projects
Commit 9528d83c authored by matograine's avatar matograine
Browse files

[enh] #301 : make `authfile` command display <pubkey:checksum> format

parent 1e45b19f
No related branches found
No related tags found
No related merge requests found
Pipeline #9774 passed
......@@ -23,9 +23,12 @@ from pathlib import Path
from duniterpy.key import SigningKey
from duniterpy.key.scrypt_params import ScryptParams
# had to import pubkey_with_checksum from wot to avoid loop dependency.
from silkaj.wot import pubkey_with_checksum
from silkaj.tools import message_exit
from silkaj.constants import PUBKEY_PATTERN
SEED_HEX_PATTERN = "^[0-9a-fA-F]{64}$"
PUBSEC_PUBKEY_PATTERN = "pub: ({0})".format(PUBKEY_PATTERN)
PUBSEC_SIGNKEY_PATTERN = "sec: ([1-9A-HJ-NP-Za-km-z]{87,90})"
......@@ -48,12 +51,13 @@ def auth_method(ctx):
def generate_auth_file(file):
key = auth_method()
authfile = Path(file)
pubkey_cksum = pubkey_with_checksum(key.pubkey)
if authfile.is_file():
confirm(
"Would you like to erase "
+ file
+ " by an authfile corresponding to following pubkey `"
+ key.pubkey
+ pubkey_cksum
+ "`?",
abort=True,
)
......@@ -61,7 +65,7 @@ def generate_auth_file(file):
print(
"Authentication file 'authfile' generated and stored in current\
folder for following public key:",
key.pubkey,
pubkey_cksum,
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment