Encrypter.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Illuminate\Contracts\Encryption;
  3. interface Encrypter
  4. {
  5. /**
  6. * Encrypt the given value.
  7. *
  8. * @param mixed $value
  9. * @param bool $serialize
  10. * @return string
  11. *
  12. * @throws \Illuminate\Contracts\Encryption\EncryptException
  13. */
  14. public function encrypt(#[\SensitiveParameter] $value, $serialize = true);
  15. /**
  16. * Decrypt the given value.
  17. *
  18. * @param string $payload
  19. * @param bool $unserialize
  20. * @return mixed
  21. *
  22. * @throws \Illuminate\Contracts\Encryption\DecryptException
  23. */
  24. public function decrypt($payload, $unserialize = true);
  25. /**
  26. * Get the encryption key that the encrypter is currently using.
  27. *
  28. * @return string
  29. */
  30. public function getKey();
  31. /**
  32. * Get the current encryption key and all previous encryption keys.
  33. *
  34. * @return array
  35. */
  36. public function getAllKeys();
  37. /**
  38. * Get the previous encryption keys.
  39. *
  40. * @return array
  41. */
  42. public function getPreviousKeys();
  43. }