Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.
/ secrecy Public archive

Secrecy - The framework agnostic secret manager

License

Notifications You must be signed in to change notification settings

webtoolsnz/secrecy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Secrecy

CI Action codecov Scrutinizer Code Quality

Secrecy is a secret management abstraction that allows you to easily swap out different adapters based on configuration.

Goals

  • Promote explicit separation of configuration data and sensitive credentials
  • Provide support for popular secret management services
  • Provide seamless integration with popular frameworks
  • Make it easy to manage your application secrets

Installation

 composer require secrecy/secrecy

Usage

Below is an example of using the JsonFileAdapter

create a secrets.json file in the root of your project

{
    "secrets" : {
        "DB_USER": "root",
        "DB_PASSWORD": "f4x3!33s@",
        "API_KEY": "SOME_SUPER_SECRET_KEY"
    }
}
require 'vendor/autoload.php';

use Secrecy\SecretManager;
use Secrecy\Adapter\JsonFileAdapter;

$secretManager = new SecretManager(
    new JsonFileAdapter(__DIR__.'/secrets.json')
);

// Get a list of all secrets
print_r($secretManager->list());

// Retrieve a single by name
print_r($secretManager->get('API_KEY'));

// Update an existing secret
print_r($secretManager->update('DB_USER', 'app_user'));

// Create a new secret
print_r($secretManager->create('APP_SECRET', 'SHH'));

Caching

The SecretManager and its adapters does not cache any data, this must be done at the framework integration layer.