custom-d/eloquent-async-keys
最新稳定版本:v4.1.3
Composer 安装命令:
composer require custom-d/eloquent-async-keys
包简介
A eloquent async keys
关键字:
README 文档
README
Package to handle public private keys for your application and other uses, stored in a rsa_keystore model which can be linked to any other model.
Installation
Install via composer
composer require custom-d/eloquent-async-keys
Register Service Provider
Note! This and next step are optional if you use laravel>=5.5 with package auto discovery feature.
Add service provider to config/app.php in providers section
CustomD\EloquentAsyncKeys\ServiceProvider::class,
Register Facade (optional)
Register package facade in config/app.php in aliases section
CustomD\EloquentAsyncKeys\Facades\EloquentAsyncKeys::class,
Publish Configuration File & generate global key
php artisan vendor:publish --provider="CustomD\EloquentAsyncKeys\ServiceProvider" --tag="config"
php artisan asynckey
Usage
namespace CustomD\EloquentAsyncKeys;
EloquentAsyncKeys::create([$keySize = null], [$overwrite = false]): self- This allows you to create a new set of keys and returns an instance of the class.EloquentAsyncKeys::encrypt($data, [$version = null]): array- this allows you to encrypt a new message and optionally set then algorithm versionEloquentAsyncKeys::encryptWithKey($publicKey, $data, [$version = null]): array- this allows you to encrypt a new message with a provided key and optionally set then algorithm versionEloquentAsyncKeys::decrypt($data, [$key = null]): string- Decrypts the messageEloquentAsyncKeys::decryptWithKey($privateKey, $data, $key = null): string- this allows you to decrypt a message with a provided keyEloquentAsyncKeys::getPublicKey(): string- gets the current public keyEloquentAsyncKeys::getPrivateKey(): string- gets the current private keyEloquentAsyncKeys::getSalt(): string- gets the current saltEloquentAsyncKeys::getDecryptedPrivateKey(): resource- gets the current decrypted private keyEloquentAsyncKeys::setKeys([$publicKey = null], [$privateKey = null], [$password = null]): self- set the public, private and passwordEloquentAsyncKeys::setPublicKey(?string $publicKey = null): self- sets/unsets the public keyEloquentAsyncKeys::setPrivateKey(?string $privateKey = null): self- sets/unsets the private keyEloquentAsyncKeys::setSalt($salt = null): self- sets/unsets/generates salt, (pass true to generate a new salt)EloquentAsyncKeys::setPassword(?string $password = null): self- set/unset the password for the current private keyEloquentAsyncKeys::setNewPassword(string $newPassword, $newSalt = false): void- sets a new password onto your current privateKey
Included for tinker / phpunit / seeds
We have added a faker library to use to populate your keystores:
use CustomD\EloquentAsyncKeys\Faker\Keygen;
...
$faker = Factory::create(Factory::DEFAULT_LOCALE);
$faker->addProvider(new Keygen($faker));
$keyset = $faker->keygenCollection($faker->password(), true);
will return your with keyset as an array containing the following structure
[
'password' => x,
'salt' => x,
'publicKey' => x,
'privateKey' => x
]
.
Security
If you discover any security related issues, please email instead of using the issue tracker.
Credits
统计信息
- 总下载量: 10.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-09-15