A HashiCorp Vault operator that allows anonymization and de-anonymization using Microsoft Presidio.
Project description
Presidio Vault Operator
A library that allows to integrate presidio with HashiCorp Vault for anonymization and deanonymization.
Getting started
Installation
Install the Vault Operator using pip:
pip install presidio-vault
Using the Vault Operator
Once the library is installed you can start using it in conjunction with presidio analyzer(Make sure you pip install the analyzer as well) as follows:
from presidio_analyzer.analyzer_engine import AnalyzerEngine
from presidio_vault.vault import Vault
text = "My phone number is 212-555-5555"
analyzer_results = AnalyzerEngine().analyze(text=text, language="en")
vaulturl="http://127.0.0.1:8200"
vaultkey="orders"
vaulttoken="" # optional token
vault = Vault(vaulturl, vaultkey, vaulttoken)
anonymizer_results = vault.anonymize(text, analyzer_results)
print(anonymizer_results)
deanonymizer_results = vault.deanonymize(anonymizer_results.text, anonymizer_results.items)
print(deanonymizer_results)
For an example of how it is used, have a look at the pii-detector-and-anonymizer.
Contributing
Local development setup
Run ./setup.sh
to install all dependencies. This will install direnv and nix then simply run direnv allow
to install all build dependencies.
Alternatively, make sure you have python 3.8 or greater and poetry setup on your machine.
To get started, run the following:
poetry install --no-interaction --no-root
poetry run pytest
Troubleshooting local setup
There is a chance that direnv allow
will not load the environment correctly and silently fail. This is observable when you attempt to run poetry install
, as you will get a command not found
error in the shell.
To fix this, you need to run the nix commands directly. Run the following:
nix --extra-experimental-features 'nix-command flakes' develop
This command will spawn a new shell which has the nix dependencies loaded. You will need to run commands from this prompt.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file presidio_vault-0.1.0.tar.gz
.
File metadata
- Download URL: presidio_vault-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eb2a974be4ee87fe04265937a1633a7d42574bdda56f85c5ce338a543531303 |
|
MD5 | 94397221dddc9cd9f7d666ff10082d66 |
|
BLAKE2b-256 | b8f7470548e5bac70191fc4b000029f202a9f4c6266d066910be35bac6023ef1 |
File details
Details for the file presidio_vault-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: presidio_vault-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ebcd8797ad93dd9dde1f00ccf4df8c8e10d7ba670c573c3c9421755b783c9a2 |
|
MD5 | e4000ddb3314d4bd7e6617fcacdbb90e |
|
BLAKE2b-256 | 624dae6a3cfb22ba88af8e0e4b1e393c15d1d0f4c7564143e2b6d47a29658ee3 |