chromium/crypto/scoped_fake_user_verifying_key_provider.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "crypto/scoped_fake_user_verifying_key_provider.h"

#include <memory>
#include <utility>
#include <vector>

#include "base/base64.h"
#include "base/containers/flat_map.h"
#include "base/containers/span.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "crypto/signature_verifier.h"
#include "crypto/unexportable_key.h"
#include "crypto/user_verifying_key.h"

namespace crypto {

namespace {

// This tracks deleted keys, so calling `DeleteUserVerifyingKey` with one
// can return false, allowing deletion to be tested.
std::vector<UserVerifyingKeyLabel> g_deleted_keys_;

// Wraps a software `UnexportableSigningKey`.
class FakeUserVerifyingSigningKey : public UserVerifyingSigningKey {};

class FakeUserVerifyingKeyProvider : public UserVerifyingKeyProvider {};

class FailingUserVerifyingSigningKey : public UserVerifyingSigningKey {};

class FailingUserVerifyingKeyProvider : public UserVerifyingKeyProvider {};

std::unique_ptr<UserVerifyingKeyProvider> GetMockUserVerifyingKeyProvider() {}

std::unique_ptr<UserVerifyingKeyProvider> GetNullUserVerifyingKeyProvider() {}

std::unique_ptr<UserVerifyingKeyProvider> GetFailingUserVerifyingKeyProvider() {}

}  // namespace

ScopedFakeUserVerifyingKeyProvider::ScopedFakeUserVerifyingKeyProvider() {}

ScopedFakeUserVerifyingKeyProvider::~ScopedFakeUserVerifyingKeyProvider() {}

ScopedNullUserVerifyingKeyProvider::ScopedNullUserVerifyingKeyProvider() {}

ScopedNullUserVerifyingKeyProvider::~ScopedNullUserVerifyingKeyProvider() {}

ScopedFailingUserVerifyingKeyProvider::ScopedFailingUserVerifyingKeyProvider() {}

ScopedFailingUserVerifyingKeyProvider::
    ~ScopedFailingUserVerifyingKeyProvider() {}
}  // namespace crypto