1 // Copyright 2018 The Chromium Authors. All rights reserved.
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 DEVICE_FIDO_PLATFORM_CREDENTIAL_STORE_H_
6 #define DEVICE_FIDO_PLATFORM_CREDENTIAL_STORE_H_
7 
8 #include "base/component_export.h"
9 #include "base/time/time.h"
10 
11 namespace device {
12 namespace fido {
13 
14 // The PlatformCredentialStore interface wraps methods for deleting WebAuthn
15 // credentials that belong to authenticators integrated into Chrome (currently
16 // only the TouchIdAuthenticator in //device/fido/mac).
COMPONENT_EXPORT(DEVICE_FIDO)17 class COMPONENT_EXPORT(DEVICE_FIDO) PlatformCredentialStore {
18  public:
19   virtual ~PlatformCredentialStore() = default;
20 
21   // DeleteCredentials deletes WebAuthn credentials that were created within the
22   // given time interval from local storage.
23   //
24   // Returns false if any attempt to delete a credential failed (but others may
25   // still have succeeded), and true otherwise.
26   virtual bool DeleteCredentials(base::Time created_not_before,
27                                  base::Time created_not_after) = 0;
28 
29   // CountCredentials returns the number of credentials that would get deleted
30   // by a call to |DeleteCredentials| with identical arguments.
31   virtual size_t CountCredentials(base::Time created_not_before,
32                                   base::Time created_not_after) = 0;
33 };
34 
35 }  // namespace fido
36 }  // namespace device
37 
38 #endif  // DEVICE_FIDO_PLATFORM_CREDENTIAL_STORE_H_
39