Enclave Secret Manager is a secure solution for managing sensitive information, such as API keys, credentials, and other secrets. It ensures that secrets are encrypted, versioned, and securely stored in a PostgreSQL database. It comes with a robust API and CLI that interact with the core library, making it easy to integrate secret management into your workflows.
- Secret Encryption: Supports encryption of secrets using AES and other algorithms.
- Versioning: Secrets can have multiple versions, with the ability to switch between versions.
- API and CLI: Access and manage secrets via a REST API or a command-line interface.
- Dockerized Deployment: Easily deploy and run using Docker and Docker Compose.
Ensure you have the following installed:
- Python 3.10+
- PostgreSQL (local or dockerized)
- Poetry for dependency management
-
Clone the repository:
git clone https://github.com/devankitjuneja/enclave.git cd enclave -
Create a virtual environment:
python -m venv .venv source .venv/bin/activate -
Install dependencies using Poetry:
poetry install
-
Set up your environment variables by creating a
.envfile:touch .env
Populate the
.envfile with the following environment variables:API_URL=http://localhost:8000 API_KEY=<your-api-key> POSTGRES_DB=enclave POSTGRES_USER=enclave POSTGRES_PASSWORD=enclave POSTGRES_HOST=localhost REDIS_HOST=localhost
-
Run the application locally:
poetry run uvicorn enclave.api.main:app --reload
-
Open your browser and navigate to
http://localhost:8000/docsto explore the API.
-
Ensure Docker and Docker Compose are installed on your machine.
-
Set up your environment variables by creating a
.envfile:touch .env
Populate the
.envfile with the following environment variables:API_URL=http://enclave-api:8000 API_KEY=<your-api-key> POSTGRES_DB=enclave POSTGRES_USER=enclave POSTGRES_PASSWORD=enclave POSTGRES_HOST=enclave-db REDIS_HOST=enclave-redis
-
Navigate to the project directory where the
docker-compose.ymlfile is located. -
Run the following command to start the services:
docker compose up --build
This command will:
- Build the API image
- Set up the PostgreSQL database
- Seed the database with initial data from the
db-scriptsfolder
-
Once the services are up, you can access the API at
http://localhost:8000and PostgreSQL onlocalhost:5432. -
To stop the services, run:
docker compose down
You can interact with the Secret Manager through its API:
-
Create a Secret:
POST /secrets { "name": "db-password", "value": "s3cr3tp@ssw0rd" } -
Retrieve a Secret:
GET /secrets/{secret_name} -
Update a Secret:
PUT /secrets/{secret_name} { "value": "newS3cr3t" } -
Delete a Secret:
DELETE /secrets/{secret_name}
You can also interact with the Secret Manager using its CLI:
-
Create a Secret:
enclave-cli create --name db-password --value s3cr3tp@ssw0rd
-
Retrieve a Secret:
enclave-cli read --name db-password --version 1 -
Update a Secret:
enclave-cli update --name db-password --value newS3cr3t
-
Delete a Secret:
enclave-cli delete --name db-password
We welcome contributions! Feel free to submit issues or pull requests.
This project is licensed under the MIT License.