Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | /** |
| 3 | * Pop PHP Framework (https://www.popphp.org/) |
| 4 | * |
| 5 | * @link https://github.com/popphp/popphp-framework |
| 6 | * @author Nick Sagona, III <dev@noladev.com> |
| 7 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 8 | * @license https://www.popphp.org/license New BSD License |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * @namespace |
| 13 | */ |
| 14 | namespace Pop\Crypt\Encryption; |
| 15 | |
| 16 | /** |
| 17 | * Pop Crypt encrypter interface |
| 18 | * |
| 19 | * @category Pop |
| 20 | * @package Pop\Crypt |
| 21 | * @author Nick Sagona, III <dev@noladev.com> |
| 22 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 23 | * @license https://www.popphp.org/license New BSD License |
| 24 | * @version 3.0.0 |
| 25 | */ |
| 26 | interface EncrypterInterface |
| 27 | { |
| 28 | |
| 29 | /** |
| 30 | * Set cipher |
| 31 | * |
| 32 | * @param string $cipher |
| 33 | * @return static |
| 34 | */ |
| 35 | public function setCipher(string $cipher): static; |
| 36 | |
| 37 | /** |
| 38 | * Get cipher |
| 39 | * |
| 40 | * @return string |
| 41 | */ |
| 42 | public function getCipher(): string; |
| 43 | |
| 44 | /** |
| 45 | * Has cipher |
| 46 | * |
| 47 | * @return bool |
| 48 | */ |
| 49 | public function hasCipher(): bool; |
| 50 | |
| 51 | /** |
| 52 | * Set key |
| 53 | * |
| 54 | * @param string $key |
| 55 | * @param bool $raw |
| 56 | * @return static |
| 57 | */ |
| 58 | public function setKey(string $key, bool $raw = true): static; |
| 59 | |
| 60 | /** |
| 61 | * Get key |
| 62 | * |
| 63 | * @param bool $raw |
| 64 | * @return string |
| 65 | */ |
| 66 | public function getKey(bool $raw = false): string; |
| 67 | |
| 68 | /** |
| 69 | * Has key |
| 70 | * |
| 71 | * @return bool |
| 72 | */ |
| 73 | public function hasKey(): bool; |
| 74 | |
| 75 | /** |
| 76 | * Get all keys |
| 77 | * |
| 78 | * @return array |
| 79 | */ |
| 80 | public function getAllKeys(): array; |
| 81 | |
| 82 | /** |
| 83 | * Set previous keys |
| 84 | * |
| 85 | * @param array $previousKeys |
| 86 | * @throws Exception |
| 87 | * @return static |
| 88 | */ |
| 89 | public function setPreviousKeys(array $previousKeys): static; |
| 90 | |
| 91 | /** |
| 92 | * Get previous keys |
| 93 | * |
| 94 | * @return array |
| 95 | */ |
| 96 | public function getPreviousKeys(): array; |
| 97 | |
| 98 | /** |
| 99 | * Has previous keys |
| 100 | * |
| 101 | * @return bool |
| 102 | */ |
| 103 | public function hasPreviousKeys(): bool; |
| 104 | |
| 105 | /** |
| 106 | * Determine if the cipher is available |
| 107 | * |
| 108 | * @param string $cipher |
| 109 | * @return bool |
| 110 | */ |
| 111 | public static function isAvailable(string $cipher); |
| 112 | |
| 113 | /** |
| 114 | * Determine if the key and cipher combination is valid |
| 115 | * |
| 116 | * @param string $key |
| 117 | * @param string $cipher |
| 118 | * @return bool |
| 119 | */ |
| 120 | public static function isValid(string $key, string $cipher): bool; |
| 121 | |
| 122 | /** |
| 123 | * Encrypt value |
| 124 | * |
| 125 | * @param mixed $value |
| 126 | * @return string |
| 127 | */ |
| 128 | public function encrypt(mixed $value): string; |
| 129 | |
| 130 | /** |
| 131 | * Decrypt value |
| 132 | * |
| 133 | * @param mixed $payload |
| 134 | * @return mixed |
| 135 | */ |
| 136 | public function decrypt(mixed $payload): mixed; |
| 137 | |
| 138 | } |