#include "content/browser/webauth/virtual_authenticator.h"
#include <optional>
#include <utility>
#include "base/functional/bind.h"
#include "base/uuid.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/public_key_credential_rp_entity.h"
#include "device/fido/public_key_credential_user_entity.h"
#include "device/fido/virtual_ctap2_device.h"
#include "device/fido/virtual_u2f_device.h"
#include "mojo/public/cpp/base/big_buffer.h"
namespace content {
VirtualAuthenticator::VirtualAuthenticator(
const blink::test::mojom::VirtualAuthenticatorOptions& options)
: … { … }
VirtualAuthenticator::~VirtualAuthenticator() { … }
void VirtualAuthenticator::AddReceiver(
mojo::PendingReceiver<blink::test::mojom::VirtualAuthenticator> receiver) { … }
bool VirtualAuthenticator::AddRegistration(
std::vector<uint8_t> key_handle,
const std::string& rp_id,
base::span<const uint8_t> private_key,
int32_t counter) { … }
bool VirtualAuthenticator::AddResidentRegistration(
std::vector<uint8_t> key_handle,
std::string rp_id,
base::span<const uint8_t> private_key,
int32_t counter,
std::vector<uint8_t> user_handle) { … }
void VirtualAuthenticator::ClearRegistrations() { … }
bool VirtualAuthenticator::RemoveRegistration(
const std::vector<uint8_t>& key_handle) { … }
void VirtualAuthenticator::SetUserPresence(bool is_user_present) { … }
std::unique_ptr<device::VirtualFidoDevice>
VirtualAuthenticator::ConstructDevice() { … }
void VirtualAuthenticator::AddObserver(Observer* observer) { … }
void VirtualAuthenticator::RemoveObserver(Observer* observer) { … }
bool VirtualAuthenticator::HasObserversForTest() { … }
void VirtualAuthenticator::SetBackupEligibility(
const std::vector<uint8_t>& key_handle,
bool backup_eligibility) { … }
void VirtualAuthenticator::SetBackupState(
const std::vector<uint8_t>& key_handle,
bool backup_state) { … }
void VirtualAuthenticator::GetLargeBlob(const std::vector<uint8_t>& key_handle,
GetLargeBlobCallback callback) { … }
void VirtualAuthenticator::SetLargeBlob(const std::vector<uint8_t>& key_handle,
const std::vector<uint8_t>& blob,
SetLargeBlobCallback callback) { … }
void VirtualAuthenticator::GetUniqueId(GetUniqueIdCallback callback) { … }
void VirtualAuthenticator::GetRegistrations(GetRegistrationsCallback callback) { … }
void VirtualAuthenticator::AddRegistration(
blink::test::mojom::RegisteredKeyPtr registration,
AddRegistrationCallback callback) { … }
void VirtualAuthenticator::ClearRegistrations(
ClearRegistrationsCallback callback) { … }
void VirtualAuthenticator::RemoveRegistration(
const std::vector<uint8_t>& key_handle,
RemoveRegistrationCallback callback) { … }
void VirtualAuthenticator::SetUserVerified(bool verified,
SetUserVerifiedCallback callback) { … }
void VirtualAuthenticator::OnCredentialCreated(
const device::VirtualFidoDevice::Credential& credential) { … }
void VirtualAuthenticator::OnAssertion(
const device::VirtualFidoDevice::Credential& credential) { … }
void VirtualAuthenticator::OnLargeBlobUncompressed(
GetLargeBlobCallback callback,
base::expected<mojo_base::BigBuffer, std::string> result) { … }
void VirtualAuthenticator::OnLargeBlobCompressed(
base::span<const uint8_t> key_handle,
uint64_t original_size,
SetLargeBlobCallback callback,
base::expected<mojo_base::BigBuffer, std::string> result) { … }
}