#include "third_party/blink/renderer/modules/credentialmanagement/public_key_credential.h"
#include <utility>
#include "base/functional/overloaded.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom-shared.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_all_accepted_credentials_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_authentication_response_js_on.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_current_user_details_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_public_key_credential_creation_options.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_registration_response_js_on.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_unknown_credential_options.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/modules/credentialmanagement/authentication_credentials_container.h"
#include "third_party/blink/renderer/modules/credentialmanagement/credential_manager_proxy.h"
#include "third_party/blink/renderer/modules/credentialmanagement/json.h"
#include "third_party/blink/renderer/modules/credentialmanagement/scoped_promise_resolver.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/text/base64.h"
#include "v8/include/v8-local-handle.h"
#include "v8/include/v8-value.h"
namespace blink {
namespace {
constexpr char kPublicKeyCredentialType[] = …;
void OnIsUserVerifyingComplete(ScriptPromiseResolver<IDLBoolean>* resolver,
bool available) { … }
std::optional<std::string> AuthenticatorAttachmentToString(
mojom::blink::AuthenticatorAttachment authenticator_attachment) { … }
void OnGetClientCapabilitiesComplete(
ScriptPromiseResolver<IDLRecord<IDLString, IDLBoolean>>* resolver,
const Vector<mojom::blink::WebAuthnClientCapabilityPtr> capabilities) { … }
void OnSignalReportComplete(
std::unique_ptr<ScopedPromiseResolver> scoped_resolver,
mojom::AuthenticatorStatus status,
mojom::blink::WebAuthnDOMExceptionDetailsPtr dom_exception_details) { … }
}
PublicKeyCredential::PublicKeyCredential(
const String& id,
DOMArrayBuffer* raw_id,
AuthenticatorResponse* response,
mojom::blink::AuthenticatorAttachment authenticator_attachment,
const AuthenticationExtensionsClientOutputs* extension_outputs,
const String& type)
: … { … }
ScriptPromise<IDLRecord<IDLString, IDLBoolean>>
PublicKeyCredential::getClientCapabilities(ScriptState* script_state) { … }
ScriptPromise<IDLBoolean>
PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable(
ScriptState* script_state) { … }
AuthenticationExtensionsClientOutputs*
PublicKeyCredential::getClientExtensionResults() const { … }
ScriptPromise<IDLBoolean> PublicKeyCredential::isConditionalMediationAvailable(
ScriptState* script_state) { … }
v8::Local<v8::Value> PublicKeyCredential::toJSON(
ScriptState* script_state) const { … }
const PublicKeyCredentialCreationOptions*
PublicKeyCredential::parseCreationOptionsFromJSON(
ScriptState* script_state,
const PublicKeyCredentialCreationOptionsJSON* options,
ExceptionState& exception_state) { … }
const PublicKeyCredentialRequestOptions*
PublicKeyCredential::parseRequestOptionsFromJSON(
ScriptState* script_state,
const PublicKeyCredentialRequestOptionsJSON* options,
ExceptionState& exception_state) { … }
ScriptPromise<IDLUndefined> PublicKeyCredential::signalUnknownCredential(
ScriptState* script_state,
const UnknownCredentialOptions* options,
ExceptionState& exception_state) { … }
ScriptPromise<IDLUndefined> PublicKeyCredential::signalAllAcceptedCredentials(
ScriptState* script_state,
const AllAcceptedCredentialsOptions* options,
ExceptionState& exception_state) { … }
ScriptPromise<IDLUndefined> PublicKeyCredential::signalCurrentUserDetails(
ScriptState* script_state,
const CurrentUserDetailsOptions* options,
ExceptionState& exception_state) { … }
void PublicKeyCredential::Trace(Visitor* visitor) const { … }
bool PublicKeyCredential::IsPublicKeyCredential() const { … }
}