๐ This is a simple HTTP service for generating one-time secrets similar to onetimesecret.com.
This service allows users to create secrets, set a passphrase for their retrieval, and generate a unique key to access the secret. The service provides a JSON API and does not include a UI.
- FastAPI
- Docker
- MongoDB
- pytest
To run the service, make sure you have Docker and Docker Compose installed on your system. Then, follow these steps:
- Clone this repository:
git clone <repository_url>
- Navigate to the project directory:
cd <project_directory>
- Build and start the Docker containers:
docker-compose up --build
- The service should now be running and accessible at
http://localhost:8000
.
- URL:
/generate
- Method:
POST
- Request Body:
secret
: The secret message to be stored.passphrase
: The passphrase required to retrieve the secret.
- Response: Returns a unique
secret_key
which can be used to retrieve the secret.
- URL:
/secrets/{secret_key}
- Method:
GET
- Parameters:
secret_key
: The unique key generated during secret creation.
- Request Header:
passphrase
: The passphrase provided during secret creation.
- Response: Returns the secret message if the correct passphrase is provided.
To run the tests, execute the following command:
make test
- Asynchronous Processing: The service can be modified to handle requests asynchronously for improved performance.
- External Storage: Data storage can be implemented using an external storage solution like MongoDB.
- Encryption: Implement encryption for storing secrets and passphrases securely.
- Time-To-Live (TTL): Implement TTL indexes to automatically delete secrets after a certain period.
Contributions are welcome! Please open an issue or submit a pull request with any improvements or additional features.
This project is licensed under the MIT License - see the LICENSE file for details.