{"id":26802238,"url":"https://github.com/onqlavelabs/onqlave-python","last_synced_at":"2025-04-23T02:36:30.718Z","repository":{"id":186623327,"uuid":"652555164","full_name":"onqlavelabs/onqlave-python","owner":"onqlavelabs","description":"Onqlave SDK for the Python programming language.","archived":false,"fork":false,"pushed_at":"2023-11-28T23:55:04.000Z","size":153,"stargazers_count":5,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-29T19:42:19.609Z","etag":null,"topics":["encryption-tool","python","sdk-python"],"latest_commit_sha":null,"homepage":"https://docs.onqlave.com/guides/sdks/sdk-py/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/onqlavelabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-12T10:03:55.000Z","updated_at":"2023-12-21T03:37:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"27f4508d-a3cd-4c67-9175-f89a7459d70c","html_url":"https://github.com/onqlavelabs/onqlave-python","commit_stats":null,"previous_names":["onqlavelabs/onqlave-python"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onqlavelabs%2Fonqlave-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onqlavelabs","download_url":"https://codeload.github.com/onqlavelabs/onqlave-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250358761,"owners_count":21417543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption-tool","python","sdk-python"],"created_at":"2025-03-29T21:16:50.203Z","updated_at":"2025-04-23T02:36:30.701Z","avatar_url":"https://github.com/onqlavelabs.png","language":"Python","readme":"This Python SDK is designed to help developers easily integrate Onqlave `Encryption As A Service` into their python backend.\n\n[![CI](https://img.shields.io/static/v1?label=CI\u0026message=passing\u0026color=green?style=plastic\u0026logo=github)](https://github.com/onqlavelabs/onqlave-python/actions)\n[![GitHub release](https://img.shields.io/github/v/release/onqlavelabs/onqlave-python.svg)](https://github.com/onqlavelabs/onqlave-python/releases)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n\n# Table of Contents\n\n- [Description](#description)\n- [Table of Contents](#table-of-contents)\n\t- [Features](#features)\n\t- [Installation](#installation)\n\t\t- [Requirements](#requirements)\n\t\t- [Configuration](#configuration)\n\t\t- [Usage](#usage)\n\t\t- [Encrypt](#encrypt)\n\t\t- [Decrypt](#decrypt)\n\t\t- [Encrypt Stream](#encrypt-stream)\n\t\t- [Decrypt Stream](#decrypt-stream)\n\t- [Reporting a Vulnerability](#reporting-a-vulnerability)\n\n## Features\n- Encrypt/decrypt pieces of information\n- Encrypt/decrypt stream of data\n\n## Installation\n\n### Requirements\n\n- Python 3.8 and above\n\n### Configuration\nTo install, simply using this command:\n\n```bash\npip install onqlave-python\n```\nYou can also check the [package detail on PyPI](https://pypi.org/project/onqlave-python)\n\n## Usage\nTo use this SDK, you firstly need to obtain credentials to access an Onqlave Arx by signing up to [Onqlave](https://onqlave.com) and following instruction to create your first Onqlave Arx. Documentation can be found at [Onqlave Technical Documentation](https://docs.onqlave.com).\n\nThe [Onqlave Python](https://github.com/onqlavelabs/onqlave-python) module is used to perform operations on the configured Arx such as encrypting and decryptin for an Onqlave Arx. \n\nTo use this module, an Onqlave client should be initialized as follows.\n(Please note that there are 3 ways of loading configurations specified in the **examples/** directory.)\n\n```python\nfrom onqlave.encryption import options\nfrom onqlave.encryption.encryption import Encryption\nfrom onqlave.credentials.credentials import Credential\nfrom onqlave.connection.client import RetrySettings\n\ncred_file_path = \"credentials.json\"\n\narx_option = options.ArxOption()\ncredential_option = Credential()\n\narx_option.load_arx_url_from_json(cred_file_path)\ncredential_option.load_config_from_json(cred_file_path)\n\nretry_option = RetrySettings(count=1,wait_time=1,max_wait_time=2) \n\nencryption_engine = Encryption(\n    debug_option=debug_option,\n    arx_option=arx_option,\n    credential_option=credential_option,\n    retry_setting=retry_option\n)\n```\n\n\n### Encrypt\n\nTo encrypt data, use the **encrypt(plaintext: bytearray, associated_data: bytearray)** method of the `Encryption` service. The **plaintext** parameter is the `bytearray` representation of data you are wishing to encrypt. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\nplaintext = \"hello world\" # your data goes here\nassociated_data = \"auth\" # your authentication data goes here\ncipher_text = encryption_engine.encrypt(plaintext.encode(), associated_data.encode())\n```\n\n### Decrypt\n\nTo decrypt data, use the **decrypt(cipher_data: bytearray, associated_data: bytearray)** method of the `Encryption` service. The **cipher_data** parameter is the `bytearray` representation of data you are wishing to decrypt (previousely encrypted). The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\ndecrypted_ciphertext = encryption_engine.decrypt(cipher_text,associated_data.encode())\n```\n\n### Encrypt Stream\nTo encrypt stream of data, use the **encrypt_stream(plain_stream io.Reader, cipher_stream io.Writer, associated_data bytearray)** method of the `Encryption` service. The **plain_stream** parameter is the `io.Reader` stream of data you are wishing to encrypt. The **cipher_stream** parameter is the `io.Write` stream you are wishing to write the cipher data to. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\nplain_file_stream = open(\"path to your plaintext file\",\"rb\")\nplain_stream = io.BytesIO(plain_file_stream.read())\ncipher_stream = io.BytesIO()\n    \nencryption_engine.encrypt_stream(plain_stream,cipher_stream,associated_data.encode())\ncipher_stream.seek(0)\n```\n\n### Decrypt Stream\nTo decrypt data, use the **decrypt_stream(cipher_stream io.io.BytesIO, plain_stream io.BytesIO, associated_data []byte)** method of the `Encryption` service. The **cipher_stream** parameter is the `io.BytesIO()` stream of data you are wishing to decrypt and it was originally encrypted using [encrypt_stream](#encrypt-stream). The **plain_stream** parameter is the `io.BytesIO()` stream you are wishing to write the plain data back to. The **associated_data** parameter the `bytearray` representation of associated data which can be used to improve the authenticity of the data (it is not mandatory), as shown below.\n\n```python\ndecrypted_stream = io.BytesIO()\nencryption_engine.decrypt_stream(\n    cipher_stream=cipher_stream,\n    plain_stream=decrypted_stream,\n    associated_data=associated_data.encode()\n)\ndecrypted_stream.seek(0)\n\nwith open(\n    \"path to your decrypted file\",\n    \"wb\"\n) as result:\n    result.write(decrypted_stream.read())\n```\n\n## Reporting a Vulnerability\n\nIf you discover a potential security issue in this project, please reach out to us at security@onqlave.com. Please do not create public GitHub issues or Pull Requests, as malicious actors could potentially view them.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonqlavelabs%2Fonqlave-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonqlavelabs%2Fonqlave-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonqlavelabs%2Fonqlave-python/lists"}