2015-01-14 22:39:23 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2015-04-07 18:02:49 +03:00
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-07 18:02:49 +03:00
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-07 18:02:49 +03: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 22:39:23 +03:00
|
|
|
*
|
2015-04-07 18:02:49 +03:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2015-01-14 22:39:23 +03:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-04-07 18:02:49 +03: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 22:39:23 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCP\Encryption;
|
2015-03-31 17:23:31 +03:00
|
|
|
|
2015-01-14 22:39:23 +03:00
|
|
|
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
|
|
|
|
use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides access to files encryption apps.
|
|
|
|
*
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03: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 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
function isEnabled();
|
|
|
|
|
|
|
|
/**
|
2015-04-14 17:48:39 +03:00
|
|
|
* Registers an callback function which must return an encryption module instance
|
2015-01-14 22:39:23 +03:00
|
|
|
*
|
2015-04-14 17:48:39 +03:00
|
|
|
* @param string $id
|
|
|
|
* @param string $displayName
|
|
|
|
* @param callable $callback
|
2015-01-14 22:39:23 +03:00
|
|
|
* @throws ModuleAlreadyExistsException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-14 17:48:39 +03:00
|
|
|
function registerEncryptionModule($id, $displayName, callable $callback);
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregisters an encryption module
|
|
|
|
*
|
2015-04-14 17:48:39 +03:00
|
|
|
* @param string $moduleId
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
2015-04-14 17:48:39 +03:00
|
|
|
function unregisterEncryptionModule($moduleId);
|
2015-01-14 22:39:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get a list of all encryption modules
|
|
|
|
*
|
2015-04-14 17:48:39 +03:00
|
|
|
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
function getEncryptionModules();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get a specific encryption module
|
|
|
|
*
|
|
|
|
* @param string $moduleId
|
|
|
|
* @return IEncryptionModule
|
|
|
|
* @throws ModuleDoesNotExistsException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
function getEncryptionModule($moduleId);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get default encryption module
|
|
|
|
*
|
|
|
|
* @return \OCP\Encryption\IEncryptionModule
|
2015-04-09 15:06:55 +03:00
|
|
|
* @throws ModuleDoesNotExistsException
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
public function getDefaultEncryptionModule();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* set default encryption module Id
|
|
|
|
*
|
|
|
|
* @param string $moduleId
|
|
|
|
* @return string
|
2015-04-16 18:00:08 +03:00
|
|
|
* @since 8.1.0
|
2015-01-14 22:39:23 +03:00
|
|
|
*/
|
|
|
|
public function setDefaultEncryptionModule($moduleId);
|
|
|
|
|
|
|
|
}
|