Compare commits
No commits in common. "7af7b78995eca2570a6603abe6d1df3e6882f7d9" and "5a337db2b05963cba2a5e162f2f6cc5bbe7700ec" have entirely different histories.
7af7b78995
...
5a337db2b0
@ -1,5 +1,3 @@
|
|||||||
- 0.0.2
|
- 0.0.1
|
||||||
* Use ~/.config for default config override
|
|
||||||
- 0.0.1-unreleased
|
|
||||||
* Add tx listing
|
* Add tx listing
|
||||||
* Add phone to user resolver
|
* Add phone to user resolver
|
||||||
|
@ -18,8 +18,6 @@ from clicada.cli.http import (
|
|||||||
PGPClientSession,
|
PGPClientSession,
|
||||||
)
|
)
|
||||||
|
|
||||||
logg = logging.getLogger()
|
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
data_dir = os.path.join(script_dir, '..', 'data')
|
data_dir = os.path.join(script_dir, '..', 'data')
|
||||||
base_config_dir = os.path.join(data_dir, 'config')
|
base_config_dir = os.path.join(data_dir, 'config')
|
||||||
@ -42,7 +40,7 @@ class CmdCtrl:
|
|||||||
self.logging(logger)
|
self.logging(logger)
|
||||||
|
|
||||||
self.module()
|
self.module()
|
||||||
|
|
||||||
self.config()
|
self.config()
|
||||||
|
|
||||||
self.auth()
|
self.auth()
|
||||||
@ -52,7 +50,7 @@ class CmdCtrl:
|
|||||||
self.remote_openers = {}
|
self.remote_openers = {}
|
||||||
if self.get('META_URL') != None:
|
if self.get('META_URL') != None:
|
||||||
auth_client_session = PGPClientSession(self.__auth)
|
auth_client_session = PGPClientSession(self.__auth)
|
||||||
self.remote_openers['meta'] = HTTPSession(self.get('META_URL'), auth=auth_client_session, origin=self.config.get('META_HTTP_ORIGIN'))
|
self.remote_openers['meta'] = HTTPSession(self.get('META_URL'), auth=auth_client_session)
|
||||||
|
|
||||||
|
|
||||||
def blockchain(self):
|
def blockchain(self):
|
||||||
@ -98,19 +96,11 @@ class CmdCtrl:
|
|||||||
|
|
||||||
|
|
||||||
def config(self):
|
def config(self):
|
||||||
override_dir = self.cmd_args.config
|
|
||||||
if override_dir == None:
|
|
||||||
p = os.environ.get('HOME')
|
|
||||||
if p != None:
|
|
||||||
p = os.path.join(p, '.config', 'cic', 'clicada')
|
|
||||||
try:
|
|
||||||
os.stat(p)
|
|
||||||
override_dir = p
|
|
||||||
logg.info('applying user config override from standard location: {}'.format(p))
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
extra_args = self.cmd_mod.extra_args()
|
extra_args = self.cmd_mod.extra_args()
|
||||||
self.config = chainlib.eth.cli.Config.from_args(self.cmd_args, base_config_dir=base_config_dir, extra_args=extra_args, default_config_dir=override_dir)
|
if self.cmd_args.config:
|
||||||
|
self.config = chainlib.eth.cli.Config.from_args(self.cmd_args, base_config_dir=base_config_dir, extra_args=extra_args, default_config_dir=self.cmd_args.config)
|
||||||
|
else:
|
||||||
|
self.config = chainlib.eth.cli.Config.from_args(self.cmd_args, base_config_dir=base_config_dir, extra_args=extra_args)
|
||||||
|
|
||||||
self.config.add(False, '_SEQ')
|
self.config.add(False, '_SEQ')
|
||||||
|
|
||||||
@ -123,9 +113,7 @@ class CmdCtrl:
|
|||||||
typ = self.get('AUTH_TYPE')
|
typ = self.get('AUTH_TYPE')
|
||||||
if typ != 'gnupg':
|
if typ != 'gnupg':
|
||||||
raise NotImplementedError('Valid aut implementations are: gnupg')
|
raise NotImplementedError('Valid aut implementations are: gnupg')
|
||||||
default_auth_db_path = None
|
default_auth_db_path = os.path.join(os.environ['HOME'], '.clicada/auth')
|
||||||
if os.environ.get('HOME') != None:
|
|
||||||
default_auth_db_path = os.path.join(os.environ['HOME'], '.local/share/cic/clicada')
|
|
||||||
auth_db_path = self.get('AUTH_DB_PATH', default_auth_db_path)
|
auth_db_path = self.get('AUTH_DB_PATH', default_auth_db_path)
|
||||||
self.__auth = PGPAuthCrypt(auth_db_path, self.get('AUTH_KEY'), self.get('AUTH_KEYRING_PATH'))
|
self.__auth = PGPAuthCrypt(auth_db_path, self.get('AUTH_KEY'), self.get('AUTH_KEYRING_PATH'))
|
||||||
self.__auth.get_secret(self.get('AUTH_PASSPHRASE'))
|
self.__auth.get_secret(self.get('AUTH_PASSPHRASE'))
|
||||||
|
@ -45,15 +45,12 @@ class HTTPSession:
|
|||||||
|
|
||||||
token_dir = '/run/user/{}/clicada/usumbufu/.token'.format(os.getuid())
|
token_dir = '/run/user/{}/clicada/usumbufu/.token'.format(os.getuid())
|
||||||
|
|
||||||
def __init__(self, url, auth=None, origin=None):
|
def __init__(self, url, auth=None):
|
||||||
|
logg.debug('auth auth {}'.format(auth))
|
||||||
self.base_url = url
|
self.base_url = url
|
||||||
url_parts = urllib.parse.urlsplit(self.base_url)
|
url_parts = urllib.parse.urlsplit(self.base_url)
|
||||||
url_parts_origin = (url_parts[0], url_parts[1], '', '', '',)
|
url_parts_origin = (url_parts[0], url_parts[1], '', '', '',)
|
||||||
self.origin = origin
|
self.origin = urllib.parse.urlunsplit(url_parts_origin)
|
||||||
if self.origin == None:
|
|
||||||
self.origin = urllib.parse.urlunsplit(url_parts_origin)
|
|
||||||
else:
|
|
||||||
logg.debug('overriding http origin for {} with {}'.format(url, self.origin))
|
|
||||||
|
|
||||||
h = hashlib.sha256()
|
h = hashlib.sha256()
|
||||||
h.update(self.base_url.encode('utf-8'))
|
h.update(self.base_url.encode('utf-8'))
|
||||||
|
@ -8,7 +8,6 @@ from cic_eth_registry import CICRegistry
|
|||||||
from cic_eth_registry.lookup.tokenindex import TokenIndexLookup
|
from cic_eth_registry.lookup.tokenindex import TokenIndexLookup
|
||||||
from cic_types.models.person import Person
|
from cic_types.models.person import Person
|
||||||
from chainlib.eth.address import to_checksum_address
|
from chainlib.eth.address import to_checksum_address
|
||||||
from chainlib.encode import TxHexNormalizer
|
|
||||||
from hexathon import add_0x
|
from hexathon import add_0x
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
@ -22,8 +21,6 @@ from clicada.tx import ResolvedTokenTx
|
|||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
tx_normalizer = TxHexNormalizer()
|
|
||||||
|
|
||||||
|
|
||||||
def process_args(argparser):
|
def process_args(argparser):
|
||||||
argparser.add_argument('-m', '--method', type=str, help='lookup method')
|
argparser.add_argument('-m', '--method', type=str, help='lookup method')
|
||||||
@ -76,10 +73,7 @@ def execute(ctrl):
|
|||||||
user_address_file_label = 'address'
|
user_address_file_label = 'address'
|
||||||
user_address_store = FileUserStore(ctrl.opener('meta'), ctrl.chain(), user_address_file_label, store_path, int(ctrl.get('FILESTORE_TTL')))
|
user_address_store = FileUserStore(ctrl.opener('meta'), ctrl.chain(), user_address_file_label, store_path, int(ctrl.get('FILESTORE_TTL')))
|
||||||
|
|
||||||
user_address_normal = tx_normalizer.wallet_address(user_address)
|
r = user_address_store.by_address(user_address, update=ctrl.get('_FORCE'))
|
||||||
|
|
||||||
r = user_address_store.by_address(user_address_normal, update=ctrl.get('_FORCE'))
|
|
||||||
print('r {}'.format(r))
|
|
||||||
|
|
||||||
print("""Phone: {}
|
print("""Phone: {}
|
||||||
Network address: {}
|
Network address: {}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
[meta]
|
[meta]
|
||||||
lookup_method = phone
|
lookup_method = phone
|
||||||
url =
|
url =
|
||||||
http_origin =
|
|
||||||
|
|
||||||
[filestore]
|
[filestore]
|
||||||
ttl = 86400
|
ttl = 86400
|
||||||
|
|
||||||
[tx]
|
[tx]
|
||||||
cache_url =
|
cache_url =
|
||||||
http_origin =
|
|
||||||
|
|
||||||
[cic]
|
[cic]
|
||||||
registry_address =
|
registry_address =
|
||||||
|
@ -5,7 +5,7 @@ import logging
|
|||||||
# local imports
|
# local imports
|
||||||
from clicada.cli import CmdCtrl
|
from clicada.cli import CmdCtrl
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
@ -16,4 +16,4 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main(ctrl)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = clicada
|
name = clicada
|
||||||
version = 0.0.2a2
|
version = 0.0.1a7
|
||||||
description = CLI CRM tool for the cic-stack custodial wallet system
|
description = CLI CRM tool for the cic-stack custodial wallet system
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user