Entities

Usage with Pydantic

See tests/test_entities.py::test_complex_usage_example for one possible way to use this lib in combination with Pydantic.

Class Docs

class cryptoshred.entities.CryptoContainer(**data)

The CryptoContainer class implements the concept of a cryptoshreddable entity.

Parameters
  • id (UUID4) – Optional uuid of the key to use for decryption. Generated if not present

  • enc (bytes) – The encrypted value

  • algo (CryptographicAlgorithm) – The cryptographic algorithm used. Defaults to AES_CBC

  • ksize (int) – The key size used

  • key_backend (KeyBackend) – The backend used to look up keys

plain()

The contained value as string.

Return type

str

Returns

The contained value

value(clazz)

Will return the contained value constructed using the constructor of the given class.

Agrs:

clazz (T): The class to deserialize the value to

Return type

Optional[~T]

Returns

The value contained in the container passed through the constructor of the given class