alextartan/flysystem-libsodium-adapter

On-the-fly encrypt and decrypt flysystem files

Maintainers

👁 alextartan

Package info

github.com/alextartan/flysystem-libsodium-adapter

pkg:composer/alextartan/flysystem-libsodium-adapter

Statistics

Installs: 27 765

Dependents: 0

Suggesters: 1

Stars: 3

Open Issues: 12

2.0.1 2020-01-20 22:21 UTC

Apache-2.0 fe62c8d52cb457bdab3c7500232fea185a58ec3c

  • Alex Tartan <alex.tartan.woop@gmail.com>

encryptionFlysystemlibsodium


README

Performing on-the-fly client-side encryption for safe storage of files.

On uploads, the content is encrypted using Poly 1305 with a secret key and stored securely on the filesystem.

On downloads, the content is decrypted.

Current build status

👁 CI
👁 codecov
👁 Infection MSI
👁 Dependabot Status
👁 Downloads

Installation

composer require alextartan/flysystem-libsodium-adapter

Usage

use AlexTartan\Flysystem\Adapter\ChunkEncryption\Libsodium;use AlexTartan\Flysystem\Adapter\EncryptionAdapterDecorator;
use League\Flysystem\Filesystem;
use League\Flysystem\Memory\MemoryAdapter;

$adapter = new MemoryAdapter();
$encryption = Libsodium::factory($encryptionKey, 4096);

$adapterDecorator = new EncryptionAdapterDecorator(
 $adapter, 
 $encryption
);

$filesystem = new Filesystem($adapterDecorator);

Notice;

Due to how AwsS3 (and probably other remote adapters) handle stream uploads, I had to change the way this lib worked (versions up to v.1.0.0)

New releases employ a php://temp stream in which the encryption is done and once that finishes, the stream is sent to writeStream/readStream

Performance wise, it handles ok from what i could see.

Versioning

This library adheres to semver