Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

foxws/livewire-encrypt

Repository files navigation

Encrypt Livewire memo data

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Description

By default Livewire exposes database connection details. See the following discussion for details.

This package encrypts memo.dataMeta.models and memo.dataMeta.modelCollections responses, so your database details cannot easily be retrieved.

NOTE: This package is a POC and comes without any warranty it actually working.

Installation

You can install the package via composer:

composer require foxws/livewire-encrypt

This package should auto-register and overrule the Livewire HydratePublicProperties class.

Filament

NOTE: By default Livewire exposes model properties to the view, unless it's defined in the model's $hidden property.

When using Filament, one may want to force route-binding instead, and use the following trait on the Edit/View page:

<?php

namespace App\Admin\Concerns;

trait InteractsWithFormData
{
    protected function mutateFormDataBeforeFill(array $data): array
    {
        return $this->prepareFormDataBeforeFill($data);
    }

    protected function prepareFormDataBeforeFill(array $data): array
    {
        // Replace model id with route-key
        $data['id'] = $this->getRecord()->getRouteKey();

        if (array_key_exists('prefixed_id', $data)) {
            unset($data['prefixed_id']);
        }

        return $data;
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.