• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 iam_executor_iauth_executor_hdi.h
18  *
19  * @brief Hardware device interface for authenticate executor.
20  * @since 3.1
21  * @version 3.2
22  */
23 
24 #ifndef IAM_EXECUTOR_IAUTH_EXECUTOR_HDI_H
25 #define IAM_EXECUTOR_IAUTH_EXECUTOR_HDI_H
26 
27 #include <cstdint>
28 #include <vector>
29 
30 #include "co_auth_client.h"
31 #include "iam_common_defines.h"
32 #include "iam_executor_framework_types.h"
33 #include "iam_executor_iexecute_callback.h"
34 
35 namespace OHOS {
36 namespace UserIam {
37 namespace UserAuth {
38 class IAuthExecutorHdi {
39 public:
40     /**
41      * @brief Default constructor.
42      */
43     IAuthExecutorHdi() = default;
44 
45     /**
46      * @brief Deconstructor.
47      */
48     virtual ~IAuthExecutorHdi() = default;
49 
50     /**
51      * @brief Get executor infomation.
52      *
53      * @param info The executor infomation.
54      * @return Return the result success or error code{@link ResultCode}.
55      */
56     virtual ResultCode GetExecutorInfo(ExecutorInfo &info) = 0;
57 
58     /**
59      * @brief Register is finish.
60      *
61      * @param templateIdList Template ID list.
62      * @param frameworkPublicKey Framework publickey
63      * @param extraInfo Extra infomation.
64      * @return Return the result success or error code{@link ResultCode}.
65      */
66     virtual ResultCode OnRegisterFinish(const std::vector<uint64_t> &templateIdList,
67         const std::vector<uint8_t> &frameworkPublicKey, const std::vector<uint8_t> &extraInfo) = 0;
68 
69     /**
70      * @brief Begin enroll.
71      *
72      * @param scheduleId Current enroll schedule ID.
73      * @param param Enroll param.
74      * @param callbackObj Callback of enroll result.
75      * @return Return the result success or error code{@link ResultCode}.
76      */
77     virtual ResultCode Enroll(uint64_t scheduleId, const EnrollParam &param,
78         const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj) = 0;
79 
80     /**
81      * @brief Begin authenticate.
82      *
83      * @param scheduleId Current authenticate schedule ID.
84      * @param param Authenticate param.
85      * @param callbackObj Callback of authenticate result.
86      * @return Return the result success or error code{@link ResultCode}.
87      */
88     virtual ResultCode Authenticate(uint64_t scheduleId, const AuthenticateParam &param,
89         const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj) = 0;
90 
91     /**
92      * @brief Begin identify.
93      *
94      * @param scheduleId Current identify schedule ID.
95      * @param param Identify param.
96      * @param callbackObj Callback of identify result.
97      * @return Return the result success or error code{@link ResultCode}.
98      */
99     virtual ResultCode Identify(uint64_t scheduleId, const IdentifyParam &param,
100         const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj) = 0;
101 
102     /**
103      * @brief Delete.
104      *
105      * @param templateIdList Template ID list.
106      * @return Return the result success or error code{@link ResultCode}.
107      */
108     virtual ResultCode Delete(const std::vector<uint64_t> &templateIdList) = 0;
109 
110     /**
111      * @brief Cancel the action of executor.
112      *
113      * @param scheduleId Current working schedule ID.
114      * @return Return the result success or error code{@link ResultCode}.
115      */
116     virtual ResultCode Cancel(uint64_t scheduleId) = 0;
117 
118     /**
119      * @brief Send command.
120      *
121      * @param commandId Command ID.
122      * @param extraInfo Extra information of send command.
123      * @param callbackObj Callback of send command result.
124      * @return Return the result success or error code{@link ResultCode}.
125      */
126     virtual ResultCode SendCommand(PropertyMode commandId, const std::vector<uint8_t> &extraInfo,
127         const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj) = 0;
128 
129     /**
130      * @brief Get property.
131      *
132      * @param templateIdList Template id list.
133      * @param keys Keys of property to get.
134      * @param property Return property .
135      * @return Return the result success or error code{@link ResultCode}.
136      */
137     virtual ResultCode GetProperty(const std::vector<uint64_t> &templateIdList,
138         const std::vector<Attributes::AttributeKey> &keys, Property &property) = 0;
139 
140     /**
141      * @brief Set cached templates.
142      *
143      * @param templateIdList Template id list.
144      * @return Return the result success or error code{@link ResultCode}.
145      */
146     virtual ResultCode SetCachedTemplates(const std::vector<uint64_t> &templateIdList) = 0;
147 };
148 } // namespace UserAuth
149 } // namespace UserIam
150 } // namespace OHOS
151 
152 #endif // IAM_EXECUTOR_IAUTH_EXECUTOR_HDI_H