-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEncryptionInterface.php
40 lines (35 loc) · 1.1 KB
/
EncryptionInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace NPR\One\Interfaces;
/**
* Establishes a set of requirements for the encryption provider for the project
*
* @package NPR\One\Interfaces
*/
interface EncryptionInterface
{
/**
* Returns whether or not this EncryptionProvider is valid and ready to be used. This is a good
* place to perform checks such as making sure any particular PHP extensions or packages
* required for this encryption algorithm are installed. If no such checks are required, just
* hard-code the function to return true.
*
* @return boolean
*/
public function isValid(): bool;
/**
* Securely encrypts the given text.
*
* @param string $value
* @return string
* @throws \InvalidArgumentException if no value is passed in, or the value isn't a string
*/
public function encrypt($value): string;
/**
* Securely decrypts the given text.
*
* @param string $value
* @return string
* @throws \InvalidArgumentException if no value is passed in, or the value isn't a string
*/
public function decrypt($value): string;
}