#include "device/fido/enclave/enclave_protocol_utils.h"
#include <optional>
#include <string>
#include <vector>
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "components/cbor/reader.h"
#include "components/cbor/values.h"
#include "components/sync/protocol/webauthn_credential_specifics.pb.h"
#include "device/fido/ctap_make_credential_request.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/fido_transport_protocol.h"
#include "device/fido/json_request.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 "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace device {
namespace {
constexpr uint8_t kHandshakeHash[32] = …;
constexpr uint8_t kDeviceId[] = …;
constexpr uint8_t kSignature[] = …;
constexpr uint8_t kUserId[] = …;
constexpr uint8_t kEncryptedPasskey[] = …;
constexpr char kClientDataJson[] = …;
constexpr char kRpId[] = …;
constexpr char kGetAssertionRequestJson[] = …;
constexpr char kMakeCredentialRequestJson[] = …;
constexpr char kGetAssertionHexResponse[] = …;
constexpr char kMakeCredentialHexResponse[] = …;
constexpr int32_t kWrappedSecretVersion = …;
struct BadResponseTestCase { … };
BadResponseTestCase kFailingGetAssertionResponses[] = …;
BadResponseTestCase kFailingMakeCredentialResponses[] = …;
sync_pb::WebauthnCredentialSpecifics PasskeyEntity() { … }
void FakeSigningCallback(
enclave::SignedMessage to_be_signed,
base::OnceCallback<void(std::optional<enclave::ClientSignature>)>
callback) { … }
class BuildCommandCompletionWaiter { … };
class EnclaveProtocolUtilsTest : public testing::Test { … };
}
namespace enclave {
TEST_F(EnclaveProtocolUtilsTest, BuildGetAssertionRequest_Success) { … }
TEST_F(EnclaveProtocolUtilsTest, BuildGetAssertionRequest_WithPIN) { … }
TEST_F(EnclaveProtocolUtilsTest, BuildMakeCredentialRequest_Success) { … }
TEST_F(EnclaveProtocolUtilsTest, BuildMakeCredentialRequest_WithPIN) { … }
TEST_F(EnclaveProtocolUtilsTest, ParseGetAssertionResponse_Success) { … }
TEST_F(EnclaveProtocolUtilsTest, ParseGetAssertionResponse_Failures) { … }
TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_Success) { … }
TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_StringFailures) { … }
TEST_F(EnclaveProtocolUtilsTest, ParseGetAssertionResponse_IntegerFailure) { … }
TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_IntegerFailure) { … }
}
}