azine / js-crypto-store-bundle
Symfony Bundle to store files on the database that have been securely encrypted on the client side (browser).
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >7.0
- doctrine/orm: ~2.0,>=2.2
- monolog/monolog: >=1.6.0,^1.6|^2.0|^3.0
- symfony/console: ^4.4|^5.4|^6.3
- symfony/finder: ^4.4|^5.4|^6.3
- symfony/framework-bundle: ^4.4|^5.4|^6.3
- symfony/twig-bundle: ^4.4|^5.4|^6.3
- symfony/yaml: ^4.4|^5.4|^6.3
Requires (Dev)
- phpunit/phpunit: ^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2024-10-27 00:56:51 UTC
README
Symfony Bundle to store files on the server that have been securely encrypted on the client side (browser).
Meta-Data is stored in the database, the file-content is stored on the file-system.
Uses vanilla JS and Stanford Javascript Crypto Library (See https://github.com/bitwiseshiftleft/sjcl/)
Features:
- Upload password protected encrypted files
- Share files via link
- Group encrypted files under one link, to share multiple files at once
- Set expiry date for files that will be removed by the cleanup command
- Cleanup command that can be run via cronjob to remove expired files
Installation
To install AzineEmailBundle with Composer just add the following to your composer.json
file:
// composer.json { require: { "azine/azine/js-crypto-store-bundle": "dev-master" } }
Then, you can install the new dependencies by running Composer’s update command from
the directory where your composer.json
file is located:
php composer.phar update
Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your AppKernel.php file, and register the new bundle. AzineEmailBundle has a dependency on KnpPaginatorBundle, so it`s also nessesary to add it to AppKernel.php file after installing.
<?php // in AppKernel::registerBundles() $bundles = array( // ... new Azine\JsCryptoStoreBundle\AzineJsCryptoStoreBundle(), // ... );
Register the routes of the AzineEmailBundle:
# in app/config/routing.yml # Default configuration for "AzineJsCryptoStoreBundle" azine_js_crypto_store: # Service used to get the ownerId (e.g. the current user id) to associate uploaded files with the current user. All files with the same owner_id as provided by this service will be shown on the dashboard ownerProvider: Azine\JsCryptoStoreBundle\Service\DefaultOwnerProvider # Encryption Ciper Algorythm. Default: aes encryptionCipher: aes # Encryption Mode. Default: 'gcm' (Galois/Counter mode) encryptionMode: gcm # Encryption Key Hash-Iterations. Default: 1000 encryptionIterations: 1000 # KS. Default: 256 encryptionKs: 256 # TS. Default: 128 encryptionTs: 128 # Default expiry time/date for documents. Format: input for DateTime(). Default: '14 days' defaultLifeTime: '14 days' # Maximum file size in bytes for the encryption. Default: 50'000'000 = 50mb maxFileSize: 50000000
See https://github.com/bitwiseshiftleft/sjcl/ for valid configuration options for the encryption.
Customize DateTime-Picker Widget
To make it easier to select a date & time for the expiry date of the uploaded and encrypted files, you can include a date picker widget via JS.
http://foundation-datepicker.peterbeno.com/ works fine for example. Include its js and css files in your site and add the following snippet to your JS.
// jquery DateTime-picker widget
$("input[type='datetime-local']").fdatepicker({
format: 'yyyy-mm-dd hh:ii',
disableDblClickSelection: true,
pickTime: true
});
Customize Owner Provider
To be able to share administration of uploaded files among users of a team or company, you can implement you custom logic to return an owner id.
E.g. by user role or by a group/team/company attribute you have stored on your users.
You just need to implement your version of \Azine\JsCryptoStoreBundle\Service\OwnerProviderInterface
, publish it as service and set the reference to your implementation in the config.yml.