#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/webauthn/json/value_conversions.h"
#include <iterator>
#include <optional>
#include <string_view>
#include "base/base64url.h"
#include "base/feature_list.h"
#include "base/ranges/ranges.h"
#include "base/values.h"
#include "device/fido/attestation_object.h"
#include "device/fido/authenticator_selection_criteria.h"
#include "device/fido/cable/cable_discovery_data.h"
#include "device/fido/features.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_transport_protocol.h"
#include "device/fido/fido_types.h"
#include "device/fido/public_key_credential_descriptor.h"
#include "device/fido/public_key_credential_params.h"
#include "device/fido/public_key_credential_rp_entity.h"
#include "device/fido/public_key_credential_user_entity.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
namespace webauthn {
namespace {
std::string Base64UrlEncode(base::span<const uint8_t> input) { … }
bool Base64UrlDecode(std::string_view input, std::string* output) { … }
std::optional<std::string> Base64UrlDecodeStringKey(
const base::Value::Dict& dict,
const std::string& key) { … }
std::tuple<bool, std::optional<std::string>> Base64UrlDecodeOptionalStringKey(
const base::Value::Dict& dict,
const std::string& key) { … }
std::vector<uint8_t> ToByteVector(const std::string& in) { … }
base::Value ToValue(const device::PublicKeyCredentialRpEntity& relying_party) { … }
base::Value ToValue(const device::PublicKeyCredentialUserEntity& user) { … }
base::Value ToValue(
const device::PublicKeyCredentialParams::CredentialInfo& params) { … }
base::Value ToValue(const device::PublicKeyCredentialDescriptor& descriptor) { … }
base::Value ToValue(
const device::AuthenticatorAttachment& authenticator_attachment) { … }
base::Value ToValue(
const device::ResidentKeyRequirement& resident_key_requirement) { … }
base::Value ToValue(
const device::UserVerificationRequirement& user_verification_requirement) { … }
base::Value ToValue(
const device::AuthenticatorSelectionCriteria& authenticator_selection) { … }
base::Value ToValue(const device::AttestationConveyancePreference&
attestation_conveyance_preference) { … }
base::Value ToValue(const blink::mojom::RemoteDesktopClientOverride&
remote_desktop_client_override) { … }
base::Value ToValue(const blink::mojom::ProtectionPolicy policy) { … }
base::Value ToValue(const device::LargeBlobSupport large_blob) { … }
base::Value ToValue(const device::CableDiscoveryData& cable_authentication) { … }
base::Value ToValue(
const blink::mojom::SupplementalPubKeysRequestPtr& supplemental_pub_keys) { … }
base::Value ToValue(const std::vector<std::string>& strings) { … }
std::optional<device::FidoTransportProtocol> FidoTransportProtocolFromValue(
const base::Value& value) { … }
std::optional<device::AuthenticatorAttachment>
OptionalAuthenticatorAttachmentFromValue(const base::Value* value) { … }
std::pair<blink::mojom::MakeCredentialAuthenticatorResponsePtr, std::string>
InvalidMakeCredentialField(const char* field_name) { … }
std::pair<blink::mojom::GetAssertionAuthenticatorResponsePtr, std::string>
InvalidGetAssertionField(const char* field_name) { … }
base::Value ToValue(const blink::mojom::PRFValuesPtr& prf_input) { … }
base::Value ToValue(const std::vector<blink::mojom::Hint>& hints) { … }
}
base::Value ToValue(
const blink::mojom::PublicKeyCredentialCreationOptionsPtr& options) { … }
base::Value ToValue(
const blink::mojom::PublicKeyCredentialRequestOptionsPtr& options) { … }
std::optional<blink::mojom::PRFValuesPtr> ParsePRFResults(
const base::Value::Dict* results) { … }
std::optional<blink::mojom::SupplementalPubKeysResponsePtr>
ParseSupplementalPubKeys(const base::Value::Dict* json) { … }
std::pair<blink::mojom::MakeCredentialAuthenticatorResponsePtr, std::string>
MakeCredentialResponseFromValue(const base::Value& value) { … }
std::pair<blink::mojom::GetAssertionAuthenticatorResponsePtr, std::string>
GetAssertionResponseFromValue(const base::Value& value) { … }
}