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  * @file iam_executor_framework_types.h
18  *
19  * @brief Some type defines in executor framwork.
20  * @since 3.1
21  * @version 3.2
22  */
23 
24 #ifndef IAM_EXECUTOR_FRAMEWORK_TYPES_H
25 #define IAM_EXECUTOR_FRAMEWORK_TYPES_H
26 
27 #include <cstdint>
28 #include <string>
29 #include <vector>
30 
31 namespace OHOS {
32 namespace UserIam {
33 namespace UserAuth {
34 /**
35  * @brief Defines authentication result.
36  */
37 enum UserAuthResult : int32_t {
38     /** Authentication result is success. */
39     USERAUTH_SUCCESS = 0,
40     /** Authentication result is error. */
41     USERAUTH_ERROR = 1,
42 };
43 
44 /**
45  * @brief Defines Executor parameter.
46  */
47 struct ExecutorParam {
48     /** Token id. */
49     uint32_t tokenId;
50     /** Auth intention. */
51     int32_t authIntent;
52     /** Schedule id. */
53     uint64_t scheduleId;
54     /** User id. */
55     int32_t userId;
56 };
57 
58 /**
59  * @brief Defines Enroll parameter.
60  */
61 struct EnrollParam {
62     /** Token id. */
63     uint32_t tokenId;
64     /** Extra info. */
65     std::vector<uint8_t> extraInfo;
66     /** User id. */
67     int32_t userId;
68 };
69 
70 /**
71  * @brief Defines Authenticate parameter.
72  */
73 struct AuthenticateParam {
74     /** Token id. */
75     uint32_t tokenId;
76     /** Template id list. */
77     std::vector<uint64_t> templateIdList;
78     /** Extra info. */
79     std::vector<uint8_t> extraInfo;
80     /** End after first fail. */
81     bool endAfterFirstFail;
82     int32_t authIntent;
83     /** User id. */
84     int32_t userId;
85 };
86 
87 /**
88  * @brief Defines Collect parameter.
89  */
90 struct CollectParam {
91     /** Token id. */
92     uint32_t tokenId;
93     /** Collector Token id. */
94     uint32_t collectorTokenId;
95     /** Extra info. */
96     std::vector<uint8_t> extraInfo;
97 };
98 
99 /**
100  * @brief Defines Identify parameter.
101  */
102 struct IdentifyParam {
103     /** Token id. */
104     uint32_t tokenId;
105     /** Extra info. */
106     std::vector<uint8_t> extraInfo;
107 };
108 
109 /**
110  * @brief Defines Property.
111  */
112 struct Property {
113     /** Auth sub type. */
114     uint64_t authSubType;
115     /** Lockout duration. */
116     int lockoutDuration;
117     /** Remain attempts. */
118     int remainAttempts;
119     /** Enroll progress. */
120     std::string enrollmentProgress;
121     /** Sensor info. */
122     std::string sensorInfo;
123     /** Next fail lockout duration. */
124     int32_t nextFailLockoutDuration;
125 };
126 
127 } // namespace UserAuth
128 } // namespace UserIam
129 } // namespace OHOS
130 
131 #endif // IAM_EXECUTOR_FRAMEWORK_TYPES_H
132