Skip to content

guillaume-ro-fr/flysystem-encryption

Repository files navigation

League\Flysystem\Encryption

Author Build Status Coverage Status Quality Score Software License Packagist Version Total Downloads

This is a Flysystem adapter to encrypt files on existing Flysystem adapters.

This package is not tested for now !

Installation

$ composer require league/flysystem-encryption

Bootstrap

Generate a private encryption key

$ bin/flysystem-encryption /path/outside/webroot/encryption.key

Create your adapter

<?php
use League\Flysystem\Encryption\EncryptionAdapter;
use League\Flysystem\Filesystem;
use ParagonIE\Halite\KeyFactory;

include __DIR__ . '/vendor/autoload.php';

$myAdapter = new FlysystemAdapter();

// Load the private key from a filepath with the previous command
$encKey = '/path/outside/webroot/encryption.key';
// or generate a new encryption key
$encKey = random_bytes(SODIUM_CRYPTO_STREAM_KEYBYTES);
// or save it in a file
$encKey = KeyFactory::generateEncryptionKey();
KeyFactory::save($encKey, '/path/outside/webroot/encryption.key');

$adapter = new EncryptionAdapter($myAdapter, $encKey);
$filesystem = new Filesystem($adapter);

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

License

MIT

About

Flysystem adapter to encrypt files

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published