2015-01-14 14:39:23 -05:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2015-01-14 14:39:23 -05:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Encryption;
|
2015-03-31 10:23:31 -04:00
|
|
|
|
2015-01-14 14:39:23 -05:00
|
|
|
use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
|
2019-11-22 14:52:10 -05:00
|
|
|
use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This class provides access to files encryption apps.
|
|
|
|
|
*
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05: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 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
2015-04-20 05:14:40 -04:00
|
|
|
public function isEnabled();
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
/**
|
2015-04-14 10:48:39 -04:00
|
|
|
* Registers an callback function which must return an encryption module instance
|
2015-01-14 14:39:23 -05:00
|
|
|
*
|
2015-04-14 10:48:39 -04:00
|
|
|
* @param string $id
|
|
|
|
|
* @param string $displayName
|
|
|
|
|
* @param callable $callback
|
2015-01-14 14:39:23 -05:00
|
|
|
* @throws ModuleAlreadyExistsException
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
2015-04-20 05:14:40 -04:00
|
|
|
public function registerEncryptionModule($id, $displayName, callable $callback);
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unregisters an encryption module
|
|
|
|
|
*
|
2015-04-14 10:48:39 -04:00
|
|
|
* @param string $moduleId
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
2015-04-20 05:14:40 -04:00
|
|
|
public function unregisterEncryptionModule($moduleId);
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get a list of all encryption modules
|
|
|
|
|
*
|
2015-04-14 10:48:39 -04:00
|
|
|
* @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
2015-04-20 05:14:40 -04:00
|
|
|
public function getEncryptionModules();
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get a specific encryption module
|
|
|
|
|
*
|
2015-04-20 05:14:40 -04:00
|
|
|
* @param string $moduleId Empty to get the default module
|
2015-01-14 14:39:23 -05:00
|
|
|
* @return IEncryptionModule
|
|
|
|
|
* @throws ModuleDoesNotExistsException
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
2015-04-20 05:14:40 -04:00
|
|
|
public function getEncryptionModule($moduleId = '');
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
/**
|
2015-04-20 05:11:52 -04:00
|
|
|
* get default encryption module Id
|
2015-01-14 14:39:23 -05:00
|
|
|
*
|
2015-04-20 05:11:52 -04:00
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
2015-04-20 05:11:52 -04:00
|
|
|
public function getDefaultEncryptionModuleId();
|
2015-01-14 14:39:23 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* set default encryption module Id
|
|
|
|
|
*
|
|
|
|
|
* @param string $moduleId
|
|
|
|
|
* @return string
|
2015-04-16 11:00:08 -04:00
|
|
|
* @since 8.1.0
|
2015-01-14 14:39:23 -05:00
|
|
|
*/
|
|
|
|
|
public function setDefaultEncryptionModule($moduleId);
|
|
|
|
|
}
|