add crypto to reqs
This commit is contained in:
@ -6,9 +6,7 @@ import json
|
|||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Callable, TYPE_CHECKING, Type, Union
|
from typing import Any, Callable, TYPE_CHECKING, Type, Union
|
||||||
|
|
||||||
from sqlalchemy import String
|
import sqlalchemy.types as types
|
||||||
from sqlalchemy.engine.default import DefaultDialect
|
|
||||||
from sqlalchemy.types import TypeDecorator
|
|
||||||
|
|
||||||
from ormar import ModelDefinitionError
|
from ormar import ModelDefinitionError
|
||||||
|
|
||||||
@ -112,12 +110,12 @@ backends_map = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class EncryptedString(TypeDecorator): # pragma nocover
|
class EncryptedString(types.TypeDecorator): # pragma nocover
|
||||||
"""
|
"""
|
||||||
Used to store encrypted values in a database
|
Used to store encrypted values in a database
|
||||||
"""
|
"""
|
||||||
|
|
||||||
impl = String
|
impl = types.String
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
*args: Any,
|
*args: Any,
|
||||||
@ -143,6 +141,7 @@ class EncryptedString(TypeDecorator): # pragma nocover
|
|||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"String({self.max_length})"
|
return f"String({self.max_length})"
|
||||||
|
|
||||||
#
|
#
|
||||||
# def load_dialect_impl(self, dialect: DefaultDialect) -> Any:
|
# def load_dialect_impl(self, dialect: DefaultDialect) -> Any:
|
||||||
# dialect.type_descriptor(VARCHAR(self.max_length))
|
# dialect.type_descriptor(VARCHAR(self.max_length))
|
||||||
@ -217,4 +216,3 @@ class EncryptedString(TypeDecorator): # pragma nocover
|
|||||||
|
|
||||||
def _coerce(self, value):
|
def _coerce(self, value):
|
||||||
return self.underlying_type._coerce(value)
|
return self.underlying_type._coerce(value)
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ pydantic
|
|||||||
sqlalchemy
|
sqlalchemy
|
||||||
typing_extensions
|
typing_extensions
|
||||||
orjson
|
orjson
|
||||||
|
cryptography
|
||||||
|
|
||||||
# Async database drivers
|
# Async database drivers
|
||||||
aiomysql
|
aiomysql
|
||||||
|
|||||||
Reference in New Issue
Block a user