{ "info": { "author": "off-the-grid-inc", "author_email": "accounts@off-the-grid.io", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Punkr\n\n\nPunkr (Python Bunkr) is a python wrapper around the RPC server running within the Bunkr daemon. It requires the daemon to be running to send the Bunkr operations.\n\n## Install\n\nInstall punkr with pip:\n`$ pip install punkr`\n\n*Compatible with python 3.6+*\n\n#### Punkr class\n\n`Punkr` class is the main structure to use. It can work either synchronously or asynchronously. All methods have their async replica, they can be identified by the `async_*` prefix in the method names.\n* new-text-secret -> create a new secret whose content is a simple text\n* new-ssh-key -> create a new secret whose content is an ECDSA ssh key\n* new-file-secret -> dump a file content as a new secret\n* new-group -> create a new group\n* import-ssh-key -> import an ssh key from a file into a secret\n* list-secrets -> list all stored secrets\n* list-devices -> list all shared devices\n* list-groups -> list all tracked groups\n* send-device -> share the current Bunkr device\n* receive-device -> import a shared Bunkr device\n* remove-device -> remove a shared device reference from Bunkr\n* remove-local -> untrack a secret, it does not delete the secret from the plattform\n* rename -> rename a secret, device or group\n* create -> create a new empty secret\n* write -> write a secret with new content\n* access -> retrieve the content of a secret\n* grant -> grant capabilities to a group or device for an specified secret or group\n* revoke -> revoke a given capability\n* delete -> erase a secret existence\n* receive-capability -> import a capability for a given secret\n* reset-triples -> synchronize triples for a secret\n* noop-test -> health check operation over a secret\n* secret-info -> get secret public information\n* sign-ecdsa -> make an ECDSA signature with a ECDSA Bunkr secret\n* ssh-public-data -> retrieve a secret public data\n* signin -> signin into the platfform\n* confirm-signin -> confirm the signin process\n\n## Examples\n\n```python\nif __name__ == \"__main__\":\n import asyncio\n # create a connection to the local Bunkr RPC server\n punkr = Punkr(\"/tmp/bunkr_daemon.sock\")\n to_delete = []\n try:\n # create a new text secret (synchronously)\n print(punkr.new_text_secret(\"MySuperSecret\", 'secret created from punkr'))\n to_delete.append(\"MySuperSecret\")\n commands = (\n (Command.ACCESS, [\"MySuperSecret\"]), # This is the structure of a batch command argument\n (Command.ACCESS, [\"MySuperSecret\"]),\n (Command.ACCESS, [\"MySuperSecret\"]),\n )\n # create corutine to access the secret (asynchronously, order of results is not guaranteed)\n async def async_test():\n async for result in punkr.async_batch_commands(*commands):\n print(result)\n # run corutine\n asyncio.run(async_test())\n # run corutine and get the results (order of result is guaranteed, but not ordered of execution)\n results1 = asyncio.run(punkr.async_ordered_batch_commands(*commands))\n print(results1)\n # execute a synchronous batch, ordered of execution and results ir guaranteed\n results2 = list(punkr.batch_commands(*commands))\n print(results2)\n assert results1 == results2\n\n # create group\n punkr.new_group(\"the_group\")\n to_delete.append(\"the_group\")\n # create ssh key\n punkr.new_ssh_key(\"test_key\")\n to_delete.append(\"test_key\")\n # listing\n res = punkr.list_secrets()\n assert len(res[\"content\"][\"secrets\"]) > 0\n res = punkr.list_devices()\n assert len(res[\"devices\"]) > 0\n res = punkr.list_groups()\n assert len(res[\"groups\"]) > 0\n\n # rename\n punkr.rename(\"the_group\", \"useless_group\")\n punkr.rename(\"useless_group\", \"the_group\")\n\n # create, write, access cycle\n content = \"some useless content\"\n punkr.create(\"useless_secret\", SecretType.GenericGF256)\n punkr.write(\"useless_secret\", content, \"text\")\n to_delete.append(\"useless_secret\")\n\n res = punkr.access(\"useless_secret\")\n assert res[\"content\"] == content\n assert res[\"mode\"] == \"text\"\n\n # granting\n punkr.grant(\"the_group\", \"useless_secret\")\n # revoke\n punkr.revoke(\"the_group\", \"useless_secret\")\n\n # reset triples\n punkr.reset_triples(\"useless_secret\")\n # noop\n punkr.noop(\"useless_secret\")\n # secret info\n res = punkr.secret_info(\"useless_secret\")\n print(res[\"msg\"])\n\n # ecdsa signature\n res = punkr.sign_ecdsa(\"test_key\", \"Zm9v\")\n print(res[\"r\"])\n print(res[\"s\"])\n\n # ssh public data\n res = punkr.ssh_public_data(\"test_key\")\n print(res[\"public_data\"][\"public_key\"])\n\n # send device\n res = punkr.send_device(\"my_device\")\n print(res[\"url_short\"])\n print(res[\"url_raw\"])\n\n except PunkrException as e:\n print(\"Error while performing a Bunkr operation:\")\n print(e)\n except Exception as e:\n print(e)\n finally:\n # delete the secret (synchronously)\n\n for s in to_delete:\n try:\n punkr.delete(s)\n except PunkrException as e:\n print(f\"Error deleting secret {s}: {e}\")\n```\n\n\n\n\n\nCopyright (c) [2019] [Off-the-grid-inc]\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "punkr", "package_url": "https://pypi.org/project/punkr/", "platform": "", "project_url": "https://pypi.org/project/punkr/", "project_urls": null, "release_url": "https://pypi.org/project/punkr/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Bunkr operations wrapper", "version": "1.0.0", "yanked": false, "yanked_reason": null }, "last_serial": 6053291, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "1f43936fd1ddfb1d88e4a1fc8ba180b9", "sha256": "fe295b33acc3bba264eaff7a05aea2f13c36721b4a3a617c47b55e72d046b7a8" }, "downloads": -1, "filename": "punkr-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1f43936fd1ddfb1d88e4a1fc8ba180b9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6609, "upload_time": "2019-08-05T08:14:18", "upload_time_iso_8601": "2019-08-05T08:14:18.296163Z", "url": "https://files.pythonhosted.org/packages/08/70/ab25ac76c867656eeeb4714d6f26ee883193f66023f478ef4b7fd65abd74/punkr-0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f127b7f8029c820e635a9799e335cdf4", "sha256": "df0e933fee6cd15822b494a3d8e7d899e920e545d81ea1104f3e50fa8d23632e" }, "downloads": -1, "filename": "punkr-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "f127b7f8029c820e635a9799e335cdf4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6645, "upload_time": "2019-08-07T07:16:47", "upload_time_iso_8601": "2019-08-07T07:16:47.719451Z", "url": "https://files.pythonhosted.org/packages/db/40/179799886a7385868d307aade05534d2fc8fedfb6362d87820a9d97e7012/punkr-0.1.1-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "32d805335810ef75f4dab32df1b2fe25", "sha256": "159d936d9d18b5a0f606bc536e1464080d49490eedb206164970d2f8c0c935ad" }, "downloads": -1, "filename": "punkr-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "32d805335810ef75f4dab32df1b2fe25", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6879, "upload_time": "2019-10-02T10:44:22", "upload_time_iso_8601": "2019-10-02T10:44:22.125095Z", "url": "https://files.pythonhosted.org/packages/9f/96/c977b5bc38e05768e2bf08e155e46f374646e876baa234fcf21094ca3ae8/punkr-0.2.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "26fe47b56a3c4465918e729b7e8da767", "sha256": "dd3992232d0d153384592f667a8724211f19dcb88ff686162cd2093c48896b40" }, "downloads": -1, "filename": "punkr-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "26fe47b56a3c4465918e729b7e8da767", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9899, "upload_time": "2019-10-30T15:35:23", "upload_time_iso_8601": "2019-10-30T15:35:23.828465Z", "url": "https://files.pythonhosted.org/packages/ac/d2/873137e2f8e31d4a919a1d491cb489139486a7e9e4f07783bfabd61adb34/punkr-1.0.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "26fe47b56a3c4465918e729b7e8da767", "sha256": "dd3992232d0d153384592f667a8724211f19dcb88ff686162cd2093c48896b40" }, "downloads": -1, "filename": "punkr-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "26fe47b56a3c4465918e729b7e8da767", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9899, "upload_time": "2019-10-30T15:35:23", "upload_time_iso_8601": "2019-10-30T15:35:23.828465Z", "url": "https://files.pythonhosted.org/packages/ac/d2/873137e2f8e31d4a919a1d491cb489139486a7e9e4f07783bfabd61adb34/punkr-1.0.0-py3-none-any.whl", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }