Overview
Python library help to use Berglas, to encrypt and to decrypt the secrets stored in a GCP storage.
See Berglas for details about bucket bootstrapping and secret creation
Library Usage
You have to get the library
pip install berglas-python
Then use it in the same way as Go library
The library berglas_python library is able to:
- Encrypt and upload the secrets
- Download and decrypt any secrets that match the Berglas environment variable reference syntax
- Replace the value for the environment variable with the decrypted secret
Here an example of usage
import os
import berglas_python as berglas
project_id = os.environ.get("MY-PROJECT")
# This higher-level API parses the secret reference at the specified
# environment variable, downloads and decrypts the secret, and replaces the
# contents of the given environment variable with the secret result.
berglas.Replace(project_id, "MY-SECRET")
# This lower-level API parses the secret reference, downloads and decrypts
# the secret, and returns the result. This is useful if you need to mutate
# the result.
my_secret = os.environ.get("MY-SECRET")
plaintext = berglas.Resolve(project_id, my_secret)
os.environ.unsetenv("MY-SECRET")
os.environ.setdefault("MY-SECRET", plaintext)
# This is lower-level API encrypts the plaintext string and uploads the blob
berglas.Encrypt(project_id, 'MY-BUCKET/MY-SECRET-FILE', 'STRING-TO-ENCRYPT')
License
This library is licensed under Apache 2.0. Full license text is available in LICENSE.
Metadata
Release files for berglas-python 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| berglas_python-0.3.4.tar.gz | 5.0 kB | Without provenance | Details for berglas_python-0.3.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| berglas_python-0.3.4-py3-none-any.whl | Python 3 | none | any | Details for berglas_python-0.3.4-py3-none-any.whl |
Total release size: 14.3 kB
Release files / berglas_python-0.3.4.tar.gz
| Download URL | berglas_python-0.3.4.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b615445cf2658a635bff84f1c80c1eaf7b8b1d30f9c16077617ee65be9a31db
|
|
BLAKE2b-256 checksum How to use checksums |
176f23d3f68cb397697a3fa1d3590013c68ff26376ec76d5b38dbde7477ef0e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|
Release files / berglas_python-0.3.4-py3-none-any.whl
| Download URL | berglas_python-0.3.4-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fa6b5f1ae8b620bc763bd1b2932b66ff76af6230ffea7ab12d40f570a717353
|
|
BLAKE2b-256 checksum How to use checksums |
1f8e6545f99df328c1794ba0a7dc5c202a929d07bf6861332da6825ced940607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9
|
Security for berglas-python 0.3.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.