| @@ 90-106 (lines=17) @@ | ||
| 87 | { |
|
| 88 | $result = new self; |
|
| 89 | ||
| 90 | if ($u2fResult->wasSuccessful()) { |
|
| 91 | $result->status = self::STATUS_SUCCESS; |
|
| 92 | } elseif ($u2fResult->didDeviceReportAnyError()) { |
|
| 93 | $result->status = self::STATUS_DEVICE_ERROR; |
|
| 94 | } elseif ($u2fResult->didResponseChallengeNotMatchRequestChallenge()) { |
|
| 95 | $result->status = self::STATUS_REQUEST_RESPONSE_MISMATCH; |
|
| 96 | } elseif ($u2fResult->wasResponseNotSignedByDevice()) { |
|
| 97 | $result->status = self::STATUS_RESPONSE_NOT_SIGNED_BY_DEVICE; |
|
| 98 | } elseif ($u2fResult->didPublicKeyDecodingFail()) { |
|
| 99 | $result->status = self::STATUS_PUBLIC_KEY_DECODING_FAILED; |
|
| 100 | } elseif ($u2fResult->wasSignCounterTooLow()) { |
|
| 101 | $result->status = self::STATUS_SIGN_COUNTER_TOO_LOW; |
|
| 102 | } elseif ($u2fResult->didntAppIdsMatch()) { |
|
| 103 | $result->status = self::STATUS_APP_ID_MISMATCH; |
|
| 104 | } else { |
|
| 105 | throw new LogicException('Unknown authentication verification result status'); |
|
| 106 | } |
|
| 107 | ||
| 108 | return $result; |
|
| 109 | } |
|
| @@ 88-104 (lines=17) @@ | ||
| 85 | { |
|
| 86 | $result = new self; |
|
| 87 | ||
| 88 | if ($u2fResult->wasSuccessful()) { |
|
| 89 | $result->status = self::STATUS_SUCCESS; |
|
| 90 | } elseif ($u2fResult->didDeviceReportAnyError()) { |
|
| 91 | $result->status = self::STATUS_DEVICE_ERROR; |
|
| 92 | } elseif ($u2fResult->didResponseChallengeNotMatchRequestChallenge()) { |
|
| 93 | $result->status = self::STATUS_UNMATCHED_REGISTRATION_CHALLENGE; |
|
| 94 | } elseif ($u2fResult->wasResponseNotSignedByDevice()) { |
|
| 95 | $result->status = self::STATUS_RESPONSE_NOT_SIGNED_BY_DEVICE; |
|
| 96 | } elseif ($u2fResult->canDeviceNotBeTrusted()) { |
|
| 97 | $result->status = self::STATUS_UNTRUSTED_DEVICE; |
|
| 98 | } elseif ($u2fResult->didPublicKeyDecodingFail()) { |
|
| 99 | $result->status = self::STATUS_PUBLIC_KEY_DECODING_FAILED; |
|
| 100 | } elseif ($u2fResult->didntAppIdsMatch()) { |
|
| 101 | $result->status = self::STATUS_APP_ID_MISMATCH; |
|
| 102 | } else { |
|
| 103 | throw new LogicException('Unknown registration verification result status'); |
|
| 104 | } |
|
| 105 | ||
| 106 | if ($u2fResult->wasSuccessful()) { |
|
| 107 | $result->registration = new Registration( |
|