2 Commits

Author SHA1 Message Date
lash
88b7625320 Release candidate for 0.0.6 2022-01-24 08:56:10 +00:00
lash
15463145d5 Add encrypter and normalization to tagger 2022-01-23 13:19:32 +00:00
8 changed files with 21 additions and 111 deletions

3
.gitignore vendored
View File

@@ -2,6 +2,3 @@ __pycache__
*.egg-info
build/
*.pyc
.venv
.clicada
dist/

View File

@@ -1,5 +1,3 @@
- 0.0.7
* fix: make store_path relative to the users home
- 0.0.6
* Add cache encryption, with AES-CTR-128
- 0.0.5

View File

@@ -1,87 +0,0 @@
## Clicada
> Admin Command Line Interface to interact with cic-meta and cic-cache
### Pre-requisites
- Public key uploaded to `cic-auth-helper`
- PGP Keyring for your key
### Installation
Use either of the following installation methods:
1. Install from git release (recommended)
```bash
wget https://git.grassecon.net/grassrootseconomics/clicada/archive/v0.0.6.zip
unzip clicada-v0.0.6.zip
cd clicada
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt --extra-index-url=https://pip.grassrootseconomics.net
```
2. Install from pip to path (non sudo)
```bash
pip3 install -UI --extra-index-url=https://pip.grassrootseconomics.net clicada
```
### GPG Keyring setup
PGP uses the default keyring, you can however pass in a custom keyring path.
To create a keyring from a specific key and get its path for `AUTH_KEYRING_PATH`:
```bash
# In some dir
gpg --homedir .gnupg --import private.pgp
pwd
```
### Usage
```bash
usage: clicada [...optional arguments] [...positional arguments]
positional arguments:
{user,u,tag,t}
user (u) retrieve transactions for a user
tag (t) locally assign a display value to an identifier
optional arguments:
-h, --help show this help message and exit
--no-logs Turn off all logging
-v Be verbose
-vv Be very verbose
-c CONFIG, --config CONFIG
Configuration directory
-n NAMESPACE, --namespace NAMESPACE
Configuration namespace
--dumpconfig {env,ini}
Output configuration and quit. Use with --raw to omit values and output schema only.
--env-prefix ENV_PREFIX
environment prefix for variables to overwrite configuration
-p P, --rpc-provider P
RPC HTTP(S) provider url
--rpc-dialect RPC_DIALECT
RPC HTTP(S) backend dialect
--height HEIGHT Block height to execute against
-i I, --chain-spec I Chain specification string
-u, --unsafe Do not verify address checksums
--seq Use sequential rpc ids
-y Y, --key-file Y Keystore file to use for signing or address
--raw Do not decode output
--fee-price FEE_PRICE
override fee price
--fee-limit FEE_LIMIT
override fee limit
```
### Example
```bash
AUTH_PASSPHRASE=queenmarlena AUTH_KEYRING_PATH=/home/kamikaze/grassroots/usumbufu/tests/testdata/pgp/.gnupg/ AUTH_KEY=CCE2E1D2D0E36ADE0405E2D0995BB21816313BD5 CHAIN_SPEC=evm:byzantium:8996:bloxberg CIC_REGISTRY_ADDRESS=0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299 RPC_PROVIDER=https://rpc.grassecon.net TX_CACHE_URL=https://cache.grassecon.net HTTP_CORS_ORIGIN=https://auth.grassecon.net META_HTTP_ORIGIN=https://auth.grassecon.net:443 PYTHONPATH=. python clicada/runnable/view.py u --meta-url https://auth.grassecon.net +254711000000
```

View File

@@ -3,8 +3,8 @@ import json
# external imports
from clicada.user import FileUserStore
from pathlib import Path
import os
from chainlib.encode import TxHexNormalizer
categories = [
'phone',
@@ -13,7 +13,7 @@ categories = [
def process_args(argparser):
argparser.add_argument('--category', required=True, type=str, help='Identifier category')
argparser.add_argument('--category', required=True, choices=categories, type=str, help='Identifier category')
argparser.add_argument('identifier', type=str, help='Identifier to store a display tag for')
argparser.add_argument('tag', type=str, help='Display tag to store for the identifier')
@@ -36,7 +36,11 @@ def validate(config, args):
def execute(ctrl):
store_path = os.path.join(str(Path.home()), '.clicada')
user_store = FileUserStore(None, ctrl.chain(), ctrl.get('_CATEGORY'), store_path, int(ctrl.get('FILESTORE_TTL')))
user_store.put(ctrl.get('_IDENTIFIER'), json.dumps(ctrl.get('_TAG')), force=True)
user_store.stick(ctrl.get('_IDENTIFIER'))
identifier = ctrl.get('_IDENTIFIER')
if ctrl.get('_CATEGORY') == 'address':
normalizer = TxHexNormalizer()
identifier = normalizer.wallet_address(identifier)
store_path = '.clicada'
user_store = FileUserStore(None, ctrl.chain(), ctrl.get('_CATEGORY'), store_path, int(ctrl.get('FILESTORE_TTL')), encrypter=ctrl.encrypter)
user_store.put(identifier, json.dumps(ctrl.get('_TAG')), force=True)
user_store.stick(identifier)

View File

@@ -2,8 +2,6 @@
import sys
import logging
import datetime
from pathlib import Path
import os
# external imports
from cic_eth_registry import CICRegistry
@@ -56,7 +54,7 @@ def validate(config, args):
def execute(ctrl):
tx_getter = TxGetter(ctrl.get('TX_CACHE_URL'), 10)
store_path = os.path.join(str(Path.home()), '.clicada')
store_path = '.clicada'
user_phone_file_label = 'phone'
user_phone_store = FileUserStore(ctrl.opener('meta'), ctrl.chain(), user_phone_file_label, store_path, int(ctrl.get('FILESTORE_TTL')), encrypter=ctrl.encrypter)

View File

@@ -269,7 +269,7 @@ class FileUserStore:
except Exception as e:
logg.debug('no metadata found for {}: {}'.format(address, e))
if not r:
if r == None:
self.failed_entities[address] = True
raise MetadataNotFoundError()

View File

@@ -1,10 +1,10 @@
usumbufu~=0.3.8
confini~=0.6.0
cic-eth-registry~=0.6.9
cic-types~=0.2.2
usumbufu~=0.3.5
confini~=0.5.3
cic-eth-registry~=0.6.1
cic-types~=0.2.1a8
phonenumbers==8.12.12
eth-erc20~=0.3.0
eth-erc20~=0.1.2
hexathon~=0.1.0
pycryptodome~=3.10.1
chainlib-eth~=0.1.0
chainlib~=0.1.0
chainlib-eth~=0.0.21
chainlib~=0.0.17

View File

@@ -1,6 +1,6 @@
[metadata]
name = clicada
version = 0.0.9
version = 0.0.6rc1
description = CLI CRM tool for the cic-stack custodial wallet system
author = Louis Holbrook
author_email = dev@holbrook.no