• 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 USERIDM_INFO_H
17 #define USERIDM_INFO_H
18 
19 #include <vector>
20 #include <cstdint>
21 
22 namespace OHOS {
23 namespace UserIAM {
24 namespace UserIDM {
25 enum CoAuthType {
26     ADD_PIN_CRED = 0,
27     MODIFY_CRED,
28     ADD_FACE_CRED,
29 };
30 
31 enum AuthType {
32     /**
33      * Authentication type all.
34      */
35     ALL = 0,
36     /**
37      * Authentication type pin.
38      */
39     PIN = 1,
40     /**
41      * Authentication type face.
42      */
43     FACE = 2,
44 };
45 
46 enum AuthSubType {
47     /**
48      * Authentication sub type six number pin.
49      */
50     PIN_SIX = 10000,
51     /**
52      * Authentication sub type self defined number pin.
53      */
54     PIN_NUMBER = 10001,
55     /**
56      * Authentication sub type mixed pin.
57      */
58     PIN_MIXED = 10002,
59     /**
60      * Authentication sub type 2D face.
61      */
62     FACE_2D = 20000,
63     /**
64      * Authentication sub type 3D face.
65      */
66     FACE_3D = 20001,
67 };
68 
69 enum IDMResultCode {
70     SUCCESS = 0,
71     FAIL = 1,
72     GENERAL_ERROR = 2,
73     CANCELED = 3,
74     TIMEOUT = 4,
75     TYPE_NOT_SUPPORT = 5,
76     TRUST_LEVEL_NOT_SUPPORT = 6,
77     BUSY = 7,
78     INVALID_PARAMETERS = 8,
79     LOCKED = 9,
80     NOT_ENROLLED = 10,
81     CHECK_PERMISSION_FAILED = 11,
82 };
83 
84 struct CredentialInfo {
85     uint64_t credentialId;
86     AuthType authType;
87     AuthSubType authSubType;
88     uint64_t templateId;
89 };
90 
91 struct EnrolledCredInfo {
92     uint64_t credentialId;
93     AuthType authType;
94     AuthSubType authSubType;
95     uint64_t templateId;
96 };
97 
98 struct EnrolledInfo {
99     AuthType authType;
100     uint64_t enrolledId;
101 };
102 
103 struct SecInfo {
104     uint64_t secureUid;
105     uint32_t enrolledInfoLen;
106     std::vector<EnrolledInfo> enrolledInfo;
107 };
108 
109 struct AddCredInfo {
110     AuthType authType;
111     AuthSubType authSubType;
112     std::vector<uint8_t> token;
113 };
114 
115 struct  RequestResult {
116     uint64_t credentialId;
117 };
118 }  // namespace UserIDM
119 }  // namespace UserIAM
120 }  // namespace OHOS
121 
122 #endif // USERIDM_INFO_H
123