1 // Copyright 2024 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CRYPTO_SCOPED_FAKE_APPLE_KEYCHAIN_V2_H_ 6 #define CRYPTO_SCOPED_FAKE_APPLE_KEYCHAIN_V2_H_ 7 8 #include <memory> 9 #include <string> 10 11 #include "crypto/crypto_export.h" 12 13 namespace crypto { 14 15 class FakeAppleKeychainV2; 16 17 // ScopedFakeAppleKeychainV2 installs itself as testing override for 18 // `AppleKeychainV2::GetInstance()`. 19 class CRYPTO_EXPORT ScopedFakeAppleKeychainV2 { 20 public: 21 // Supported types of user verification, reported by 22 // LAContextCanEvaluatePolicy. 23 enum class UVMethod { 24 kNone, 25 kPasswordOnly, 26 kBiometrics, 27 }; 28 29 explicit ScopedFakeAppleKeychainV2(const std::string& keychain_access_group); 30 ~ScopedFakeAppleKeychainV2(); 31 keychain()32 FakeAppleKeychainV2* keychain() { return keychain_.get(); } 33 34 void SetUVMethod(UVMethod uv_method); 35 36 private: 37 std::unique_ptr<FakeAppleKeychainV2> keychain_; 38 }; 39 40 } // namespace crypto 41 42 #endif // CRYPTO_SCOPED_FAKE_APPLE_KEYCHAIN_V2_H_ 43