项目作者: alextartan

项目描述 :
Libsodium adapter for Flysytem
高级语言: PHP
项目地址: git://github.com/alextartan/flysystem-libsodium-adapter.git
创建时间: 2019-07-23T00:03:12Z
项目社区:https://github.com/alextartan/flysystem-libsodium-adapter

开源协议:

下载


Libsodium Adapter for Flysystem

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

  1. composer require alextartan/flysystem-libsodium-adapter

Usage

  1. use AlexTartan\Flysystem\Adapter\ChunkEncryption\Libsodium;use AlexTartan\Flysystem\Adapter\EncryptionAdapterDecorator;
  2. use League\Flysystem\Filesystem;
  3. use League\Flysystem\Memory\MemoryAdapter;
  4. $adapter = new MemoryAdapter();
  5. $encryption = Libsodium::factory($encryptionKey, 4096);
  6. $adapterDecorator = new EncryptionAdapterDecorator(
  7. $adapter,
  8. $encryption
  9. );
  10. $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