Commit eaa6c2ed authored by Jonas Smedegaard's avatar Jonas Smedegaard

New upstream version 0.6.2

parents a3950a2d d198457b
...@@ -4,7 +4,7 @@ verify_ssl = true ...@@ -4,7 +4,7 @@ verify_ssl = true
name = "pypi" name = "pypi"
[packages] [packages]
commandlines = "*" click = "*"
ipaddress = "*" ipaddress = "*"
tabulate = "*" tabulate = "*"
scrypt = "*" scrypt = "*"
......
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "44e71031df1ac2e4bd25e523804020e5d05d2d8b71a33d0d84f2a296523345e1" "sha256": "cd8383687b27bd13d038a1d59ead6e80bd301a266dcdaf6eeb4f330e36cd629d"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
], ],
"version": "==1.11.5" "version": "==1.11.5"
}, },
"commandlines": { "click": {
"hashes": [ "hashes": [
"sha256:86b650b78470ac95966d7b1a9d215c16591bccb34b28ae2bb9026c3b4166fd64", "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
"sha256:b7dbf71b8dec42c16e9694b87e0e121d288e5a40d5d4f0dd1c0651ab7af06837" "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.4.1" "version": "==7.0"
}, },
"e1839a8": { "e1839a8": {
"editable": true, "editable": true,
...@@ -84,7 +84,6 @@ ...@@ -84,7 +84,6 @@
"hashes": [ "hashes": [
"sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3"
], ],
"markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==2.19" "version": "==2.19"
}, },
"pynacl": { "pynacl": {
...@@ -110,7 +109,6 @@ ...@@ -110,7 +109,6 @@
"sha256:f67814c38162f4deb31f68d590771a29d5ae3b1bd64b75cf232308e5c74777e0" "sha256:f67814c38162f4deb31f68d590771a29d5ae3b1bd64b75cf232308e5c74777e0"
], ],
"index": "pypi", "index": "pypi",
"markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==1.3.0" "version": "==1.3.0"
}, },
"scrypt": { "scrypt": {
...@@ -133,10 +131,10 @@ ...@@ -133,10 +131,10 @@
}, },
"six": { "six": {
"hashes": [ "hashes": [
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
], ],
"version": "==1.11.0" "version": "==1.12.0"
}, },
"tabulate": { "tabulate": {
"hashes": [ "hashes": [
...@@ -192,17 +190,17 @@ ...@@ -192,17 +190,17 @@
}, },
"certifi": { "certifi": {
"hashes": [ "hashes": [
"sha256:339dc09518b07e2fa7eda5450740925974815557727d6bd35d319c1524a04a4c", "sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7",
"sha256:6d58c986d22b038c8c0df30d639f23a3e6d172a05c3583e766f4c0b785c0986a" "sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033"
], ],
"version": "==2018.10.15" "version": "==2018.11.29"
}, },
"cfgv": { "cfgv": {
"hashes": [ "hashes": [
"sha256:73f48a752bd7aab103c4b882d6596c6360b7aa63b34073dd2c35c7b4b8f93010", "sha256:c7c332338fc9936b38aea5916020caeb5d34e40774992893fc4353957e1394bd",
"sha256:d1791caa9ff5c0c7bce80e7ecc1921752a2eb7c2463a08ed9b6c96b85a2f75aa" "sha256:d25d51bd5e8514dcb55fb07c773db316a2ee9db0c07aefc028c8a7a7b1e45321"
], ],
"version": "==1.1.0" "version": "==1.2.0"
}, },
"chardet": { "chardet": {
"hashes": [ "hashes": [
...@@ -216,7 +214,7 @@ ...@@ -216,7 +214,7 @@
"sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13",
"sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7" "sha256:5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"
], ],
"markers": "python_version != '3.2.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.1.*' and python_version >= '2.7'", "index": "pypi",
"version": "==7.0" "version": "==7.0"
}, },
"docutils": { "docutils": {
...@@ -229,25 +227,24 @@ ...@@ -229,25 +227,24 @@
}, },
"identify": { "identify": {
"hashes": [ "hashes": [
"sha256:5e956558a9a1e3b3891d7c6609fc9709657a11878af288ace484d1a46a93922b", "sha256:08826e68e39e7de53cc2ddd8f6228a4e463b4bacb20565e5301c3ec690e68d27",
"sha256:623086059219cc7b86c77a3891f3700cb175d4ce02b8fb8802b047301d71e783" "sha256:2364e24a7699fea0dc910e90740adbab43eef3746eeea4e016029c34123ce66d"
], ],
"version": "==1.1.7" "version": "==1.1.8"
}, },
"idna": { "idna": {
"hashes": [ "hashes": [
"sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
"sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16" "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"
], ],
"version": "==2.7" "version": "==2.8"
}, },
"importlib-metadata": { "importlib-metadata": {
"hashes": [ "hashes": [
"sha256:36b02c84f9001adf65209fefdf951be8e9014a95eab9938c0779ad5670359b1c", "sha256:a17ce1a8c7bff1e8674cb12c992375d8d0800c9190177ecf0ad93e0097224095",
"sha256:60b6481a72908c93ccb707abeb926fb5a15319b9e6f0b76639a718837ee12de0" "sha256:b50191ead8c70adfa12495fba19ce6d75f2e0275c14c5a7beb653d6799b512bd"
], ],
"markers": "python_version != '3.2' and python_version != '3.0' and python_version != '3.1' and python_version != '3.3' and python_version >= '2.7'", "version": "==0.8"
"version": "==0.6"
}, },
"nodeenv": { "nodeenv": {
"hashes": [ "hashes": [
...@@ -264,18 +261,18 @@ ...@@ -264,18 +261,18 @@
}, },
"pre-commit": { "pre-commit": {
"hashes": [ "hashes": [
"sha256:7542bd8ae1c58745175ea0a9295964ee82a10f7e18c4344f5e4c02bd85d02561", "sha256:33bb9bf599c334d458fa9e311bde54e0c306a651473b6a36fdb36a61c8605c89",
"sha256:87f687da6a2651d5067cfec95b854b004e95b70143cbf2369604bb3acbce25ec" "sha256:e233f5cf3230ae9ed9ada132e9cf6890e18cc937adc669353fb64394f6e80c17"
], ],
"index": "pypi", "index": "pypi",
"version": "==1.12.0" "version": "==1.13.0"
}, },
"pygments": { "pygments": {
"hashes": [ "hashes": [
"sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d", "sha256:5ffada19f6203563680669ee7f53b64dabbeb100eb51b61996085e99c03b284a",
"sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc" "sha256:e8218dd399a61674745138520d0d4cf2621d7e032439341bc3f647bff125818d"
], ],
"version": "==2.2.0" "version": "==2.3.1"
}, },
"pyyaml": { "pyyaml": {
"hashes": [ "hashes": [
...@@ -296,10 +293,10 @@ ...@@ -296,10 +293,10 @@
}, },
"requests": { "requests": {
"hashes": [ "hashes": [
"sha256:65b3a120e4329e33c9889db89c80976c5272f56ea92d3e74da8a463992e3ff54", "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e",
"sha256:ea881206e59f41dbd0bd445437d792e43906703fff75ca8ff43ccdb11f33f263" "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b"
], ],
"version": "==2.20.1" "version": "==2.21.0"
}, },
"requests-toolbelt": { "requests-toolbelt": {
"hashes": [ "hashes": [
...@@ -310,10 +307,10 @@ ...@@ -310,10 +307,10 @@
}, },
"six": { "six": {
"hashes": [ "hashes": [
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9", "sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb" "sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"
], ],
"version": "==1.11.0" "version": "==1.12.0"
}, },
"toml": { "toml": {
"hashes": [ "hashes": [
...@@ -327,7 +324,6 @@ ...@@ -327,7 +324,6 @@
"sha256:3c4d4a5a41ef162dd61f1edb86b0e1c7859054ab656b2e7c7b77e7fbf6d9f392", "sha256:3c4d4a5a41ef162dd61f1edb86b0e1c7859054ab656b2e7c7b77e7fbf6d9f392",
"sha256:5b4d5549984503050883bc126280b386f5f4ca87e6c023c5d015655ad75bdebb" "sha256:5b4d5549984503050883bc126280b386f5f4ca87e6c023c5d015655ad75bdebb"
], ],
"markers": "python_version >= '2.6' and python_version != '3.1.*' and python_version != '3.0.*'",
"version": "==4.28.1" "version": "==4.28.1"
}, },
"twine": { "twine": {
...@@ -343,16 +339,14 @@ ...@@ -343,16 +339,14 @@
"sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39", "sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39",
"sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22" "sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"
], ],
"markers": "python_version != '3.2.*' and python_version < '4' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.1.*' and python_version >= '2.7'",
"version": "==1.24.1" "version": "==1.24.1"
}, },
"virtualenv": { "virtualenv": {
"hashes": [ "hashes": [
"sha256:686176c23a538ecc56d27ed9d5217abd34644823d6391cbeb232f42bf722baad", "sha256:34b9ae3742abed2f95d3970acf4d80533261d6061b51160b197f84e5b4c98b4c",
"sha256:f899fafcd92e1150f40c8215328be38ff24b519cd95357fa6e78e006c7638208" "sha256:fa736831a7b18bd2bfeef746beb622a92509e9733d645952da136b0639cd40cd"
], ],
"markers": "python_version != '3.2.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.1.*' and python_version >= '2.7'", "version": "==16.2.0"
"version": "==16.1.0"
}, },
"webencodings": { "webencodings": {
"hashes": [ "hashes": [
...@@ -363,11 +357,18 @@ ...@@ -363,11 +357,18 @@
}, },
"wheel": { "wheel": {
"hashes": [ "hashes": [
"sha256:196c9842d79262bb66fcf59faa4bd0deb27da911dbc7c6cdca931080eb1f0783", "sha256:029703bf514e16c8271c3821806a1c171220cc5bdd325cbf4e7da1e056a01db6",
"sha256:c93e2d711f5f9841e17f53b0e6c0ff85593f3b416b6eec7a9452041a59a42688" "sha256:1e53cdb3f808d5ccd0df57f964263752aa74ea7359526d3da6c02114ec1e1d44"
], ],
"index": "pypi", "index": "pypi",
"version": "==0.32.2" "version": "==0.32.3"
},
"zipp": {
"hashes": [
"sha256:55ca87266c38af6658b84db8cfb7343cdb0bf275f93c7afaea0d8e7a209c7478",
"sha256:682b3e1c62b7026afe24eadf6be579fb45fec54c07ea218bded8092af07a68c4"
],
"version": "==0.3.3"
} }
} }
} }
...@@ -2,12 +2,7 @@ ...@@ -2,12 +2,7 @@
from sys import exit from sys import exit
from silkaj.network_tools import check_port, best_node, EndPoint
from silkaj.cli_tools import manage_cmd from silkaj.cli_tools import manage_cmd
if __name__ == "__main__": if __name__ == "__main__":
ep = EndPoint().ep
if not check_port(ep["port"]):
exit(1)
best_node(ep, True)
manage_cmd() manage_cmd()
...@@ -22,7 +22,7 @@ check_branch() { ...@@ -22,7 +22,7 @@ check_branch() {
} }
update_version() { update_version() {
sed -i "s/SILKAJ_VERSION = \"silkaj.*\"/SILKAJ_VERSION = \"silkaj $VERSION\"/" silkaj/constants.py sed -i "s/SILKAJ_VERSION = \".*\"/SILKAJ_VERSION = \"$VERSION\"/" silkaj/constants.py
sed -i "s/version=\".*\",/version=\"$VERSION\",/" setup.py sed -i "s/version=\".*\",/version=\"$VERSION\",/" setup.py
git diff git diff
} }
......
...@@ -5,7 +5,7 @@ with open("README.md", "r") as fh: ...@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup( setuptools.setup(
name="silkaj", name="silkaj",
version="0.6.1", version="0.6.2",
author="Moul", author="Moul",
author_email="moul@moul.re", author_email="moul@moul.re",
description="Command line client for Duniter", description="Command line client for Duniter",
...@@ -25,7 +25,7 @@ setuptools.setup( ...@@ -25,7 +25,7 @@ setuptools.setup(
"Operating System :: OS Independent", "Operating System :: OS Independent",
), ),
install_requires=[ install_requires=[
"commandlines", "Click",
"ipaddress", "ipaddress",
"tabulate", "tabulate",
"pynacl", "pynacl",
......
...@@ -7,25 +7,25 @@ import pyaes ...@@ -7,25 +7,25 @@ import pyaes
from getpass import getpass from getpass import getpass
from os import path from os import path
from re import compile, search from re import compile, search
import click
def auth_method(cli_args): @click.pass_context
if cli_args.contains_switches("auth-seed"): def auth_method(ctx):
if ctx.obj["AUTH_SEED"]:
return auth_by_seed() return auth_by_seed()
if cli_args.contains_switches("auth-file"): if ctx.obj["AUTH_FILE"]:
return auth_by_auth_file(cli_args) return auth_by_auth_file()
if cli_args.contains_switches("auth-wif"): if ctx.obj["AUTH_WIF"]:
return auth_by_wif() return auth_by_wif()
else: else:
return auth_by_scrypt(cli_args) return auth_by_scrypt()
def generate_auth_file(cli_args): def generate_auth_file(file):
if cli_args.contains_definitions("file"): if not file:
file = cli_args.get_definition("file")
else:
file = "authfile" file = "authfile"
seed = auth_method(cli_args) seed = auth_method()
with open(file, "w") as f: with open(file, "w") as f:
f.write(seed) f.write(seed)
print( print(
...@@ -35,9 +35,10 @@ def generate_auth_file(cli_args): ...@@ -35,9 +35,10 @@ def generate_auth_file(cli_args):
) )
def auth_by_auth_file(cli_args): @click.pass_context
if cli_args.contains_definitions("file"): def auth_by_auth_file(ctx):
file = cli_args.get_definition("file") if ctx.obj["AUTH_FILE_PATH"]:
file = ctx.obj["AUTH_FILE_PATH"]
else: else:
file = "authfile" file = "authfile"
if not path.isfile(file): if not path.isfile(file):
...@@ -69,20 +70,13 @@ def auth_by_seed(): ...@@ -69,20 +70,13 @@ def auth_by_seed():
return seed return seed
def auth_by_scrypt(cli_args): @click.pass_context
def auth_by_scrypt(ctx):
salt = getpass("Please enter your Scrypt Salt (Secret identifier): ") salt = getpass("Please enter your Scrypt Salt (Secret identifier): ")
password = getpass("Please enter your Scrypt password (masked): ") password = getpass("Please enter your Scrypt password (masked): ")
if ( if ctx.obj["AUTH_SCRYPT_PARAMS"]:
cli_args.contains_definitions("n") n, r, p = ctx.obj["AUTH_SCRYPT_PARAMS"].split(",")
and cli_args.contains_definitions("r")
and cli_args.contains_definitions("p")
):
n, r, p = (
cli_args.get_definition("n"),
cli_args.get_definition("r"),
cli_args.get_definition("p"),
)
if n.isnumeric() and r.isnumeric() and p.isnumeric(): if n.isnumeric() and r.isnumeric() and p.isnumeric():
n, r, p = int(n), int(r), int(p) n, r, p = int(n), int(r), int(p)
if n <= 0 or n > 65536 or r <= 0 or r > 512 or p <= 0 or p > 32: if n <= 0 or n > 65536 or r <= 0 or r > 512 or p <= 0 or p > 32:
......
...@@ -11,15 +11,15 @@ from silkaj.license import license_approval ...@@ -11,15 +11,15 @@ from silkaj.license import license_approval
from silkaj.wot import is_member, get_uid_from_pubkey, get_informations_for_identity from silkaj.wot import is_member, get_uid_from_pubkey, get_informations_for_identity
def send_certification(cli_args): def send_certification(id_to_certify):
id_to_certify = get_informations_for_identity(cli_args.subsubcmd) id_to_certify = get_informations_for_identity(id_to_certify)
main_id_to_certify = id_to_certify["uids"][0] main_id_to_certify = id_to_certify["uids"][0]
# Display license and ask for confirmation # Display license and ask for confirmation
license_approval(HeadBlock().head_block["currency"]) license_approval(HeadBlock().head_block["currency"])
# Authentication # Authentication
seed = auth_method(cli_args) seed = auth_method()
# Check whether current user is member # Check whether current user is member
issuer_pubkey = get_publickey_from_seed(seed) issuer_pubkey = get_publickey_from_seed(seed)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import click
from sys import stderr from sys import stderr
from commandlines import Command
from silkaj.tx import send_transaction from silkaj.tx import send_transaction
from silkaj.money import cmd_amount from silkaj.money import cmd_amount
from silkaj.cert import send_certification from silkaj.cert import send_certification
...@@ -27,6 +27,163 @@ from silkaj.constants import ( ...@@ -27,6 +27,163 @@ from silkaj.constants import (
) )
@click.group()
@click.version_option(version=SILKAJ_VERSION)
@click.option(
"--peer",
"-p",
help="Default endpoint will reach Ğ1 currency with `https://g1.duniter.org` endpoint.\
Custom endpoint can be specified with `-p` option followed by <domain>:<port>",
)
@click.option(
"--gtest", "-gt", is_flag=True, help="ĞTest: `https://g1-test.duniter.org` endpoint"
)
@click.option(
"--auth-scrypt", is_flag=True, help="Scrypt authentication: default method"
)
@click.option(
"--scrypt-params",
"--nrp",
help="Scrypt parameters seperated by commas: defaults N,r,p: 4096,16,1",
)
@click.option(
"--auth-file", is_flag=True, help="Authentication file. Defaults to: './authfile'"
)
@click.option("--file", help="Path file specification with '--auth-file'")
@click.option("--auth-seed", is_flag=True, help="Seed authentication")
@click.option("--auth-wif", is_flag=True, help="WIF and EWIF authentication methods")
@click.pass_context
def cli(
ctx, peer, gtest, auth_scrypt, scrypt_params, auth_file, file, auth_seed, auth_wif
):
ctx.obj = dict()
ctx.ensure_object(dict)
ctx.obj["PEER"] = peer
ctx.obj["GTEST"] = gtest
ctx.obj["AUTH_SCRYPT"] = auth_scrypt
ctx.obj["AUTH_SCRYPT_PARAMS"] = scrypt_params
ctx.obj["AUTH_FILE"] = auth_file
ctx.obj["AUTH_FILE_PATH"] = file
ctx.obj["AUTH_SEED"] = auth_seed
ctx.obj["AUTH_WIF"] = auth_wif
def manage_cmd():
cli(obj={})
@cli.command("about", help="Display informations about the programm")
def cliAbout():
about()
@cli.command("amount", help="Get amount of pubkeys")
@click.option(
"--pubkeys", "-p", help="pubkeys and/or ids separated with colon: <pubkey:pubkey>"
)
def cliAmount(pubkeys):
cmd_amount(pubkeys)
@cli.command("argos", help="Display currency information formated for Argos or BitBar")
def cliArgos():
argos_info()
@cli.command("blocks", help="Display blocks")
@click.option(
"--nbr",
"-n",
required=True,
type=int,
help="Number of blocks (`0` for current window size), Details blocks are displayed under n <= 30.",
)
@click.option("--detailed", "-d", is_flag=True, help="This flag force detailed view")
def cliBlocks(nbr, detailed):
list_issuers(nbr, detailed)
@cli.command("cert", help="Send certification")
@click.argument("id_to_certify")
def cliCert(id_to_certify):
send_certification(id_to_certify)
@cli.command("diffi", help="List proof-of-work difficulty to generate next block")
def cliDiffi():
difficulties()
@cli.command(
"generate_auth_file", help="Generate file to store the seed of the account"
)
@click.option("--file", help="Path file")
def cliGenerateAuthFile(file):
generate_auth_file(file)
@cli.command("id", help="Get corresponding identity or pubkey from pubkey or identity")
@click.argument("id_pubkey")
def cliId(id_pubkey):
id_pubkey_correspondence(id_pubkey)