mirror of https://github.com/nucypher/nucypher.git
Added "nucypher ursula public-keys" for printing ferveo key based on current keystore.
Co-authored-by: KPrasch <kieranprasch@gmail.com>pull/3554/head
parent
8ff2c9e6b3
commit
c64e5c8643
|
@ -50,7 +50,12 @@ from nucypher.cli.options import (
|
|||
option_teacher_uri,
|
||||
)
|
||||
from nucypher.cli.painting.help import paint_new_installation_help
|
||||
from nucypher.cli.types import EIP55_CHECKSUM_ADDRESS, NETWORK_PORT, OPERATOR_IP
|
||||
from nucypher.cli.types import (
|
||||
EIP55_CHECKSUM_ADDRESS,
|
||||
EXISTING_READABLE_FILE,
|
||||
NETWORK_PORT,
|
||||
OPERATOR_IP,
|
||||
)
|
||||
from nucypher.cli.utils import make_cli_character, setup_emitter
|
||||
from nucypher.config.characters import UrsulaConfiguration
|
||||
from nucypher.config.constants import (
|
||||
|
@ -59,6 +64,8 @@ from nucypher.config.constants import (
|
|||
TEMPORARY_DOMAIN_NAME,
|
||||
)
|
||||
from nucypher.crypto.keystore import Keystore
|
||||
from nucypher.crypto.powers import RitualisticPower
|
||||
from nucypher.utilities.emitters import StdoutEmitter
|
||||
from nucypher.utilities.prometheus.metrics import PrometheusMetricsConfig
|
||||
|
||||
|
||||
|
@ -557,6 +564,29 @@ def config(general_config, config_options, config_file, force, action):
|
|||
updates=updates)
|
||||
|
||||
|
||||
@ursula.command()
|
||||
@click.option(
|
||||
"--keystore-filepath",
|
||||
help="Path to keystore .priv file",
|
||||
type=EXISTING_READABLE_FILE,
|
||||
required=True,
|
||||
)
|
||||
def public_keys(keystore_filepath):
|
||||
emitter = StdoutEmitter()
|
||||
keystore = Keystore(keystore_filepath)
|
||||
|
||||
# unlock keystore
|
||||
password = get_nucypher_password(emitter=emitter, confirm=False)
|
||||
keystore.unlock(password)
|
||||
|
||||
ritualistic_power = keystore.derive_crypto_power(RitualisticPower)
|
||||
keystore_file_data = json.load(open(keystore_filepath, "r"))
|
||||
emitter.echo(f"Keystore timestamp ........ {keystore_file_data['created']}")
|
||||
emitter.echo(
|
||||
f"Ferveo Public Key ......... {bytes(ritualistic_power.public_key()).hex()}"
|
||||
)
|
||||
|
||||
|
||||
def _pre_launch_warnings(emitter, dev, force):
|
||||
if dev:
|
||||
emitter.echo(DEVELOPMENT_MODE_WARNING, color='yellow', verbosity=1)
|
||||
|
|
|
@ -7,7 +7,7 @@ from json import JSONDecodeError
|
|||
from os.path import abspath
|
||||
from pathlib import Path
|
||||
from secrets import token_bytes
|
||||
from typing import Callable, ClassVar, Dict, List, Optional, Tuple, Union
|
||||
from typing import Callable, Dict, List, Optional, Tuple, Type, Union
|
||||
|
||||
import click
|
||||
from constant_sorrow.constants import KEYSTORE_LOCKED
|
||||
|
@ -439,10 +439,9 @@ class Keystore:
|
|||
def unlock(self, password: str) -> None:
|
||||
self.__decrypt_keystore(path=self.keystore_path, password=password)
|
||||
|
||||
def derive_crypto_power(self,
|
||||
power_class: ClassVar[CryptoPowerUp],
|
||||
*power_args, **power_kwargs
|
||||
) -> Union[KeyPairBasedPower, DerivedKeyBasedPower]:
|
||||
def derive_crypto_power(
|
||||
self, power_class: Type[CryptoPowerUp], *power_args, **power_kwargs
|
||||
) -> Union[KeyPairBasedPower, DerivedKeyBasedPower]:
|
||||
|
||||
if not self.is_unlocked:
|
||||
raise Keystore.Locked(f"{self.id} is locked and must be unlocked before use.")
|
||||
|
|
Loading…
Reference in New Issue