castelnuovo/laravel-age

Laravel wrapper for the AGE cli

v1.3.0 2024-05-14 16:46 UTC

This package is auto-updated.

Last update: 2024-05-14 16:46:57 UTC


README

68747470733a2f2f6173736574732e63617374656c6e756f766f2e6465762f6c6f676f2e737667

castelnuovo/laravel-age

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

Laravel wrapper for the AGE cli

Installation

Important

Make sure you have the AGE cli installed on your system. You can find the installation instructions here.

You can install the package via composer:

composer require castelnuovo/laravel-age

You can publish the config file with:

php artisan vendor:publish --tag="laravel-age-config"

This is the contents of the published config file:

return [
    'identity' => env('AGE_IDENTITY')
];

Usage

use Castelnuovo\LaravelAge\LaravelAge;

$message = 'Hello World!';

$age = LaravelAge::generateKeypair();
$privateKey = $age->getPrivateKey();
$publicKey = $age->getPublicKey();

$age2 = new LaravelAge(publicKey: $publicKey);
$encrypted_message = $age2->encrypt($message);

$age3 = new LaravelAge(privateKey: $privateKey);
$decrypted_message = $age3->decrypt($encrypted_message);

echo $message === $decrypted_message ? 'Success' : 'Failed';

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.