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 #include "napi_account_iam_constant.h"
17 
18 #include "account_log_wrapper.h"
19 #include "napi_account_iam_common.h"
20 
21 namespace OHOS {
22 namespace AccountJsKit {
23 using namespace OHOS::AccountSA;
24 
AuthTypeConstructor(napi_env env)25 napi_value AuthTypeConstructor(napi_env env)
26 {
27     napi_value authType = nullptr;
28     napi_value pin = nullptr;
29     napi_value face = nullptr;
30     napi_value fingerPrint = nullptr;
31     napi_value recoveryKey = nullptr;
32     napi_value privatePin  = nullptr;
33     napi_value domain = nullptr;
34     NAPI_CALL(env, napi_create_object(env, &authType));
35     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthType::PIN), &pin));
36     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthType::FACE), &face));
37     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthType::FINGERPRINT), &fingerPrint));
38     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthType::RECOVERY_KEY), &recoveryKey));
39     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthType::PRIVATE_PIN), &privatePin));
40     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(IAMAuthType::DOMAIN), &domain));
41     NAPI_CALL(env, napi_set_named_property(env, authType, "PIN", pin));
42     NAPI_CALL(env, napi_set_named_property(env, authType, "FACE", face));
43     NAPI_CALL(env, napi_set_named_property(env, authType, "FINGERPRINT", fingerPrint));
44     NAPI_CALL(env, napi_set_named_property(env, authType, "RECOVERY_KEY", recoveryKey));
45     NAPI_CALL(env, napi_set_named_property(env, authType, "PRIVATE_PIN", privatePin));
46     NAPI_CALL(env, napi_set_named_property(env, authType, "DOMAIN", domain));
47     return authType;
48 }
49 
AuthSubTypeConstructor(napi_env env)50 napi_value AuthSubTypeConstructor(napi_env env)
51 {
52     napi_value authSubType = nullptr;
53     napi_value pinSix = nullptr;
54     napi_value pinNumber = nullptr;
55     napi_value pinMixed = nullptr;
56     napi_value pinFour = nullptr;
57     napi_value pinPattern = nullptr;
58     napi_value face2d = nullptr;
59     napi_value face3d = nullptr;
60     napi_value fingerprintCapacitive = nullptr;
61     napi_value fingerprintOptical = nullptr;
62     napi_value fingerprintUltrasonic = nullptr;
63     napi_value pinQuestion  = nullptr;
64     napi_value domainMixed = nullptr;
65     NAPI_CALL(env, napi_create_object(env, &authSubType));
66     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(PinSubType::PIN_SIX), &pinSix));
67     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(PinSubType::PIN_NUMBER), &pinNumber));
68     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(PinSubType::PIN_MIXED), &pinMixed));
69     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(PinSubType::PIN_FOUR), &pinFour));
70     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(PinSubType::PIN_PATTERN), &pinPattern));
71     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(FACE_2D), &face2d));
72     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(FACE_3D), &face3d));
73     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(FINGERPRINT_CAPACITIVE), &fingerprintCapacitive));
74     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(FINGERPRINT_OPTICAL), &fingerprintOptical));
75     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(FINGERPRINT_ULTRASONIC), &fingerprintUltrasonic));
76     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(PinSubType::PIN_QUESTION), &pinQuestion));
77     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(IAMAuthSubType::DOMAIN_MIXED), &domainMixed));
78     NAPI_CALL(env, napi_set_named_property(env, authSubType, "PIN_SIX", pinSix));
79     NAPI_CALL(env, napi_set_named_property(env, authSubType, "PIN_NUMBER", pinNumber));
80     NAPI_CALL(env, napi_set_named_property(env, authSubType, "PIN_MIXED", pinMixed));
81     NAPI_CALL(env, napi_set_named_property(env, authSubType, "PIN_FOUR", pinFour));
82     NAPI_CALL(env, napi_set_named_property(env, authSubType, "PIN_PATTERN", pinPattern));
83     NAPI_CALL(env, napi_set_named_property(env, authSubType, "FACE_2D", face2d));
84     NAPI_CALL(env, napi_set_named_property(env, authSubType, "FACE_3D", face3d));
85     NAPI_CALL(env, napi_set_named_property(env, authSubType, "FINGERPRINT_CAPACITIVE", fingerprintCapacitive));
86     NAPI_CALL(env, napi_set_named_property(env, authSubType, "FINGERPRINT_OPTICAL", fingerprintOptical));
87     NAPI_CALL(env, napi_set_named_property(env, authSubType, "FINGERPRINT_ULTRASONIC", fingerprintUltrasonic));
88     NAPI_CALL(env, napi_set_named_property(env, authSubType, "PIN_QUESTION", pinQuestion));
89     NAPI_CALL(env, napi_set_named_property(env, authSubType, "DOMAIN_MIXED", domainMixed));
90     return authSubType;
91 }
92 
AuthTrustLevelConstructor(napi_env env)93 napi_value AuthTrustLevelConstructor(napi_env env)
94 {
95     napi_value authTrustLevel = nullptr;
96     napi_value atl1 = nullptr;
97     napi_value atl2 = nullptr;
98     napi_value atl3 = nullptr;
99     napi_value atl4 = nullptr;
100     NAPI_CALL(env, napi_create_object(env, &authTrustLevel));
101     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL1), &atl1));
102     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL2), &atl2));
103     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL3), &atl3));
104     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL4), &atl4));
105     NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL1", atl1));
106     NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL2", atl2));
107     NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL3", atl3));
108     NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL4", atl4));
109     return authTrustLevel;
110 }
111 
GetPropertyTypeConstructor(napi_env env)112 napi_value GetPropertyTypeConstructor(napi_env env)
113 {
114     napi_value getPropertyType = nullptr;
115     napi_value authSubType = nullptr;
116     napi_value remainTimes = nullptr;
117     napi_value freezingTime = nullptr;
118     napi_value enrollmentProgress = nullptr;
119     napi_value sensorInfo = nullptr;
120     napi_value nextPhaseFreezingTime = nullptr;
121     NAPI_CALL(env, napi_create_object(env, &getPropertyType));
122     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(GetPropertyType::AUTH_SUB_TYPE), &authSubType));
123     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(GetPropertyType::REMAIN_TIMES), &remainTimes));
124     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(GetPropertyType::FREEZING_TIME), &freezingTime));
125     NAPI_CALL(env,
126         napi_create_int32(env, static_cast<int32_t>(GetPropertyType::ENROLLMENT_PROGRESS), &enrollmentProgress));
127     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(GetPropertyType::SENSOR_INFO), &sensorInfo));
128     NAPI_CALL(env, napi_create_int32(
129         env, static_cast<int32_t>(GetPropertyType::NEXT_PHASE_FREEZING_TIME), &nextPhaseFreezingTime));
130     NAPI_CALL(env, napi_set_named_property(env, getPropertyType, "AUTH_SUB_TYPE", authSubType));
131     NAPI_CALL(env, napi_set_named_property(env, getPropertyType, "REMAIN_TIMES", remainTimes));
132     NAPI_CALL(env, napi_set_named_property(env, getPropertyType, "FREEZING_TIME", freezingTime));
133     NAPI_CALL(env, napi_set_named_property(env, getPropertyType, "ENROLLMENT_PROGRESS", enrollmentProgress));
134     NAPI_CALL(env, napi_set_named_property(env, getPropertyType, "SENSOR_INFO", sensorInfo));
135     NAPI_CALL(env, napi_set_named_property(env, getPropertyType, "NEXT_PHASE_FREEZING_TIME", nextPhaseFreezingTime));
136     return getPropertyType;
137 }
138 
SetPropertyTypeConstructor(napi_env env)139 napi_value SetPropertyTypeConstructor(napi_env env)
140 {
141     napi_value setPropertyType = nullptr;
142     napi_value initAlgorithm = nullptr;
143     NAPI_CALL(env, napi_create_object(env, &setPropertyType));
144     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(SetPropertyType::INIT_ALGORITHM), &initAlgorithm));
145     NAPI_CALL(env, napi_set_named_property(env, setPropertyType, "INIT_ALGORITHM", initAlgorithm));
146     return setPropertyType;
147 }
148 
AuthMethodConstructor(napi_env env)149 napi_value AuthMethodConstructor(napi_env env)
150 {
151     napi_value authMethod = nullptr;
152     napi_value pinOnly = nullptr;
153     napi_value faceOnly = nullptr;
154     NAPI_CALL(env, napi_create_object(env, &authMethod));
155     NAPI_CALL(env, napi_create_int32(env, AuthMethod::PIN_ONLY, &pinOnly));
156     NAPI_CALL(env, napi_create_int32(env, AuthMethod::FACE_ONLY, &faceOnly));
157     NAPI_CALL(env, napi_set_named_property(env, authMethod, "PIN_ONLY", pinOnly));
158     NAPI_CALL(env, napi_set_named_property(env, authMethod, "FACE_ONLY", faceOnly));
159     return authMethod;
160 }
161 
ModuleConstructor(napi_env env)162 napi_value ModuleConstructor(napi_env env)
163 {
164     napi_value module = nullptr;
165     napi_value faceAuth = nullptr;
166     NAPI_CALL(env, napi_create_object(env, &module));
167     NAPI_CALL(env, napi_create_int32(env, Module::FACE_AUTH, &faceAuth));
168     NAPI_CALL(env, napi_set_named_property(env, module, "FACE_AUTH", faceAuth));
169     return module;
170 }
171 
ResultCodeConstructor(napi_env env)172 napi_value ResultCodeConstructor(napi_env env)
173 {
174     napi_value resultCode = nullptr;
175     napi_value success = nullptr;
176     napi_value fail = nullptr;
177     napi_value generalError = nullptr;
178     napi_value canceled = nullptr;
179     napi_value timeout = nullptr;
180     napi_value typeNotSupport = nullptr;
181     napi_value trustLevelNotSupport = nullptr;
182     napi_value busy = nullptr;
183     napi_value invalidParameters = nullptr;
184     napi_value locked = nullptr;
185     napi_value notEnrolled = nullptr;
186     NAPI_CALL(env, napi_create_object(env, &resultCode));
187     NAPI_CALL(env, napi_create_int32(env, ResultCode::SUCCESS, &success));
188     NAPI_CALL(env, napi_create_int32(env, ResultCode::FAIL, &fail));
189     NAPI_CALL(env, napi_create_int32(env, ResultCode::GENERAL_ERROR, &generalError));
190     NAPI_CALL(env, napi_create_int32(env, ResultCode::CANCELED, &canceled));
191     NAPI_CALL(env, napi_create_int32(env, ResultCode::TIMEOUT, &timeout));
192     NAPI_CALL(env, napi_create_int32(env, ResultCode::TYPE_NOT_SUPPORT, &typeNotSupport));
193     NAPI_CALL(env, napi_create_int32(env, ResultCode::TRUST_LEVEL_NOT_SUPPORT, &trustLevelNotSupport));
194     NAPI_CALL(env, napi_create_int32(env, ResultCode::BUSY, &busy));
195     NAPI_CALL(env, napi_create_int32(env, ResultCode::INVALID_PARAMETERS, &invalidParameters));
196     NAPI_CALL(env, napi_create_int32(env, ResultCode::LOCKED, &locked));
197     NAPI_CALL(env, napi_create_int32(env, ResultCode::NOT_ENROLLED, &notEnrolled));
198     NAPI_CALL(env, napi_set_named_property(env, resultCode, "SUCCESS", success));
199     NAPI_CALL(env, napi_set_named_property(env, resultCode, "FAIL", fail));
200     NAPI_CALL(env, napi_set_named_property(env, resultCode, "GENERAL_ERROR", generalError));
201     NAPI_CALL(env, napi_set_named_property(env, resultCode, "CANCELED", canceled));
202     NAPI_CALL(env, napi_set_named_property(env, resultCode, "TIMEOUT", timeout));
203     NAPI_CALL(env, napi_set_named_property(env, resultCode, "TYPE_NOT_SUPPORT", typeNotSupport));
204     NAPI_CALL(env, napi_set_named_property(env, resultCode, "TRUST_LEVEL_NOT_SUPPORT", trustLevelNotSupport));
205     NAPI_CALL(env, napi_set_named_property(env, resultCode, "BUSY", busy));
206     NAPI_CALL(env, napi_set_named_property(env, resultCode, "INVALID_PARAMETERS", invalidParameters));
207     NAPI_CALL(env, napi_set_named_property(env, resultCode, "LOCKED", locked));
208     NAPI_CALL(env, napi_set_named_property(env, resultCode, "NOT_ENROLLED", notEnrolled));
209     return resultCode;
210 }
211 
FaceTipsCodeConstructor(napi_env env)212 napi_value FaceTipsCodeConstructor(napi_env env)
213 {
214     napi_value faceTipsCode = nullptr;
215     napi_value faceAuthTipTooBright = nullptr;
216     napi_value faceAuthTipTooDark = nullptr;
217     napi_value faceAuthTipTooClose = nullptr;
218     napi_value faceAuthTipTooFar = nullptr;
219     napi_value faceAuthTipTooHigh = nullptr;
220     napi_value faceAuthTipTooLow = nullptr;
221     napi_value faceAuthTipTooRight = nullptr;
222     napi_value faceAuthTipTooLeft = nullptr;
223     napi_value faceAuthTipTooMuchMotion = nullptr;
224     napi_value faceAuthTipPoorGaze = nullptr;
225     napi_value faceAuthTipNotDetected = nullptr;
226     NAPI_CALL(env, napi_create_object(env, &faceTipsCode));
227     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_BRIGHT, &faceAuthTipTooBright));
228     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_DARK, &faceAuthTipTooDark));
229     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_CLOSE, &faceAuthTipTooClose));
230     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_FAR, &faceAuthTipTooFar));
231     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_HIGH, &faceAuthTipTooHigh));
232     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_LOW, &faceAuthTipTooLow));
233     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_RIGHT, &faceAuthTipTooRight));
234     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_LEFT, &faceAuthTipTooLeft));
235     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_TOO_MUCH_MOTION, &faceAuthTipTooMuchMotion));
236     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_POOR_GAZE, &faceAuthTipPoorGaze));
237     NAPI_CALL(env, napi_create_int32(env, FaceTipsCode::FACE_AUTH_TIP_NOT_DETECTED, &faceAuthTipNotDetected));
238     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_BRIGHT", faceAuthTipTooBright));
239     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_DARK", faceAuthTipTooDark));
240     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_CLOSE", faceAuthTipTooClose));
241     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_FAR", faceAuthTipTooFar));
242     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_HIGH", faceAuthTipTooHigh));
243     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_LOW", faceAuthTipTooLow));
244     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_RIGHT", faceAuthTipTooRight));
245     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_TOO_LEFT", faceAuthTipTooLeft));
246     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode,
247         "FACE_AUTH_TIP_TOO_MUCH_MOTION", faceAuthTipTooMuchMotion));
248     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_POOR_GAZE", faceAuthTipPoorGaze));
249     NAPI_CALL(env, napi_set_named_property(env, faceTipsCode, "FACE_AUTH_TIP_NOT_DETECTED", faceAuthTipNotDetected));
250     return faceTipsCode;
251 }
252 
FingerprintTipsConstructorForInnerkits(napi_env env)253 napi_value FingerprintTipsConstructorForInnerkits(napi_env env)
254 {
255     napi_value fingerprintTips = nullptr;
256     napi_value fingerprintTipGood = nullptr;
257     napi_value fingerprintTipImagerDirty = nullptr;
258     napi_value fingerprintTipInsufficient = nullptr;
259     napi_value fingerprintTipPartial = nullptr;
260     napi_value fingerprintTipTooFast = nullptr;
261     napi_value fingerprintTipTooSlow = nullptr;
262     napi_value fingerprintTipFingerDown = nullptr;
263     napi_value fingerprintTipFingerUp = nullptr;
264     NAPI_CALL(env, napi_create_object(env, &fingerprintTips));
265     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_AUTH_TIP_GOOD, &fingerprintTipGood));
266     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_AUTH_TIP_IMAGER_DIRTY,
267         &fingerprintTipImagerDirty));
268     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_AUTH_TIP_INSUFFICIENT,
269         &fingerprintTipInsufficient));
270     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_AUTH_TIP_PARTIAL, &fingerprintTipPartial));
271     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_AUTH_TIP_TOO_FAST, &fingerprintTipTooFast));
272     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_AUTH_TIP_TOO_SLOW, &fingerprintTipTooSlow));
273     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_TIP_FINGER_DOWN, &fingerprintTipFingerDown));
274     NAPI_CALL(env, napi_create_int32(env, FingerprintTips::FINGERPRINT_TIP_FINGER_UP, &fingerprintTipFingerUp));
275     NAPI_CALL(env,
276         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_GOOD", fingerprintTipGood));
277     NAPI_CALL(env,
278         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_IMAGER_DIRTY", fingerprintTipImagerDirty));
279     NAPI_CALL(env,
280         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_INSUFFICIENT", fingerprintTipInsufficient));
281     NAPI_CALL(env,
282         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_PARTIAL", fingerprintTipPartial));
283     NAPI_CALL(env,
284         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_TOO_FAST", fingerprintTipTooFast));
285     NAPI_CALL(env,
286         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_TOO_SLOW", fingerprintTipTooSlow));
287     NAPI_CALL(env,
288         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_FINGER_DOWN", fingerprintTipFingerDown));
289     NAPI_CALL(env,
290         napi_set_named_property(env, fingerprintTips, "FINGERPRINT_TIP_FINGER_UP", fingerprintTipFingerUp));
291     return fingerprintTips;
292 }
293 
AuthIntentConstructorForInnerkits(napi_env env)294 napi_value AuthIntentConstructorForInnerkits(napi_env env)
295 {
296     napi_value authIntent = nullptr;
297     napi_value unlock = nullptr;
298     napi_value silent_auth = nullptr;
299     napi_value question_auth = nullptr;
300     NAPI_CALL(env, napi_create_object(env, &authIntent));
301     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthIntent::UNLOCK), &unlock));
302     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthIntent::SILENT_AUTH), &silent_auth));
303     NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthIntent::QUESTION_AUTH), &question_auth));
304     NAPI_CALL(env, napi_set_named_property(env, authIntent, "UNLOCK", unlock));
305     NAPI_CALL(env, napi_set_named_property(env, authIntent, "SILENT_AUTH", silent_auth));
306     NAPI_CALL(env, napi_set_named_property(env, authIntent, "QUESTION_AUTH", question_auth));
307     return authIntent;
308 }
309 
Init(napi_env env,napi_value exports)310 napi_value NapiAccountIAMConstant::Init(napi_env env, napi_value exports)
311 {
312     napi_property_descriptor descriptors[] = {
313         DECLARE_NAPI_PROPERTY("AuthType", AuthTypeConstructor(env)),
314         DECLARE_NAPI_PROPERTY("AuthSubType", AuthSubTypeConstructor(env)),
315         DECLARE_NAPI_PROPERTY("AuthTrustLevel", AuthTrustLevelConstructor(env)),
316         DECLARE_NAPI_PROPERTY("GetPropertyType", GetPropertyTypeConstructor(env)),
317         DECLARE_NAPI_PROPERTY("SetPropertyType", SetPropertyTypeConstructor(env)),
318         DECLARE_NAPI_PROPERTY("AuthMethod", AuthMethodConstructor(env)),
319         DECLARE_NAPI_PROPERTY("Module", ModuleConstructor(env)),
320         DECLARE_NAPI_PROPERTY("ResultCode", ResultCodeConstructor(env)),
321         DECLARE_NAPI_PROPERTY("FaceTipsCode", FaceTipsCodeConstructor(env)),
322         DECLARE_NAPI_PROPERTY("FingerprintTips", FingerprintTipsConstructorForInnerkits(env)),
323         DECLARE_NAPI_PROPERTY("AuthIntent", AuthIntentConstructorForInnerkits(env)),
324     };
325     napi_define_properties(env, exports, sizeof(descriptors) / sizeof(napi_property_descriptor), descriptors);
326     return exports;
327 }
328 }  // namespace AccountJsKit
329 }  // namespace OHOS
330