IManager.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP\Encryption;
  8. use OC\Encryption\Exceptions\ModuleAlreadyExistsException;
  9. use OC\Encryption\Exceptions\ModuleDoesNotExistsException;
  10. /**
  11. * This class provides access to files encryption apps.
  12. *
  13. * @since 8.1.0
  14. */
  15. interface IManager {
  16. /**
  17. * Check if encryption is available (at least one encryption module needs to be enabled)
  18. *
  19. * @return bool true if enabled, false if not
  20. * @since 8.1.0
  21. */
  22. public function isEnabled();
  23. /**
  24. * Registers an callback function which must return an encryption module instance
  25. *
  26. * @param string $id
  27. * @param string $displayName
  28. * @param callable $callback
  29. * @throws ModuleAlreadyExistsException
  30. * @since 8.1.0
  31. */
  32. public function registerEncryptionModule($id, $displayName, callable $callback);
  33. /**
  34. * Unregisters an encryption module
  35. *
  36. * @param string $moduleId
  37. * @since 8.1.0
  38. */
  39. public function unregisterEncryptionModule($moduleId);
  40. /**
  41. * get a list of all encryption modules
  42. *
  43. * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
  44. * @since 8.1.0
  45. */
  46. public function getEncryptionModules();
  47. /**
  48. * get a specific encryption module
  49. *
  50. * @param string $moduleId Empty to get the default module
  51. * @return IEncryptionModule
  52. * @throws ModuleDoesNotExistsException
  53. * @since 8.1.0
  54. */
  55. public function getEncryptionModule($moduleId = '');
  56. /**
  57. * get default encryption module Id
  58. *
  59. * @return string
  60. * @since 8.1.0
  61. */
  62. public function getDefaultEncryptionModuleId();
  63. /**
  64. * set default encryption module Id
  65. *
  66. * @param string $moduleId
  67. * @return string
  68. * @since 8.1.0
  69. */
  70. public function setDefaultEncryptionModule($moduleId);
  71. }