Api data decryption and encryption support for Django REST Framework
Project description
django-rest-vault
Api data decryption and encryption support for Django REST Framework
Requirements
- Python (3.6+)
- Django (2.2.16+)
- Django REST Framework (3.10.3+)
Installation
Install using pip
pip install django-rest-vault
Usage
Add rest_framework_vault to INSTALLED_APPS and REST_FRAMEWORK
INSTALLED_APPS = (
...
'rest_framework', # Django REST Framework
'rest_framework_vault', # Django REST Vault
...
)
REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES': (
'rest_framework.parsers.JSONParser',
'rest_framework_vault.parsers.VaultParser',
),
'DEFAULT_RENDERER_CLASSES': (
'rest_framework.renderers.JSONRenderer',
'rest_framework_vault.renderers.VaultRenderer',
),
}
Also add settings for REST_VAULT to your project settings.py
REST_VAULT = {
'SECRET_KEY': b'*Thirty-two byte (256 bits) key*',
'HTTP_CONTENT_TYPE': 'application/vault',
'HTTP_ACCEPT': 'application/vault',
'HTTP_FORMAT': 'vault',
'USE_TOKEN_AS_KEY': True,
}
Examples
Get Users List (Default - json)
curl -u admin:123456 'http://localhost:8000/users/'
{"count":1,"next":null,"previous":null,"results":[{"url":"http://localhost:8000/users/1/","username":"admin","email":"admin@example.com","groups":[]}]}
Get Users List (vault)
curl -u admin:123456 'http://localhost:8000/users/?format=vault
6ARyPVxylOavaXFslb/Ab/AiYWsoFqCIu8pJ9bhnGI9zozmRkdWOySt4bI7CY0detuA9RkWhnHMS4/gLIu907E0Z8A0vHP56z493Zkld+UYSS94nk19LDr5TfkOEAQ0+A4C1AgbxlgSWk2XpxpDVZc4Nwm9rXOrP1xpIWXwAUREG520mdPwiR8AYPUpRVExsH7hSKXiasEVczAxPsXVKaamv/WC3CxgMldrIRA==
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-rest-vault-0.0.3.tar.gz.
File metadata
- Download URL: django-rest-vault-0.0.3.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0de416639eb8750b1bb7a41370b02d504a895427a08dd36af9793f3bb61adbfd
|
|
| MD5 |
2c4eb683239367428508ae45dc9e1614
|
|
| BLAKE2b-256 |
5edb4030bdfb1f0f3c5214d2b82420225aee76525aefbad769d6b53b453c8aaf
|
File details
Details for the file django_rest_vault-0.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: django_rest_vault-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b385983a8958b86de1a4ba44abc34b47ee6ff760190719d787d5cfd1b5e52b4
|
|
| MD5 |
9b1b86f992d5d576096804e757091447
|
|
| BLAKE2b-256 |
c3ba280e1514ac8184c17ef59f805be7a6fd850473ed9a4f9167a32a15caff34
|