1 | <?php |
||
5 | class OtpVerificationResult |
||
6 | { |
||
7 | /** The OTP is valid. */ |
||
8 | const STATUS_OK = 'OK'; |
||
9 | /** The OTP is invalid format. */ |
||
10 | const ERROR_BAD_OTP = 'BAD_OTP'; |
||
11 | /** The OTP has already been seen by the service. */ |
||
12 | const ERROR_REPLAYED_OTP = 'REPLAYED_OTP'; |
||
13 | /** The HMAC signature verification failed. */ |
||
14 | const ERROR_BAD_SIGNATURE = 'BAD_SIGNATURE'; |
||
15 | /** The request lacks a parameter. */ |
||
16 | const ERROR_MISSING_PARAMETER = 'MISSING_PARAMETER'; |
||
17 | /** The request id does not exist. */ |
||
18 | const ERROR_NO_SUCH_CLIENT = 'NO_SUCH_CLIENT'; |
||
19 | /** The request id is not allowed to verify OTPs. */ |
||
20 | const ERROR_OPERATION_NOT_ALLOWED = 'OPERATION_NOT_ALLOWED'; |
||
21 | /** Unexpected error in our server. Please contact us if you see this error. */ |
||
22 | const ERROR_BACKEND_ERROR = 'BACKEND_ERROR'; |
||
23 | /** Server could not get requested number of syncs during before timeout */ |
||
24 | const ERROR_NOT_ENOUGH_ANSWERS = 'NOT_ENOUGH_ANSWERS'; |
||
25 | /** Server has seen the OTP/Nonce combination before */ |
||
26 | const ERROR_REPLAYED_REQUEST = 'REPLAYED_REQUEST'; |
||
27 | |||
28 | /** |
||
29 | * @var string $status |
||
30 | */ |
||
31 | private $status; |
||
32 | |||
33 | /** |
||
34 | * @param string $status |
||
35 | */ |
||
36 | public function __construct($status) |
||
40 | |||
41 | /** |
||
42 | * @return boolean |
||
43 | */ |
||
44 | public function isSuccessful() |
||
48 | |||
49 | /** |
||
50 | * @return string|null NULL if verification was successful, or one of the ERROR_* constants. |
||
51 | */ |
||
52 | public function getError() |
||
56 | } |
||
57 |