from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes from cryptography.hazmat.backends import default_backend import os key = os.urandom(32) # 256-bit key iv = os.urandom(16) # AES block size plaintext = b"Hello cryptography!" cipher = Cipher(algorithms.AES(key), modes.CBC(iv), backend=default_backend()) encryptor = cipher.encryptor() # PKCS7 padding (block size 128 bits = 16 bytes) from cryptography.hazmat.primitives import padding padder = padding.PKCS7(128).padder() padded_data = padder.update(plaintext) + padder.finalize() ciphertext = encryptor.update(padded_data) + encryptor.finalize() # Decrypt decryptor = cipher.decryptor() decrypted_padded = decryptor.update(ciphertext) + decryptor.finalize() unpadder = padding.PKCS7(128).unpadder() decrypted = unpadder.update(decrypted_padded) + unpadder.finalize() print("Decrypted:", decrypted.decode()) fxGfw*eW##$6*TE APIs for this project GuestAPI - c Dahsboard - c Category (pagination,filter,serach) - c Category images(pagination,filter,serach) - c history(pagination,filter,serach) -c save tattoo - c remove bg - c social login auto login profile update logout - c delete account save subscription cron to validate recipt tokem expire issue tattoo_project/ │ ├── app/ │ ├── __init__.py │ ├── api/ │ │ ├── __init__.py │ │ ├── v1/ │ │ │ ├── __init__.py │ │ │ ├── guest_api.py # Handles guest-related actions (e.g., visit pages, view tattoos) │ │ │ ├── dashboard_api.py # Dashboard related APIs (tattoo history, user info) │ │ │ ├── category_api.py # Handles category-related actions (pagination, filtering, etc.) │ │ │ ├── tattoo_api.py # Manages tattoo saving, history, remove bg, etc. │ │ │ └── user_api.py # Handles user authentication, profile update, account delete │ │ ├── v2/ │ │ │ ├── __init__.py │ │ │ ├── guest_api.py │ │ │ ├── dashboard_api.py │ │ │ ├── category_api.py │ │ │ ├── tattoo_api.py │ │ │ └── user_api.py │ │ │ ├── models/ │ │ ├── __init__.py │ │ ├── category_model.py │ │ ├── tattoo_model.py │ │ └── user_model.py │ │ │ ├── schemas/ # New folder for API-specific schemas │ │ ├── __init__.py │ │ ├── user.py # User schema for serialization │ │ └── item.py # Item schema for tattoos or related entities │ │ │ ├── db/ # New folder for database connection and management │ │ ├── __init__.py │ │ ├── database.py # Database connection manager │ │ │ ├── services/ │ │ ├── __init__.py │ │ ├── encryption_service.py # AES encryption for image processing and data security │ │ ├── image_service.py # Image background removal and processing services │ │ ├── jwt_service.py # JWT token generation and validation │ │ ├── notification_service.py # Email, SMS, or in-app notifications │ │ └── social_login_service.py # Handles social logins (Facebook, Google, Apple) │ │ │ ├── utils/ │ │ ├── __init__.py │ │ ├── token_utils.py # Utility functions for token handling │ │ ├── validation_utils.py # Input validation, data sanitization utilities │ │ └── response_utils.py # Centralized response format utility │ │ │ ├── cron_jobs/ │ │ ├── __init__.py │ │ ├── receipt_validation.py # Cron job to validate subscription receipts │ │ └── clean_up_jobs.py # Cron job for database cleanup, expired sessions │ │ │ ├── core/ # Core configurations and shared services │ │ ├── __init__.py │ │ ├── config.py # App configurations, secrets, DB URL │ │ ├── logger.py # Logging setup │ │ └── app_init.py # App initialization code (e.g., FastAPI setup) │ ├── scripts/ │ ├── populate_db.py # Script for populating initial DB │ └── cron_jobs.py # Cron job configuration and handling │ ├── tests/ │ ├── __init__.py │ ├── test_api.py # Unit tests for APIs │ ├── test_services.py # Unit tests for services (JWT, image processing) │ └── test_cron_jobs.py # Tests for cron jobs (receipt validation, cleanup) │ ├── Dockerfile # Docker container setup for production deployment ├── requirements.txt # Python dependencies ├── .gitignore # Git ignore file ├── README.md # Project documentation and setup instructions ├── main.py # Main entry point for FastAPI app └── schema.sql # SQL schema file for creating the database structure ENV_FILE=.env.staging uvicorn app.main:app git pull # make code changes git add . git commit -m "your message" git push uvicorn main:app --host 0.0.0.0 --port 8000