summaryrefslogtreecommitdiff
path: root/chromium/content/browser/webauth/is_uvpaa.cc
blob: f986d0b53e1077da8670213911236a47d8ff59d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/public/browser/is_uvpaa.h"

#include "base/feature_list.h"
#include "build/build_config.h"
#include "device/fido/features.h"

#if defined(OS_MAC)
#include "device/fido/mac/authenticator.h"
#endif

#if defined(OS_WIN)
#include "device/fido/win/authenticator.h"
#include "device/fido/win/webauthn_api.h"
#endif

#if defined(OS_CHROMEOS)
#include "device/fido/cros/authenticator.h"
#endif

namespace content {

#if defined(OS_MAC)
bool IsUVPlatformAuthenticatorAvailable(
    const content::AuthenticatorRequestClientDelegate::
        TouchIdAuthenticatorConfig& config) {
  return device::fido::mac::TouchIdAuthenticator::IsAvailable(config);
}

#elif defined(OS_WIN)
bool IsUVPlatformAuthenticatorAvailable(
    device::WinWebAuthnApi* win_webauthn_api) {
  return base::FeatureList::IsEnabled(device::kWebAuthUseNativeWinApi) &&
         device::WinWebAuthnApiAuthenticator::
             IsUserVerifyingPlatformAuthenticatorAvailable(win_webauthn_api);
}

#elif defined(OS_CHROMEOS)
bool IsUVPlatformAuthenticatorAvailable() {
  return base::FeatureList::IsEnabled(
             device::kWebAuthCrosPlatformAuthenticator) &&
         device::ChromeOSAuthenticator::
             IsUVPlatformAuthenticatorAvailableBlocking();
}

#else
bool IsUVPlatformAuthenticatorAvailable() {
  return false;
}
#endif

}  // namespace content