Skip to content

Add a way to allow unencrypted stored data #46

Open
@tonysm

Description

@tonysm

This might be useful when migrating data that was initially unencrypted.

My current thinking is something like:

Post::query()->each(function ($post) {
    $post->withoutRichTextDecryptionOnRead(function () use ($post {
        $post->update(['content' => $post->content?->toTrixHtml()]);
    });
});

But it could also look like this:

protected $richTextAttributes = [
    'content' => ['encrypted' => true, 'allow_unencrypted_data' => true],
];

The idea is that we allow the decryption to fail when reading the data when that context is set. This way, we allow encrypting existing data that's currently not encrypted at rest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions