2015-01-14 19:39:23 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-04-07 15:02:49 +00:00
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
2015-06-25 09:43:55 +00:00
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
2015-01-14 19:39:23 +00:00
|
|
|
*
|
2015-04-07 15:02:49 +00:00
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*
|
2015-04-07 15:02:49 +00:00
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
2015-01-14 19:39:23 +00:00
|
|
|
*
|
2015-04-07 15:02:49 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2015-01-14 19:39:23 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-04-07 15:02:49 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2015-01-14 19:39:23 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCP\Encryption;
|
2015-03-31 14:23:31 +00:00
|
|
|
|
2015-01-14 19:39:23 +00:00
|
|
|
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
|
|
|
|
use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides access to files encryption apps.
|
|
|
|
*
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
|
|
|
interface IManager {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if encryption is available (at least one encryption module needs to be enabled)
|
|
|
|
*
|
|
|
|
* @return bool true if enabled, false if not
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
2015-04-20 09:14:40 +00:00
|
|
|
public function isEnabled();
|
2015-01-14 19:39:23 +00:00
|
|
|
|
|
|
|
/**
|
2015-04-14 14:48:39 +00:00
|
|
|
* Registers an callback function which must return an encryption module instance
|
2015-01-14 19:39:23 +00:00
|
|
|
*
|
2015-04-14 14:48:39 +00:00
|
|
|
* @param string $id
|
|
|
|
* @param string $displayName
|
|
|
|
* @param callable $callback
|
2015-01-14 19:39:23 +00:00
|
|
|
* @throws ModuleAlreadyExistsException
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
2015-04-20 09:14:40 +00:00
|
|
|
public function registerEncryptionModule($id, $displayName, callable $callback);
|
2015-01-14 19:39:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregisters an encryption module
|
|
|
|
*
|
2015-04-14 14:48:39 +00:00
|
|
|
* @param string $moduleId
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
2015-04-20 09:14:40 +00:00
|
|
|
public function unregisterEncryptionModule($moduleId);
|
2015-01-14 19:39:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get a list of all encryption modules
|
|
|
|
*
|
2015-04-14 14:48:39 +00:00
|
|
|
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
2015-04-20 09:14:40 +00:00
|
|
|
public function getEncryptionModules();
|
2015-01-14 19:39:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get a specific encryption module
|
|
|
|
*
|
2015-04-20 09:14:40 +00:00
|
|
|
* @param string $moduleId Empty to get the default module
|
2015-01-14 19:39:23 +00:00
|
|
|
* @return IEncryptionModule
|
|
|
|
* @throws ModuleDoesNotExistsException
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
2015-04-20 09:14:40 +00:00
|
|
|
public function getEncryptionModule($moduleId = '');
|
2015-01-14 19:39:23 +00:00
|
|
|
|
|
|
|
/**
|
2015-04-20 09:11:52 +00:00
|
|
|
* get default encryption module Id
|
2015-01-14 19:39:23 +00:00
|
|
|
*
|
2015-04-20 09:11:52 +00:00
|
|
|
* @return string
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
2015-04-20 09:11:52 +00:00
|
|
|
public function getDefaultEncryptionModuleId();
|
2015-01-14 19:39:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* set default encryption module Id
|
|
|
|
*
|
|
|
|
* @param string $moduleId
|
|
|
|
* @return string
|
2015-04-16 15:00:08 +00:00
|
|
|
* @since 8.1.0
|
2015-01-14 19:39:23 +00:00
|
|
|
*/
|
|
|
|
public function setDefaultEncryptionModule($moduleId);
|
|
|
|
|
|
|
|
}
|