From f735cbb867dc82e4495836b41850494fbcd0b3b0 Mon Sep 17 00:00:00 2001 From: mtf Date: Mon, 25 Apr 2022 14:51:38 +0800 Subject: [PATCH] update idl interface Signed-off-by: mtf Change-Id: Ifaa1c5f5e84df3b58e2c752f285648f0db3deb44 --- pinauth/v1_0/BUILD.gn | 41 ++++++++ pinauth/v1_0/IExecutor.idl | 161 +++++++++++++++++++++++++++++ pinauth/v1_0/IExecutorCallback.idl | 78 ++++++++++++++ pinauth/v1_0/IInputterCallback.idl | 20 ++++ pinauth/v1_0/IPinAuthInterface.idl | 51 +++++++++ pinauth/v1_0/Types.idl | 154 +++++++++++++++++++++++++++ 6 files changed, 505 insertions(+) create mode 100644 pinauth/v1_0/BUILD.gn create mode 100644 pinauth/v1_0/IExecutor.idl create mode 100644 pinauth/v1_0/IExecutorCallback.idl create mode 100644 pinauth/v1_0/IInputterCallback.idl create mode 100644 pinauth/v1_0/IPinAuthInterface.idl create mode 100644 pinauth/v1_0/Types.idl diff --git a/pinauth/v1_0/BUILD.gn b/pinauth/v1_0/BUILD.gn new file mode 100644 index 00000000..05faee3c --- /dev/null +++ b/pinauth/v1_0/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +<<<<<<< Updated upstream +import("//drivers/adapter/uhdf2/hdi.gni") # 编译idl必须要导入的模板 +hdi("pinauth") { # 目标名称,会生成两个so: libfoo_[proxy/stub]_1.0.z.so + module_name = "pinauth" # module_name匹配dirver文件中驱动描述符(HdfDriverEntry)的moduleName + sources = [ # 参与编译的idl文件 +======= +import("//drivers/adapter/uhdf2/hdi.gni") +hdi("pinauth") { + module_name = "pinauth" + sources = [ +>>>>>>> Stashed changes + "IExecutor.idl", + "IExecutorCallback.idl", + "Types.idl", + "IPinAuthInterface.idl", +<<<<<<< Updated upstream + "IInputterCallback.idl" + ] + language = "cpp" # 控制idl生成c或c++代码 可选择`c`或`cpp` + subsystem_name = "hdf" # 子系统,统一填写“hdf” + part_name = "hdf_device_driver" # 部件名,如果不属于已有部件,则需要定义新的部件 +======= + ] + language = "cpp" + subsystem_name = "hdf" + part_name = "pinauth_device_driver" +>>>>>>> Stashed changes +} \ No newline at end of file diff --git a/pinauth/v1_0/IExecutor.idl b/pinauth/v1_0/IExecutor.idl new file mode 100644 index 00000000..c5c5c6a9 --- /dev/null +++ b/pinauth/v1_0/IExecutor.idl @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 3.2 + */ + +/** + * @file IExecutor.idl + * + * @brief Defines the APIs of executor. These APIs can be used to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 3.2 + */ + +package ohos.hdi.pinauth.v1_0; + +import ohos.hdi.pinauth.v1_0.Types; +import ohos.hdi.pinauth.v1_0.IExecutorCallback; + +/** + * @brief Defines the APIs of executor. These APIs can be used to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 3.2 + * @version 1.0 + */ + +interface IExecutor { + /** + * @brief Get executor info. + * + * @param info Indicates executor info, see {@link ExecutorInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + GetExecutorInfo([out] struct ExecutorInfo info); + /** + * @brief Get template info. + * + * @param templateId Indicates template id. + * @param info Indicates template info, see {@link TemplateInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + GetTemplateInfo([in] unsigned long templateId, [out] struct TemplateInfo info); + /** + * @brief Send parameters to driver when executor register finish. + * + * @param templateIdList Indicates templates previously registered to userauth framework. + * @param frameworkPublicKey Indicates framework public key. + * @param extraInfo Indicates extra info send to executor. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + OnRegisterFinish([in] unsigned long [] templateIdList, [in] unsigned char[] frameworkPublicKey, [in] unsigned char[] extraInfo); + /** +<<<<<<< Updated upstream +======= + * @brief Send parameters to driver when executor register finish. + * + * @param scheduleId Indicates schedule id of enroll. + * @param authSubType . + * @param data . + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + OnSetData([in] unsigned long scheduleId, [in] unsigned long authSubType, [in] unsigned char[] data); + /** +>>>>>>> Stashed changes + * @brief Enroll template. + * + * @param scheduleId Indicates schedule id of enroll. + * @param extraInfo Indicates extra info of enroll. + * @param callbackObj Indicates enroll callback object, see {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + Enroll([in] unsigned long scheduleId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Authenticate template. + * + * @param scheduleId Indicates schedule id of authenticate. +<<<<<<< Updated upstream + * @param templateIdList Indicates the templates to authenticate. +======= + * @param templateId Indicates the template to authenticate. +>>>>>>> Stashed changes + * @param extraInfo Indicates extra info of authenticate. + * @param callbackObj Indicates authenticate callback object, see {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + Authenticate([in] unsigned long scheduleId, [in] unsigned long templateId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); + /** + * @brief Delete templates. + * +<<<<<<< Updated upstream + * @param templateIdList Indicates the templates to delete. +======= + * @param templateId Indicates the template to delete. +>>>>>>> Stashed changes + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ +<<<<<<< Updated upstream + Delete([in] unsigned long [] templateIdList); +======= + Delete([in] unsigned long templateId); +>>>>>>> Stashed changes + /** + * @brief Cancel enroll, authenticate or identify operation. + * + * @param scheduleId Indicates schedule id of operation to cancel. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + Cancel([in] unsigned long scheduleId); + /** + * @brief Send command to driver. + * + * @param commandId Indicates command id. For details, see {@link CommandId}. + * @param extraInfo Indicates extra info of command. + * @param callbackObj Indicates command callback object, see {@link IExecutorCallback}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + SendCommand([in] enum CommandId commandId, [in] unsigned char[] extraInfo, [in] IExecutorCallback callbackObj); +} diff --git a/pinauth/v1_0/IExecutorCallback.idl b/pinauth/v1_0/IExecutorCallback.idl new file mode 100644 index 00000000..7a188d64 --- /dev/null +++ b/pinauth/v1_0/IExecutorCallback.idl @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 3.2 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief Defines the callback for async API. These callback can be used to report operation result or info + * of async API. + * + * @since 3.2 + */ + +package ohos.hdi.pinauth.v1_0; + +<<<<<<< Updated upstream +import ohos.hdi.pinauth.v1_0.IInputterCallback; + +======= +>>>>>>> Stashed changes +[callback] interface IExecutorCallback { + /** + * @brief Defines the function for reporting operation result. + * + * @param code Indicates acquire info code, see {@link ResultCode}. + * @param extraInfo Indicates extra info to report. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ + OnResult([in] int code, [in] unsigned char[] extraInfo); + /** + * @brief defines the function for reporting info in process. + * +<<<<<<< Updated upstream + * tianshi: need discuss on acquire info -- Tip code ?? + * @param salt Indicates acquire info code, see {@link FaceTipsCode}. + * @param authSubType Indicates extra info to report. + * @param callbackObj Callback to retrieve the corresponding information to report, see {@link IInputterCallback}. +======= + * @param salt Indicates acquire info code, see {@link FaceTipsCode}. + * @param authSubType Indicates extra info to report. +>>>>>>> Stashed changes + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + */ +<<<<<<< Updated upstream + OnGetData([in] unsigned char[] salt, [in] unsigned long authSubType, [in] IInputterCallback callbackObj); +======= + OnGetData([in] unsigned long scheduleId, [in] unsigned char[] salt, [in] unsigned long authSubType); +>>>>>>> Stashed changes +} \ No newline at end of file diff --git a/pinauth/v1_0/IInputterCallback.idl b/pinauth/v1_0/IInputterCallback.idl new file mode 100644 index 00000000..3178149e --- /dev/null +++ b/pinauth/v1_0/IInputterCallback.idl @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.pinauth.v1_0; + +[callback] interface IInputterCallback { + OnSetData([in] unsigned long authSubType, [in] unsigned char[] data); +} \ No newline at end of file diff --git a/pinauth/v1_0/IPinAuthInterface.idl b/pinauth/v1_0/IPinAuthInterface.idl new file mode 100644 index 00000000..a9b4c6a1 --- /dev/null +++ b/pinauth/v1_0/IPinAuthInterface.idl @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 3.2 + */ + +/** + * @file IExecutorCallback.idl + * + * @brief Defines the callback for async API. These callback can be used to report operation result or info + * of async API. + * + * @since 3.2 + */ + +package ohos.hdi.pinauth.v1_0; + +import ohos.hdi.pinauth.v1_0.IExecutor; + +/** + * @brief Defines the get executor list API of the pin auth driver. + * + * @since 3.2 + * @version 1.0 + */ +interface IPinAuthInterface { + GetExecutorList([out] IExecutor [] executorList); +} \ No newline at end of file diff --git a/pinauth/v1_0/Types.idl b/pinauth/v1_0/Types.idl new file mode 100644 index 00000000..3ee43db1 --- /dev/null +++ b/pinauth/v1_0/Types.idl @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdfPinAuth + * @{ + * + * @brief Provides APIs for the pin auth driver. + * + * The pin auth driver provides a unified interface for the pin auth service to access the pin auth driver. + * After obtaining the pin auth driver proxy, the service can call related APIs to obtain executors. + * After obtaining the pin auth executors, the service can call related APIs to get executor info, get + * template info, enroll template, authenticate template, delete template, etc. + * + * @since 3.2 + */ + +/** + * @fiPinTypes.idl + * + * @brief Defines pin auth driver enumeration and data structure, including AuthType, ExecutorRole, ExecutorSecureLevel, + * CommandId, ResultCode, ExecutorInfo and TemplateInfo. + * + * @since 3.2 + */ +package ohos.hdi.pinauth.v1_0; + +/** + * Enumerates credential type for authentication. + * + * @since 3.2 + * @version 1.0 + */ +enum AuthType : unsigned int { + PIN = 1, /**< Indicates authentication type is PIN. */ + FACE = 2, /**< Indicates authentication type is face. */ + FINGERPRINT = 3, /**< Indicates authentication type is fingerprint. */ +}; + +/** + * Enumerates executor role. + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorRole : unsigned int { + COLLECTOR = 1, /**< Indicates executor role is collector. */ + VERIFIER = 2, /**< Indicates executor role is verifier. */ + ALL_IN_ONE = 3, /**< Indicates executor role is collector and verifier. */ +}; + +/** + * Enumerates executor secure level. + * + * @since 3.2 + * @version 1.0 + */ +enum ExecutorSecureLevel : unsigned int { + ESL0 = 0, /**< Indicates executor secure level is ESL0. */ + ESL1 = 1, /**< Indicates executor secure level is ESL1. */ + ESL2 = 2, /**< Indicates executor secure level is ESL2. */ + ESL3 = 3, /**< Indicates executor secure level is ESL3. */ +}; + +<<<<<<< Updated upstream +enum CommandId : unsigned int { + ENROLL = 0, + AUTH, + DELETE, + QUERY = 10000 +}; + + +======= +/** + * Enumerates command id. + * + * @since 3.2 + * @version 1.0 + */ +enum CommandId : unsigned int { + DEFAULT = 0, +}; + +>>>>>>> Stashed changes +/** + * Enumerates operation result. + * + * @since 3.2 + * @version 1.0 + */ +enum ResultCode : unsigned int { + SUCCESS = 0, /**< Indicates the operation is success or ability is supported. */ + FAIL = 1, /**< Indicates the operation is fail. */ + GENERAL_ERROR = 2, /**< Indicates other errors happened during the operation. */ + CANCELED = 3, /**< Indicates that operation has been canceled. */ + TIMEOUT = 4, /**< Indicates that operation is timed out. */ + TYPE_NOT_SUPPORT = 5, /**< Indicates that auth type is not supported. */ + TRUST_LEVEL_NOT_SUPPORT = 6, /**< Indicates that trust level is not supported. */ + BUSY = 7, /**< Indicates that the executor is busy. */ + INVALID_PARAMETERS = 8, /**< Indicates that the parameters are invalid. */ + LOCKED = 9, /**< Indicates that the executor is locked. */ + NOT_ENROLLED = 10, /**< Indicates that the user has not enrolled credential for the executor. */ + OPERATION_NOT_SUPPORT = 21, /**< Indicates that the executor does not support this operation. */ + FRAMEWORK_RESULT_CODE_MAX, /**< Indicates Indicates the max result code for framework. */ + VENDOR_RESULT_CODE_BEGIN = 10000, /**< Vendor may add custom result code after this. */ +}; + +/** + * Indicates the executor info. + * + * @since 3.2 + * @version 1.0 + */ +struct ExecutorInfo { + unsigned int sensorId; /**< Indicates sensor id. Sensor id must be unique in driver. */ + unsigned int executorType; /**< Indicates executor type. */ + enum ExecutorRole executorRole; /**< Indicates executor role, see @{ExecutorRole}. */ + enum AuthType authType; /**< Indicates auth type, see @{AuthType}. */ + enum ExecutorSecureLevel esl; /**< Indicates executor secure level, see @{ExecutorSecureLevel}. */ + unsigned char[] publicKey; /**< Indicates publicKey. */ + unsigned char[] extraInfo; /**< Indicates extra info. */ +}; + +/** + * Indicates the template info. + * + * @since 3.2 + * @version 1.0 + */ +struct TemplateInfo { +<<<<<<< Updated upstream + unsigned long authSubType; /**< Subtype of PIN authentication. */ + unsigned int freezingTime; /**< Pin authentication current freezing time. */ + unsigned int remainTimes; /**< Pin Number of remaining authentication times. */ +======= + unsigned int executorType; /**< executorType of PIN authentication. */ + unsigned int freezingTime; /**< Pin authentication current freezing time. */ + unsigned int remainTimes; /**< Pin Number of remaining authentication times. */ + unsigned char[] extraInfo; /**< Indicates extra info. */ +>>>>>>> Stashed changes +}; \ No newline at end of file -- Gitee