Exemple #1
0
 def main():
     """Temp test, not to be used"""
     signing_key, verifying_key = ed25519.create_keypair()
     print(
         "Original private key",
         ByteUtil.bytes_as_string_with_dashes(signing_key.to_bytes()[:32]))
     # signing key has signing + verifying, we keep the first 32 to only get the private part.
     print("Original public key",
           ByteUtil.bytes_as_string_with_dashes(verifying_key.to_bytes()))
Exemple #2
0
def info(ctx):
    """Print version and more info"""
    if ctx.obj['json']:
        print(
            json.dumps({
                "version":
                __version__,
                "private_dir":
                get_private_dir(),
                "public_address":
                ByteUtil.bytes_as_string_with_dashes(
                    config.PUBLIC_KEY.to_bytes()),
                "client":
                ctx.obj['client'],
                "port":
                ctx.obj['port'],
            }))
    else:
        print(f"Nyzocli version {__version__}")
        print(f"Your private dir is {get_private_dir()}")
        print(
            f"Your public address is {ByteUtil.bytes_as_string_with_dashes(config.PUBLIC_KEY.to_bytes())}"
        )
        print(f"Default verifier is {ctx.obj['verifier_ip']}")
        print(f"Client is {ctx.obj['client']} on port {ctx.obj['port']}")
Exemple #3
0
def test_keys_2(verbose=False):
    master = b'9444'  # Nyzo port as test seed
    seed = hashlib.sha256(master).digest()
    # NEVER USE THAT KEY IN REAL WORLD!!!
    signing_key = ed25519.SigningKey(seed)
    nyzo_format = ByteUtil.bytes_as_string_with_dashes(
        signing_key.to_bytes()[:32])
    if verbose:
        print("private nyzo format", nyzo_format)
    assert nyzo_format == '2c56403f-cffbd134-4dfb7726-89f60e44-6f4471d2-ca17f3a5-eaa629f6-c5323c6c'
Exemple #4
0
def info(ctx):
    """Print version"""
    if ctx.obj['json']:
        print(
            json.dumps({
                "private_dir":
                get_private_dir(),
                "public_address":
                ByteUtil.bytes_as_string_with_dashes(
                    config.PUBLIC_KEY.to_bytes()),
                "default_host":
                ctx.obj['host'],
                "default_port":
                ctx.obj['port'],
            }))
    else:
        print(f"Your private dir is {get_private_dir()}")
        print(
            f"Your public address is {ByteUtil.bytes_as_string_with_dashes(config.PUBLIC_KEY.to_bytes())}"
        )
        print(f"Default host is {ctx.obj['host']} on port {ctx.obj['port']}")
Exemple #5
0
 def save_to_private_seed_file(filename: str, key: bytes) -> None:
     """Saves the privkey to the nyzo formatted file"""
     nyzo_format = ByteUtil.bytes_as_string_with_dashes(key)
     with open(filename, 'w') as f:
         f.write(nyzo_format)