WebAuthenticatorCoordinator.cpp [plain text]
#include "config.h"
#include "WebAuthenticatorCoordinator.h"
#if ENABLE(WEB_AUTHN)
#include "WebAuthenticatorCoordinatorMessages.h"
#include "WebAuthenticatorCoordinatorProxyMessages.h"
#include "WebPage.h"
#include "WebProcess.h"
#include <WebCore/PublicKeyCredentialCreationOptions.h>
#include <WebCore/PublicKeyCredentialRequestOptions.h>
namespace WebKit {
WebAuthenticatorCoordinator::WebAuthenticatorCoordinator(WebPage& webPage)
: m_webPage(webPage)
{
WebProcess::singleton().addMessageReceiver(Messages::WebAuthenticatorCoordinator::messageReceiverName(), m_webPage.pageID(), *this);
}
WebAuthenticatorCoordinator::~WebAuthenticatorCoordinator()
{
WebProcess::singleton().removeMessageReceiver(*this);
}
void WebAuthenticatorCoordinator::makeCredential(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions& options, WebCore::RequestCompletionHandler&& handler)
{
if (!setRequestCompletionHandler(WTFMove(handler)))
return;
m_webPage.send(Messages::WebAuthenticatorCoordinatorProxy::MakeCredential(hash, options));
}
void WebAuthenticatorCoordinator::getAssertion(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions& options, WebCore::RequestCompletionHandler&& handler)
{
if (!setRequestCompletionHandler(WTFMove(handler)))
return;
m_webPage.send(Messages::WebAuthenticatorCoordinatorProxy::GetAssertion(hash, options));
}
void WebAuthenticatorCoordinator::isUserVerifyingPlatformAuthenticatorAvailable(WebCore::QueryCompletionHandler&& handler)
{
auto messageId = addQueryCompletionHandler(WTFMove(handler));
m_webPage.send(Messages::WebAuthenticatorCoordinatorProxy::IsUserVerifyingPlatformAuthenticatorAvailable(messageId));
}
}
#endif // ENABLE(WEB_AUTHN)