#include "chrome/browser/webauthn/fake_magic_arch.h"
#include "base/check.h"
#include "base/containers/span.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/webauthn/fake_recovery_key_store.h"
#include "chrome/browser/webauthn/fake_security_domain_service.h"
#include "components/trusted_vault/proto/recovery_key_store.pb.h"
#include "components/trusted_vault/proto/vault.pb.h"
#include "components/trusted_vault/securebox.h"
#include "third_party/boringssl/src/include/openssl/aead.h"
#include "third_party/boringssl/src/include/openssl/evp.h"
#include "third_party/boringssl/src/include/openssl/hmac.h"
#include "third_party/boringssl/src/include/openssl/sha.h"
namespace {
base::span<const uint8_t> ToSpan(std::string_view s) { … }
const trusted_vault_pb::AsymmetricKeyPair* GetKeyPairWithPublicKey(
const trusted_vault_pb::Vault& vault,
std::string_view public_key) { … }
std::string AsLEBytes(int32_t v) { … }
std::array<uint8_t, 32> HashPIN(std::string_view pin,
const trusted_vault_pb::Vault& vault) { … }
std::array<uint8_t, SHA256_DIGEST_LENGTH> SHA256Spans(
base::span<const uint8_t> a,
base::span<const uint8_t> b) { … }
std::vector<uint8_t> Decrypt(base::span<const uint8_t> key,
base::span<const uint8_t> nonce_and_ciphertext) { … }
}
std::optional<std::vector<uint8_t>> FakeMagicArch::RecoverWithPIN(
std::string_view pin,
const FakeSecurityDomainService& security_domain_service,
const FakeRecoveryKeyStore& recovery_key_store) { … }