vcrypto 4.0.2__tar.gz → 4.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vcrypto-4.2.0/PKG-INFO +128 -0
- vcrypto-4.2.0/README.md +101 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/pyproject.toml +1 -1
- vcrypto-4.2.0/vcrypto/__init__.py +19 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto/vcrypto.py +19 -1
- vcrypto-4.2.0/vcrypto.egg-info/PKG-INFO +128 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto.egg-info/SOURCES.txt +1 -0
- vcrypto-4.0.2/PKG-INFO +0 -133
- vcrypto-4.0.2/README.md +0 -106
- vcrypto-4.0.2/vcrypto.egg-info/PKG-INFO +0 -133
- {vcrypto-4.0.2 → vcrypto-4.2.0}/setup.cfg +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/tests/test_encryption.py +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/tests/test_secrets_manager.py +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/tests/test_vcrypto.py +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto/encryption.py +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto/secrets_manager.py +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto.egg-info/dependency_links.txt +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto.egg-info/requires.txt +0 -0
- {vcrypto-4.0.2 → vcrypto-4.2.0}/vcrypto.egg-info/top_level.txt +0 -0
vcrypto-4.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: vcrypto
|
|
3
|
+
Version: 4.2.0
|
|
4
|
+
Summary: Utility to easily store passwords/secrets
|
|
5
|
+
Author-email: Arnau Villoro <arnau@villoro.com>
|
|
6
|
+
Maintainer-email: Arnau Villoro <arnau@villoro.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Topic :: Security
|
|
11
|
+
Classifier: Topic :: Utilities
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: cryptography>=44.0.1
|
|
23
|
+
Requires-Dist: loguru>=0.7.3
|
|
24
|
+
Requires-Dist: pytest>=8.3.4
|
|
25
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
26
|
+
Requires-Dist: ruff>=0.9.7
|
|
27
|
+
|
|
28
|
+
# **vcrypto - Secure Secrets Management in Python**
|
|
29
|
+
vcrypto is a simple and effective utility for securely storing passwords and secrets in Python. It leverages **Fernet encryption** from the [cryptography](https://cryptography.io/en/latest/) module instead of reinventing the wheel.
|
|
30
|
+
|
|
31
|
+
## **🔒 Why vcrypto?**
|
|
32
|
+
Managing secrets in Python, especially in collaborative projects, can be cumbersome. Our approach simplifies it:
|
|
33
|
+
|
|
34
|
+
👉 **One master private password** (ignored in Git)\
|
|
35
|
+
👉 **A structured dictionary file with encrypted secrets**\
|
|
36
|
+
👉 **Easily shareable** - only the master password needs to be exchanged once\
|
|
37
|
+
👉 **Version-controlled secrets** - since only encrypted values are stored
|
|
38
|
+
|
|
39
|
+
This package makes it easy to **store and retrieve encrypted secrets** in **JSON** or **YAML** formats.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## **📌 Features**
|
|
44
|
+
- 🔐 **AES-128 Encryption** (Fernet) for secure storage.
|
|
45
|
+
- 📂 **JSON/YAML Support** for structured secret storage.
|
|
46
|
+
- 🛠️ **Environment Variable Support** for flexible key management.
|
|
47
|
+
- 🔑 **Simple API** for saving and retrieving secrets.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## **📝 Installation**
|
|
52
|
+
Install via **pip**:
|
|
53
|
+
```sh
|
|
54
|
+
pip install vcrypto
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## **🚀 Quickstart**
|
|
60
|
+
### **1️⃣ Initialize vcrypto**
|
|
61
|
+
Before using `vcrypto`, initialize it with:
|
|
62
|
+
```python
|
|
63
|
+
from vcrypto import init_vcrypto
|
|
64
|
+
|
|
65
|
+
init_vcrypto(secrets_file="secrets.yaml", environ_var_name="MY_ENV_VAR")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
> [!TIP]
|
|
69
|
+
> You only need to initialize it **once**.
|
|
70
|
+
|
|
71
|
+
This ensures `vcrypto` knows where to store secrets and how to retrieve the master password.
|
|
72
|
+
|
|
73
|
+
### **2️⃣ Store and Retrieve Secrets**
|
|
74
|
+
#### **Save a Secret**
|
|
75
|
+
```python
|
|
76
|
+
from vcrypto import save_secret
|
|
77
|
+
|
|
78
|
+
save_secret("SECRET_TOKEN", "super_secret_value")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### **Retrieve a Secret**
|
|
82
|
+
```python
|
|
83
|
+
from vcrypto import read_secret
|
|
84
|
+
|
|
85
|
+
token = read_secret("SECRET_TOKEN")
|
|
86
|
+
print(token) # Output: super_secret_value
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## **⚙️ Customization**
|
|
92
|
+
The `init_vcrypto` function allows customization:
|
|
93
|
+
|
|
94
|
+
| Parameter | Description |
|
|
95
|
+
|---------------------------|-------------|
|
|
96
|
+
| `secrets_file` | Path to the encrypted secrets file (JSON/YAML) |
|
|
97
|
+
| `filename_master_password`| Path to the master password file (optional, defaults to `master.password`) |
|
|
98
|
+
| `environ_var_name` | Name of an environment variable to retrieve the master password |
|
|
99
|
+
|
|
100
|
+
**Example:**
|
|
101
|
+
```python
|
|
102
|
+
init_vcrypto(secrets_file="config/secrets.yaml", filename_master_password="config/master.secret")
|
|
103
|
+
```
|
|
104
|
+
This setup stores **both** the `master.password` and `secrets.yaml` in the `config/` folder.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## **🛠️ Development**
|
|
109
|
+
This project uses [`uv`](https://github.com/astral-sh/uv) for dependency management.
|
|
110
|
+
|
|
111
|
+
### **Install dependencies**
|
|
112
|
+
```sh
|
|
113
|
+
pip install uv
|
|
114
|
+
uv venv
|
|
115
|
+
uv install
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## **💜 License**
|
|
121
|
+
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## **👤 Author**
|
|
126
|
+
- **[Arnau Villoro](https://villoro.com)**
|
|
127
|
+
|
|
128
|
+
---
|
vcrypto-4.2.0/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# **vcrypto - Secure Secrets Management in Python**
|
|
2
|
+
vcrypto is a simple and effective utility for securely storing passwords and secrets in Python. It leverages **Fernet encryption** from the [cryptography](https://cryptography.io/en/latest/) module instead of reinventing the wheel.
|
|
3
|
+
|
|
4
|
+
## **🔒 Why vcrypto?**
|
|
5
|
+
Managing secrets in Python, especially in collaborative projects, can be cumbersome. Our approach simplifies it:
|
|
6
|
+
|
|
7
|
+
👉 **One master private password** (ignored in Git)\
|
|
8
|
+
👉 **A structured dictionary file with encrypted secrets**\
|
|
9
|
+
👉 **Easily shareable** - only the master password needs to be exchanged once\
|
|
10
|
+
👉 **Version-controlled secrets** - since only encrypted values are stored
|
|
11
|
+
|
|
12
|
+
This package makes it easy to **store and retrieve encrypted secrets** in **JSON** or **YAML** formats.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## **📌 Features**
|
|
17
|
+
- 🔐 **AES-128 Encryption** (Fernet) for secure storage.
|
|
18
|
+
- 📂 **JSON/YAML Support** for structured secret storage.
|
|
19
|
+
- 🛠️ **Environment Variable Support** for flexible key management.
|
|
20
|
+
- 🔑 **Simple API** for saving and retrieving secrets.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## **📝 Installation**
|
|
25
|
+
Install via **pip**:
|
|
26
|
+
```sh
|
|
27
|
+
pip install vcrypto
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## **🚀 Quickstart**
|
|
33
|
+
### **1️⃣ Initialize vcrypto**
|
|
34
|
+
Before using `vcrypto`, initialize it with:
|
|
35
|
+
```python
|
|
36
|
+
from vcrypto import init_vcrypto
|
|
37
|
+
|
|
38
|
+
init_vcrypto(secrets_file="secrets.yaml", environ_var_name="MY_ENV_VAR")
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> [!TIP]
|
|
42
|
+
> You only need to initialize it **once**.
|
|
43
|
+
|
|
44
|
+
This ensures `vcrypto` knows where to store secrets and how to retrieve the master password.
|
|
45
|
+
|
|
46
|
+
### **2️⃣ Store and Retrieve Secrets**
|
|
47
|
+
#### **Save a Secret**
|
|
48
|
+
```python
|
|
49
|
+
from vcrypto import save_secret
|
|
50
|
+
|
|
51
|
+
save_secret("SECRET_TOKEN", "super_secret_value")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### **Retrieve a Secret**
|
|
55
|
+
```python
|
|
56
|
+
from vcrypto import read_secret
|
|
57
|
+
|
|
58
|
+
token = read_secret("SECRET_TOKEN")
|
|
59
|
+
print(token) # Output: super_secret_value
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## **⚙️ Customization**
|
|
65
|
+
The `init_vcrypto` function allows customization:
|
|
66
|
+
|
|
67
|
+
| Parameter | Description |
|
|
68
|
+
|---------------------------|-------------|
|
|
69
|
+
| `secrets_file` | Path to the encrypted secrets file (JSON/YAML) |
|
|
70
|
+
| `filename_master_password`| Path to the master password file (optional, defaults to `master.password`) |
|
|
71
|
+
| `environ_var_name` | Name of an environment variable to retrieve the master password |
|
|
72
|
+
|
|
73
|
+
**Example:**
|
|
74
|
+
```python
|
|
75
|
+
init_vcrypto(secrets_file="config/secrets.yaml", filename_master_password="config/master.secret")
|
|
76
|
+
```
|
|
77
|
+
This setup stores **both** the `master.password` and `secrets.yaml` in the `config/` folder.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## **🛠️ Development**
|
|
82
|
+
This project uses [`uv`](https://github.com/astral-sh/uv) for dependency management.
|
|
83
|
+
|
|
84
|
+
### **Install dependencies**
|
|
85
|
+
```sh
|
|
86
|
+
pip install uv
|
|
87
|
+
uv venv
|
|
88
|
+
uv install
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## **💜 License**
|
|
94
|
+
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## **👤 Author**
|
|
99
|
+
- **[Arnau Villoro](https://villoro.com)**
|
|
100
|
+
|
|
101
|
+
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "vcrypto"
|
|
3
|
-
version = "4.0
|
|
3
|
+
version = "4.2.0"
|
|
4
4
|
description = "Utility to easily store passwords/secrets"
|
|
5
5
|
authors = [{ name = "Arnau Villoro", email = "arnau@villoro.com" }]
|
|
6
6
|
maintainers = [{ name = "Arnau Villoro", email = "arnau@villoro.com" }]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from vcrypto.vcrypto import create_password
|
|
2
|
+
from vcrypto.vcrypto import export_secret
|
|
3
|
+
from vcrypto.vcrypto import get_secret
|
|
4
|
+
from vcrypto.vcrypto import init_vcrypto
|
|
5
|
+
from vcrypto.vcrypto import save_secret
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Alias `get_secret` as `read_secret`
|
|
9
|
+
read_secret = get_secret
|
|
10
|
+
|
|
11
|
+
# Explicitly define public API
|
|
12
|
+
__all__ = [
|
|
13
|
+
"init_vcrypto",
|
|
14
|
+
"get_secret",
|
|
15
|
+
"read_secret",
|
|
16
|
+
"save_secret",
|
|
17
|
+
"create_password",
|
|
18
|
+
"export_secret",
|
|
19
|
+
]
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from os import path
|
|
2
|
+
|
|
1
3
|
from loguru import logger
|
|
2
4
|
|
|
3
5
|
from vcrypto import encryption
|
|
@@ -49,7 +51,7 @@ class Vcrypto:
|
|
|
49
51
|
|
|
50
52
|
|
|
51
53
|
def init_vcrypto(
|
|
52
|
-
secrets_file="secrets.
|
|
54
|
+
secrets_file="secrets.yaml",
|
|
53
55
|
filename_master_password="master.password",
|
|
54
56
|
environ_var_name=None,
|
|
55
57
|
):
|
|
@@ -79,3 +81,19 @@ def create_password(store_secret=True):
|
|
|
79
81
|
"""Global function to create a master password."""
|
|
80
82
|
Vcrypto._check_vcrypto()
|
|
81
83
|
return _VCRYPTO.create_password(store_secret)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def export_secret(uri, secret_name, binary=False):
|
|
87
|
+
"""Export a secret from secrets.yaml"""
|
|
88
|
+
|
|
89
|
+
logger.debug(f"Exporting {secret_name=} to {uri=}")
|
|
90
|
+
|
|
91
|
+
if path.exists(uri):
|
|
92
|
+
logger.info(f"Skipping secret export since {uri=} already exists")
|
|
93
|
+
return False
|
|
94
|
+
|
|
95
|
+
secret = get_secret(secret_name, encoding="utf8" if not binary else None)
|
|
96
|
+
|
|
97
|
+
logger.info(f"Writing {secret_name=} to {uri=}")
|
|
98
|
+
with open(uri, "wb" if binary else "w") as stream:
|
|
99
|
+
stream.write(secret)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: vcrypto
|
|
3
|
+
Version: 4.2.0
|
|
4
|
+
Summary: Utility to easily store passwords/secrets
|
|
5
|
+
Author-email: Arnau Villoro <arnau@villoro.com>
|
|
6
|
+
Maintainer-email: Arnau Villoro <arnau@villoro.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Topic :: Security
|
|
11
|
+
Classifier: Topic :: Utilities
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Requires-Python: >=3.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: cryptography>=44.0.1
|
|
23
|
+
Requires-Dist: loguru>=0.7.3
|
|
24
|
+
Requires-Dist: pytest>=8.3.4
|
|
25
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
26
|
+
Requires-Dist: ruff>=0.9.7
|
|
27
|
+
|
|
28
|
+
# **vcrypto - Secure Secrets Management in Python**
|
|
29
|
+
vcrypto is a simple and effective utility for securely storing passwords and secrets in Python. It leverages **Fernet encryption** from the [cryptography](https://cryptography.io/en/latest/) module instead of reinventing the wheel.
|
|
30
|
+
|
|
31
|
+
## **🔒 Why vcrypto?**
|
|
32
|
+
Managing secrets in Python, especially in collaborative projects, can be cumbersome. Our approach simplifies it:
|
|
33
|
+
|
|
34
|
+
👉 **One master private password** (ignored in Git)\
|
|
35
|
+
👉 **A structured dictionary file with encrypted secrets**\
|
|
36
|
+
👉 **Easily shareable** - only the master password needs to be exchanged once\
|
|
37
|
+
👉 **Version-controlled secrets** - since only encrypted values are stored
|
|
38
|
+
|
|
39
|
+
This package makes it easy to **store and retrieve encrypted secrets** in **JSON** or **YAML** formats.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## **📌 Features**
|
|
44
|
+
- 🔐 **AES-128 Encryption** (Fernet) for secure storage.
|
|
45
|
+
- 📂 **JSON/YAML Support** for structured secret storage.
|
|
46
|
+
- 🛠️ **Environment Variable Support** for flexible key management.
|
|
47
|
+
- 🔑 **Simple API** for saving and retrieving secrets.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## **📝 Installation**
|
|
52
|
+
Install via **pip**:
|
|
53
|
+
```sh
|
|
54
|
+
pip install vcrypto
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## **🚀 Quickstart**
|
|
60
|
+
### **1️⃣ Initialize vcrypto**
|
|
61
|
+
Before using `vcrypto`, initialize it with:
|
|
62
|
+
```python
|
|
63
|
+
from vcrypto import init_vcrypto
|
|
64
|
+
|
|
65
|
+
init_vcrypto(secrets_file="secrets.yaml", environ_var_name="MY_ENV_VAR")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
> [!TIP]
|
|
69
|
+
> You only need to initialize it **once**.
|
|
70
|
+
|
|
71
|
+
This ensures `vcrypto` knows where to store secrets and how to retrieve the master password.
|
|
72
|
+
|
|
73
|
+
### **2️⃣ Store and Retrieve Secrets**
|
|
74
|
+
#### **Save a Secret**
|
|
75
|
+
```python
|
|
76
|
+
from vcrypto import save_secret
|
|
77
|
+
|
|
78
|
+
save_secret("SECRET_TOKEN", "super_secret_value")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### **Retrieve a Secret**
|
|
82
|
+
```python
|
|
83
|
+
from vcrypto import read_secret
|
|
84
|
+
|
|
85
|
+
token = read_secret("SECRET_TOKEN")
|
|
86
|
+
print(token) # Output: super_secret_value
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## **⚙️ Customization**
|
|
92
|
+
The `init_vcrypto` function allows customization:
|
|
93
|
+
|
|
94
|
+
| Parameter | Description |
|
|
95
|
+
|---------------------------|-------------|
|
|
96
|
+
| `secrets_file` | Path to the encrypted secrets file (JSON/YAML) |
|
|
97
|
+
| `filename_master_password`| Path to the master password file (optional, defaults to `master.password`) |
|
|
98
|
+
| `environ_var_name` | Name of an environment variable to retrieve the master password |
|
|
99
|
+
|
|
100
|
+
**Example:**
|
|
101
|
+
```python
|
|
102
|
+
init_vcrypto(secrets_file="config/secrets.yaml", filename_master_password="config/master.secret")
|
|
103
|
+
```
|
|
104
|
+
This setup stores **both** the `master.password` and `secrets.yaml` in the `config/` folder.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## **🛠️ Development**
|
|
109
|
+
This project uses [`uv`](https://github.com/astral-sh/uv) for dependency management.
|
|
110
|
+
|
|
111
|
+
### **Install dependencies**
|
|
112
|
+
```sh
|
|
113
|
+
pip install uv
|
|
114
|
+
uv venv
|
|
115
|
+
uv install
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## **💜 License**
|
|
121
|
+
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## **👤 Author**
|
|
126
|
+
- **[Arnau Villoro](https://villoro.com)**
|
|
127
|
+
|
|
128
|
+
---
|
vcrypto-4.0.2/PKG-INFO
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: vcrypto
|
|
3
|
-
Version: 4.0.2
|
|
4
|
-
Summary: Utility to easily store passwords/secrets
|
|
5
|
-
Author-email: Arnau Villoro <arnau@villoro.com>
|
|
6
|
-
Maintainer-email: Arnau Villoro <arnau@villoro.com>
|
|
7
|
-
License: MIT
|
|
8
|
-
Classifier: Development Status :: 4 - Beta
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: Topic :: Security
|
|
11
|
-
Classifier: Topic :: Utilities
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python: >=3.8
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: cryptography>=44.0.1
|
|
23
|
-
Requires-Dist: loguru>=0.7.3
|
|
24
|
-
Requires-Dist: pytest>=8.3.4
|
|
25
|
-
Requires-Dist: pyyaml>=6.0.2
|
|
26
|
-
Requires-Dist: ruff>=0.9.7
|
|
27
|
-
|
|
28
|
-
# Palette Material Design
|
|
29
|
-
Utility to easily store password/secrets. It uses `Fernet` from the [cryptography](https://cryptography.io/en/latest/) module instead of reinventing the wheel.
|
|
30
|
-
|
|
31
|
-
Fernet is a symmetric encryption that uses 128-bit AES in CBC mode and PKCS7 padding with HMAC using SHA256 for authentication. You can read more about it [here](https://medium.com/coinmonks/if-youre-struggling-picking-a-crypto-suite-fernet-may-be-the-answer-95196c0fec4b).
|
|
32
|
-
|
|
33
|
-
## Why vcrypto?
|
|
34
|
-
It is always annoying to deal with secrets and passwords in python especially if you work with other people. What we found that worked best for us was:
|
|
35
|
-
|
|
36
|
-
* Create one master private password (ignored from git)
|
|
37
|
-
* Have dict-like file with the rest of passwords encrypted
|
|
38
|
-
|
|
39
|
-
This module provides the class `Cipher` to handle that easily.
|
|
40
|
-
|
|
41
|
-
The idea behind this module is to be able to **create a `json` or `yaml` with encrypted secrets**. The keys will be public but the values won't. This way you can **store the dictionary of secrets in git** and easily share them with other people working in the same project. You will only need to **share the `master.password` once**. And all the other passwords/secrets will be tracked with git.
|
|
42
|
-
|
|
43
|
-
## Installation
|
|
44
|
-
|
|
45
|
-
You can install it with pip by running:
|
|
46
|
-
|
|
47
|
-
pip install vcrypto
|
|
48
|
-
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
51
|
-
```python
|
|
52
|
-
from vcrypto import Cipher
|
|
53
|
-
|
|
54
|
-
# Create a cipher instance
|
|
55
|
-
cipher = Cipher()
|
|
56
|
-
|
|
57
|
-
# Create a new master password
|
|
58
|
-
cipher.create_password()
|
|
59
|
-
|
|
60
|
-
# Store a secret
|
|
61
|
-
cipher.save_secret("secret", "I like python")
|
|
62
|
-
|
|
63
|
-
# Retrive a secret
|
|
64
|
-
cipher.get_secret("secret")
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Customization
|
|
68
|
-
|
|
69
|
-
There are three paramaters to customize the cipher:
|
|
70
|
-
|
|
71
|
-
1. **secrets_file:** path of the file with secrets. Can be a `json` or `yaml`.
|
|
72
|
-
2. **filename_master_password:** path of the file with the master password
|
|
73
|
-
3. **environ_var_name:** if passed it allows to read the master password from an environ var.
|
|
74
|
-
|
|
75
|
-
> For `yaml` you need to install `pyyaml`
|
|
76
|
-
|
|
77
|
-
For example you could do:
|
|
78
|
-
|
|
79
|
-
```python
|
|
80
|
-
cipher = Cipher(secrets_file="data/secrets.yaml", filename_master_password="data/master.secret")
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
This will allow you to store both the `master.password` and `secrets.yaml` in the folder `data`.
|
|
84
|
-
|
|
85
|
-
There is not much more customization since the idea is to keep it simple.
|
|
86
|
-
|
|
87
|
-
### Integrating it in other projects
|
|
88
|
-
We usually have one or more python files with utilities, for example `utilities.py`.
|
|
89
|
-
|
|
90
|
-
To use vcrypto we initiallize the `cipher` there and then create a `get_secret` dummy function that will call the cipher.
|
|
91
|
-
|
|
92
|
-
```python
|
|
93
|
-
from vcrypto import Cipher
|
|
94
|
-
|
|
95
|
-
cipher = Cipher(secrets_file="data/secrets.yaml", filename_master_password="data/master.secret")
|
|
96
|
-
|
|
97
|
-
def get_secret(key):
|
|
98
|
-
return cipher.get_secret(key)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Then you can use it elsewhere with:
|
|
102
|
-
|
|
103
|
-
```python
|
|
104
|
-
import utilities as u
|
|
105
|
-
|
|
106
|
-
u.get_secret("secret")
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Development
|
|
110
|
-
|
|
111
|
-
This package relies on [poetry](https://villoro.com/post/poetry) and `pre-commit`. In order to develop you need to install both libraries with:
|
|
112
|
-
|
|
113
|
-
```sh
|
|
114
|
-
pip install poetry pre-commit
|
|
115
|
-
poetry install
|
|
116
|
-
pre-commit install
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Then you need to add `poetry run` before any python shell command. For example:
|
|
120
|
-
|
|
121
|
-
```sh
|
|
122
|
-
# DO
|
|
123
|
-
poetry run python master.py
|
|
124
|
-
|
|
125
|
-
# don't do
|
|
126
|
-
python master.py
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Authors
|
|
130
|
-
* [Arnau Villoro](https://villoro.com)
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
The content of this repository is licensed under a [MIT](https://opensource.org/licenses/MIT).
|
vcrypto-4.0.2/README.md
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
# Palette Material Design
|
|
2
|
-
Utility to easily store password/secrets. It uses `Fernet` from the [cryptography](https://cryptography.io/en/latest/) module instead of reinventing the wheel.
|
|
3
|
-
|
|
4
|
-
Fernet is a symmetric encryption that uses 128-bit AES in CBC mode and PKCS7 padding with HMAC using SHA256 for authentication. You can read more about it [here](https://medium.com/coinmonks/if-youre-struggling-picking-a-crypto-suite-fernet-may-be-the-answer-95196c0fec4b).
|
|
5
|
-
|
|
6
|
-
## Why vcrypto?
|
|
7
|
-
It is always annoying to deal with secrets and passwords in python especially if you work with other people. What we found that worked best for us was:
|
|
8
|
-
|
|
9
|
-
* Create one master private password (ignored from git)
|
|
10
|
-
* Have dict-like file with the rest of passwords encrypted
|
|
11
|
-
|
|
12
|
-
This module provides the class `Cipher` to handle that easily.
|
|
13
|
-
|
|
14
|
-
The idea behind this module is to be able to **create a `json` or `yaml` with encrypted secrets**. The keys will be public but the values won't. This way you can **store the dictionary of secrets in git** and easily share them with other people working in the same project. You will only need to **share the `master.password` once**. And all the other passwords/secrets will be tracked with git.
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
You can install it with pip by running:
|
|
19
|
-
|
|
20
|
-
pip install vcrypto
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```python
|
|
25
|
-
from vcrypto import Cipher
|
|
26
|
-
|
|
27
|
-
# Create a cipher instance
|
|
28
|
-
cipher = Cipher()
|
|
29
|
-
|
|
30
|
-
# Create a new master password
|
|
31
|
-
cipher.create_password()
|
|
32
|
-
|
|
33
|
-
# Store a secret
|
|
34
|
-
cipher.save_secret("secret", "I like python")
|
|
35
|
-
|
|
36
|
-
# Retrive a secret
|
|
37
|
-
cipher.get_secret("secret")
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Customization
|
|
41
|
-
|
|
42
|
-
There are three paramaters to customize the cipher:
|
|
43
|
-
|
|
44
|
-
1. **secrets_file:** path of the file with secrets. Can be a `json` or `yaml`.
|
|
45
|
-
2. **filename_master_password:** path of the file with the master password
|
|
46
|
-
3. **environ_var_name:** if passed it allows to read the master password from an environ var.
|
|
47
|
-
|
|
48
|
-
> For `yaml` you need to install `pyyaml`
|
|
49
|
-
|
|
50
|
-
For example you could do:
|
|
51
|
-
|
|
52
|
-
```python
|
|
53
|
-
cipher = Cipher(secrets_file="data/secrets.yaml", filename_master_password="data/master.secret")
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This will allow you to store both the `master.password` and `secrets.yaml` in the folder `data`.
|
|
57
|
-
|
|
58
|
-
There is not much more customization since the idea is to keep it simple.
|
|
59
|
-
|
|
60
|
-
### Integrating it in other projects
|
|
61
|
-
We usually have one or more python files with utilities, for example `utilities.py`.
|
|
62
|
-
|
|
63
|
-
To use vcrypto we initiallize the `cipher` there and then create a `get_secret` dummy function that will call the cipher.
|
|
64
|
-
|
|
65
|
-
```python
|
|
66
|
-
from vcrypto import Cipher
|
|
67
|
-
|
|
68
|
-
cipher = Cipher(secrets_file="data/secrets.yaml", filename_master_password="data/master.secret")
|
|
69
|
-
|
|
70
|
-
def get_secret(key):
|
|
71
|
-
return cipher.get_secret(key)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Then you can use it elsewhere with:
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
import utilities as u
|
|
78
|
-
|
|
79
|
-
u.get_secret("secret")
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Development
|
|
83
|
-
|
|
84
|
-
This package relies on [poetry](https://villoro.com/post/poetry) and `pre-commit`. In order to develop you need to install both libraries with:
|
|
85
|
-
|
|
86
|
-
```sh
|
|
87
|
-
pip install poetry pre-commit
|
|
88
|
-
poetry install
|
|
89
|
-
pre-commit install
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Then you need to add `poetry run` before any python shell command. For example:
|
|
93
|
-
|
|
94
|
-
```sh
|
|
95
|
-
# DO
|
|
96
|
-
poetry run python master.py
|
|
97
|
-
|
|
98
|
-
# don't do
|
|
99
|
-
python master.py
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Authors
|
|
103
|
-
* [Arnau Villoro](https://villoro.com)
|
|
104
|
-
|
|
105
|
-
## License
|
|
106
|
-
The content of this repository is licensed under a [MIT](https://opensource.org/licenses/MIT).
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.2
|
|
2
|
-
Name: vcrypto
|
|
3
|
-
Version: 4.0.2
|
|
4
|
-
Summary: Utility to easily store passwords/secrets
|
|
5
|
-
Author-email: Arnau Villoro <arnau@villoro.com>
|
|
6
|
-
Maintainer-email: Arnau Villoro <arnau@villoro.com>
|
|
7
|
-
License: MIT
|
|
8
|
-
Classifier: Development Status :: 4 - Beta
|
|
9
|
-
Classifier: Intended Audience :: Developers
|
|
10
|
-
Classifier: Topic :: Security
|
|
11
|
-
Classifier: Topic :: Utilities
|
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python: >=3.8
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
Requires-Dist: cryptography>=44.0.1
|
|
23
|
-
Requires-Dist: loguru>=0.7.3
|
|
24
|
-
Requires-Dist: pytest>=8.3.4
|
|
25
|
-
Requires-Dist: pyyaml>=6.0.2
|
|
26
|
-
Requires-Dist: ruff>=0.9.7
|
|
27
|
-
|
|
28
|
-
# Palette Material Design
|
|
29
|
-
Utility to easily store password/secrets. It uses `Fernet` from the [cryptography](https://cryptography.io/en/latest/) module instead of reinventing the wheel.
|
|
30
|
-
|
|
31
|
-
Fernet is a symmetric encryption that uses 128-bit AES in CBC mode and PKCS7 padding with HMAC using SHA256 for authentication. You can read more about it [here](https://medium.com/coinmonks/if-youre-struggling-picking-a-crypto-suite-fernet-may-be-the-answer-95196c0fec4b).
|
|
32
|
-
|
|
33
|
-
## Why vcrypto?
|
|
34
|
-
It is always annoying to deal with secrets and passwords in python especially if you work with other people. What we found that worked best for us was:
|
|
35
|
-
|
|
36
|
-
* Create one master private password (ignored from git)
|
|
37
|
-
* Have dict-like file with the rest of passwords encrypted
|
|
38
|
-
|
|
39
|
-
This module provides the class `Cipher` to handle that easily.
|
|
40
|
-
|
|
41
|
-
The idea behind this module is to be able to **create a `json` or `yaml` with encrypted secrets**. The keys will be public but the values won't. This way you can **store the dictionary of secrets in git** and easily share them with other people working in the same project. You will only need to **share the `master.password` once**. And all the other passwords/secrets will be tracked with git.
|
|
42
|
-
|
|
43
|
-
## Installation
|
|
44
|
-
|
|
45
|
-
You can install it with pip by running:
|
|
46
|
-
|
|
47
|
-
pip install vcrypto
|
|
48
|
-
|
|
49
|
-
## Usage
|
|
50
|
-
|
|
51
|
-
```python
|
|
52
|
-
from vcrypto import Cipher
|
|
53
|
-
|
|
54
|
-
# Create a cipher instance
|
|
55
|
-
cipher = Cipher()
|
|
56
|
-
|
|
57
|
-
# Create a new master password
|
|
58
|
-
cipher.create_password()
|
|
59
|
-
|
|
60
|
-
# Store a secret
|
|
61
|
-
cipher.save_secret("secret", "I like python")
|
|
62
|
-
|
|
63
|
-
# Retrive a secret
|
|
64
|
-
cipher.get_secret("secret")
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Customization
|
|
68
|
-
|
|
69
|
-
There are three paramaters to customize the cipher:
|
|
70
|
-
|
|
71
|
-
1. **secrets_file:** path of the file with secrets. Can be a `json` or `yaml`.
|
|
72
|
-
2. **filename_master_password:** path of the file with the master password
|
|
73
|
-
3. **environ_var_name:** if passed it allows to read the master password from an environ var.
|
|
74
|
-
|
|
75
|
-
> For `yaml` you need to install `pyyaml`
|
|
76
|
-
|
|
77
|
-
For example you could do:
|
|
78
|
-
|
|
79
|
-
```python
|
|
80
|
-
cipher = Cipher(secrets_file="data/secrets.yaml", filename_master_password="data/master.secret")
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
This will allow you to store both the `master.password` and `secrets.yaml` in the folder `data`.
|
|
84
|
-
|
|
85
|
-
There is not much more customization since the idea is to keep it simple.
|
|
86
|
-
|
|
87
|
-
### Integrating it in other projects
|
|
88
|
-
We usually have one or more python files with utilities, for example `utilities.py`.
|
|
89
|
-
|
|
90
|
-
To use vcrypto we initiallize the `cipher` there and then create a `get_secret` dummy function that will call the cipher.
|
|
91
|
-
|
|
92
|
-
```python
|
|
93
|
-
from vcrypto import Cipher
|
|
94
|
-
|
|
95
|
-
cipher = Cipher(secrets_file="data/secrets.yaml", filename_master_password="data/master.secret")
|
|
96
|
-
|
|
97
|
-
def get_secret(key):
|
|
98
|
-
return cipher.get_secret(key)
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Then you can use it elsewhere with:
|
|
102
|
-
|
|
103
|
-
```python
|
|
104
|
-
import utilities as u
|
|
105
|
-
|
|
106
|
-
u.get_secret("secret")
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Development
|
|
110
|
-
|
|
111
|
-
This package relies on [poetry](https://villoro.com/post/poetry) and `pre-commit`. In order to develop you need to install both libraries with:
|
|
112
|
-
|
|
113
|
-
```sh
|
|
114
|
-
pip install poetry pre-commit
|
|
115
|
-
poetry install
|
|
116
|
-
pre-commit install
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Then you need to add `poetry run` before any python shell command. For example:
|
|
120
|
-
|
|
121
|
-
```sh
|
|
122
|
-
# DO
|
|
123
|
-
poetry run python master.py
|
|
124
|
-
|
|
125
|
-
# don't do
|
|
126
|
-
python master.py
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Authors
|
|
130
|
-
* [Arnau Villoro](https://villoro.com)
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
The content of this repository is licensed under a [MIT](https://opensource.org/licenses/MIT).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|