Docs in main API
This commit is contained in:
@@ -8,6 +8,15 @@ try:
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class EncryptedTextField(models.TextField):
|
class EncryptedTextField(models.TextField):
|
||||||
|
"""
|
||||||
|
Django model field to provide database encryption using AES-256-CTR.
|
||||||
|
Simply replace existing TextField with EncryptedTextField and add
|
||||||
|
hex encoded 256-bit long encryption key to use. In code, you can
|
||||||
|
read and write the data with no further changes. However, in the
|
||||||
|
underlying database they will be encrypted.
|
||||||
|
|
||||||
|
Make sure to migrate the data appropriately.
|
||||||
|
"""
|
||||||
description = 'Encrypted data'
|
description = 'Encrypted data'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -43,6 +52,15 @@ try:
|
|||||||
from sqlalchemy import types
|
from sqlalchemy import types
|
||||||
|
|
||||||
class EncryptedText(types.TypeDecorator):
|
class EncryptedText(types.TypeDecorator):
|
||||||
|
"""
|
||||||
|
SQLAlchemy model field to provide database encryption using AES-256-CTR.
|
||||||
|
Simply replace existing TEXT field with EncryptedText field and add
|
||||||
|
hex encoded 256-bit long encryption key to use. In code, you can
|
||||||
|
read and write the data with no further changes. However, in the
|
||||||
|
underlying database they will be encrypted.
|
||||||
|
|
||||||
|
Make sure to migrate the data appropriately.
|
||||||
|
"""
|
||||||
impl = types.TEXT
|
impl = types.TEXT
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user