• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 HdfFaceAuth
18 * @{
19 *
20 * @brief Provides APIs for the face auth driver.
21 *
22 * The face auth driver provides a unified interface for the face auth service to access the face auth driver.
23 * After obtaining the face auth driver proxy, the service can call related APIs to obtain executors.
24 * After obtaining the face 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 * @file FaceAuthTypes.idl
32 *
33 * @brief Defines face auth driver enumeration and data structure, including AuthType, ExecutorRole, ExecutorSecureLevel,
34 * CommandId, FaceTipsCode, ExecutorInfo and TemplateInfo.
35 *
36 * @since 3.2
37 */
38
39package ohos.hdi.face_auth.v1_0;
40
41/**
42 * Enumerates credential type for authentication.
43 *
44 * @since 3.2
45 * @version 1.0
46 */
47enum AuthType : int {
48    PIN = 1, /**< Indicates authentication type is PIN. */
49    FACE = 2, /**< Indicates authentication type is face. */
50    FINGERPRINT = 4, /**< Indicates authentication type is fingerprint. */
51};
52
53/**
54 * Enumerates executor role.
55 *
56 * @since 3.2
57 * @version 1.0
58 */
59enum ExecutorRole : int {
60    COLLECTOR = 1, /**< Indicates executor role is collector. */
61    VERIFIER = 2, /**< Indicates executor role is verifier. */
62    ALL_IN_ONE = 3, /**< Indicates executor role is combination of collector and verifier, cannot be used as collector or verifier. */
63};
64
65/**
66 * Enumerates executor secure level.
67 *
68 * @since 3.2
69 * @version 1.0
70 */
71enum ExecutorSecureLevel : int {
72    ESL0 = 0, /**< Indicates executor secure level is ESL0. */
73    ESL1 = 1, /**< Indicates executor secure level is ESL1. */
74    ESL2 = 2, /**< Indicates executor secure level is ESL2. */
75    ESL3 = 3, /**< Indicates executor secure level is ESL3. */
76};
77
78/**
79 * Enumerates command id.
80 *
81 * @since 3.2
82 * @version 1.0
83 */
84enum CommandId : int {
85    LOCK_TEMPLATE = 1, /**< Indicates lock template command id. */
86    UNLOCK_TEMPLATE = 2, /**< Indicates unlock template command id. */
87    VENDOR_COMMAND_BEGIN = 10000 /**< Vendor may add custom command id after this. */
88};
89
90/**
91 * Enumerates prompt codes.
92 *
93 * @since 3.2
94 * @version 1.0
95 */
96enum FaceTipsCode : int {
97    FACE_AUTH_TIP_TOO_BRIGHT = 1, /**< Indicates that the obtained facial image is too bright due to high illumination. */
98    FACE_AUTH_TIP_TOO_DARK = 2, /**< Indicates that the obtained facial image is too dark due to low illumination. */
99    FACE_AUTH_TIP_TOO_CLOSE = 3, /**< Indicates that the face is too close to the device. */
100    FACE_AUTH_TIP_TOO_FAR = 4, /**< Indicates that the face is too far away from the device. */
101    FACE_AUTH_TIP_TOO_HIGH = 5, /**< Indicates that the device is too high, and that only the upper part of the face is captured. */
102    FACE_AUTH_TIP_TOO_LOW = 6, /**< Indicates that the device is too low, and that only the lower part of the face is captured. */
103    FACE_AUTH_TIP_TOO_RIGHT = 7, /**< Indicates that the device is deviated to the right, and that only the right part of the face is captured. */
104    FACE_AUTH_TIP_TOO_LEFT = 8, /**< Indicates that the device is deviated to the left, and that only the left part of the face is captured. */
105    FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, /**< Indicates that the face moves too much during facial information collection. */
106    FACE_AUTH_TIP_POOR_GAZE = 10, /**< Indicates the user is not gazing at the device. */
107    FACE_AUTH_TIP_NOT_DETECTED = 11, /**< Indicates that no face is detected. */
108    VENDOR_FACE_AUTH_TIP_BEGIN = 10000 /**< Vendor may add custom face auth tip after this. */
109};
110
111/**
112 * Indicates the executor info.
113 *
114 * @since 3.2
115 * @version 1.0
116 */
117struct ExecutorInfo {
118    unsigned short sensorId; /**< Indicates sensor id. Sensor id must be unique in driver. */
119    unsigned int executorType; /**< Indicates executor type. */
120    enum ExecutorRole executorRole; /**< Indicates executor role, see @{ExecutorRole}. */
121    enum AuthType authType; /**< Indicates auth type, see @{AuthType}. */
122    enum ExecutorSecureLevel esl; /**< Indicates executor secure level, see @{ExecutorSecureLevel}. */
123    unsigned char[] publicKey; /**< Indicates publicKey. */
124    unsigned char[] extraInfo; /**< Indicates extra info. */
125};
126
127/**
128 * Indicates the template info.
129 *
130 * @since 3.2
131 * @version 1.0
132 */
133struct TemplateInfo {
134    unsigned int executorType; /**< Indicates executor type. */
135    int lockoutDuration; /**< Indicates lockout duration in seconds. */
136    int remainAttempts; /**< Indicates remain attempts before a lockout. */
137    unsigned char[] extraInfo; /**< Indicates extra info. */
138};