You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CipherSweet supports Multi-Tenant Encryption paragonie/ciphersweet#59 however it's really challenging when working with the Queue. Specifically Laravel serialized the model you pass to the job and deserialize again when the job runs, which triggers the retrieved event and the package listens to this event and decrypt the fields immediately so I don't have any chance to switch the active tenant because it's gonna throw invalid cipher exception.
// AppServiceProvider$this->app->singleton(MultiTenantProvider::class, function () {
$teams = Team::select(['id', 'team_key'])
->get()
->mapWithKeys(fn ($team) => [$team->id => newStringProvider($team->team_key)])
->toArray();
reset($teams);
// set first key as active keyreturnnewMultiTenantProvider($teams, key($teams));
});
class TeamKeyFactory
{
publicfunction__invoke()
{
returnapp(MultiTenantProvider::class);
}
}
// dispatch the spatie queueable action$importTemplatesAction
->onQueue()
->execute($fund);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
CipherSweet supports Multi-Tenant Encryption paragonie/ciphersweet#59 however it's really challenging when working with the Queue. Specifically Laravel serialized the model you pass to the job and deserialize again when the job runs, which triggers the retrieved event and the package listens to this event and decrypt the fields immediately so I don't have any chance to switch the active tenant because it's gonna throw invalid cipher exception.
Beta Was this translation helpful? Give feedback.
All reactions