1 | <?php |
||
21 | final class AuthenticationVerificationResult |
||
22 | { |
||
23 | const STATUS_SUCCESS = 'SUCCESS'; |
||
24 | |||
25 | /** |
||
26 | * The API behaved in an unexpected manner. |
||
27 | */ |
||
28 | const STATUS_API_ERROR = 'API_ERROR'; |
||
29 | |||
30 | /** |
||
31 | * No registration with the given key handle is known. |
||
32 | */ |
||
33 | const STATUS_UNKNOWN_KEY_HANDLE = 'UNKNOWN_KEY_HANDLE'; |
||
34 | |||
35 | /** |
||
36 | * Device responded with an error. |
||
37 | */ |
||
38 | const STATUS_DEVICE_ERROR = 'DEVICE_ERROR'; |
||
39 | |||
40 | /** |
||
41 | * The response challenge did not match the request challenge. |
||
42 | */ |
||
43 | const STATUS_REQUEST_RESPONSE_MISMATCH = 'REQUEST_RESPONSE_MISMATCH'; |
||
44 | |||
45 | /** |
||
46 | * The response was signed by another party than the device, indicating it was tampered with. |
||
47 | */ |
||
48 | const STATUS_RESPONSE_NOT_SIGNED_BY_DEVICE = 'RESPONSE_NOT_SIGNED_BY_DEVICE'; |
||
49 | |||
50 | /** |
||
51 | * The decoding of the device's public key failed. |
||
52 | */ |
||
53 | const STATUS_PUBLIC_KEY_DECODING_FAILED = 'PUBLIC_KEY_DECODING_FAILED'; |
||
54 | |||
55 | /** |
||
56 | * A message's AppID didn't match the server's |
||
57 | */ |
||
58 | const STATUS_APP_ID_MISMATCH = 'APP_ID_MISMATCH'; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | private $status; |
||
64 | |||
65 | public static function success() |
||
69 | |||
70 | /** |
||
71 | * @param string $status |
||
72 | * @return AuthenticationVerificationResult |
||
73 | */ |
||
74 | public static function error($status) |
||
78 | |||
79 | public static function apiError() |
||
83 | |||
84 | private function __construct($status) |
||
88 | |||
89 | /** |
||
90 | * @return bool |
||
91 | */ |
||
92 | public function wasSuccessful() |
||
96 | |||
97 | /** |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function didDeviceReportAnyError() |
||
104 | } |
||
105 |