Skip to content

Support encrypted fields in embedded schemas #84

@danielberkompas

Description

@danielberkompas

See #81 and #83.

Because many databases do not support direct encoding and decoding of embeds, it is often emulated by Ecto by using specific encoding and decoding rules.

For example, PostgreSQL will store embeds on top of JSONB columns, which means types in embedded schemas won’t go through the usual dump->DB->load cycle but rather encode->DB->decode->cast. This means that, when using embedded schemas with databases like PG or MySQL, make sure all of your types can be JSON encoded/decoded correctly. Ecto provides this guarantee for all built-in types.

Some thoughts:

  • The values would need to be base64 encrypted in order to encode to JSON
  • Ecto needs to call Cloak's dump functions in order to trigger the encryption

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions