IManager.php 2.5 KB

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