{ "info": { "author": "leucothia", "author_email": "devops@oceanprotocol.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "[![banner](https://raw.githubusercontent.com/oceanprotocol/art/master/github/repo-banner%402x.png)](https://oceanprotocol.com)\n\n# secret-store-client-py \n\n> \ud83d\udc33 Python client for Parity Secret Store.\n> [oceanprotocol.com](https://oceanprotocol.com)\n\n\n[![Travis (.com)](https://img.shields.io/travis/com/oceanprotocol/secret-store-client-py.svg)](https://travis-ci.com/oceanprotocol/secret-store-client-py)\n[![PyPI](https://img.shields.io/pypi/v/secret-store-client.svg)](https://pypi.org/project/secret-store-client/)\n\n\n---\n\n## Table of Contents\n\n - [Features](#features)\n - [Prerequisites](#prerequisites)\n - [Quickstart](#quickstart)\n - [Environment variables](#environment-variables)\n - [Code style](#code-style)\n - [Testing](#testing)\n - [New Version](#new-version)\n - [License](#license)\n\n---\n\n## Features\n\n- Encrypt and publish encrypted documents to the Parity Secret Store.\n- Fetch and decrypt the documents from the Parity Secret Store, if permissions are given.\n\n## Prerequisites\n\n- A URL of a Secret Store node that accepts requests.\n- A supported version of Python. For details, see `setup.py`.\n- A JSON-RPC URL of the [Parity EVM client](https://github.com/paritytech/parity-ethereum). It is strongly recommended to run the client locally.\n\n- A publisher Ethereum account, for publishing documents.\n- A consumer Ethreum account, for consuming documents.\n\n## Quickstart\n\n#### Instantiate a publisher\n\n```\nfrom secret_store_client import Client\n\nsecret_store_url = 'http://localhost:8010'\nparity_client_url = 'http://localhost:8545'\npublisher_address = '0xc8307e6fbe40e97061a7b9f88b98df9249e4cefd'\npublisher_password = 'publisherpwd'\n\npublisher = Client(secret_store_url, parity_client_url,\n publisher_address, publisher_password)\n```\n\n#### Publish a document\n\n```\nimport hashlib\n\ndocument = 'mySecretDocument'\n# we need a 256 bit hash\ndocument_id = hashlib.sha256(document.encode()).hexdigest()\n\nencrypted = publisher.publish_document(document_id, document)\n```\n\nBy default, if there are multiple Secret Store nodes, all nodes are required to participate in the encryption process. You can allow one or more nodes to not participate by passing a custom `threshold` parameter:\n\n```\nencrypted = publisher.publish_document(document_id, document, threshold=1)\n```\n\nYou can find some guidance on how to choose a threshold [here](https://wiki.parity.io/Secret-Store#server-key-generation-session).\n\n#### Instantiate a consumer\n\n```\nfrom secret_store_client import Client\n\nsecret_store_url = 'http://localhost:8010'\nparity_client_url = 'http://localhost:8545'\nconsumer_address = '0xe887f790103a108e9c500cf167bfef019f5f41e0'\nconsumer_password = 'consumerpwd'\n\nconsumer = Client(secret_store_url, parity_client_url,\n consumer_address, consumer_password)\n```\n\n#### Decrypt the document\n\n```\ndecrypted = consumer.decrypt_document(document_id, encrypted)\n\nassert 'mySecretDocument' == decrypted\n```\n\n## Development\n\nThe Secret Store setup instructions in this section is a simplification of the instructions presented [here](https://wiki.parity.io/Secret-Store-Tutorial-1.html).\n\n#### Download and compile the Parity Ethereum client\n\nFollow these [instructions](https://wiki.parity.io/Secret-Store-Tutorial-1.html#1-enable-the-secret-store-feature-of-parity).\n\nPut the `./target/release/parity` binary somewhere on your PATH.\n\n#### Configure a publisher node\n\nMake a copy of the user configuration template.\n\n```\ncp integration_tests/configs/users.template.toml integration_tests/configs/users.toml\n```\n\nCreate an account.\n\n```\nparity --config integration_tests/configs/users.toml account new\n```\n\nIt asks you for a password and outputs an address.\n\n\nNow make a copy of the test configuration template.\n\n```\ncp integration_tests/configs/test_setup.template.conf integration_tests/configs/test_setup.conf\n```\n\nInsert your publisher password and address into the corresponding placeholders inside `test_setup.conf`.\n\n\n#### Configure a consumer node\n\nRepeat the steps from the previous section except for this time fill in consumer address and password in the configuration file.\n\n\n#### Configure a Secret Store node\n\nMake a copy of the Secret Store configuration template.\n\n```\ncp integration_tests/configs/secret_store.template.toml integration_tests/configs/secret_store.toml\n```\n\nCreate an account.\n\n```\nparity --config integration_tests/configs/secret_store.toml account new\n```\n\nIt asks you for a password and outputs an address.\n\nPut your password into `integration_tests/configs/ss.pwd`. Put the account address into the corresponding place\ninside `integration_tests/configs/secret_store.toml` and uncomment the `password =` line.\n\nRun the Secret Store node.\n\n```\nparity --config integration_tests/configs/secret_store.toml\n```\n\nIt outputs its public node URL.\n\n```\n...\nPublic node URL: enode://a67dd8d6ffbf81fdd98fdae6902c527c77de34bc6fc39ffa8767126ee71d73484f8f7f692c02f095682b2578e11af004ab68ba47d8a923a7b868a040d2f6d479@192.168.86.248:30301\n```\n\nInsert this URL into the `bootnodes` list of your `users.toml`.\n\n#### Deploy the test permission contract\n\nInstall `truffle`:\n\n```\nnpm -g install truffle@beta\n```\n\nNote the versions the process was tested with.\n```\nnpm 6.4.1\nnode v9.11.2\nTruffle v5.0.0-beta.1 (core: 5.0.0-beta.1)\nSolidity v0.4.25 (solc-js)\n```\n\nCompile the contract.\n\n```\ntruffle compile\n```\n\nDeploy the contract.\n\n```\ntruffle migrate\n```\n\nIt outputs \"contract address\". Copy it and insert as a value for `acl_contract` into `secret_store.toml`.\n\nRelaunch the node for the change to take action.\n\n#### Run the nodes\n\nThe steps above have to only be performed once. Every time you want to develop or test, just run the Secret Store node and the Parity Ethereum client.\n\nRun the Secret Store node:\n\n```\nparity --config integration_tests/configs/secret_store.toml\n```\n\nRun the Parity Ethereum client:\n```\nparity --config integration_tests/configs/users.toml\n```\n\n#### Execute integration tests\n\nMake sure the Secret Store node and the Parity Ethereum client are up and running, then execute:\n\n```\npython3 setup.py test\n```\n\nAutomatic tests are setup via Travis, executing `tox`.\nOur test use pytest framework.\n\n## Code style\n\nThe information about code style in python is documented in this two links [python-developer-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-developer-guide.md)\nand [python-style-guide](https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/python-style-guide.md).\n\n### TLDR\n\n```\npip install flake8\nflake8 secret_store_client integration_tests tests\n```\n\n## New Version\n\nThe `bumpversion.sh` script helps to bump the project version. You can execute the script using as first argument {major|minor|patch} to bump accordingly the version.\n\n## License\n\n```\nCopyright 2018 Ocean Protocol Foundation Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oceanprotocol/secret-store-client-py", "keywords": "ocean-secret-store-client", "license": "Apache Software License 2.0", "maintainer": "", "maintainer_email": "", "name": "ocean-secret-store-client", "package_url": "https://pypi.org/project/ocean-secret-store-client/", "platform": "", "project_url": "https://pypi.org/project/ocean-secret-store-client/", "project_urls": { "Homepage": "https://github.com/oceanprotocol/secret-store-client-py" }, "release_url": "https://pypi.org/project/ocean-secret-store-client/0.0.1/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "\ud83d\udc33 Python client for Parity Secret Store.", "version": "0.0.1" }, "last_serial": 4465416, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "cda95a67e783708919c3dddbf856a517", "sha256": "01aa4834dac46886ef75523f6d7bcbfc25a0e630395c0a4a1ee627c2c25abf40" }, "downloads": -1, "filename": "ocean_secret_store_client-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cda95a67e783708919c3dddbf856a517", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9948, "upload_time": "2018-11-08T12:32:34", "url": "https://files.pythonhosted.org/packages/51/71/02eadc8e1a26578ef00656b3946c7447a2935b335bdfcaa64d131613331c/ocean_secret_store_client-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "08428cd92d629beb109b73321383aeef", "sha256": "3bb873e681537c65000aafe252511b2713f2e93803227d90d5c18a837a526e3e" }, "downloads": -1, "filename": "ocean-secret-store-client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "08428cd92d629beb109b73321383aeef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10034, "upload_time": "2018-11-08T12:32:36", "url": "https://files.pythonhosted.org/packages/b4/48/c3bf43ea7a9b8884f790a6b53c0710546ab256eb6b8745c3f4f347e6b784/ocean-secret-store-client-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cda95a67e783708919c3dddbf856a517", "sha256": "01aa4834dac46886ef75523f6d7bcbfc25a0e630395c0a4a1ee627c2c25abf40" }, "downloads": -1, "filename": "ocean_secret_store_client-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cda95a67e783708919c3dddbf856a517", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9948, "upload_time": "2018-11-08T12:32:34", "url": "https://files.pythonhosted.org/packages/51/71/02eadc8e1a26578ef00656b3946c7447a2935b335bdfcaa64d131613331c/ocean_secret_store_client-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "08428cd92d629beb109b73321383aeef", "sha256": "3bb873e681537c65000aafe252511b2713f2e93803227d90d5c18a837a526e3e" }, "downloads": -1, "filename": "ocean-secret-store-client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "08428cd92d629beb109b73321383aeef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10034, "upload_time": "2018-11-08T12:32:36", "url": "https://files.pythonhosted.org/packages/b4/48/c3bf43ea7a9b8884f790a6b53c0710546ab256eb6b8745c3f4f347e6b784/ocean-secret-store-client-0.0.1.tar.gz" } ] }