feat: add meta-auth #4

Merged
williamluke merged 2 commits from feat/meta-auth into master 2022-07-04 12:37:41 +02:00
10 changed files with 640 additions and 507 deletions

View File

@ -59,7 +59,7 @@ confidence=
# #
# Kubeflow disables string-interpolation because we are starting to use f # Kubeflow disables string-interpolation because we are starting to use f
# style strings # style strings
disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,missing-docstring,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,relative-import,invalid-name,bad-continuation,no-member,locally-disabled,fixme,import-error,too-many-locals,no-name-in-module,too-many-instance-attributes,no-self-use,logging-fstring-interpolation disable=old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,missing-docstring,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,relative-import,invalid-name,bad-continuation,no-member,locally-disabled,fixme,import-error,too-many-locals,no-name-in-module,too-many-instance-attributes,no-self-use,logging-fstring-interpolation
[REPORTS] [REPORTS]

View File

@ -10,7 +10,7 @@ registry_address = 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299
[meta] [meta]
url = http://localhost:63380 url = http://localhost:63380
http_origin = http_origin =
auth_token =
[rpc] [rpc]
provider = http://localhost:63545 provider = http://localhost:63545

View File

@ -10,6 +10,7 @@ registry_address = 0xcf60ebc445b636a5ab787f9e8bc465a2a3ef8299
[meta] [meta]
url = http://localhost:8000 url = http://localhost:8000
http_origin = http_origin =
auth_token =
[rpc] [rpc]
provider = http://localhost:8545 provider = http://localhost:8545

View File

@ -10,6 +10,7 @@ registry_address = 0xe3e3431BF25b06166513019Ed7B21598D27d05dC
[meta] [meta]
url = https://meta.sarafu.network url = https://meta.sarafu.network
http_origin = http_origin =
auth_token =
[rpc] [rpc]
provider = https://rpc.sarafu.network provider = https://rpc.sarafu.network

View File

@ -10,7 +10,7 @@ registry_address = 0x47269C43e4aCcA5CFd09CB4778553B2F69963303
[meta] [meta]
url = https://meta.sarafu.network url = https://meta.sarafu.network
http_origin = http_origin =
auth_token =
[rpc] [rpc]
provider = https://rpc.sarafu.network provider = https://rpc.sarafu.network

View File

@ -4,8 +4,12 @@ import logging
import os import os
from typing import List from typing import List
# External imports
from chainlib.chain import ChainSpec from chainlib.chain import ChainSpec
from chainlib.cli.config import Config from chainlib.cli.config import Config
from cic_types.ext.metadata import MetadataRequestsHandler
from cic_types.ext.metadata.signer import Signer as MetadataSigner
# Local Modules # Local Modules
from cic.contract.components.attachment import Attachment from cic.contract.components.attachment import Attachment
from cic.contract.components.meta import Meta from cic.contract.components.meta import Meta
@ -15,9 +19,7 @@ from cic.contract.helpers import init_writers_from_config
from cic.contract.network import Network from cic.contract.network import Network
from cic.contract.processor import ContractProcessor from cic.contract.processor import ContractProcessor
from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter from cic.writers import HTTPWriter, KeyedWriterFactory, MetadataWriter
# external imports
from cic_types.ext.metadata import MetadataRequestsHandler
from cic_types.ext.metadata.signer import Signer as MetadataSigner
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -146,9 +148,12 @@ def deploy_contract(
output_writer_path_meta = output_directory output_writer_path_meta = output_directory
metadata_endpoint = config.get("META_URL") metadata_endpoint = config.get("META_URL")
metadata_auth_token = config.get("META_AUTH_TOKEN")
if metadata_endpoint is not None: if metadata_endpoint is not None:
MetadataRequestsHandler.base_url = metadata_endpoint MetadataRequestsHandler.base_url = metadata_endpoint
MetadataRequestsHandler.auth_token = metadata_auth_token
MetadataSigner.gpg_path = "/tmp" MetadataSigner.gpg_path = "/tmp"
MetadataSigner.key_file_path = config.get("AUTH_KEYFILE_PATH") MetadataSigner.key_file_path = config.get("AUTH_KEYFILE_PATH")
MetadataSigner.gpg_passphrase = config.get("AUTH_PASSPHRASE") MetadataSigner.gpg_passphrase = config.get("AUTH_PASSPHRASE")

View File

@ -10,7 +10,7 @@ registry_address = 0xe3e3431BF25b06166513019Ed7B21598D27d05dC
[meta] [meta]
url = https://meta.sarafu.network url = https://meta.sarafu.network
http_origin = http_origin =
auth_token =
[auth] [auth]
type = gnupg type = gnupg
keyfile_path = keyfile_path =

View File

@ -90,7 +90,6 @@ def main():
except Exception as e: except Exception as e:
logg.exception(e) logg.exception(e)
sys.stderr.write("\033[;91m" + str(e) + "\033[;39m\n") sys.stderr.write("\033[;91m" + str(e) + "\033[;39m\n")
argparser.print_help()
sys.exit(1) sys.exit(1)

1105
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -32,27 +32,28 @@ cic = 'cic.runnable.cic_cmd:main'
[[tool.poetry.source]] [[tool.poetry.source]]
name = "grassroots_" name = "grassroots_"
url = "https://pip.grassrootseconomics.net/" url = "https://pip.grassrootseconomics.net/"
default = true secondary = true
[[tool.poetry.source]] [[tool.poetry.source]]
name = "pypi_" name = "pypi_"
url = "https://pypi.org/simple/" url = "https://pypi.org/simple/"
secondary = true default = true
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.8"
funga-eth = "^0.6.0" funga-eth = "^0.6.0"
cic-types = "^0.2.3" cic-types = "^0.2.2"
confini = "^0.6.0" confini = "^0.6.0"
chainlib = "~0.3.0" chainlib = "~0.1.0"
cbor2 = "~5.4.1" cbor2 = "~5.4.1"
chainlib-eth = { version = "~0.3.1", optional = true } chainlib-eth = { version = "~0.1.1", optional = true }
eth-token-index = { version = "^0.3.0", optional = true } eth-token-index = { version = "^0.3.0", optional = true }
eth-address-index = { version = "~0.5.0", optional = true } eth-address-index = { version = "~0.5.0", optional = true }
okota = { version = "^0.4.0", optional = true } okota = { version = "^0.4.0", optional = true }
cic-eth-registry = { version = "^0.7.0", optional = true } cic-eth-registry = { version = "^0.6.9", optional = true }
cic-contracts = { version = "~0.2.0", optional = true } cic-contracts = { version = "~0.1.0", optional = true }
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
@ -61,9 +62,10 @@ pytest-cov = "2.10.1"
python-semantic-release = "^7.25.2" python-semantic-release = "^7.25.2"
pylint = "^2.12.2" pylint = "^2.12.2"
black = { version = "^22.1.0", allow-prereleases = true } black = { version = "^22.1.0", allow-prereleases = true }
eth_tester = "0.6.0b6" eth_tester = "0.5.0b3"
py-evm = "0.5.0a3" py-evm = "0.3.0a20"
rlp = "2.0.1" rlp = "2.0.1"
mypy = "^0.961"
[tool.poetry.extras] [tool.poetry.extras]
eth = [ eth = [