Skip to main content

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
N8:0aSs"AQȪ<zC0jB=UIT\;IUH#&\1IqZI0x7zkt>舋Kd ng:       j+WЂM#gd̼&GȌ/NjQb_

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-rest-vault-0.0.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

django_rest_vault-0.0.2-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-rest-vault-0.0.2.tar.gz.

File metadata

  • Download URL: django-rest-vault-0.0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for django-rest-vault-0.0.2.tar.gz
Algorithm Hash digest
SHA256 415dc411e692c4099a033c99b377107ba63438d91f1fc5e0d746f8bcb36a2053
MD5 8dae035a238a0dbbd9c24b78d1fa0af6
BLAKE2b-256 3d34cc1ae4793a630e788c21bb6841d3805be93165ececbf471d3e758557e414

See more details on using hashes here.

File details

Details for the file django_rest_vault-0.0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_rest_vault-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4ec7f13522be061144ba8ceb4990811f38641bda2f5af941ed91f178a1ab1a36
MD5 ab6e0c73980865b5ea9f1c155c5fe0fe
BLAKE2b-256 19c6d66f7542b4b3e92d8b0008107179663878488e86101553fd34ee986cc183

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page