1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @file co_auth_client.h
18  *
19  * @brief The definition of coAuth client.
20  * @since 3.1
21  * @version 3.2
22  */
23 
24 #ifndef CO_AUTH_CLIENT_H
25 #define CO_AUTH_CLIENT_H
26 
27 #include "co_auth_client_callback.h"
28 #include "co_auth_client_defines.h"
29 
30 namespace OHOS {
31 namespace UserIam {
32 namespace UserAuth {
33 class CoAuthClient {
34 public:
35     /**
36      * @brief Get coAuth client's instance.
37      *
38      * @return CoAuthClient's instance.
39      */
40     static CoAuthClient &GetInstance();
41 
42     /**
43      * @brief Deconstructor.
44      */
45     virtual ~CoAuthClient() = default;
46 
47     /**
48      * @brief Executor secure register into coAuth resource pool.
49      *
50      * @param info Information about executor which need to register into coAuth.
51      * @param callback Callback of executor register.
52      *
53      * @return Executor index.
54      */
55     virtual uint64_t Register(const ExecutorInfo &info, const std::shared_ptr<ExecutorRegisterCallback> &callback) = 0;
56 
57     /**
58      * @brief Executor secure unregister from coAuth resource pool.
59      *
60      * @param info Information about executor which need to unregister from coAuth.
61      */
62     virtual void Unregister(uint64_t executorIndex) = 0;
63 };
64 } // namespace UserAuth
65 } // namespace UserIam
66 } // namespace OHOS
67 #endif // CO_AUTH_CLIENT_H