nihilsen / keypad
Client-side cryptography framework for Laravel using Blade components and native Web Crypto API.
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- laravel/dusk: ^7.6
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- orchestra/testbench: ^8.0
- orchestra/testbench-dusk: ^8.4.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
This package is auto-updated.
Last update: 2024-11-11 08:06:41 UTC
README
Keypad is a Laravel package that aims to make it easier to add client-side encryption and decryption to your Laravel applications.
Keypad offers a suite of reactive Blade components that can be inserted into your existing authentication forms.
Under the hood, Keypad uses browser-native Web Crypto API.
Installation
You can install the package via composer:
composer require nihilsen/keypad
You can run the migrations with:
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="keypad-config"
This is the contents of the published config file:
Components and usage
Login: <x-keypad::login>
<form method="POST" action="/login/"> {{ -- CSRF token -- }} @csrf {{ -- email field -- }} <input type="email" name="email_field" placeholder="email" /> {{ -- password field -- }} <input type="password" name="password_field" placeholder="password" /> {{ -- Keypad "login" component -- }} <x-keypad::login password="password_field" /> {{ -- other form elements, submit button, etc ... -- }} </form>
Register: <x-keypad::register>
<form method="POST" action="/register/"> {{ -- CSRF token -- }} @csrf {{ -- email field -- }} <input type="email" name="email_field" placeholder="email" /> {{ -- password field -- }} <input type="password" name="password_field" placeholder="password" /> {{ -- confirm password field -- }} <input type="password" name="confirm_password_field" placeholder="confirm password" /> {{ -- Keypad "register" component -- }} <x-keypad::register password="password_field" confirmation="confirm_password_field" /> {{ -- other form elements, submit button, etc ... -- }} </form>
Encrypt: <x-keypad::encrypt>
<form method="POST" action="/send_message/"> {{ -- CSRF token -- }} @csrf {{ -- plaintext message field -- }} <input type="text" name="secret_message" placeholder="Enter your message" /> {{ -- get recipient keypad -- }} @php $recipient = User::find($__GET['recipient_id']); $keypad = $recipient->keypad; @endphp {{ -- Keypad "encrypt" component -- }} <x-keypad::encrypt target="secret_message" :$keypad /> {{ -- other form elements, submit button, etc ... -- }} </form>
Decrypt: <x-keypad::decrypt>
<x-keypad::decrypt>{{ $message->secret_message }}</x-keypad::decrypt>
Changelog
Please see CHANGELOG for more information on what has changed recently.
Roadmap
-
<x-keypad::login />
-
<x-keypad::register />
-
<x-keypad::encrypt />
-
<x-keypad::decrypt />
-
<x-keypad::hash />
-
<x-keypad::change-password />
-
<x-keypad::recover />
Contributing
- Pull requests, bug reports and feature requests are welcome.
Credits
License
The MIT License (MIT). Please see License File for more information.