Title: [248631] trunk/Source/WebKit
Revision
248631
Author
jiewen_...@apple.com
Date
2019-08-13 13:43:00 -0700 (Tue, 13 Aug 2019)

Log Message

[WebAuthn] Make CtapHidAuthenticator/U2fHidAuthenticator to CtapAuthenticator/U2fAuthenticator
https://bugs.webkit.org/show_bug.cgi?id=191527
<rdar://problem/54237146>

Reviewed by Chris Dumez.

This patch makes an ABC CtapDriver, which services as an abstract interface for CtapAuthenticator/U2fAuthenticator to talk to
the actual object that implement the specific CTAP protocol that mananges communications over different transports, for example,
CtapHidDriver, such that CtapAuthenticator/U2fAuthenticator can be shared across different transports.

This patch also renames CtapHidAuthenticator/U2fHidAuthenticator to CtapAuthenticator/U2fAuthenticator correspondingly.

* Sources.txt:
* UIProcess/WebAuthentication/Cocoa/HidService.mm:
(WebKit::HidService::continueAddDeviceAfterGetInfo):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp.
(WebKit::CtapAuthenticator::CtapAuthenticator):
(WebKit::CtapAuthenticator::makeCredential):
(WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const):
(WebKit::CtapAuthenticator::getAssertion):
(WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
(WebKit::CtapAuthenticator::tryDowngrade):
* UIProcess/WebAuthentication/fido/CtapAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h.
* UIProcess/WebAuthentication/fido/CtapDriver.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h.
* UIProcess/WebAuthentication/fido/CtapHidDriver.h:
(WebKit::CtapHidDriver::setProtocol):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp.
(WebKit::U2fAuthenticator::U2fAuthenticator):
(WebKit::U2fAuthenticator::makeCredential):
(WebKit::U2fAuthenticator::checkExcludeList):
(WebKit::U2fAuthenticator::issueRegisterCommand):
(WebKit::U2fAuthenticator::getAssertion):
(WebKit::U2fAuthenticator::issueSignCommand):
(WebKit::U2fAuthenticator::issueNewCommand):
(WebKit::U2fAuthenticator::issueCommand):
(WebKit::U2fAuthenticator::responseReceived):
(WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
(WebKit::U2fAuthenticator::continueCheckOnlyCommandAfterResponseReceived):
(WebKit::U2fAuthenticator::continueBogusCommandAfterResponseReceived):
(WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
* UIProcess/WebAuthentication/fido/U2fAuthenticator.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h.
* WebKit.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (248630 => 248631)


--- trunk/Source/WebKit/ChangeLog	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/ChangeLog	2019-08-13 20:43:00 UTC (rev 248631)
@@ -1,3 +1,48 @@
+2019-08-12  Jiewen Tan  <jiewen_...@apple.com>
+
+        [WebAuthn] Make CtapHidAuthenticator/U2fHidAuthenticator to CtapAuthenticator/U2fAuthenticator
+        https://bugs.webkit.org/show_bug.cgi?id=191527
+        <rdar://problem/54237146>
+
+        Reviewed by Chris Dumez.
+
+        This patch makes an ABC CtapDriver, which services as an abstract interface for CtapAuthenticator/U2fAuthenticator to talk to
+        the actual object that implement the specific CTAP protocol that mananges communications over different transports, for example,
+        CtapHidDriver, such that CtapAuthenticator/U2fAuthenticator can be shared across different transports.
+
+        This patch also renames CtapHidAuthenticator/U2fHidAuthenticator to CtapAuthenticator/U2fAuthenticator correspondingly.
+
+        * Sources.txt:
+        * UIProcess/WebAuthentication/Cocoa/HidService.mm:
+        (WebKit::HidService::continueAddDeviceAfterGetInfo):
+        * UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp.
+        (WebKit::CtapAuthenticator::CtapAuthenticator):
+        (WebKit::CtapAuthenticator::makeCredential):
+        (WebKit::CtapAuthenticator::continueMakeCredentialAfterResponseReceived const):
+        (WebKit::CtapAuthenticator::getAssertion):
+        (WebKit::CtapAuthenticator::continueGetAssertionAfterResponseReceived):
+        (WebKit::CtapAuthenticator::tryDowngrade):
+        * UIProcess/WebAuthentication/fido/CtapAuthenticator.h: Copied from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h.
+        * UIProcess/WebAuthentication/fido/CtapDriver.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h.
+        * UIProcess/WebAuthentication/fido/CtapHidDriver.h:
+        (WebKit::CtapHidDriver::setProtocol):
+        * UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp.
+        (WebKit::U2fAuthenticator::U2fAuthenticator):
+        (WebKit::U2fAuthenticator::makeCredential):
+        (WebKit::U2fAuthenticator::checkExcludeList):
+        (WebKit::U2fAuthenticator::issueRegisterCommand):
+        (WebKit::U2fAuthenticator::getAssertion):
+        (WebKit::U2fAuthenticator::issueSignCommand):
+        (WebKit::U2fAuthenticator::issueNewCommand):
+        (WebKit::U2fAuthenticator::issueCommand):
+        (WebKit::U2fAuthenticator::responseReceived):
+        (WebKit::U2fAuthenticator::continueRegisterCommandAfterResponseReceived):
+        (WebKit::U2fAuthenticator::continueCheckOnlyCommandAfterResponseReceived):
+        (WebKit::U2fAuthenticator::continueBogusCommandAfterResponseReceived):
+        (WebKit::U2fAuthenticator::continueSignCommandAfterResponseReceived):
+        * UIProcess/WebAuthentication/fido/U2fAuthenticator.h: Renamed from Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h.
+        * WebKit.xcodeproj/project.pbxproj:
+
 2019-08-13  Chris Dumez  <cdu...@apple.com>
 
         Crash under IPC::Connection::markCurrentlyDispatchedMessageAsInvalid()

Modified: trunk/Source/WebKit/Sources.txt (248630 => 248631)


--- trunk/Source/WebKit/Sources.txt	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/Sources.txt	2019-08-13 20:43:00 UTC (rev 248631)
@@ -405,9 +405,9 @@
 UIProcess/UserContent/WebScriptMessageHandler.cpp
 UIProcess/UserContent/WebUserContentControllerProxy.cpp
 
-UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp
+UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp
 UIProcess/WebAuthentication/fido/CtapHidDriver.cpp
-UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp
+UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp
 
 UIProcess/WebAuthentication/Mock/MockAuthenticatorManager.cpp
 UIProcess/WebAuthentication/Mock/MockHidConnection.cpp

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.mm (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.mm	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidService.mm	2019-08-13 20:43:00 UTC (rev 248631)
@@ -28,10 +28,10 @@
 
 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
 
-#import "CtapHidAuthenticator.h"
+#import "CtapAuthenticator.h"
 #import "CtapHidDriver.h"
 #import "HidConnection.h"
-#import "U2fHidAuthenticator.h"
+#import "U2fAuthenticator.h"
 #import <WebCore/DeviceRequestConverter.h>
 #import <WebCore/DeviceResponseConverter.h>
 #import <WebCore/FidoConstants.h>
@@ -112,12 +112,12 @@
 
     auto info = readCTAPGetInfoResponse(response);
     if (info && info->versions().find(ProtocolVersion::kCtap) != info->versions().end()) {
-        observer()->authenticatorAdded(CtapHidAuthenticator::create(WTFMove(driver), WTFMove(*info)));
+        observer()->authenticatorAdded(CtapAuthenticator::create(WTFMove(driver), WTFMove(*info)));
         return;
     }
     LOG_ERROR("Couldn't parse a ctap get info response.");
     driver->setProtocol(ProtocolVersion::kU2f);
-    observer()->authenticatorAdded(U2fHidAuthenticator::create(WTFMove(driver)));
+    observer()->authenticatorAdded(U2fAuthenticator::create(WTFMove(driver)));
 }
 
 } // namespace WebKit

Copied: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp (from rev 248630, trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp) (0 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.cpp	2019-08-13 20:43:00 UTC (rev 248631)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CtapAuthenticator.h"
+
+#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
+
+#include "CtapDriver.h"
+#include "CtapHidDriver.h"
+#include "U2fAuthenticator.h"
+#include <WebCore/DeviceRequestConverter.h>
+#include <WebCore/DeviceResponseConverter.h>
+#include <WebCore/ExceptionData.h>
+#include <wtf/RunLoop.h>
+#include <wtf/text/StringConcatenateNumbers.h>
+
+namespace WebKit {
+using namespace WebCore;
+using namespace fido;
+
+CtapAuthenticator::CtapAuthenticator(std::unique_ptr<CtapDriver>&& driver, AuthenticatorGetInfoResponse&& info)
+    : m_driver(WTFMove(driver))
+    , m_info(WTFMove(info))
+{
+    // FIXME(191520): We need a way to convert std::unique_ptr to UniqueRef.
+    ASSERT(m_driver);
+}
+
+void CtapAuthenticator::makeCredential()
+{
+    ASSERT(!m_isDowngraded);
+    auto cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, requestData().creationOptions, m_info.options().userVerificationAvailability());
+    m_driver->transact(WTFMove(cborCmd), [weakThis = makeWeakPtr(*this)](Vector<uint8_t>&& data) {
+        ASSERT(RunLoop::isMain());
+        if (!weakThis)
+            return;
+        weakThis->continueMakeCredentialAfterResponseReceived(WTFMove(data));
+    });
+}
+
+void CtapAuthenticator::continueMakeCredentialAfterResponseReceived(Vector<uint8_t>&& data) const
+{
+    auto response = readCTAPMakeCredentialResponse(data, requestData().creationOptions.attestation);
+    if (!response) {
+        auto error = getResponseCode(data);
+        if (error == CtapDeviceResponseCode::kCtap2ErrCredentialExcluded)
+            receiveRespond(ExceptionData { InvalidStateError, "At least one credential matches an entry of the excludeCredentials list in the authenticator."_s });
+        else
+            receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<uint8_t>(error)) });
+        return;
+    }
+    receiveRespond(WTFMove(*response));
+}
+
+void CtapAuthenticator::getAssertion()
+{
+    ASSERT(!m_isDowngraded);
+    auto cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, requestData().requestOptions, m_info.options().userVerificationAvailability());
+    m_driver->transact(WTFMove(cborCmd), [weakThis = makeWeakPtr(*this)](Vector<uint8_t>&& data) {
+        ASSERT(RunLoop::isMain());
+        if (!weakThis)
+            return;
+        weakThis->continueGetAssertionAfterResponseReceived(WTFMove(data));
+    });
+}
+
+void CtapAuthenticator::continueGetAssertionAfterResponseReceived(Vector<uint8_t>&& data)
+{
+    auto response = readCTAPGetAssertionResponse(data);
+    if (!response) {
+        auto error = getResponseCode(data);
+        if (error != CtapDeviceResponseCode::kCtap2ErrInvalidCBOR && tryDowngrade())
+            return;
+        receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<uint8_t>(error)) });
+        return;
+    }
+    receiveRespond(WTFMove(*response));
+}
+
+bool CtapAuthenticator::tryDowngrade()
+{
+    if (m_info.versions().find(ProtocolVersion::kU2f) == m_info.versions().end())
+        return false;
+    if (!observer())
+        return false;
+
+    m_isDowngraded = true;
+    m_driver->setProtocol(ProtocolVersion::kU2f);
+    observer()->downgrade(this, U2fAuthenticator::create(WTFMove(m_driver)));
+    return true;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Copied: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.h (from rev 248630, trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h) (0 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapAuthenticator.h	2019-08-13 20:43:00 UTC (rev 248631)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
+
+#include "Authenticator.h"
+#include <WebCore/AuthenticatorGetInfoResponse.h>
+
+namespace WebKit {
+
+class CtapDriver;
+
+class CtapAuthenticator final : public Authenticator {
+public:
+    static Ref<CtapAuthenticator> create(std::unique_ptr<CtapDriver>&& driver, fido::AuthenticatorGetInfoResponse&& info)
+    {
+        return adoptRef(*new CtapAuthenticator(WTFMove(driver), WTFMove(info)));
+    }
+
+private:
+    explicit CtapAuthenticator(std::unique_ptr<CtapDriver>&&, fido::AuthenticatorGetInfoResponse&&);
+
+    void makeCredential() final;
+    void continueMakeCredentialAfterResponseReceived(Vector<uint8_t>&&) const;
+    void getAssertion() final;
+    void continueGetAssertionAfterResponseReceived(Vector<uint8_t>&&);
+
+    bool tryDowngrade();
+
+    std::unique_ptr<CtapDriver> m_driver;
+    fido::AuthenticatorGetInfoResponse m_info;
+    bool m_isDowngraded { false };
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Copied: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapDriver.h (from rev 248630, trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h) (0 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapDriver.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapDriver.h	2019-08-13 20:43:00 UTC (rev 248631)
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUTHN)
+
+#include <WebCore/FidoConstants.h>
+#include <wtf/Forward.h>
+#include <wtf/Function.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebKit {
+
+class CtapDriver : public CanMakeWeakPtr<CtapDriver> {
+    WTF_MAKE_FAST_ALLOCATED;
+    WTF_MAKE_NONCOPYABLE(CtapDriver);
+public:
+    using ResponseCallback = Function<void(Vector<uint8_t>&&)>;
+
+    CtapDriver() = default;
+    virtual ~CtapDriver() = default;
+
+    void setProtocol(fido::ProtocolVersion protocol) { m_protocol = protocol; }
+
+    virtual void transact(Vector<uint8_t>&& data, ResponseCallback&&) = 0;
+
+protected:
+    fido::ProtocolVersion protocol() const { return m_protocol; }
+
+private:
+    fido::ProtocolVersion m_protocol { fido::ProtocolVersion::kCtap };
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN)

Deleted: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.cpp	2019-08-13 20:43:00 UTC (rev 248631)
@@ -1,117 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CtapHidAuthenticator.h"
-
-#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
-
-#include "CtapHidDriver.h"
-#include "U2fHidAuthenticator.h"
-#include <WebCore/DeviceRequestConverter.h>
-#include <WebCore/DeviceResponseConverter.h>
-#include <WebCore/ExceptionData.h>
-#include <wtf/RunLoop.h>
-#include <wtf/text/StringConcatenateNumbers.h>
-
-namespace WebKit {
-using namespace WebCore;
-using namespace fido;
-
-CtapHidAuthenticator::CtapHidAuthenticator(std::unique_ptr<CtapHidDriver>&& driver, AuthenticatorGetInfoResponse&& info)
-    : m_driver(WTFMove(driver))
-    , m_info(WTFMove(info))
-{
-    // FIXME(191520): We need a way to convert std::unique_ptr to UniqueRef.
-    ASSERT(m_driver);
-}
-
-void CtapHidAuthenticator::makeCredential()
-{
-    ASSERT(!m_isDowngraded);
-    auto cborCmd = encodeMakeCredenitalRequestAsCBOR(requestData().hash, requestData().creationOptions, m_info.options().userVerificationAvailability());
-    m_driver->transact(WTFMove(cborCmd), [weakThis = makeWeakPtr(*this)](Vector<uint8_t>&& data) {
-        ASSERT(RunLoop::isMain());
-        if (!weakThis)
-            return;
-        weakThis->continueMakeCredentialAfterResponseReceived(WTFMove(data));
-    });
-}
-
-void CtapHidAuthenticator::continueMakeCredentialAfterResponseReceived(Vector<uint8_t>&& data) const
-{
-    auto response = readCTAPMakeCredentialResponse(data, requestData().creationOptions.attestation);
-    if (!response) {
-        auto error = getResponseCode(data);
-        if (error == CtapDeviceResponseCode::kCtap2ErrCredentialExcluded)
-            receiveRespond(ExceptionData { InvalidStateError, "At least one credential matches an entry of the excludeCredentials list in the authenticator."_s });
-        else
-            receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<uint8_t>(error)) });
-        return;
-    }
-    receiveRespond(WTFMove(*response));
-}
-
-void CtapHidAuthenticator::getAssertion()
-{
-    ASSERT(!m_isDowngraded);
-    auto cborCmd = encodeGetAssertionRequestAsCBOR(requestData().hash, requestData().requestOptions, m_info.options().userVerificationAvailability());
-    m_driver->transact(WTFMove(cborCmd), [weakThis = makeWeakPtr(*this)](Vector<uint8_t>&& data) {
-        ASSERT(RunLoop::isMain());
-        if (!weakThis)
-            return;
-        weakThis->continueGetAssertionAfterResponseReceived(WTFMove(data));
-    });
-}
-
-void CtapHidAuthenticator::continueGetAssertionAfterResponseReceived(Vector<uint8_t>&& data)
-{
-    auto response = readCTAPGetAssertionResponse(data);
-    if (!response) {
-        auto error = getResponseCode(data);
-        if (error != CtapDeviceResponseCode::kCtap2ErrInvalidCBOR && tryDowngrade())
-            return;
-        receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<uint8_t>(error)) });
-        return;
-    }
-    receiveRespond(WTFMove(*response));
-}
-
-bool CtapHidAuthenticator::tryDowngrade()
-{
-    if (m_info.versions().find(ProtocolVersion::kU2f) == m_info.versions().end())
-        return false;
-    if (!observer())
-        return false;
-
-    m_isDowngraded = true;
-    m_driver->setProtocol(ProtocolVersion::kU2f);
-    observer()->downgrade(this, U2fHidAuthenticator::create(WTFMove(m_driver)));
-    return true;
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Deleted: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidAuthenticator.h	2019-08-13 20:43:00 UTC (rev 248631)
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
-
-#include "Authenticator.h"
-#include <WebCore/AuthenticatorGetInfoResponse.h>
-
-namespace WebKit {
-
-class CtapHidDriver;
-
-class CtapHidAuthenticator final : public Authenticator {
-public:
-    static Ref<CtapHidAuthenticator> create(std::unique_ptr<CtapHidDriver>&& driver, fido::AuthenticatorGetInfoResponse&& info)
-    {
-        return adoptRef(*new CtapHidAuthenticator(WTFMove(driver), WTFMove(info)));
-    }
-
-private:
-    explicit CtapHidAuthenticator(std::unique_ptr<CtapHidDriver>&&, fido::AuthenticatorGetInfoResponse&&);
-
-    void makeCredential() final;
-    void continueMakeCredentialAfterResponseReceived(Vector<uint8_t>&&) const;
-    void getAssertion() final;
-    void continueGetAssertionAfterResponseReceived(Vector<uint8_t>&&);
-
-    bool tryDowngrade();
-
-    std::unique_ptr<CtapHidDriver> m_driver;
-    fido::AuthenticatorGetInfoResponse m_info;
-    bool m_isDowngraded { false };
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.cpp	2019-08-13 20:43:00 UTC (rev 248631)
@@ -194,7 +194,7 @@
     m_channelId |= static_cast<uint32_t>(payload[index++]) << 8;
     m_channelId |= static_cast<uint32_t>(payload[index]);
     // FIXME(191534): Check the reset of the payload.
-    auto cmd = FidoHidMessage::create(m_channelId, m_protocol == ProtocolVersion::kCtap ? FidoHidDeviceCommand::kCbor : FidoHidDeviceCommand::kMsg, m_requestData);
+    auto cmd = FidoHidMessage::create(m_channelId, protocol() == ProtocolVersion::kCtap ? FidoHidDeviceCommand::kCbor : FidoHidDeviceCommand::kMsg, m_requestData);
     ASSERT(cmd);
     m_worker->transact(WTFMove(*cmd), [weakThis = makeWeakPtr(*this)](Optional<FidoHidMessage>&& response) mutable {
         ASSERT(RunLoop::isMain());

Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/CtapHidDriver.h	2019-08-13 20:43:00 UTC (rev 248631)
@@ -27,14 +27,10 @@
 
 #if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
 
+#include "CtapDriver.h"
 #include "HidConnection.h"
-#include <WebCore/FidoConstants.h>
 #include <WebCore/FidoHidMessage.h>
-#include <wtf/CompletionHandler.h>
-#include <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
 #include <wtf/UniqueRef.h>
-#include <wtf/WeakPtr.h>
 
 namespace WebKit {
 
@@ -41,12 +37,8 @@
 // The following implements the CTAP HID protocol:
 // https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#usb
 // FSM: Idle => AllocateChannel => Ready
-class CtapHidDriver : public CanMakeWeakPtr<CtapHidDriver> {
-    WTF_MAKE_FAST_ALLOCATED;
-    WTF_MAKE_NONCOPYABLE(CtapHidDriver);
+class CtapHidDriver : public CtapDriver {
 public:
-    using ResponseCallback = Function<void(Vector<uint8_t>&&)>;
-
     enum class State : uint8_t {
         Idle,
         AllocateChannel,
@@ -57,8 +49,7 @@
 
     explicit CtapHidDriver(UniqueRef<HidConnection>&&);
 
-    void setProtocol(fido::ProtocolVersion protocol) { m_protocol = protocol; }
-    void transact(Vector<uint8_t>&& data, ResponseCallback&&);
+    void transact(Vector<uint8_t>&& data, ResponseCallback&&) final;
 
 private:
     // Worker is the helper that maintains the transaction.
@@ -104,7 +95,6 @@
     Vector<uint8_t> m_requestData;
     ResponseCallback m_responseCallback;
     Vector<uint8_t> m_nonce;
-    fido::ProtocolVersion m_protocol { fido::ProtocolVersion::kCtap };
 };
 
 } // namespace WebKit

Copied: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp (from rev 248630, trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp) (0 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fAuthenticator.cpp	2019-08-13 20:43:00 UTC (rev 248631)
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "U2fAuthenticator.h"
+
+#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
+
+#include "CtapDriver.h"
+#include <WebCore/ApduResponse.h>
+#include <WebCore/ExceptionData.h>
+#include <WebCore/U2fCommandConstructor.h>
+#include <WebCore/U2fResponseConverter.h>
+#include <wtf/RunLoop.h>
+#include <wtf/text/StringConcatenateNumbers.h>
+
+namespace WebKit {
+using namespace WebCore;
+using namespace apdu;
+using namespace fido;
+
+namespace {
+const unsigned retryTimeOutValueMs = 200;
+}
+
+U2fAuthenticator::U2fAuthenticator(std::unique_ptr<CtapDriver>&& driver)
+    : m_driver(WTFMove(driver))
+    , m_retryTimer(RunLoop::main(), this, &U2fAuthenticator::retryLastCommand)
+{
+    // FIXME(191520): We need a way to convert std::unique_ptr to UniqueRef.
+    ASSERT(m_driver);
+}
+
+void U2fAuthenticator::makeCredential()
+{
+    if (!isConvertibleToU2fRegisterCommand(requestData().creationOptions)) {
+        receiveRespond(ExceptionData { NotSupportedError, "Cannot convert the request to U2F command."_s });
+        return;
+    }
+    if (!requestData().creationOptions.excludeCredentials.isEmpty()) {
+        ASSERT(!m_nextListIndex);
+        checkExcludeList(m_nextListIndex++);
+        return;
+    }
+    issueRegisterCommand();
+}
+
+void U2fAuthenticator::checkExcludeList(size_t index)
+{
+    if (index >= requestData().creationOptions.excludeCredentials.size()) {
+        issueRegisterCommand();
+        return;
+    }
+    auto u2fCmd = convertToU2fCheckOnlySignCommand(requestData().hash, requestData().creationOptions, requestData().creationOptions.excludeCredentials[index]);
+    ASSERT(u2fCmd);
+    issueNewCommand(WTFMove(*u2fCmd), CommandType::CheckOnlyCommand);
+}
+
+void U2fAuthenticator::issueRegisterCommand()
+{
+    auto u2fCmd = convertToU2fRegisterCommand(requestData().hash, requestData().creationOptions);
+    ASSERT(u2fCmd);
+    issueNewCommand(WTFMove(*u2fCmd), CommandType::RegisterCommand);
+}
+
+void U2fAuthenticator::getAssertion()
+{
+    if (!isConvertibleToU2fSignCommand(requestData().requestOptions)) {
+        receiveRespond(ExceptionData { NotSupportedError, "Cannot convert the request to U2F command."_s });
+        return;
+    }
+    ASSERT(!m_nextListIndex);
+    issueSignCommand(m_nextListIndex++);
+}
+
+void U2fAuthenticator::issueSignCommand(size_t index)
+{
+    if (index >= requestData().requestOptions.allowCredentials.size()) {
+        receiveRespond(ExceptionData { NotAllowedError, "No credentials from the allowCredentials list is found in the authenticator."_s });
+        return;
+    }
+    auto u2fCmd = convertToU2fSignCommand(requestData().hash, requestData().requestOptions, requestData().requestOptions.allowCredentials[index].idVector, m_isAppId);
+    ASSERT(u2fCmd);
+    issueNewCommand(WTFMove(*u2fCmd), CommandType::SignCommand);
+}
+
+void U2fAuthenticator::issueNewCommand(Vector<uint8_t>&& command, CommandType type)
+{
+    m_lastCommand = WTFMove(command);
+    m_lastCommandType = type;
+    issueCommand(m_lastCommand, m_lastCommandType);
+}
+
+void U2fAuthenticator::issueCommand(const Vector<uint8_t>& command, CommandType type)
+{
+    m_driver->transact(Vector<uint8_t>(command), [weakThis = makeWeakPtr(*this), type](Vector<uint8_t>&& data) {
+        ASSERT(RunLoop::isMain());
+        if (!weakThis)
+            return;
+        weakThis->responseReceived(WTFMove(data), type);
+    });
+}
+
+void U2fAuthenticator::responseReceived(Vector<uint8_t>&& response, CommandType type)
+{
+    auto apduResponse = ApduResponse::createFromMessage(response);
+    if (!apduResponse) {
+        receiveRespond(ExceptionData { UnknownError, "Couldn't parse the APDU response."_s });
+        return;
+    }
+
+    switch (type) {
+    case CommandType::RegisterCommand:
+        continueRegisterCommandAfterResponseReceived(WTFMove(*apduResponse));
+        return;
+    case CommandType::CheckOnlyCommand:
+        continueCheckOnlyCommandAfterResponseReceived(WTFMove(*apduResponse));
+        return;
+    case CommandType::BogusCommand:
+        continueBogusCommandAfterResponseReceived(WTFMove(*apduResponse));
+        return;
+    case CommandType::SignCommand:
+        continueSignCommandAfterResponseReceived(WTFMove(*apduResponse));
+        return;
+    }
+    ASSERT_NOT_REACHED();
+}
+
+void U2fAuthenticator::continueRegisterCommandAfterResponseReceived(ApduResponse&& apduResponse)
+{
+    switch (apduResponse.status()) {
+    case ApduResponse::Status::SW_NO_ERROR: {
+        auto response = readU2fRegisterResponse(requestData().creationOptions.rp.id, apduResponse.data(), requestData().creationOptions.attestation);
+        if (!response) {
+            receiveRespond(ExceptionData { UnknownError, "Couldn't parse the U2F register response."_s });
+            return;
+        }
+        receiveRespond(WTFMove(*response));
+        return;
+    }
+    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
+        // Polling is required during test of user presence.
+        m_retryTimer.startOneShot(Seconds::fromMilliseconds(retryTimeOutValueMs));
+        return;
+    default:
+        receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<unsigned>(apduResponse.status())) });
+    }
+}
+
+void U2fAuthenticator::continueCheckOnlyCommandAfterResponseReceived(ApduResponse&& apduResponse)
+{
+    switch (apduResponse.status()) {
+    case ApduResponse::Status::SW_NO_ERROR:
+    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
+        issueNewCommand(constructBogusU2fRegistrationCommand(), CommandType::BogusCommand);
+        return;
+    default:
+        checkExcludeList(m_nextListIndex++);
+    }
+}
+
+void U2fAuthenticator::continueBogusCommandAfterResponseReceived(ApduResponse&& apduResponse)
+{
+    switch (apduResponse.status()) {
+    case ApduResponse::Status::SW_NO_ERROR:
+        receiveRespond(ExceptionData { InvalidStateError, "At least one credential matches an entry of the excludeCredentials list in the authenticator."_s });
+        return;
+    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
+        // Polling is required during test of user presence.
+        m_retryTimer.startOneShot(Seconds::fromMilliseconds(retryTimeOutValueMs));
+        return;
+    default:
+        receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<unsigned>(apduResponse.status())) });
+    }
+}
+
+void U2fAuthenticator::continueSignCommandAfterResponseReceived(ApduResponse&& apduResponse)
+{
+    switch (apduResponse.status()) {
+    case ApduResponse::Status::SW_NO_ERROR: {
+        Optional<PublicKeyCredentialData> response;
+        if (m_isAppId) {
+            ASSERT(requestData().requestOptions.extensions && !requestData().requestOptions.extensions->appid.isNull());
+            response = readU2fSignResponse(requestData().requestOptions.extensions->appid, requestData().requestOptions.allowCredentials[m_nextListIndex - 1].idVector, apduResponse.data());
+        } else
+            response = readU2fSignResponse(requestData().requestOptions.rpId, requestData().requestOptions.allowCredentials[m_nextListIndex - 1].idVector, apduResponse.data());
+        if (!response) {
+            receiveRespond(ExceptionData { UnknownError, "Couldn't parse the U2F sign response."_s });
+            return;
+        }
+        if (m_isAppId)
+            response->appid = m_isAppId;
+
+        receiveRespond(WTFMove(*response));
+        return;
+    }
+    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
+        // Polling is required during test of user presence.
+        m_retryTimer.startOneShot(Seconds::fromMilliseconds(retryTimeOutValueMs));
+        return;
+    case ApduResponse::Status::SW_WRONG_DATA:
+        if (requestData().requestOptions.extensions && !requestData().requestOptions.extensions->appid.isNull()) {
+            if (!m_isAppId) {
+                m_isAppId = true;
+                issueSignCommand(m_nextListIndex - 1);
+                return;
+            }
+            m_isAppId = false;
+        }
+        issueSignCommand(m_nextListIndex++);
+        return;
+    default:
+        issueSignCommand(m_nextListIndex++);
+    }
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Copied: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fAuthenticator.h (from rev 248630, trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h) (0 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fAuthenticator.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fAuthenticator.h	2019-08-13 20:43:00 UTC (rev 248631)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
+
+#include "Authenticator.h"
+#include <wtf/RunLoop.h>
+
+namespace apdu {
+class ApduResponse;
+}
+
+namespace WebKit {
+
+class CtapDriver;
+
+class U2fAuthenticator final : public Authenticator {
+public:
+    static Ref<U2fAuthenticator> create(std::unique_ptr<CtapDriver>&& driver)
+    {
+        return adoptRef(*new U2fAuthenticator(WTFMove(driver)));
+    }
+
+private:
+    explicit U2fAuthenticator(std::unique_ptr<CtapDriver>&&);
+
+    void makeCredential() final;
+    void checkExcludeList(size_t index);
+    void issueRegisterCommand();
+    void getAssertion() final;
+    void issueSignCommand(size_t index);
+
+    enum class CommandType : uint8_t {
+        RegisterCommand,
+        CheckOnlyCommand,
+        BogusCommand,
+        SignCommand
+    };
+    void issueNewCommand(Vector<uint8_t>&& command, CommandType);
+    void retryLastCommand() { issueCommand(m_lastCommand, m_lastCommandType); }
+    void issueCommand(const Vector<uint8_t>& command, CommandType);
+    void responseReceived(Vector<uint8_t>&& response, CommandType);
+    void continueRegisterCommandAfterResponseReceived(apdu::ApduResponse&&);
+    void continueCheckOnlyCommandAfterResponseReceived(apdu::ApduResponse&&);
+    void continueBogusCommandAfterResponseReceived(apdu::ApduResponse&&);
+    void continueSignCommandAfterResponseReceived(apdu::ApduResponse&&);
+
+    std::unique_ptr<CtapDriver> m_driver;
+    RunLoop::Timer<U2fAuthenticator> m_retryTimer;
+    Vector<uint8_t> m_lastCommand;
+    CommandType m_lastCommandType;
+    size_t m_nextListIndex { 0 };
+    bool m_isAppId { false };
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Deleted: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.cpp	2019-08-13 20:43:00 UTC (rev 248631)
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "U2fHidAuthenticator.h"
-
-#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
-
-#include "CtapHidDriver.h"
-#include <WebCore/ApduResponse.h>
-#include <WebCore/ExceptionData.h>
-#include <WebCore/U2fCommandConstructor.h>
-#include <WebCore/U2fResponseConverter.h>
-#include <wtf/RunLoop.h>
-#include <wtf/text/StringConcatenateNumbers.h>
-
-namespace WebKit {
-using namespace WebCore;
-using namespace apdu;
-using namespace fido;
-
-namespace {
-const unsigned retryTimeOutValueMs = 200;
-}
-
-U2fHidAuthenticator::U2fHidAuthenticator(std::unique_ptr<CtapHidDriver>&& driver)
-    : m_driver(WTFMove(driver))
-    , m_retryTimer(RunLoop::main(), this, &U2fHidAuthenticator::retryLastCommand)
-{
-    // FIXME(191520): We need a way to convert std::unique_ptr to UniqueRef.
-    ASSERT(m_driver);
-}
-
-void U2fHidAuthenticator::makeCredential()
-{
-    if (!isConvertibleToU2fRegisterCommand(requestData().creationOptions)) {
-        receiveRespond(ExceptionData { NotSupportedError, "Cannot convert the request to U2F command."_s });
-        return;
-    }
-    if (!requestData().creationOptions.excludeCredentials.isEmpty()) {
-        ASSERT(!m_nextListIndex);
-        checkExcludeList(m_nextListIndex++);
-        return;
-    }
-    issueRegisterCommand();
-}
-
-void U2fHidAuthenticator::checkExcludeList(size_t index)
-{
-    if (index >= requestData().creationOptions.excludeCredentials.size()) {
-        issueRegisterCommand();
-        return;
-    }
-    auto u2fCmd = convertToU2fCheckOnlySignCommand(requestData().hash, requestData().creationOptions, requestData().creationOptions.excludeCredentials[index]);
-    ASSERT(u2fCmd);
-    issueNewCommand(WTFMove(*u2fCmd), CommandType::CheckOnlyCommand);
-}
-
-void U2fHidAuthenticator::issueRegisterCommand()
-{
-    auto u2fCmd = convertToU2fRegisterCommand(requestData().hash, requestData().creationOptions);
-    ASSERT(u2fCmd);
-    issueNewCommand(WTFMove(*u2fCmd), CommandType::RegisterCommand);
-}
-
-void U2fHidAuthenticator::getAssertion()
-{
-    if (!isConvertibleToU2fSignCommand(requestData().requestOptions)) {
-        receiveRespond(ExceptionData { NotSupportedError, "Cannot convert the request to U2F command."_s });
-        return;
-    }
-    ASSERT(!m_nextListIndex);
-    issueSignCommand(m_nextListIndex++);
-}
-
-void U2fHidAuthenticator::issueSignCommand(size_t index)
-{
-    if (index >= requestData().requestOptions.allowCredentials.size()) {
-        receiveRespond(ExceptionData { NotAllowedError, "No credentials from the allowCredentials list is found in the authenticator."_s });
-        return;
-    }
-    auto u2fCmd = convertToU2fSignCommand(requestData().hash, requestData().requestOptions, requestData().requestOptions.allowCredentials[index].idVector, m_isAppId);
-    ASSERT(u2fCmd);
-    issueNewCommand(WTFMove(*u2fCmd), CommandType::SignCommand);
-}
-
-void U2fHidAuthenticator::issueNewCommand(Vector<uint8_t>&& command, CommandType type)
-{
-    m_lastCommand = WTFMove(command);
-    m_lastCommandType = type;
-    issueCommand(m_lastCommand, m_lastCommandType);
-}
-
-void U2fHidAuthenticator::issueCommand(const Vector<uint8_t>& command, CommandType type)
-{
-    m_driver->transact(Vector<uint8_t>(command), [weakThis = makeWeakPtr(*this), type](Vector<uint8_t>&& data) {
-        ASSERT(RunLoop::isMain());
-        if (!weakThis)
-            return;
-        weakThis->responseReceived(WTFMove(data), type);
-    });
-}
-
-void U2fHidAuthenticator::responseReceived(Vector<uint8_t>&& response, CommandType type)
-{
-    auto apduResponse = ApduResponse::createFromMessage(response);
-    if (!apduResponse) {
-        receiveRespond(ExceptionData { UnknownError, "Couldn't parse the APDU response."_s });
-        return;
-    }
-
-    switch (type) {
-    case CommandType::RegisterCommand:
-        continueRegisterCommandAfterResponseReceived(WTFMove(*apduResponse));
-        return;
-    case CommandType::CheckOnlyCommand:
-        continueCheckOnlyCommandAfterResponseReceived(WTFMove(*apduResponse));
-        return;
-    case CommandType::BogusCommand:
-        continueBogusCommandAfterResponseReceived(WTFMove(*apduResponse));
-        return;
-    case CommandType::SignCommand:
-        continueSignCommandAfterResponseReceived(WTFMove(*apduResponse));
-        return;
-    }
-    ASSERT_NOT_REACHED();
-}
-
-void U2fHidAuthenticator::continueRegisterCommandAfterResponseReceived(ApduResponse&& apduResponse)
-{
-    switch (apduResponse.status()) {
-    case ApduResponse::Status::SW_NO_ERROR: {
-        auto response = readU2fRegisterResponse(requestData().creationOptions.rp.id, apduResponse.data(), requestData().creationOptions.attestation);
-        if (!response) {
-            receiveRespond(ExceptionData { UnknownError, "Couldn't parse the U2F register response."_s });
-            return;
-        }
-        receiveRespond(WTFMove(*response));
-        return;
-    }
-    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
-        // Polling is required during test of user presence.
-        m_retryTimer.startOneShot(Seconds::fromMilliseconds(retryTimeOutValueMs));
-        return;
-    default:
-        receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<unsigned>(apduResponse.status())) });
-    }
-}
-
-void U2fHidAuthenticator::continueCheckOnlyCommandAfterResponseReceived(ApduResponse&& apduResponse)
-{
-    switch (apduResponse.status()) {
-    case ApduResponse::Status::SW_NO_ERROR:
-    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
-        issueNewCommand(constructBogusU2fRegistrationCommand(), CommandType::BogusCommand);
-        return;
-    default:
-        checkExcludeList(m_nextListIndex++);
-    }
-}
-
-void U2fHidAuthenticator::continueBogusCommandAfterResponseReceived(ApduResponse&& apduResponse)
-{
-    switch (apduResponse.status()) {
-    case ApduResponse::Status::SW_NO_ERROR:
-        receiveRespond(ExceptionData { InvalidStateError, "At least one credential matches an entry of the excludeCredentials list in the authenticator."_s });
-        return;
-    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
-        // Polling is required during test of user presence.
-        m_retryTimer.startOneShot(Seconds::fromMilliseconds(retryTimeOutValueMs));
-        return;
-    default:
-        receiveRespond(ExceptionData { UnknownError, makeString("Unknown internal error. Error code: ", static_cast<unsigned>(apduResponse.status())) });
-    }
-}
-
-void U2fHidAuthenticator::continueSignCommandAfterResponseReceived(ApduResponse&& apduResponse)
-{
-    switch (apduResponse.status()) {
-    case ApduResponse::Status::SW_NO_ERROR: {
-        Optional<PublicKeyCredentialData> response;
-        if (m_isAppId) {
-            ASSERT(requestData().requestOptions.extensions && !requestData().requestOptions.extensions->appid.isNull());
-            response = readU2fSignResponse(requestData().requestOptions.extensions->appid, requestData().requestOptions.allowCredentials[m_nextListIndex - 1].idVector, apduResponse.data());
-        } else
-            response = readU2fSignResponse(requestData().requestOptions.rpId, requestData().requestOptions.allowCredentials[m_nextListIndex - 1].idVector, apduResponse.data());
-        if (!response) {
-            receiveRespond(ExceptionData { UnknownError, "Couldn't parse the U2F sign response."_s });
-            return;
-        }
-        if (m_isAppId)
-            response->appid = m_isAppId;
-
-        receiveRespond(WTFMove(*response));
-        return;
-    }
-    case ApduResponse::Status::SW_CONDITIONS_NOT_SATISFIED:
-        // Polling is required during test of user presence.
-        m_retryTimer.startOneShot(Seconds::fromMilliseconds(retryTimeOutValueMs));
-        return;
-    case ApduResponse::Status::SW_WRONG_DATA:
-        if (requestData().requestOptions.extensions && !requestData().requestOptions.extensions->appid.isNull()) {
-            if (!m_isAppId) {
-                m_isAppId = true;
-                issueSignCommand(m_nextListIndex - 1);
-                return;
-            }
-            m_isAppId = false;
-        }
-        issueSignCommand(m_nextListIndex++);
-        return;
-    default:
-        issueSignCommand(m_nextListIndex++);
-    }
-}
-
-} // namespace WebKit
-
-#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Deleted: trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h (248630 => 248631)


--- trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/fido/U2fHidAuthenticator.h	2019-08-13 20:43:00 UTC (rev 248631)
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEB_AUTHN) && PLATFORM(MAC)
-
-#include "Authenticator.h"
-#include <wtf/RunLoop.h>
-
-namespace apdu {
-class ApduResponse;
-}
-
-namespace WebKit {
-
-class CtapHidDriver;
-
-class U2fHidAuthenticator final : public Authenticator {
-public:
-    static Ref<U2fHidAuthenticator> create(std::unique_ptr<CtapHidDriver>&& driver)
-    {
-        return adoptRef(*new U2fHidAuthenticator(WTFMove(driver)));
-    }
-
-private:
-    explicit U2fHidAuthenticator(std::unique_ptr<CtapHidDriver>&&);
-
-    void makeCredential() final;
-    void checkExcludeList(size_t index);
-    void issueRegisterCommand();
-    void getAssertion() final;
-    void issueSignCommand(size_t index);
-
-    enum class CommandType : uint8_t {
-        RegisterCommand,
-        CheckOnlyCommand,
-        BogusCommand,
-        SignCommand
-    };
-    void issueNewCommand(Vector<uint8_t>&& command, CommandType);
-    void retryLastCommand() { issueCommand(m_lastCommand, m_lastCommandType); }
-    void issueCommand(const Vector<uint8_t>& command, CommandType);
-    void responseReceived(Vector<uint8_t>&& response, CommandType);
-    void continueRegisterCommandAfterResponseReceived(apdu::ApduResponse&&);
-    void continueCheckOnlyCommandAfterResponseReceived(apdu::ApduResponse&&);
-    void continueBogusCommandAfterResponseReceived(apdu::ApduResponse&&);
-    void continueSignCommandAfterResponseReceived(apdu::ApduResponse&&);
-
-    std::unique_ptr<CtapHidDriver> m_driver;
-    RunLoop::Timer<U2fHidAuthenticator> m_retryTimer;
-    Vector<uint8_t> m_lastCommand;
-    CommandType m_lastCommandType;
-    size_t m_nextListIndex { 0 };
-    bool m_isAppId { false };
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(WEB_AUTHN) && PLATFORM(MAC)

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (248630 => 248631)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-08-13 20:26:07 UTC (rev 248630)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-08-13 20:43:00 UTC (rev 248631)
@@ -1038,7 +1038,7 @@
 		570AB8F320AE3BD700B8BE87 /* SecKeyProxyStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F220AE3BD700B8BE87 /* SecKeyProxyStore.h */; };
 		572FD44322265CE200A1ECC3 /* WebViewDidMoveToWindowObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 572FD44122265CE200A1ECC3 /* WebViewDidMoveToWindowObserver.h */; };
 		57597EB921811D9A0037F924 /* CtapHidDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 57597EB721811D9A0037F924 /* CtapHidDriver.h */; };
-		57597EBD218184900037F924 /* CtapHidAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57597EBB2181848F0037F924 /* CtapHidAuthenticator.h */; };
+		57597EBD218184900037F924 /* CtapAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57597EBB2181848F0037F924 /* CtapAuthenticator.h */; };
 		576CA9D722B862180030143C /* SOAuthorizationNSURLExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317322B35148008D0E8B /* SOAuthorizationNSURLExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5772F206217DBD6A0056BF2C /* HidService.h in Headers */ = {isa = PBXBuildFile; fileRef = 5772F204217DBD6A0056BF2C /* HidService.h */; };
 		578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; };
