Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/icolomina/secrets
Encode secrets and store them easily
https://github.com/icolomina/secrets
php8 secret symfony vault
Last synced: 30 days ago
JSON representation
Encode secrets and store them easily
- Host: GitHub
- URL: https://github.com/icolomina/secrets
- Owner: icolomina
- License: mit
- Created: 2023-05-20T11:27:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-24T13:49:57.000Z (3 months ago)
- Last Synced: 2024-12-03T14:46:06.826Z (about 1 month ago)
- Topics: php8, secret, symfony, vault
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Introduction
This bundle allows developers to encrypt its keys ans store them using redis as a vault### Requirements
- This bundle requires [sodium extension](https://www.php.net/manual/en/book.sodium.php) and [predis](https://github.com/predis/predis) to be installed.## Installation
Install it using composer:```shell
composer require ict/secrets:dev-main
```### Configuration
Bundle requires the following configuration:
```ỳaml
ict_secrets:
hash_alg: 'sha512' # Any type supported by php hash function
encoder: sodium
store:
type: redis
config:
uri: 'your redis uri connection'
```At the moment, only sodium encoder and redis vault are allowed.
### How to use it
#### Inject Vault service:
```php
use Ict\Secrets\Vault\VaultStorageInterface;
..........
public function __construct(
private readonly VaultStorageInterface $vaultStorage
)
```#### Store a secret
```php
$this->vaultStorage->storeKeys('your_encription_keys_name')->storeSecret('your_secret_name', 'your_secret_value');
```
_your_encription_keys_name_ is used to store the encription keys by which your secrets will be encripted### Retrieve a secret
```php
$secretVal = $this->vaultStorage->getSecret($secretKey)
```### Remove a secret
```php
$secretVal = $this->vaultStorage->removeSecret($secretKey)
```