Giter Club home page Giter Club logo

crypton's Introduction

๐ŸŽ Laravel Crypton

Crypton Cover Image

GitHub License Latest Version on Packagist GitHub Tests Action Status Total Downloads

TThis is a simple package for laravel to encrypt decrypt api request & response in both ends, Backend & Javascript.

๐Ÿ“ฆ Installation

Via Composer

$ composer require tzsk/crypton

Publish config file

$ php artisan crypton:publish

Add an environment variable in the .env file

CRYPTON_KEY=your-encryption-key

๐Ÿ‘€ Keep in Mind

TIP: You can easily generate an encryption key by running php artisan key:generate then copy the generated key. Then again run: php artisan key:generate to make the key used by crypton and the default application key different.

WARNING: DO NOT USE THE SAME APP_KEY AND CRYPTON_KEY

๐Ÿ”ฅ Usage

Start off by adding a Middleware in the app/Http/Kernel.php file.

$routeMiddleware = [
    'crypton' => \Tzsk\Crypton\Middleware\EncryptRequestResponse::class,
];

Now, add this middleware to any api routes or groups.

Example:

Route::middleware('crypton')->post('some-endpoint', function(Request $request) {
    return Post::paginate($request->per_page ? : 10);
});

That's it.

๐Ÿ˜ Javascript adapter

See Laravel Crypton

๐Ÿ”ฌ 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.

crypton's People

Contributors

dependabot-preview[bot] avatar tzsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

crypton's Issues

Add "force encrypton" to config

Hi,
I would like to have the option to only accept and return encrypted requests on my API.
Now if a request does not have the "X-RESPONSE-ENCRYPTED" header the response is in plain text.
My approach would be to add an option for forcing it to the config file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.