mirror of
https://github.com/openharmony/useriam_user_auth.git
synced 2026-07-19 22:33:53 -04:00
fix issue isolate API6 and API7
Signed-off-by: https://gitee.com/WALL_EYE <wangguoqiang12@huawei.com> Change-Id: I26f50be4f157a544c1825d4bb7736c85f63d5842
This commit is contained in:
@@ -36,6 +36,7 @@ void Init(napi_env env, napi_value exports);
|
||||
* @return napi_value UserAuth Instance
|
||||
*/
|
||||
napi_value GetCtor(napi_env env);
|
||||
|
||||
/**
|
||||
* @brief Construction method
|
||||
*
|
||||
@@ -45,6 +46,23 @@ napi_value GetCtor(napi_env env);
|
||||
*/
|
||||
napi_value Constructor(napi_env env, napi_callback_info info);
|
||||
|
||||
/**
|
||||
* @brief Get the Ctor object for API6
|
||||
*
|
||||
* @param env
|
||||
* @return napi_value UserAuth Instance
|
||||
*/
|
||||
napi_value GetCtorForAPI6(napi_env env);
|
||||
|
||||
/**
|
||||
* @brief Construction method for API6
|
||||
*
|
||||
* @param env
|
||||
* @param info
|
||||
* @return napi_value UserAuth Instance
|
||||
*/
|
||||
napi_value ConstructorForAPI6(napi_env env, napi_callback_info info);
|
||||
|
||||
/**
|
||||
* @brief Instance passed to context
|
||||
*
|
||||
@@ -100,6 +118,13 @@ napi_value SetProperty(napi_env env, napi_callback_info info);
|
||||
*/
|
||||
napi_value Auth(napi_env env, napi_callback_info info);
|
||||
|
||||
/**
|
||||
* @brief Execute authentication
|
||||
*
|
||||
* @param env
|
||||
* @param info
|
||||
* @return Returns the result of successful authentication
|
||||
*/
|
||||
napi_value Execute(napi_env env, napi_callback_info info);
|
||||
|
||||
/**
|
||||
|
||||
@@ -206,7 +206,7 @@ void Init(napi_env env, napi_value exports)
|
||||
napi_status status;
|
||||
napi_property_descriptor exportFuncs[] = {
|
||||
DECLARE_NAPI_FUNCTION("constructor", UserAuth::Constructor),
|
||||
DECLARE_NAPI_FUNCTION("getAuthenticator", UserAuth::Constructor),
|
||||
DECLARE_NAPI_FUNCTION("getAuthenticator", UserAuth::ConstructorForAPI6),
|
||||
};
|
||||
status = napi_define_properties(env, exports, sizeof(exportFuncs) / sizeof(*exportFuncs), exportFuncs);
|
||||
if (status != napi_ok) {
|
||||
@@ -223,6 +223,15 @@ napi_value Constructor(napi_env env, napi_callback_info info)
|
||||
return userAuth;
|
||||
}
|
||||
|
||||
napi_value ConstructorForAPI6(napi_env env, napi_callback_info info)
|
||||
{
|
||||
napi_value thisVar = nullptr;
|
||||
napi_value userAuthForAPI6 = nullptr;
|
||||
NAPI_CALL(env, napi_new_instance(env, GetCtorForAPI6(env), 0, nullptr, &userAuthForAPI6));
|
||||
NAPI_CALL(env, napi_get_cb_info(env, info, nullptr, nullptr, &thisVar, nullptr));
|
||||
return userAuthForAPI6;
|
||||
}
|
||||
|
||||
napi_value GetCtor(napi_env env)
|
||||
{
|
||||
napi_value cons = nullptr;
|
||||
@@ -234,12 +243,22 @@ napi_value GetCtor(napi_env env)
|
||||
DECLARE_NAPI_FUNCTION("auth", UserAuth::Auth),
|
||||
DECLARE_NAPI_FUNCTION("authUser", UserAuth::AuthUser),
|
||||
DECLARE_NAPI_FUNCTION("cancelAuth", UserAuth::CancelAuth),
|
||||
DECLARE_NAPI_FUNCTION("execute", UserAuth::Execute),
|
||||
};
|
||||
NAPI_CALL(env, napi_define_class(env, "UserAuth", NAPI_AUTO_LENGTH, UserAuthServiceConstructor, nullptr,
|
||||
sizeof(clzDes) / sizeof(napi_property_descriptor), clzDes, &cons));
|
||||
return cons;
|
||||
}
|
||||
|
||||
napi_value GetCtorForAPI6(napi_env env)
|
||||
{
|
||||
napi_value cons = nullptr;
|
||||
napi_property_descriptor clzDes[] = {
|
||||
DECLARE_NAPI_FUNCTION("execute", UserAuth::Execute),
|
||||
};
|
||||
NAPI_CALL(env, napi_define_class(env, "FaceAuthAbility", NAPI_AUTO_LENGTH, UserAuthServiceConstructor, nullptr,
|
||||
sizeof(clzDes) / sizeof(napi_property_descriptor), clzDes, &cons));
|
||||
return cons;
|
||||
}
|
||||
} // namespace UserAuth
|
||||
} // namespace UserIAM
|
||||
} // namespace OHOS
|
||||
|
||||
Reference in New Issue
Block a user