1 /*
2  * Copyright 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 namespace bluetooth {
18 namespace bluetooth_keystore {
19 
20 class BluetoothKeystoreCallbacks {
21  public:
22   virtual ~BluetoothKeystoreCallbacks() = default;
23 
24   /** Callback for key encrypt or remove key */
25   virtual void set_encrypt_key_or_remove_key(std::string prefix,
26                                              std::string encryptedString) = 0;
27 
28   /** Callback for get key. */
29   virtual std::string get_key(std::string prefix) = 0;
30 };
31 
32 class BluetoothKeystoreInterface {
33  public:
34   virtual ~BluetoothKeystoreInterface() = default;
35 
36   /** Register the bluetooth keystore callbacks */
37   virtual void init(BluetoothKeystoreCallbacks* callbacks) = 0;
38 
39   /** Interface for key encrypt or remove key */
40   virtual void set_encrypt_key_or_remove_key(std::string prefix,
41                                              std::string encryptedString) = 0;
42 
43   /** Interface for get key. */
44   virtual std::string get_key(std::string prefix) = 0;
45 
46   /** Interface for clear map. */
47   virtual void clear_map() = 0;
48 };
49 
50 }  // namespace bluetooth_keystore
51 }  // namespace bluetooth
52