Skip to content
Snippets Groups Projects
Commit 721fba91 authored by Moul's avatar Moul
Browse files
parent ff6dbbe0
No related branches found
No related tags found
No related merge requests found
Pipeline #5914 failed
from duniterpy.key import SigningKey from duniterpy.key import SigningKey
import getpass import getpass
import os import os
from pathlib import Path
if "XDG_CONFIG_HOME" in os.environ: if "XDG_CONFIG_HOME" in os.environ:
home_path = os.environ["XDG_CONFIG_HOME"] home_path = Path(os.environ["XDG_CONFIG_HOME"])
elif "HOME" in os.environ: elif "HOME" in os.environ:
home_path = os.environ["HOME"] home_path = Path(os.environ["HOME"])
elif "APPDATA" in os.environ: elif "APPDATA" in os.environ:
home_path = os.environ["APPDATA"] home_path = Path(os.environ["APPDATA"])
else: else:
home_path = os.path.dirname(__file__) home_path = Path(__file__).parent
# CONFIG ####################################### # CONFIG #######################################
# WARNING : Hide this file in a safe and secure place # WARNING : Hide this file in a safe and secure place
# If one day you forget your credentials, # If one day you forget your credentials,
# you'll have to use one of your private keys instead # you'll have to use one of your private keys instead
PRIVATE_KEYS_FILE_PATH = os.path.join(home_path, ".duniter_account_private_keys.txt") PRIVATE_KEYS_FILE_PATH = Path(home_path, ".duniter_account_private_keys.txt")
################################################ ################################################
......
from duniterpy.key import SigningKey from duniterpy.key import SigningKey
import getpass import getpass
import os import os
from pathlib import Path
if "XDG_CONFIG_HOME" in os.environ: if "XDG_CONFIG_HOME" in os.environ:
home_path = os.environ["XDG_CONFIG_HOME"] home_path = Path(os.environ["XDG_CONFIG_HOME"])
elif "HOME" in os.environ: elif "HOME" in os.environ:
home_path = os.environ["HOME"] home_path = Path(os.environ["HOME"])
elif "APPDATA" in os.environ: elif "APPDATA" in os.environ:
home_path = os.environ["APPDATA"] home_path = Path(os.environ["APPDATA"])
else: else:
home_path = os.path.dirname(__file__) home_path = Path(__file__).parent
# CONFIG ####################################### # CONFIG #######################################
# WARNING : Hide this file in a safe and secure place # WARNING : Hide this file in a safe and secure place
# If one day you forget your credentials, # If one day you forget your credentials,
# you'll have to use one of your private keys instead # you'll have to use one of your private keys instead
PRIVATE_KEY_FILE_PATH = os.path.join(home_path, ".duniter_account_ewif_v1.duniterkey") PRIVATE_KEY_FILE_PATH = Path(home_path, ".duniter_account_ewif_v1.duniterkey")
################################################ ################################################
......
from duniterpy.key import SigningKey from duniterpy.key import SigningKey
import getpass import getpass
import os import os
from pathlib import Path
if "XDG_CONFIG_HOME" in os.environ: if "XDG_CONFIG_HOME" in os.environ:
home_path = os.environ["XDG_CONFIG_HOME"] home_path = Path(os.environ["XDG_CONFIG_HOME"])
elif "HOME" in os.environ: elif "HOME" in os.environ:
home_path = os.environ["HOME"] home_path = Path(os.environ["HOME"])
elif "APPDATA" in os.environ: elif "APPDATA" in os.environ:
home_path = os.environ["APPDATA"] home_path = Path(os.environ["APPDATA"])
else: else:
home_path = os.path.dirname(__file__) home_path = Path(__file__).parent
# CONFIG ####################################### # CONFIG #######################################
# WARNING : Hide this file in a safe and secure place # WARNING : Hide this file in a safe and secure place
# If one day you forget your credentials, # If one day you forget your credentials,
# you'll have to use one of your private keys instead # you'll have to use one of your private keys instead
PRIVATE_KEY_FILE_PATH = os.path.join(home_path, ".duniter_account_pubsec_v1.duniterkey") PRIVATE_KEY_FILE_PATH = Path(home_path, ".duniter_account_pubsec_v1.duniterkey")
################################################ ################################################
......
from duniterpy.key import SigningKey from duniterpy.key import SigningKey
import getpass import getpass
import os import os
from pathlib import Path
if "XDG_CONFIG_HOME" in os.environ: if "XDG_CONFIG_HOME" in os.environ:
home_path = os.environ["XDG_CONFIG_HOME"] home_path = Path(os.environ["XDG_CONFIG_HOME"])
elif "HOME" in os.environ: elif "HOME" in os.environ:
home_path = os.environ["HOME"] home_path = Path(os.environ["HOME"])
elif "APPDATA" in os.environ: elif "APPDATA" in os.environ:
home_path = os.environ["APPDATA"] home_path = Path(os.environ["APPDATA"])
else: else:
home_path = os.path.dirname(__file__) home_path = Path(__file__).parent
# CONFIG ####################################### # CONFIG #######################################
# WARNING : Hide this file in a safe and secure place # WARNING : Hide this file in a safe and secure place
# If one day you forget your credentials, # If one day you forget your credentials,
# you'll have to use one of your private keys instead # you'll have to use one of your private keys instead
PRIVATE_KEY_FILE_PATH = os.path.join(home_path, ".duniter_account_wif_v1.duniterkey") PRIVATE_KEY_FILE_PATH = Path(home_path, ".duniter_account_wif_v1.duniterkey")
################################################ ################################################
......
import os from pathlib import Path
from duniterpy.key import VerifyingKey, SigningKey, PublicKey from duniterpy.key import VerifyingKey, SigningKey, PublicKey
from duniterpy.key.scrypt_params import ScryptParams from duniterpy.key.scrypt_params import ScryptParams
import unittest import unittest
TEST_FILE_PATH = "/tmp/test_file.txt" TEST_FILE_PATH = Path("/tmp/test_file.txt")
class TestSigningKey(unittest.TestCase): class TestSigningKey(unittest.TestCase):
...@@ -12,8 +12,8 @@ class TestSigningKey(unittest.TestCase): ...@@ -12,8 +12,8 @@ class TestSigningKey(unittest.TestCase):
super(TestSigningKey, self) super(TestSigningKey, self)
# remove test file from disk # remove test file from disk
if os.path.exists(TEST_FILE_PATH): if TEST_FILE_PATH.exists():
os.unlink(TEST_FILE_PATH) TEST_FILE_PATH.unlink()
def test_decrypt_seal(self): def test_decrypt_seal(self):
sign_key = SigningKey.from_credentials("alice", "password", ScryptParams()) sign_key = SigningKey.from_credentials("alice", "password", ScryptParams())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment