Open FabricioPatrocinio opened 7 months ago
This sounds cool!
Probably too specific to be included in Pydantic, especially in the Field
signature. Perhaps in pydantic-extra-types?
We could even receive the function itself instead of encryption_key, so everyone would use their chosen encryption lib. My point is that it should be as simple as possible to do end-to-end data encryption
Probably too specific to be included in Pydantic, especially in the Field signature. Perhaps in pydantic-extra-types?
I like @Viicos suggestion here. Moving this issue to pydantic-extra-types
.
Initial Checks
Description
Idea
Automatically perform encryption for data entry schemes with their natural values and another scheme being inherited from the previous one this time for data presentation. I have more or less a good idea of how to do it, I'll demonstrate it using your tool.
Example of the code I use today
I believe that this should already be embedded in the FIELD field, using the same logic that I showed above, you could provide a new parameter, which would receive an inheritance by composition with two arguments,
Field(encryptar=True or False, encryption_key=ENCRYPTION_KEY)
or using a class to configure, example:I prefer using field ;) But they could make both available!
I hope you understand the idea, I can try to implement something like that one day and contribute with you! :)
My cryptographic functions
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM mode