• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 #ifndef OHOS_USERAUTH_COMMON_H
17 #define OHOS_USERAUTH_COMMON_H
18 
19 #include <map>
20 #include <vector>
21 
22 #include "napi/native_api.h"
23 #include "napi/native_common.h"
24 
25 #include "iam_common_defines.h"
26 
27 namespace OHOS {
28 namespace UserIam {
29 namespace UserAuth {
30 constexpr size_t ARGS_ZERO = 0;
31 constexpr size_t ARGS_ONE = 1;
32 constexpr size_t ARGS_TWO = 2;
33 constexpr size_t ARGS_THREE = 3;
34 constexpr size_t ARGS_FOUR = 4;
35 
36 constexpr size_t PARAM0 = 0;
37 constexpr size_t PARAM1 = 1;
38 constexpr size_t PARAM2 = 2;
39 constexpr size_t PARAM3 = 3;
40 
41 constexpr int32_t API_VERSION_6 = 6;
42 constexpr int32_t API_VERSION_8 = 8;
43 constexpr int32_t API_VERSION_9 = 9;
44 constexpr int32_t API_VERSION_10 = 10;
45 
46 constexpr const char *NOTICE_EVENT_AUTH_READY = "EVENT_AUTH_TYPE_READY";
47 constexpr const char *NOTICE_EVENT_CANCEL_AUTH = "EVENT_AUTH_USER_CANCEL";
48 constexpr const char *NOTICE_EVENT_USER_NAVIGATION = "EVENT_AUTH_USER_NAVIGATION";
49 
50 // For API6
51 enum class AuthenticationResult : int32_t {
52     NO_SUPPORT = -1,
53     SUCCESS = 0,
54     COMPARE_FAILURE = 1,
55     CANCELED = 2,
56     TIMEOUT = 3,
57     CAMERA_FAIL = 4,
58     BUSY = 5,
59     INVALID_PARAMETERS = 6,
60     LOCKED = 7,
61     NOT_ENROLLED = 8,
62     GENERAL_ERROR = 100,
63 };
64 
65 enum class UserAuthResultCode : int32_t {
66     OHOS_CHECK_PERMISSION_FAILED = 201,
67     OHOS_CHECK_SYSTEM_APP_FAILED = 202,
68     OHOS_INVALID_PARAM = 401,
69     RESULT_CODE_V9_MIN = 12500000,
70     RESULT_CODE_V10_MIN = 12500000,
71     SUCCESS = 12500000,
72     FAIL = 12500001,
73     GENERAL_ERROR = 12500002,
74     CANCELED = 12500003,
75     TIMEOUT = 12500004,
76     TYPE_NOT_SUPPORT = 12500005,
77     TRUST_LEVEL_NOT_SUPPORT = 12500006,
78     BUSY = 12500007,
79     LOCKED = 12500009,
80     NOT_ENROLLED = 12500010,
81     RESULT_CODE_V9_MAX = 12500010,
82     CANCELED_FROM_WIDGET = 12500011,
83     RESULT_CODE_V10_MAX = 12500011,
84 };
85 
86 enum FaceTipsCode {
87     FACE_AUTH_TIP_TOO_BRIGHT = 1,
88     FACE_AUTH_TIP_TOO_DARK = 2,
89     FACE_AUTH_TIP_TOO_CLOSE = 3,
90     FACE_AUTH_TIP_TOO_FAR = 4,
91     FACE_AUTH_TIP_TOO_HIGH = 5,
92     FACE_AUTH_TIP_TOO_LOW = 6,
93     FACE_AUTH_TIP_TOO_RIGHT = 7,
94     FACE_AUTH_TIP_TOO_LEFT = 8,
95     FACE_AUTH_TIP_TOO_MUCH_MOTION = 9,
96     FACE_AUTH_TIP_POOR_GAZE = 10,
97     FACE_AUTH_TIP_NOT_DETECTED = 11,
98     FACE_AUTH_TIP_MAX = FACE_AUTH_TIP_NOT_DETECTED,
99 };
100 
101 enum FingerprintTips {
102     FINGERPRINT_AUTH_TIP_GOOD = 0,
103     FINGERPRINT_AUTH_TIP_IMAGER_DIRTY = 1,
104     FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2,
105     FINGERPRINT_AUTH_TIP_PARTIAL = 3,
106     FINGERPRINT_AUTH_TIP_TOO_FAST = 4,
107     FINGERPRINT_AUTH_TIP_TOO_SLOW = 5,
108     FINGERPRINT_AUTH_TIP_MAX = FINGERPRINT_AUTH_TIP_TOO_SLOW,
109 };
110 } // namespace UserAuth
111 } // namespace UserIam
112 } // namespace OHOS
113 #endif /* OHOS_USERAUTH_COMMON_H */
114