Skip to content

allisson/secure-qrcode

Repository files navigation

πŸ” Secure QR Code Generator

Build Status Docker Image Version

πŸš€ Encrypt your sensitive data using modern cryptography and turn it into secure QR codes!

Transform your private information into unreadable encrypted data using the powerful ChaCha20-Poly1305 cipher, then encode it as a QR code for easy sharing and storage. πŸ”’πŸ“±

✨ Features

  • πŸ” Military-grade encryption with ChaCha20-Poly1305
  • πŸ—οΈ PBKDF2 key derivation for enhanced security
  • πŸ“± QR code generation for easy data transfer
  • 🌐 RESTful API with interactive documentation
  • 🐳 Docker support for easy deployment
  • ⚑ FastAPI backend for high performance

πŸ“‹ Version Compatibility

⚠️ Important: Version "2.x" is not compatible with version "1.x".

For legacy "1.x" QR codes, check the v1.6.0 documentation. πŸ“š

πŸ” How It Works

  1. πŸ“ Input: Your secret message and encryption key
  2. πŸ”‘ Derivation: PBKDF2 transforms your key into a 32-byte cryptographic key
  3. πŸ”’ Encryption: ChaCha20-Poly1305 encrypts your data with authenticated encryption
  4. πŸ“± QR Generation: Encrypted data becomes a scannable QR code
Plaintext + Key β†’ PBKDF2 β†’ ChaCha20-Poly1305 β†’ QR Code

πŸš€ Quick Start

🌐 Try It Online

Visit the live demo in your browser! 🌍

πŸ’‘ Note: This is a free instance that may sleep during inactivity. Please be patient! ⏳

🐳 Run Locally with Docker

# Pull and run the API server
docker run --rm -p 8000:8000 allisson/secure-qrcode

# Access the web interface
open http://localhost:8000

That's it! Your secure QR code generator is now running locally. πŸŽ‰

πŸ’» Local Development

To set up the project for local development:

  1. Clone the repository:

    git clone https://github.com/allisson/secure-qrcode.git
    cd secure-qrcode
  2. Install dependencies and run the API server:

    uv sync
    uv run uvicorn secure_qrcode.api:app --reload

    This will start the API server locally, and it will automatically reload on code changes.

  3. Access the web interface and API docs:

πŸ“– API Documentation

Explore the interactive API docs:

πŸ’» Usage Examples

πŸ” Generate a Secure QR Code

curl --location 'http://localhost:8000/v1/encode' \
--header 'Content-Type: application/json' \
--data '{
    "plaintext": "my super secret text",
    "key": "my super secret key"
}' | jq -r '.content' | base64 --decode > secure_qrcode.png

# Your encrypted QR code is saved as secure_qrcode.png! πŸ–ΌοΈ

πŸ”“ Decrypt a QR Code

First, scan your QR code to get the encrypted data (it looks like this):

{
    "salt": "LC1bxUNUpMnt/mae1KDNiA==",
    "iterations": 1200000,
    "associated_data": "0WdPVTKSb/a6KjB3NgjFww==",
    "nonce": "FgmmR8D1Su13HgUO",
    "ciphertext": "4FIQ8LAlztzaToyElulDcPAReKGnOd2TFYiH1P9ZatIOuHN+"
}

Then decrypt it:

curl --location 'http://localhost:8000/v1/decode' \
--header 'Content-Type: application/json' \
--data '{
    "encrypted_data": {
        "salt": "LC1bxUNUpMnt/mae1KDNiA==",
        "iterations": 1200000,
        "associated_data": "0WdPVTKSb/a6KjB3NgjFww==",
        "nonce": "FgmmR8D1Su13HgUO",
        "ciphertext": "4FIQ8LAlztzaToyElulDcPAReKGnOd2TFYiH1P9ZatIOuHN+"
    },
    "key": "my super secret key"
}' | jq

Response:

{
  "decrypted_data": "my super secret text"
}

βš™οΈ Configuration

πŸ”§ Customize PBKDF2 Iterations

The default PBKDF2 iterations (1,200,000) provide excellent security. For custom security levels:

# Run with custom iterations (example: 1,000,000)
docker run --rm -p 8000:8000 \
  -e secure_qrcode_pbkdf2_iterations=1000000 \
  allisson/secure-qrcode

πŸ’‘ Tip: Higher iterations = better security but slower performance. Find your balance! βš–οΈ

🀝 Contributing

We welcome contributions! Please feel free to submit issues, feature requests, or pull requests. πŸ› οΈ

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details. πŸ“‹


Made with ❀️ for secure data sharing

About

Encrypt your data using the modern ChaCha20-Poly1305 cipher and export it into a secure QR code

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors