1
0

IManager.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. }