Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lexpank/django-secure-credentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Secure Credentials 🔐

A secure, encrypted credentials system for Django, inspired by Rails credentials.

Features

  • Environment-specific encrypted credentials
  • Simple management commands (edit, show, generate key)

Installation

pip install django-secure-credentials

Usage

Add secure_credentials to your INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    ...
    'secure_credentials',
    ...
]

Add secret keys to .gitignore:

echo "secrets/*.key" >> .gitignore

Run the following command to generate a new key and credentials file:

python manage.py credentials_generate_key <environment>

This will create a new key and credentials file at config/credentials.yml.enc.

To edit the credentials file, run:

python manage.py credentials_edit <environment>

To load the credentials in your Django app:

from secure_credentials.secrets_loader import decrypt_credentials
credentials = decrypt_credentials("environment")

Where credentials is an instance of class CredentialsContainer containing the decrypted credentials.

To access a credential:

credentials.get('key')

or

credentials.dig('key', 'subkey')

for complex nested credentials.

About

A secure, encrypted credentials system for Django, inspired by Rails credentials.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages