Download the PHP package vpremiss/livewire-nonceable without Composer
On this page you can find all versions of the php package vpremiss/livewire-nonceable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download vpremiss/livewire-nonceable
More information about vpremiss/livewire-nonceable
Files in vpremiss/livewire-nonceable
Download vpremiss/livewire-nonceable
More information about vpremiss/livewire-nonceable
Files in vpremiss/livewire-nonceable
Vendor vpremiss
Package livewire-nonceable
Short Description The security Livewire public methods needed!
License MIT
Homepage https://github.com/VPremiss/LivewireNonceable
Package livewire-nonceable
Short Description The security Livewire public methods needed!
License MIT
Homepage https://github.com/VPremiss/LivewireNonceable
Please rate this library. Is it a good library?
Informations about the package livewire-nonceable
بسم الله الرحمن الرحيم
# Livewire Nonceable
**The security [Livewire](https://livewire.laravel.com) public methods needed!**
[![Latest Version on Packagist](https://img.shields.io/packagist/v/vpremiss/livewire-nonceable.svg?style=for-the-badge&color=gray)](https://packagist.org/packages/vpremiss/livewire-nonceable)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/vpremiss/livewire-nonceable/testing-and-analysis.yml?branch=main&label=tests&style=for-the-badge&color=forestgreen)](https://github.com/VPremiss/Livewire-Nonceable/actions/workflows/testing-and-analysis.yml?query=branch%3Amain++)
![Codecov](https://img.shields.io/codecov/c/github/VPremiss/Livewire-Nonceable?style=for-the-badge&color=purple)
[![Total Downloads](https://img.shields.io/packagist/dt/vpremiss/livewire-nonceable.svg?style=for-the-badge&color=blue)](https://packagist.org/packages/vpremiss/livewire-nonceable)
## Description
The reason for this package is to address Livewire's current weakness of forcing the developer to expose certain methods to the **`public`** in order for the front-end ([AlpineJS](https://alpinejs.dev)) to be able to communicate with it; parameters included...
And if you ask, why wouldn't you do sensitive, protected stuff in Livewire component only, and why would you need to expose them in the first place? WELL, how about YOU try using [Sanctum](https://laravel.com/docs/sanctum) and see how things go! Hitting APIs that are `auth:sanctum` middleware-protected is **impossible**. And the only approach is to rely on `axios` in your [TALL](https://tallstack.dev) views to communicate with APIs after being authenticated with Sanctum.
This ***back-and-forth*** will draw you to think about what to do with regard to protecting those `public` methods from being just hit from the client with ease (AKA. DDOSed). And we've concluded that a solution would be to [`NONCE`](https://computersciencewiki.org/index.php/Nonce) into Laravel's **cache instead of its session** -because of the persistance approach that Livewire works with and the need to be able to access it from different places. An, yes, there **is** a unique identifier for the nonce cache key; part of the required interface.
Thanks for coming to my ta- Sorry. Enjoy the package and the awesome stacking like fine blacksmithery!
## Installation
0. Ensure that both [Livewire](https://livewire.laravel.com) is installed, of course.
1. Ensure that [cache](https://laravel.com/docs/cache) is set up properly and ready to be used. [Memcached](https://memcached.org/) is cool!
2. Install the package via [composer](https://getcomposer.org):
3. Publish the [config file](config/livewire-nonceable.php) using this [Artisan](https://laravel.com/docs/artisan) command:
## Usage
- In your Livewire component, implement our [Noncing](src/Interfaces/Noncing.php) interface and its methods. Then apply the [Nonceable](src/Traits/Nonceable.php) trait as well.
- And you may also utilize these 2 checking methods from the view:
And again, just to recap: we **CANNOT** work around not making the complexSearch method public because we need to call it from the only place where **Sanctum** allows API calls to its protected routes: the front-end...
***If you found a better way to deal around this, please let us know in the [discussions](https://github.com/VPremiss/Livewire-Nonceable/discussions) section.***
### API Below is the table of key methods provided by the `LivewireNonceable` package along with their descriptions: | Exposure | Method | Description | |------------|--------------------------------------------------------------|-------------------------------------------------------------------------------------| | **protected** | `generateNonce(string $title): string` | Generates a nonce, stores it in cache based on the `getNonces()` array, and returns the nonce. | | **protected** | `deleteNonce(string $title, string $nonce): void` | Deletes a nonce from cache if it exists and is still valid. | | **public** | `doesNonceExist(string $title, string $nonce): bool` | Checks if a given nonce exists in cache and is still valid. | | **public** | `isNonceSense(string $title, string $nonce): bool` | Checks if a given nonce does not exist or has expired. | | **public** | `validatedNonce(string $title, string $nonce): bool` | If the given nonce does not exist, it returns false, and otherwise, it deletes the nonce and then returns true. It's just a helper for a quicker approach. |
### Package Development - Change the `localTimezone` to yours in the [`TestCase`] file. ### Changelogs You can check out the package's [changelogs](https://app.whatthediff.ai/changelog/github/VPremiss/Livewire-Nonceable) online via WTD. ### Progress You can also checkout the project's [roadmap](https://github.com/orgs/VPremiss/projects/8) among others in the organization's dedicated section for [projects](https://github.com/orgs/VPremiss/projects). ## Support Support ongoing package maintenance as well as the development of **other projects** through [sponsorship](https://github.com/sponsors/VPremiss) or one-time [donations](https://github.com/sponsors/VPremiss?frequency=one-time&sponsor=VPremiss) if you prefer. And may Allah accept your strive; aameen. ### License This package is open-sourced software licensed under the [MIT license](LICENSE.md). ### Credits - [ChatGPT](https://chat.openai.com) - [Graphite](https://graphite.dev) - [Laravel](https://github.com/Laravel) - [Livewire](https://github.com/Livewire) - [Spatie](https://github.com/spatie) - [BeyondCode](https://beyondco.de) - [The Contributors](../../contributors) - All the [backend packages](/composer.json#23) and services this package relies on... - And the generous individuals that we've learned from and been supported by throughout our journey...
### API Below is the table of key methods provided by the `LivewireNonceable` package along with their descriptions: | Exposure | Method | Description | |------------|--------------------------------------------------------------|-------------------------------------------------------------------------------------| | **protected** | `generateNonce(string $title): string` | Generates a nonce, stores it in cache based on the `getNonces()` array, and returns the nonce. | | **protected** | `deleteNonce(string $title, string $nonce): void` | Deletes a nonce from cache if it exists and is still valid. | | **public** | `doesNonceExist(string $title, string $nonce): bool` | Checks if a given nonce exists in cache and is still valid. | | **public** | `isNonceSense(string $title, string $nonce): bool` | Checks if a given nonce does not exist or has expired. | | **public** | `validatedNonce(string $title, string $nonce): bool` | If the given nonce does not exist, it returns false, and otherwise, it deletes the nonce and then returns true. It's just a helper for a quicker approach. |
### Package Development - Change the `localTimezone` to yours in the [`TestCase`] file. ### Changelogs You can check out the package's [changelogs](https://app.whatthediff.ai/changelog/github/VPremiss/Livewire-Nonceable) online via WTD. ### Progress You can also checkout the project's [roadmap](https://github.com/orgs/VPremiss/projects/8) among others in the organization's dedicated section for [projects](https://github.com/orgs/VPremiss/projects). ## Support Support ongoing package maintenance as well as the development of **other projects** through [sponsorship](https://github.com/sponsors/VPremiss) or one-time [donations](https://github.com/sponsors/VPremiss?frequency=one-time&sponsor=VPremiss) if you prefer. And may Allah accept your strive; aameen. ### License This package is open-sourced software licensed under the [MIT license](LICENSE.md). ### Credits - [ChatGPT](https://chat.openai.com) - [Graphite](https://graphite.dev) - [Laravel](https://github.com/Laravel) - [Livewire](https://github.com/Livewire) - [Spatie](https://github.com/spatie) - [BeyondCode](https://beyondco.de) - [The Contributors](../../contributors) - All the [backend packages](/composer.json#23) and services this package relies on... - And the generous individuals that we've learned from and been supported by throughout our journey...
والحمد لله رب العالمين
All versions of livewire-nonceable with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
laravel/framework Version ^11.0
livewire/livewire Version ^3.0
nesbot/carbon Version ^3.4
predis/predis Version ^2.0
spatie/laravel-package-tools Version ^1.16
vpremiss/crafty Version ^4.9.8
laravel/framework Version ^11.0
livewire/livewire Version ^3.0
nesbot/carbon Version ^3.4
predis/predis Version ^2.0
spatie/laravel-package-tools Version ^1.16
vpremiss/crafty Version ^4.9.8
The package vpremiss/livewire-nonceable contains the following files
Loading the files please wait ....