• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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
16package OHOS.UserIam.UserAuth;
17
18/**
19 * @brief Remote auth parameter.
20 */
21struct IpcRemoteAuthParam {
22    /** Is with remote auth parameter */
23    boolean isHasRemoteAuthParam;
24    /** Is with verifier network id */
25    boolean isHasVerifierNetworkId;
26    /** verifier network id */
27    String verifierNetworkId;
28    /** Is with collector network id */
29    boolean isHasCollectorNetworkId;
30    /** collector network id */
31    String collectorNetworkId;
32    /** Is with collector token id  */
33    boolean isHasCollectorTokenId;
34    /** collector token id */
35    unsigned int collectorTokenId;
36};
37
38/**
39 * @brief Reuse unlock authentication result.
40 */
41struct IpcReuseUnlockResult {
42    /** Whether to reuse unlock result, ReuseUnlockResult is valid only when isReuse is true.*/
43    boolean isReuse;
44    /** The mode for reusing unlock authentication result. */
45    int reuseMode;
46    /** The allowable reuse duration.The value of duration should be between 0 and MAX_ALLOWABLE_REUSE_DURATION. */
47    unsigned long reuseDuration;
48};
49
50/**
51 * @brief Global config value.
52 */
53struct IpcGlobalConfigValue {
54    /** Global config value of pin expired period.It's value should between 0 and 2^50.
55      * When pinExpiredPeriod <= 0, userAuth won't check pin expired period. */
56    unsigned long pinExpiredPeriod;
57    /** Enable specified authType capability. */
58    boolean enableStatus;
59};
60
61/**
62 * @brief Global config param.
63 */
64struct IpcGlobalConfigParam {
65    /** Global config type. */
66    int type;
67    /** Global config value. */
68    IpcGlobalConfigValue value;
69    /** Specified userIds. GlobalConfigParam will be effect for all userspaces when the array is empty. */
70    int[] userIds;
71    /** Specified authTypes. Should not empty. */
72    int[] authTypes;
73};
74
75/**
76 * @brief Define credential enrollment information.
77 */
78struct IpcEnrolledInfo {
79    /** Auth type supported by executor. */
80    int authType;
81    /** Enrolled ID. */
82    unsigned long enrolledId;
83};
84
85struct IpcExecutorRegisterInfo {
86    /** Auth type supported by executor. */
87    int authType;
88    /** Role supported by executor. */
89    int executorRole;
90    /** Multiple sensors index by executor. */
91    unsigned int executorSensorHint;
92    /** Matcher supported by executor. */
93    unsigned int executorMatcher;
94    /** Esl supported by executor. */
95    int esl;
96    /** Max Acl supported by executor. */
97    unsigned int maxTemplateAcl;
98    /** The pubKey of executor. */
99    unsigned char[] publicKey;
100    /** Device udid of executor. */
101    String deviceUdid;
102    /** The information of remote executor. */
103    unsigned char[] signedRemoteExecutorInfo;
104};
105
106/**
107 * @brief Auth parameter.
108 */
109struct IpcAuthParamInner {
110    /** user id */
111    int userId;
112    /** is userId specified */
113    boolean isUserIdSpecified;
114    /** challenge value */
115    unsigned char[] challenge;
116    /** Credential type for authentication. */
117    int authType;
118    /** Credential type for authentication. */
119    int[] authTypes;
120    /** Trust level of authentication result. */
121    int authTrustLevel;
122    /** Reuse unlock authentication result. */
123    IpcReuseUnlockResult reuseUnlockResult;
124    /** Auth intention. */
125    int authIntent;
126    /** Skip locked biometric authentication */
127    boolean skipLockedBiometricAuth;
128};
129
130/**
131 * @brief EnrolledId digest and credential count.
132 */
133struct IpcEnrolledState {
134    /** The credential digest. */
135    unsigned long credentialDigest;
136    /** The credential count */
137    unsigned short credentialCount;
138};
139
140/**
141 * @brief Auth widget parameter.
142 */
143struct IpcWidgetParamInner {
144    /** Title of widget. */
145    String title;
146    /** The description text of navigation button. */
147    String navigationButtonText;
148    /** Full screen or not. */
149    int windowMode;
150    /** Default has't context. */
151    boolean hasContext;
152};
153
154/**
155 * @brief credential parameter.
156 */
157struct IpcCredentialPara {
158    /** Credential type for authentication. */
159    int authType;
160    /* Auth subtype of PIN. */
161    int pinType;
162    /** Auth token. */
163    unsigned char[] token;
164};
165
166/**
167 * @brief User credential infomation returned.
168 */
169struct IpcCredentialInfo {
170    /* Auth type supported by executor. */
171    int authType;
172    /* Auth subtype of PIN. */
173    int pinType;
174    /* User credentialId is generated by idm to associate userId and templateId. */
175    unsigned long credentialId;
176    /* User templateId is generated by executor to represent user characteristics. */
177    unsigned long templateId;
178    /* Abandoned flag of pin credential. */
179    boolean isAbandoned;
180    /* Valid period of credential remain. */
181    long validityPeriod;
182};
183
184/**
185 * @brief Define security user information.
186 */
187struct IpcSecUserInfo {
188    /** Security user ID. */
189    unsigned long secureUid;
190    /** The user credential enrollment infomation. */
191    IpcEnrolledInfo[] enrolledInfo;
192};
193
194/**
195 * @brief Cred change info for notify event.
196 */
197struct IpcCredChangeEventInfo {
198    /** The callerName who make cred change. */
199    String callerName;
200    /** The callerType who make cred change. */
201    int callerType;
202    /** New credentialId when ADD_CRED or UPDATE_CRED. */
203    unsigned long credentialId;
204    /** Deleted credentialId when DEL_CRED or UPDATE_CRED. */
205    unsigned long lastCredentialId;
206    /** Is silent cred change. */
207    boolean isSilentCredChange;
208};