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