You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IManager.php 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Björn Schießle <bjoern@schiessle.org>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Roeland Jago Douma <roeland@famdouma.nl>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Encryption;
  26. use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
  27. use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
  28. /**
  29. * This class provides access to files encryption apps.
  30. *
  31. * @since 8.1.0
  32. */
  33. interface IManager {
  34. /**
  35. * Check if encryption is available (at least one encryption module needs to be enabled)
  36. *
  37. * @return bool true if enabled, false if not
  38. * @since 8.1.0
  39. */
  40. public function isEnabled();
  41. /**
  42. * Registers an callback function which must return an encryption module instance
  43. *
  44. * @param string $id
  45. * @param string $displayName
  46. * @param callable $callback
  47. * @throws ModuleAlreadyExistsException
  48. * @since 8.1.0
  49. */
  50. public function registerEncryptionModule($id, $displayName, callable $callback);
  51. /**
  52. * Unregisters an encryption module
  53. *
  54. * @param string $moduleId
  55. * @since 8.1.0
  56. */
  57. public function unregisterEncryptionModule($moduleId);
  58. /**
  59. * get a list of all encryption modules
  60. *
  61. * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
  62. * @since 8.1.0
  63. */
  64. public function getEncryptionModules();
  65. /**
  66. * get a specific encryption module
  67. *
  68. * @param string $moduleId Empty to get the default module
  69. * @return IEncryptionModule
  70. * @throws ModuleDoesNotExistsException
  71. * @since 8.1.0
  72. */
  73. public function getEncryptionModule($moduleId = '');
  74. /**
  75. * get default encryption module Id
  76. *
  77. * @return string
  78. * @since 8.1.0
  79. */
  80. public function getDefaultEncryptionModuleId();
  81. /**
  82. * set default encryption module Id
  83. *
  84. * @param string $moduleId
  85. * @return string
  86. * @since 8.1.0
  87. */
  88. public function setDefaultEncryptionModule($moduleId);
  89. }