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 * @addtogroup HdfPinAuth
18 * @{
19 *
20 * @brief Provides APIs for the pin auth driver.
21 *
22 * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver.
23 * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors.
24 * After obtaining the pin auth executors, the service can call related APIs to get executor information, get
25 * template information, and enroll, authenticate, and delete templates, etc.
26 *
27 * @since 3.2
28 */
29
30/**
31 * @file IExecutor.idl
32 *
33 * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get
34 * template information, and enroll, authenticate, and delete templates, etc.
35 *
36 * @since 3.2
37 */
38
39package ohos.hdi.pin_auth.v1_0;
40
41import ohos.hdi.pin_auth.v1_0.PinAuthTypes;
42import ohos.hdi.pin_auth.v1_0.IExecutorCallback;
43
44/**
45 * @brief Defines the APIs of the executors. These APIs can be used to get executor information, get
46 * template information, and enroll, authenticate, and delete templates, etc.
47 *
48 * @since 3.2
49 * @version 1.0
50 */
51
52interface IExecutor {
53    /**
54     * @brief Gets executor information.
55     *
56     * @param executorInfo Indicates executor information. See {@link ExecutorInfo}.
57     *
58     * @return Returns <b>0</b> if the operation is successful.
59     * @return Returns a non-zero value if the operation fails.
60     */
61    GetExecutorInfo([out] struct ExecutorInfo executorInfo);
62    /**
63     * @brief Gets template information.
64     *
65     * @param templateId Indicates the template ID.
66     * @param templateInfo Indicates template information. See {@link TemplateInfo}.
67     *
68     * @return Returns <b>0</b> if the operation is successful.
69     * @return Returns a non-zero value if the operation fails.
70     *
71     * @deprecated
72     */
73    GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo templateInfo);
74    /**
75     * @brief Sends parameters to the driver when executor registration is finished.
76     *
77     * @param templateIdList Indicates the templates previously registered to the user auth framework.
78     * @param frameworkPublicKey Indicates the framework public key.
79     * @param extraInfo Indicates the extra information that is sent to the executors.
80     *
81     * @return Returns <b>0</b> if the operation is successful.
82     * @return Returns a non-zero value if the operation fails.
83     */
84    OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo);
85    /**
86     * @brief Sets pin data.
87     *
88     * @param scheduleId Indicates the schedule ID of enrollment.
89     * @param authSubType Indicates the pin sub type.
90     * @param data Indicates the pin data.
91     *
92     * @return Returns <b>0</b> if the operation is successful.
93     * @return Returns a non-zero value if the operation fails.
94     */
95    OnSetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data);
96    /**
97     * @brief Enrolls templates.
98     *
99     * @param scheduleId Indicates the schedule ID of enrollment.
100     * @param extraInfo Indicates the extra information of enrollment.
101     * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}.
102     *
103     * @return Returns <b>0</b> if the operation is successful.
104     * @return Returns a non-zero value if the operation fails.
105     */
106    Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
107    /**
108     * @brief Authenticates templates.
109     *
110     * @param scheduleId Indicates the schedule ID of authentication.
111     * @param templateId Indicates the templates to authenticate.
112     * @param extraInfo Indicates the extra information of authentication.
113     * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}.
114     *
115     * @return Returns <b>0</b> if the operation is successful.
116     * @return Returns a non-zero value if the operation fails.
117     */
118    Authenticate([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
119    /**
120     * @brief Deletes templates.
121     *
122     * @param templateId Indicates the templates to delete.
123     *
124     * @return Returns <b>0</b> if the operation is successful.
125     * @return Returns a non-zero value if the operation fails.
126     */
127    Delete([in] unsigned long templateId);
128    /**
129     * @brief Cancels an operation.
130     *
131     * @param scheduleId Indicates the schedule ID of the operation to cancel.
132     *
133     * @return Returns <b>0</b> if the operation is successful.
134     * @return Returns a non-zero value if the operation fails.
135     */
136    Cancel([in] unsigned long scheduleId);
137    /**
138     * @brief Sends a command to the driver.
139     *
140     * @param commandId Indicates the command ID. See {@link CommandId}.
141     * @param extraInfo Indicates the extra information of the command.
142     * @param callbackObj Indicates the callback object of the command. See {@link IExecutorCallback}.
143     *
144     * @return Returns <b>0</b> if the operation is successful.
145     * @return Returns a non-zero value if the operation fails.
146     */
147    SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
148}
149/** @} */