@@ -1062,7 +1062,7 @@
 		57DCEDC3214F114C0016B847 /* MockLocalService.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC1214F114C0016B847 /* MockLocalService.h */; };
 		57DCEDC7214F18300016B847 /* MockLocalConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC5214F18300016B847 /* MockLocalConnection.h */; };
 		57DCEDCB214F4E420016B847 /* MockAuthenticatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */; };
-		57EB2E3A21E1983E00B89CDF /* U2fHidAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EB2E3821E1983E00B89CDF /* U2fHidAuthenticator.h */; };
+		57EB2E3A21E1983E00B89CDF /* U2fAuthenticator.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */; };
 		57FD318022B35158008D0E8B /* NavigationSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317822B35149008D0E8B /* NavigationSOAuthorizationSession.h */; };
 		57FD318122B3515B008D0E8B /* PopUpSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */; };
 		57FD318222B3515E008D0E8B /* RedirectSOAuthorizationSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FD317422B35149008D0E8B /* RedirectSOAuthorizationSession.h */; };
@@ -3467,6 +3467,7 @@
 		570AB8F220AE3BD700B8BE87 /* SecKeyProxyStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecKeyProxyStore.h; sourceTree = "<group>"; };
 		570AB90020B2517400B8BE87 /* AuthenticationChallengeProxyCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationChallengeProxyCocoa.mm; sourceTree = "<group>"; };
 		570AB90320B2541C00B8BE87 /* SecKeyProxyStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SecKeyProxyStore.mm; sourceTree = "<group>"; };
+		570B73CF230236DD00FAEC53 /* CtapDriver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CtapDriver.h; sourceTree = "<group>"; };
 		572FD44122265CE200A1ECC3 /* WebViewDidMoveToWindowObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebViewDidMoveToWindowObserver.h; sourceTree = "<group>"; };
 		575075A720AB763600693EA9 /* WebCredentialMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCredentialMac.mm; sourceTree = "<group>"; };
 		5750F32A2032D4E500389347 /* LocalAuthentication.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LocalAuthentication.framework; path = System/Library/Frameworks/LocalAuthentication.framework; sourceTree = SDKROOT; };
@@ -3475,8 +3476,8 @@
 		5756DD76218D14A200D4EE6A /* MockHidConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockHidConnection.h; sourceTree = "<group>"; };
 		5756DD77218D14A200D4EE6A /* MockHidConnection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MockHidConnection.cpp; sourceTree = "<group>"; };
 		57597EB721811D9A0037F924 /* CtapHidDriver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CtapHidDriver.h; sourceTree = "<group>"; };
-		57597EBB2181848F0037F924 /* CtapHidAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CtapHidAuthenticator.h; sourceTree = "<group>"; };
-		57597EBC2181848F0037F924 /* CtapHidAuthenticator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CtapHidAuthenticator.cpp; sourceTree = "<group>"; };
+		57597EBB2181848F0037F924 /* CtapAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CtapAuthenticator.h; sourceTree = "<group>"; };
+		57597EBC2181848F0037F924 /* CtapAuthenticator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CtapAuthenticator.cpp; sourceTree = "<group>"; };
 		57597EC021818BE20037F924 /* CtapHidDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CtapHidDriver.cpp; sourceTree = "<group>"; };
 		5760828B2029854200116678 /* WebAuthenticatorCoordinator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebAuthenticatorCoordinator.h; sourceTree = "<group>"; };
 		5760828C2029854200116678 /* WebAuthenticatorCoordinator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebAuthenticatorCoordinator.cpp; sourceTree = "<group>"; };
@@ -3517,8 +3518,8 @@
 		57DCEDC6214F18300016B847 /* MockLocalConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MockLocalConnection.mm; sourceTree = "<group>"; };
 		57DCEDC9214F4E420016B847 /* MockAuthenticatorManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockAuthenticatorManager.h; sourceTree = "<group>"; };
 		57DCEDCD214F51680016B847 /* MockAuthenticatorManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockAuthenticatorManager.cpp; sourceTree = "<group>"; };
-		57EB2E3821E1983E00B89CDF /* U2fHidAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = U2fHidAuthenticator.h; sourceTree = "<group>"; };
-		57EB2E3921E1983E00B89CDF /* U2fHidAuthenticator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = U2fHidAuthenticator.cpp; sourceTree = "<group>"; };
+		57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = U2fAuthenticator.h; sourceTree = "<group>"; };
+		57EB2E3921E1983E00B89CDF /* U2fAuthenticator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = U2fAuthenticator.cpp; sourceTree = "<group>"; };
 		57FD317022B35148008D0E8B /* PopUpSOAuthorizationSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopUpSOAuthorizationSession.h; sourceTree = "<group>"; };
 		57FD317122B35148008D0E8B /* WKSOAuthorizationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKSOAuthorizationDelegate.h; sourceTree = "<group>"; };
 		57FD317222B35148008D0E8B /* SOAuthorizationCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SOAuthorizationCoordinator.h; sourceTree = "<group>"; };
@@ -6954,12 +6955,13 @@
 		57597EBF218184B20037F924 /* fido */ = {
 			isa = PBXGroup;
 			children = (
-				57597EBC2181848F0037F924 /* CtapHidAuthenticator.cpp */,
-				57597EBB2181848F0037F924 /* CtapHidAuthenticator.h */,
+				57597EBC2181848F0037F924 /* CtapAuthenticator.cpp */,
+				57597EBB2181848F0037F924 /* CtapAuthenticator.h */,
+				570B73CF230236DD00FAEC53 /* CtapDriver.h */,
 				57597EC021818BE20037F924 /* CtapHidDriver.cpp */,
 				57597EB721811D9A0037F924 /* CtapHidDriver.h */,
-				57EB2E3921E1983E00B89CDF /* U2fHidAuthenticator.cpp */,
-				57EB2E3821E1983E00B89CDF /* U2fHidAuthenticator.h */,
+				57EB2E3921E1983E00B89CDF /* U2fAuthenticator.cpp */,
+				57EB2E3821E1983E00B89CDF /* U2fAuthenticator.h */,
 			);
 			path = fido;
 			sourceTree = "<group>";
@@ -9337,7 +9339,7 @@
 				37C21CAE1E994C0C0029D5F9 /* CorePredictionSPI.h in Headers */,
 				B878B615133428DC006888E9 /* CorrectionPanel.h in Headers */,
 				A1FB68271F6E51C100C43F9F /* CrashReporterClientSPI.h in Headers */,
-				57597EBD218184900037F924 /* CtapHidAuthenticator.h in Headers */,
+				57597EBD218184900037F924 /* CtapAuthenticator.h in Headers */,
 				57597EB921811D9A0037F924 /* CtapHidDriver.h in Headers */,
 				C55F91711C59676E0029E92D /* DataDetectionResult.h in Headers */,
 				1AC75380183BE50F0072CB15 /* DataReference.h in Headers */,
@@ -9684,7 +9686,7 @@
 				1AF05D8714688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h in Headers */,
 				2F8336861FA139DF00C6E080 /* TouchBarMenuData.h in Headers */,
 				46BEB6E322FBB21A00269867 /* TransientLocalStorageNamespace.h in Headers */,
-				57EB2E3A21E1983E00B89CDF /* U2fHidAuthenticator.h in Headers */,
+				57EB2E3A21E1983E00B89CDF /* U2fAuthenticator.h in Headers */,
 				1AFE436618B6C081009C7A48 /* UIDelegate.h in Headers */,
 				515BE1B51D5917FF00DD7C68 /* UIGamepad.h in Headers */,
 				515BE1A91D55293400DD7C68 /* UIGamepadProvider.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to