#include "device/fido/credential_management.h"
#include "base/check_op.h"
#include "components/cbor/values.h"
#include "components/cbor/writer.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/pin.h"
#include "third_party/boringssl/src/include/openssl/hmac.h"
#include "third_party/boringssl/src/include/openssl/sha.h"
namespace device {
CredentialManagementRequest::CredentialManagementRequest(
Version version_,
CredentialManagementSubCommand subcommand_,
std::optional<cbor::Value::MapValue> params_)
: … { … }
CredentialManagementRequest::CredentialManagementRequest(
CredentialManagementRequest&&) = default;
CredentialManagementRequest& CredentialManagementRequest::operator=(
CredentialManagementRequest&&) = default;
CredentialManagementRequest::~CredentialManagementRequest() = default;
CredentialManagementRequest CredentialManagementRequest::ForGetCredsMetadata(
Version version,
const pin::TokenResponse& token) { … }
CredentialManagementRequest CredentialManagementRequest::ForEnumerateRPsBegin(
Version version,
const pin::TokenResponse& token) { … }
CredentialManagementRequest CredentialManagementRequest::ForEnumerateRPsGetNext(
Version version) { … }
CredentialManagementRequest
CredentialManagementRequest::ForEnumerateCredentialsBegin(
Version version,
const pin::TokenResponse& token,
std::array<uint8_t, kRpIdHashLength> rp_id_hash) { … }
CredentialManagementRequest
CredentialManagementRequest::ForEnumerateCredentialsGetNext(Version version) { … }
CredentialManagementRequest CredentialManagementRequest::ForDeleteCredential(
Version version,
const pin::TokenResponse& token,
const PublicKeyCredentialDescriptor& credential_id) { … }
CredentialManagementRequest
CredentialManagementRequest::ForUpdateUserInformation(
Version version,
const pin::TokenResponse& token,
const PublicKeyCredentialDescriptor& credential_id,
const PublicKeyCredentialUserEntity& updated_user) { … }
std::optional<CredentialsMetadataResponse> CredentialsMetadataResponse::Parse(
const std::optional<cbor::Value>& cbor_response) { … }
std::optional<EnumerateRPsResponse> EnumerateRPsResponse::Parse(
bool expect_rp_count,
const std::optional<cbor::Value>& cbor_response) { … }
bool EnumerateRPsResponse::StringFixupPredicate(
const std::vector<const cbor::Value*>& path) { … }
EnumerateRPsResponse::EnumerateRPsResponse(EnumerateRPsResponse&&) = default;
EnumerateRPsResponse& EnumerateRPsResponse::operator=(EnumerateRPsResponse&&) =
default;
EnumerateRPsResponse::~EnumerateRPsResponse() = default;
EnumerateRPsResponse::EnumerateRPsResponse(
std::optional<PublicKeyCredentialRpEntity> rp_,
std::optional<std::array<uint8_t, kRpIdHashLength>> rp_id_hash_,
size_t rp_count_)
: … { … }
std::optional<EnumerateCredentialsResponse> EnumerateCredentialsResponse::Parse(
bool expect_credential_count,
const std::optional<cbor::Value>& cbor_response) { … }
bool EnumerateCredentialsResponse::StringFixupPredicate(
const std::vector<const cbor::Value*>& path) { … }
EnumerateCredentialsResponse::EnumerateCredentialsResponse(
EnumerateCredentialsResponse&&) = default;
EnumerateCredentialsResponse& EnumerateCredentialsResponse::operator=(
EnumerateCredentialsResponse&&) = default;
EnumerateCredentialsResponse::~EnumerateCredentialsResponse() = default;
EnumerateCredentialsResponse::EnumerateCredentialsResponse(
PublicKeyCredentialUserEntity user_,
PublicKeyCredentialDescriptor credential_id_,
size_t credential_count_,
std::optional<std::array<uint8_t, kLargeBlobKeyLength>> large_blob_key_)
: … { … }
AggregatedEnumerateCredentialsResponse::AggregatedEnumerateCredentialsResponse(
PublicKeyCredentialRpEntity rp_)
: … { … }
AggregatedEnumerateCredentialsResponse::AggregatedEnumerateCredentialsResponse(
AggregatedEnumerateCredentialsResponse&&) = default;
AggregatedEnumerateCredentialsResponse&
AggregatedEnumerateCredentialsResponse::operator=(
AggregatedEnumerateCredentialsResponse&&) = default;
AggregatedEnumerateCredentialsResponse::
~AggregatedEnumerateCredentialsResponse() = default;
std::pair<CtapRequestCommand, std::optional<cbor::Value>>
AsCTAPRequestValuePair(const CredentialManagementRequest& request) { … }
}