• 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 #ifndef COAUTH_INFO_DEFINE_H
17 #define COAUTH_INFO_DEFINE_H
18 
19 #include "parcel.h"
20 
21 namespace OHOS {
22 namespace UserIAM {
23 /* enums define */
24 enum AuthAttributeType {
25     /* Root tag */
26     AUTH_ROOT = 100000,
27     /* Result code */
28     AUTH_RESULT_CODE = 100001,
29     /* Tag of signature data in TLV */
30     AUTH_SIGNATURE = 100004,
31     /* Identify mode */
32     AUTH_IDENTIFY_MODE = 100005,
33     /* Tag of templateId data in TLV */
34     AUTH_TEMPLATE_ID = 100006,
35     /* Tag of templateId list data in TLV */
36     AUTH_TEMPLATE_ID_LIST = 100007,
37     /* Expected attribute, tag of remain count in TLV */
38     AUTH_REMAIN_COUNT = 100009,
39     /* Remain time */
40     AUTH_REMAIN_TIME = 100010,
41     /* Session id, required when decode in C */
42     AUTH_SCHEDULE_ID = 100014,
43     /* Package name */
44     AUTH_CALLER_NAME = 100015,
45     /* Schedule version */
46     AUTH_SCHEDULE_VERSION = 100016,
47     /* Tag of lock out template in TLV */
48     AUTH_LOCK_OUT_TEMPLATE = 100018,
49     /* Tag of unlock template in TLV */
50     AUTH_UNLOCK_TEMPLATE = 100019,
51     /* Tag of data */
52     AUTH_DATA = 100020,
53     /* Tag of auth subType */
54     AUTH_SUBTYPE = 100021,
55     /* Tag of auth schedule mode */
56     AUTH_SCHEDULE_MODE = 100022,
57     /* Tag of property */
58     AUTH_PROPERTY_MODE = 100023,
59     /* Tag of auth type */
60     AUTH_TYPE = 100024,
61     /* Tag of cred id */
62     AUTH_CREDENTIAL_ID = 100025,
63     /* Controller */
64     AUTH_CONTROLLER = 100026,
65     /* calleruid */
66     AUTH_CALLER_UID = 100027,
67     /* result */
68     AUTH_RESULT = 100028,
69     /* capability level */
70     AUTH_CAPABILITY_LEVEL = 100029,
71     /* algorithm setinfo */
72     ALGORITHM_INFO
73 };
74 
75 enum AuthType {
76     /* Authentication type pin */
77     PIN = 1,
78     /* Authentication type face */
79     FACE = 2
80 };
81 
82 enum AuthAbility {
83     /* Executor authentication ability six number pin */
84     PIN_SIX = 1,
85     /* Executor authentication ability self defined number pin */
86     PIN_NUMBER = 2,
87     /* Executor authentication ability mixed pin */
88     PIN_MIXED = 4,
89     /* Executor authentication ability 2D face */
90     FACE_2D = 1,
91     /* Executor authentication ability 3D face */
92     FACE_3D = 2
93 };
94 
95 /* Safety level of actuator */
96 enum ExecutorSecureLevel {
97     /* Executor without access control */
98     ESL0 = 0,
99     /* Executor with access control */
100     ESL1 = 1,
101     /* Executor in secure hardware */
102     ESL2 = 2,
103     /* Executor in high secure hardware */
104     ESL3 = 3
105 };
106 
107 enum ExecutorType {
108     /* Type of coauth */
109     TYPE_CO_AUTH = 0,
110     /* Type of executor collector */
111     TYPE_COLLECTOR = 1,
112     /* Type of executor verifier */
113     TYPE_VERIFIER = 2,
114     /* Type of executor all in one */
115     TYPE_ALL_IN_ONE = 3
116 };
117 
118 enum ResultCode {
119     /**
120      * Indicates that authentication is success or ability is supported.
121      */
122     SUCCESS = 0,
123     /**
124      * Indicates the authenticator fails to identify user.
125      */
126     FAIL = 1,
127     /**
128      * Indicates other errors.
129      */
130     GENERAL_ERROR = 2,
131     /**
132      * Indicates that authentication has been canceled.
133      */
134     CANCELED = 3,
135     /**
136      * Indicates that authentication has timed out.
137      */
138     TIMEOUT = 4,
139     /**
140      * Indicates that this authentication type is not supported.
141      */
142     TYPE_NOT_SUPPORT = 5,
143     /**
144      * Indicates that the authentication trust level is not supported.
145      */
146     TRUST_LEVEL_NOT_SUPPORT = 6,
147     /**
148      * Indicates that the authentication task is busy. Wait for a few seconds and try again.
149      */
150     BUSY = 7,
151     /**
152      * Indicates incorrect parameters.
153      */
154     INVALID_PARAMETERS = 8,
155     /**
156      * Indicates that the authenticator is locked.
157      */
158     LOCKED = 9,
159     /**
160      * Indicates that the user has not enrolled the authenticator.
161      */
162     NOT_ENROLLED = 10
163 };
164 
165 const uint64_t INVALID_EXECUTOR_ID = 0;
166 } // namespace UserIAM
167 } // namespace OHOS
168 #endif // COAUTH_INFO_DEFINE_H
169