Secret Generator API is a small application developed using FastAPI that allows generating customizable alphanumeric secrets. It also provides a health check endpoint to verify the API status.
- Features
- Prerequisites
- Installation
- Running the Application
- Usage
- Available Endpoints
- Contributing
- License
- Generate alphanumeric secrets with a custom length.
- Health check endpoint (
/healthz
) to verify the API status. - Configurable maximum length for secrets (default: 10,000).
- Python 3.8+
- FastAPI
- Uvicorn (to run the application)
-
Clone the repository:
git clone https://github.com/nejos97/generate-secret.git cd generate-secret
-
Create a virtual environment and activate it:
python -m venv env source env/bin/activate # On Windows use `env\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
Run the application using Uvicorn:
uvicorn main:app --reload
This will start the local server at http://127.0.0.1:8000
.
To generate an alphanumeric secret, use the following endpoint:
GET /?length=<secret_length>
curl -X GET "http://127.0.0.1:8000/?length=16"
{
"secret": "a1b2c3d4e5f6g7h8"
}
Note: The default length is 32 characters if
length
is not specified. The maximum allowed length is 10,000.
To check if the API is functioning correctly, use the /healthz
endpoint:
GET /healthz
{
"status": 200,
"message": "OK"
}
GET /
: Generates an alphanumeric secret.GET /healthz
: Checks the API status.
Contributions are welcome! If you have suggestions for improvements, bug reports, or feature requests, feel free to create an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.