| 1 | <?php |
||
| 11 | class ZifratuFacade |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var SecretGenerator\Md5Surrounder |
||
| 16 | */ |
||
| 17 | protected $secretKeyGenerator; |
||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $secret; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * ZifratuFacade constructor. |
||
| 25 | * |
||
| 26 | * @param $secret |
||
| 27 | */ |
||
| 28 | public function __construct($secret) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Named constructor |
||
| 36 | * |
||
| 37 | * @param $secret |
||
| 38 | * |
||
| 39 | * @return static |
||
| 40 | */ |
||
| 41 | public static function create($secret) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Encrypt a value with a given secret using AES |
||
| 50 | * |
||
| 51 | * @param string $value |
||
| 52 | * |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function encrypt($value) |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Decrypt a value with a given secret using AES |
||
| 64 | * |
||
| 65 | * @param string $value |
||
| 66 | * |
||
| 67 | * @return string |
||
| 68 | */ |
||
| 69 | public function decrypt($value) |
||
| 75 | } |