keyvault


Namekeyvault JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/zypp-io/keyvault
SummaryA small package for handling project secrets
upload_time2024-09-24 07:40:56
maintainerNone
docs_urlNone
authorMelvin Folkers, Erfan Nariman
requires_python>=3.6
licenseNone
keywords python azure keyvault
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
  <img alt="logo" src="https://www.zypp.io/static/assets/img/logos/zypp/white/500px.png"  width="200"/>
</p>

[![Downloads](https://pepy.tech/badge/keyvault)](https://pepy.tech/project/keyvault)
![PyPI](https://img.shields.io/pypi/v/keyvault)
[![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Azure key vaults
===
> Repository for explaining how to use Azure key vaults in our projects.

![Flowdiagram](docs/project_layout.png)

## Index
- [Usage](#usage)
    - [Pip install package](#pip-install-this-public-package)
    - [Secrets to environment](#secrets-to-environment)
    - [Get dotenv secrets](#get-dotenv-secrets)
    - [Get keyvault secrets](#get-keyvault-secrets)
    - [Dotenv to keyvault](#dotenv-to-keyvault)
    - [Dict to keyvault](#dict-to-keyvault)
    - [Delete keyvault secrets](#delete-keyvault-secrets)
- [mandatory .env variables](#mandatory-env-variables)

# Usage
This package is designed for easily pulling and creating secrets in Azure key vaults.

## pip install this public package
```.sh
pip install git+ssh://git@github.com/zypp-io/keyvault.git
```

## Secrets to environment
This function sets the keyvault secrets to the runtime environment variables.
This function will only work if you have set the [required environment variables](#mandatory-env-variables)

```python
from keyvault import secrets_to_environment

secrets_to_environment(keyvault_name="mykeyvault")
```



## Get dotenv secrets
Function for reading the local .env file and capturing the secret_name, secret_value as key value pairs.

```python
from keyvault import get_dotenv_secrets

get_dotenv_secrets(dotenv_file=".env")
```


## Get keyvault secrets
This function can be used to pull secrets from the vault. This function will only work if you have
set the [required environment variables](#mandatory-env-variables)

```python
from keyvault import get_keyvault_secrets

secrets = get_keyvault_secrets(keyvault_name="mykeyvault")
# Returns a dictionary containing secret_name, secret_value pairs
```


## dotenv to keyvault
This function is designed for making it easy to upload sensitive project secrets to Azure key vault.
The function reads the `.env` file and uploads the names and values to Azure key vault.

```python
from keyvault import dotenv_to_keyvault

dotenv_to_keyvault(keyvault_name="mykeyvault", dotenv_file=".env")
# Uploads your current .env variables to azure key vault
```

## Dict to keyvault
The function lets you upload a dictionary, where the key-value pairs are the secretname-secretvalues in Azure key vault.

```python
from keyvault import dict_to_keyvault

dict_to_keyvault(keyvault_name="mykeyvault", secret_dict={'SECRET_NAME': 'secret value'})

```
It is also possible to add an expiry date or the content type of the secrets:

```python
from keyvault import dict_to_keyvault
from datetime import datetime, timedelta
expiry_date = datetime.now() + timedelta(days=80)

dict_to_keyvault(
    keyvault_name="mykeyvault",
    secret_dict={'SECRET_NAME': 'secret value'},
    expires_on=expiry_date,
    content_type="text/plain"
)
```

## Delete keyvault secrets
The function lets you delete secrets in the keyvault. Secrets will be deleted with soft_delete enabled.

```python
from keyvault import delete_keyvault_secrets

delete_keyvault_secrets(keyvault_name="mykeyvault", secret_list=["SECRET_NAME"])
```

# mandatory environment variables
There are 3 environment variables that are necessary for authenticating with the azure key vault.
These variables always need to be present in the project in order for the secrets to be retrieved.

```.env
AZURE_CLIENT_ID=REPLACE-ME
AZURE_CLIENT_SECRET=REPLACE-ME
AZURE_TENANT_ID=REPLACE-ME
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zypp-io/keyvault",
    "name": "keyvault",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, azure, keyvault",
    "author": "Melvin Folkers, Erfan Nariman",
    "author_email": "hello@zypp.io",
    "download_url": "https://files.pythonhosted.org/packages/96/14/b0d3dec76b999d04ae98e090e8fcf095aa542d5f82ab145dbb5ce88b6dad/keyvault-0.2.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img alt=\"logo\" src=\"https://www.zypp.io/static/assets/img/logos/zypp/white/500px.png\"  width=\"200\"/>\n</p>\n\n[![Downloads](https://pepy.tech/badge/keyvault)](https://pepy.tech/project/keyvault)\n![PyPI](https://img.shields.io/pypi/v/keyvault)\n[![Open Source](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://opensource.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nAzure key vaults\n===\n> Repository for explaining how to use Azure key vaults in our projects.\n\n![Flowdiagram](docs/project_layout.png)\n\n## Index\n- [Usage](#usage)\n    - [Pip install package](#pip-install-this-public-package)\n    - [Secrets to environment](#secrets-to-environment)\n    - [Get dotenv secrets](#get-dotenv-secrets)\n    - [Get keyvault secrets](#get-keyvault-secrets)\n    - [Dotenv to keyvault](#dotenv-to-keyvault)\n    - [Dict to keyvault](#dict-to-keyvault)\n    - [Delete keyvault secrets](#delete-keyvault-secrets)\n- [mandatory .env variables](#mandatory-env-variables)\n\n# Usage\nThis package is designed for easily pulling and creating secrets in Azure key vaults.\n\n## pip install this public package\n```.sh\npip install git+ssh://git@github.com/zypp-io/keyvault.git\n```\n\n## Secrets to environment\nThis function sets the keyvault secrets to the runtime environment variables.\nThis function will only work if you have set the [required environment variables](#mandatory-env-variables)\n\n```python\nfrom keyvault import secrets_to_environment\n\nsecrets_to_environment(keyvault_name=\"mykeyvault\")\n```\n\n\n\n## Get dotenv secrets\nFunction for reading the local .env file and capturing the secret_name, secret_value as key value pairs.\n\n```python\nfrom keyvault import get_dotenv_secrets\n\nget_dotenv_secrets(dotenv_file=\".env\")\n```\n\n\n## Get keyvault secrets\nThis function can be used to pull secrets from the vault. This function will only work if you have\nset the [required environment variables](#mandatory-env-variables)\n\n```python\nfrom keyvault import get_keyvault_secrets\n\nsecrets = get_keyvault_secrets(keyvault_name=\"mykeyvault\")\n# Returns a dictionary containing secret_name, secret_value pairs\n```\n\n\n## dotenv to keyvault\nThis function is designed for making it easy to upload sensitive project secrets to Azure key vault.\nThe function reads the `.env` file and uploads the names and values to Azure key vault.\n\n```python\nfrom keyvault import dotenv_to_keyvault\n\ndotenv_to_keyvault(keyvault_name=\"mykeyvault\", dotenv_file=\".env\")\n# Uploads your current .env variables to azure key vault\n```\n\n## Dict to keyvault\nThe function lets you upload a dictionary, where the key-value pairs are the secretname-secretvalues in Azure key vault.\n\n```python\nfrom keyvault import dict_to_keyvault\n\ndict_to_keyvault(keyvault_name=\"mykeyvault\", secret_dict={'SECRET_NAME': 'secret value'})\n\n```\nIt is also possible to add an expiry date or the content type of the secrets:\n\n```python\nfrom keyvault import dict_to_keyvault\nfrom datetime import datetime, timedelta\nexpiry_date = datetime.now() + timedelta(days=80)\n\ndict_to_keyvault(\n    keyvault_name=\"mykeyvault\",\n    secret_dict={'SECRET_NAME': 'secret value'},\n    expires_on=expiry_date,\n    content_type=\"text/plain\"\n)\n```\n\n## Delete keyvault secrets\nThe function lets you delete secrets in the keyvault. Secrets will be deleted with soft_delete enabled.\n\n```python\nfrom keyvault import delete_keyvault_secrets\n\ndelete_keyvault_secrets(keyvault_name=\"mykeyvault\", secret_list=[\"SECRET_NAME\"])\n```\n\n# mandatory environment variables\nThere are 3 environment variables that are necessary for authenticating with the azure key vault.\nThese variables always need to be present in the project in order for the secrets to be retrieved.\n\n```.env\nAZURE_CLIENT_ID=REPLACE-ME\nAZURE_CLIENT_SECRET=REPLACE-ME\nAZURE_TENANT_ID=REPLACE-ME\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A small package for handling project secrets",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/zypp-io/keyvault/issues",
        "Homepage": "https://github.com/zypp-io/keyvault",
        "Source": "https://github.com/zypp-io/keyvault"
    },
    "split_keywords": [
        "python",
        " azure",
        " keyvault"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d008192067b552de387df578f7e2f0aee0122b92e373b1452139868bc63469f7",
                "md5": "4313807c86c05982fffa0620c744a9be",
                "sha256": "163e5f4de56bf94a8fcc248628a40a43403c6ecc9b0bc81da5ce1c35757e2aab"
            },
            "downloads": -1,
            "filename": "keyvault-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4313807c86c05982fffa0620c744a9be",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6401,
            "upload_time": "2024-09-24T07:40:55",
            "upload_time_iso_8601": "2024-09-24T07:40:55.420016Z",
            "url": "https://files.pythonhosted.org/packages/d0/08/192067b552de387df578f7e2f0aee0122b92e373b1452139868bc63469f7/keyvault-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9614b0d3dec76b999d04ae98e090e8fcf095aa542d5f82ab145dbb5ce88b6dad",
                "md5": "91410c18bfb56748bf694e0847fd44ca",
                "sha256": "85a3dc378f1e936b6d623b6355c43e6db25cc28a850073152c419a8199ae49d4"
            },
            "downloads": -1,
            "filename": "keyvault-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "91410c18bfb56748bf694e0847fd44ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5461,
            "upload_time": "2024-09-24T07:40:56",
            "upload_time_iso_8601": "2024-09-24T07:40:56.650361Z",
            "url": "https://files.pythonhosted.org/packages/96/14/b0d3dec76b999d04ae98e090e8fcf095aa542d5f82ab145dbb5ce88b6dad/keyvault-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-24 07:40:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zypp-io",
    "github_project": "keyvault",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "keyvault"
}
        
Elapsed time: 0.51832s