Django-secrets-fields

Latest version: v1.0.5

Safety actively analyzes 723158 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.0.5

**Full Changelog**: https://github.com/ryan-shaw/django-secrets-fields/compare/1.0.4...1.0.5

1.0.4

What's Changed
* Add versioned ciphertext by ryan-shaw in https://github.com/ryan-shaw/django-secrets-fields/pull/10
* 1.0.4 by ryan-shaw in https://github.com/ryan-shaw/django-secrets-fields/pull/11


**Full Changelog**: https://github.com/ryan-shaw/django-secrets-fields/compare/1.0.3...1.0.4

1.0.3

**Full Changelog**: https://github.com/ryan-shaw/django-secrets-fields/compare/1.0.2...1.0.3

1.0.2

What's Changed
* Fix crypter config - 1.0.2 by ryan-shaw in https://github.com/ryan-shaw/django-secrets-fields/pull/3


**Full Changelog**: https://github.com/ryan-shaw/django-secrets-fields/compare/1.0.1...1.0.2

1.0.1

**Full Changelog**: https://github.com/ryan-shaw/django-secrets-fields/compare/1.0.0...1.0.1

1.0.0

Django encrypted fields with support for multiple backends, currently supports symmetric encryption using Fernet and AWS Secrets Manager. Two fields types are currently supported, `SecretTextField` and `SecretJSONField`.

⚙️ Installation

Install django-secrets-fields:

bash
pip install django-secrets-fields


To use backend that requires AWS install using:

bash
pip install django-secrets-fields[aws]


🤖 Usage

**settings.py**
python
DJANGO_SECRET_FIELDS = {
"default": {
"backend": "secrets_fields.backends.encrypted.EncryptedBackend",
"encryption_key": b"<fernet key>",
},
"aws": {
"backend": "secrets_fields.backends.secretsmanager.SecretsManagerBackend",
"prefix": "/path/",
},
}


A [Fernet](https://cryptography.io/en/latest/fernet/) can be generated using the following command:

bash
python manage.py generate_fernet_key



**models.py**
python
from django.db import models
from secrets_fields.fields import SecretJSONField, SecretTextField


class MyModel(models.Model):
secret_text = SecretTextField(backend="aws")
secret_json = SecretJSONField()

Links

Releases

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.