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 info, get 25 * template info, enroll template, authenticate template, delete template, etc. 26 * 27 * @since 3.2 28 */ 29 30/** 31 * @fiPinTypes.idl 32 * 33 * @brief Defines pin auth driver enumeration and data structure, including AuthType, ExecutorRole, ExecutorSecureLevel, 34 * CommandId, ResultCode, ExecutorInfo and TemplateInfo. 35 * 36 * @since 3.2 37 */ 38package ohos.hdi.pin_auth.v1_0; 39 40/** 41 * Enumerates credential type for authentication. 42 * 43 * @since 3.2 44 * @version 1.0 45 */ 46enum AuthType : int { 47 PIN = 1, /**< Indicates authentication type is PIN. */ 48 FACE = 2, /**< Indicates authentication type is face. */ 49 FINGERPRINT = 4, /**< Indicates authentication type is fingerprint. */ 50}; 51 52/** 53 * Enumerates executor role. 54 * 55 * @since 3.2 56 * @version 1.0 57 */ 58enum ExecutorRole : int { 59 COLLECTOR = 1, /**< Indicates executor role is collector. */ 60 VERIFIER = 2, /**< Indicates executor role is verifier. */ 61 ALL_IN_ONE = 3, /**< Indicates executor role is combination of collector and verifier, cannot be used as collector or verifier. */ 62}; 63 64/** 65 * Enumerates executor secure level. 66 * 67 * @since 3.2 68 * @version 1.0 69 */ 70enum ExecutorSecureLevel : int { 71 ESL0 = 0, /**< Indicates executor secure level is ESL0. */ 72 ESL1 = 1, /**< Indicates executor secure level is ESL1. */ 73 ESL2 = 2, /**< Indicates executor secure level is ESL2. */ 74 ESL3 = 3, /**< Indicates executor secure level is ESL3. */ 75}; 76 77/** 78 * Enumerates command id. 79 * 80 * @since 3.2 81 * @version 1.0 82 */ 83enum CommandId : int { 84 DEFAULT = 0, /**< Default parameters. */ 85}; 86 87 88/** 89 * Indicates the executor info. 90 * 91 * @since 3.2 92 * @version 1.0 93 */ 94struct ExecutorInfo { 95 unsigned short sensorId; /**< Indicates sensor id. Sensor id must be unique in driver. */ 96 unsigned int executorType; /**< Indicates executor type. */ 97 enum ExecutorRole executorRole; /**< Indicates executor role, see @{ExecutorRole}. */ 98 enum AuthType authType; /**< Indicates auth type, see @{AuthType}. */ 99 enum ExecutorSecureLevel esl; /**< Indicates executor secure level, see @{ExecutorSecureLevel}. */ 100 unsigned char[] publicKey; /**< Indicates publicKey. */ 101 unsigned char[] extraInfo; /**< Indicates extra info. */ 102}; 103 104/** 105 * Indicates the template info. 106 * 107 * @since 3.2 108 * @version 1.0 109 */ 110struct TemplateInfo { 111 unsigned int executorType; /**< Indicates executor type. */ 112 int lockoutDuration; /**< Indicates lockout duration in seconds. */ 113 int remainAttempts; /**< Indicates remain attempts before a lockout. */ 114 unsigned char[] extraInfo; /**< Indicates extra info. */ 115};