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 Cancel the action of executor. 71 * 72 * @param scheduleId Current working schedule ID. 73 * @return Return the result success or error code{@link ResultCode}. 74 */ 75 virtual ResultCode Cancel(uint64_t scheduleId) = 0; 76 77 /** 78 * @brief Cancel the action of executor. 79 * 80 * @param scheduleId Current working schedule ID. 81 * @param srcRole Source role. 82 * @param msg Message. 83 * @return Return the result success or error code{@link ResultCode}. 84 */ 85 virtual ResultCode SendMessage(uint64_t scheduleId, int32_t srcRole, const std::vector<uint8_t> &msg) = 0; 86 87 /** 88 * @brief Begin enroll. 89 * 90 * @param scheduleId Current enroll schedule ID. 91 * @param param Enroll param. 92 * @param callbackObj Callback of enroll result. 93 * @return Return the result success or error code{@link ResultCode}. 94 */ 95 virtual ResultCode Enroll(uint64_t scheduleId, const EnrollParam ¶m, 96 const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj); 97 98 /** 99 * @brief Begin authenticate. 100 * 101 * @param scheduleId Current authenticate schedule ID. 102 * @param param Authenticate param. 103 * @param callbackObj Callback of authenticate result. 104 * @return Return the result success or error code{@link ResultCode}. 105 */ 106 virtual ResultCode Authenticate(uint64_t scheduleId, const AuthenticateParam ¶m, 107 const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj); 108 109 /** 110 * @brief Begin collect. 111 * 112 * @param scheduleId Current collect schedule ID. 113 * @param param Collect param. 114 * @param callbackObj Callback of authenticate result. 115 * @return Return the result success or error code{@link ResultCode}. 116 */ 117 virtual ResultCode Collect(uint64_t scheduleId, const CollectParam ¶m, 118 const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj); 119 120 /** 121 * @brief Begin identify. 122 * 123 * @param scheduleId Current identify schedule ID. 124 * @param param Identify param. 125 * @param callbackObj Callback of identify result. 126 * @return Return the result success or error code{@link ResultCode}. 127 */ 128 virtual ResultCode Identify(uint64_t scheduleId, const IdentifyParam ¶m, 129 const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj); 130 131 /** 132 * @brief Delete. 133 * 134 * @param templateIdList Template ID list. 135 * @return Return the result success or error code{@link ResultCode}. 136 */ 137 virtual ResultCode Delete(const std::vector<uint64_t> &templateIdList); 138 139 /** 140 * @brief Send command. 141 * 142 * @param commandId Command ID. 143 * @param extraInfo Extra information of send command. 144 * @param callbackObj Callback of send command result. 145 * @return Return the result success or error code{@link ResultCode}. 146 */ 147 virtual ResultCode SendCommand(PropertyMode commandId, const std::vector<uint8_t> &extraInfo, 148 const std::shared_ptr<UserAuth::IExecuteCallback> &callbackObj); 149 150 /** 151 * @brief Get property. 152 * 153 * @param templateIdList Template id list. 154 * @param keys Keys of property to get. 155 * @param property Return property . 156 * @return Return the result success or error code{@link ResultCode}. 157 */ 158 virtual ResultCode GetProperty(const std::vector<uint64_t> &templateIdList, 159 const std::vector<Attributes::AttributeKey> &keys, Property &property); 160 161 /** 162 * @brief Set cached templates. 163 * 164 * @param templateIdList Template id list. 165 * @return Return the result success or error code{@link ResultCode}. 166 */ 167 virtual ResultCode SetCachedTemplates(const std::vector<uint64_t> &templateIdList); 168 169 /** 170 * @brief Notify collector ready. 171 * 172 * @param scheduleId Current collect schedule ID. 173 * @return Return the result success or error code{@link ResultCode}. 174 */ 175 virtual ResultCode NotifyCollectorReady(uint64_t scheduleId); 176 }; 177 } // namespace UserAuth 178 } // namespace UserIam 179 } // namespace OHOS 180 181 #endif // IAM_EXECUTOR_IAUTH_EXECUTOR_HDI_H