1/*
2 * Copyright (c) 2024 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 5.0
28 * @version 1.1
29 */
30
31/**
32 * @file IAllInOneExecutor.idl
33 *
34 * @brief Defines the APIs of the all-in-one executors. These APIs can be used to get executor information, get property,
35 * enroll, authenticate, and delete templates, etc.
36 *
37 * @since 5.0
38 * @version 1.1
39 */
40
41package ohos.hdi.pin_auth.v2_1;
42
43import ohos.hdi.pin_auth.v2_1.PinAuthTypes;
44import ohos.hdi.pin_auth.v2_1.IExecutorCallback;
45
46/**
47 * @brief Defines the APIs of the all-in-one executors. These APIs can be used to get executor information, get property,
48 * enroll, authenticate, and delete templates, etc.
49 *
50 * @since 5.0
51 * @version 1.1
52 */
53
54interface IAllInOneExecutor {
55    /**
56     * @brief Gets executor information.
57     *
58     * @param executorInfo Indicates executor information. See {@link ExecutorInfo}.
59     *
60     * @return Returns <b>0</b> if the operation is successful.
61     * @return Returns a non-zero value if the operation fails.
62     *
63     * @since 5.0
64     * @version 1.0
65     */
66    GetExecutorInfo([out] struct ExecutorInfo executorInfo);
67    /**
68     * @brief Sends parameters to the driver when executor registration is finished.
69     *
70     * @param templateIdList Indicates the templates previously registered to the user auth framework.
71     * @param frameworkPublicKey Indicates the framework public key.
72     * @param extraInfo Indicates the extra information that is sent to the executors.
73     *
74     * @return Returns <b>0</b> if the operation is successful.
75     * @return Returns a non-zero value if the operation fails.
76     *
77     * @since 5.0
78     * @version 1.0
79     */
80    OnRegisterFinish([in] unsigned long[] templateIdList, [in] unsigned char[] frameworkPublicKey,
81        [in] unsigned char[] extraInfo);
82    /**
83     * @brief Cancels an operation.
84     *
85     * @param scheduleId Indicates the schedule ID of the operation to cancel.
86     *
87     * @return Returns <b>0</b> if the operation is successful.
88     * @return Returns a non-zero value if the operation fails.
89     *
90     * @since 5.0
91     * @version 1.0
92     */
93    Cancel([in] unsigned long scheduleId);
94    /**
95     * @brief Send message.
96     *
97     * @param scheduleId Indicates the schedule ID of the message.
98     * @param srcRole is the role of source.
99     * @param msg is the message content.
100     *
101     * @return Returns <b>0</b> if the operation is successful.
102     * @return Returns a non-zero value if the operation fails.
103     *
104     * @since 5.0
105     * @version 1.0
106     */
107    SendMessage([in] unsigned long scheduleId, [in] int srcRole, [in] unsigned char[] msg);
108    /**
109     * @brief Sets pin data.
110     *
111     * @param scheduleId Indicates the schedule ID of enrollment.
112     * @param authSubType Indicates the pin sub type.
113     * @param data Indicates the pin data.
114     * @param resultCode Indicates the result code.
115     *
116     * @return Returns <b>0</b> if the operation is successful.
117     * @return Returns a non-zero value if the operation fails.
118     *
119     * @since 5.0
120     * @version 1.0
121     */
122    SetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data,
123        [in] int resultCode);
124    /**
125     * @brief Enrolls templates.
126     *
127     * @param scheduleId Indicates the schedule ID of enrollment.
128     * @param extraInfo Indicates the extra information of enrollment.
129     * @param callbackObj Indicates the callback object of enrollment. See {@link IExecutorCallback}.
130     *
131     * @return Returns <b>0</b> if the operation is successful.
132     * @return Returns a non-zero value if the operation fails.
133     *
134     * @since 5.0
135     * @version 1.0
136     */
137    Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
138    /**
139     * @brief Authenticates templates.
140     *
141     * @param scheduleId Indicates the schedule ID of authentication.
142     * @param templateIdList Indicates the templates to authenticate.
143     * @param extraInfo Indicates the extra information of authentication.
144     * @param callbackObj Indicates the callback object of authentication. See {@link IExecutorCallback}.
145     *
146     * @return Returns <b>0</b> if the operation is successful.
147     * @return Returns a non-zero value if the operation fails.
148     *
149     * @since 5.0
150     * @version 1.0
151     */
152    Authenticate([in] unsigned long scheduleId, [in] unsigned long[] templateIdList, [in] unsigned char[] extraInfo,
153        [in] IExecutorCallback callbackObj);
154    /**
155     * @brief Deletes templates.
156     *
157     * @param templateId Indicates the templates to delete.
158     *
159     * @return Returns <b>0</b> if the operation is successful.
160     * @return Returns a non-zero value if the operation fails.
161     *
162     * @since 5.0
163     * @version 1.0
164     */
165    Delete([in] unsigned long templateId);
166    /**
167     * @brief Get property.
168     *
169     * @param templateIdList Indicates the templates to process.
170     * @param propertyTypes Indicates the property types to get. See {@link GetPropertyType}.
171     * @param property Indicates property. See {@link Property}.
172     *
173     * @return Returns <b>0</b> if the operation is successful.
174     * @return Returns a non-zero value if the operation fails.
175     *
176     * @since 5.0
177     * @version 1.0
178     */
179    GetProperty([in] unsigned long[] templateIdList, [in] int[] propertyTypes, [out] struct Property property);
180    /**
181     * @brief Sends a command to the driver.
182     *
183     * @param commandId Indicates the command ID. See {@link CommandId}.
184     * @param extraInfo Indicates the extra information of the command.
185     * @param callbackObj Indicates the callback object of the command. See {@link IExecutorCallback}.
186     *
187     * @return Returns <b>0</b> if the operation is successful.
188     * @return Returns a non-zero value if the operation fails.
189     *
190     * @since 5.0
191     * @version 1.0
192     */
193    SendCommand([in] int commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj);
194}
195
196/** @} */