diff --git a/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h b/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h index 477bbbea264d2cd53c1fbd00693c24441d31345c..f7213102eac80ca9bfdbbf57ac3dba19855be92e 100644 --- a/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h +++ b/interfaces/innerkits/cert_manager_standard/main/include/cm_type.h @@ -90,6 +90,8 @@ extern "C" { (((a) != CM_AUTH_STORAGE_LEVEL_EL1) && ((a) != CM_AUTH_STORAGE_LEVEL_EL2) && ((a) != CM_AUTH_STORAGE_LEVEL_EL4)) #define CA_STORE_PATH_SYSTEM "/etc/security/certificates" +#define CA_STORE_PATH_SYSTEM_SM "/etc/security/certificates_gm" +#define SYSTEM_CA_STORE_GM "/system/etc/security/certificates_gm/" #define CA_STORE_PATH_USER_SANDBOX_BASE "/data/certificates/user_cacerts/" #define CA_STORE_PATH_USER_SERVICE_BASE "/data/service/el1/public/cert_manager_service/certificates/user_open/" diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn index 03db8cb006881d2853274bd4d9c2f7365614f2c8..c919dd7b9e6328fd85c4a5e9e7e0d09b49cb7793 100644 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -92,6 +92,7 @@ ohos_shared_library("certmanagerdialog") { "src/dialog/cm_napi_open_dialog.cpp", "src/dialog/cm_napi_open_install_dialog.cpp", "src/dialog/cm_napi_open_uninstall_dialog.cpp", + "src/dialog/cm_napi_open_authorize_dialog.cpp", ] external_deps = [ diff --git a/interfaces/kits/napi/include/cm_napi_common.h b/interfaces/kits/napi/include/cm_napi_common.h index eaae94d03bd564451b124707ad7514fc33e9abfb..e5606d1c994a1f8702f5910e5b9426213b1a719c 100644 --- a/interfaces/kits/napi/include/cm_napi_common.h +++ b/interfaces/kits/napi/include/cm_napi_common.h @@ -56,6 +56,7 @@ static const std::string CM_RESULT_PRPPERTY_CREDENTIAL = "credential"; static const std::string CM_CERT_SCOPE_STR = "certScope"; static const std::string CM_CERT_TYPE_STR = "certType"; +static const std::string CM_CERT_ALG_STR = "certAlg"; static const std::string GENERIC_MSG = "There is an internal error. Possible causes: " "1.IPC communication failed. 2.Memory operation error."; @@ -95,6 +96,7 @@ void GenerateNapiPromise(napi_env env, napi_ref callback, napi_deferred *deferre bool IsValidCertType(const uint32_t certType); bool IsValidCertScope(const uint32_t scope); +bool IsValidCertAlg(const uint32_t certAlg); inline napi_value GetNull(napi_env env) { @@ -168,6 +170,7 @@ enum ErrorCode { ALIAS_LENGTH_REACHED_LIMIT = 17500006, DEVICE_ENTER_ADVSECMODE = 17500007, PASSWORD_IS_ERROR = 17500008, + STORE_PATH_NOT_SUPPORTED = 17500009, }; enum CmJSKeyDigest { @@ -187,6 +190,11 @@ enum CmJSKeyPadding { CM_JS_PADDING_PKCS1_V1_5 = 2, }; +enum CmCertAlg { + CM_ALG_INTERNATIONAL = 1, + CM_ALG_SM = 2, +}; + struct CertInfoValue { napi_value uri; napi_value certAlias; diff --git a/interfaces/kits/napi/include/dialog/cm_napi_dialog_common.h b/interfaces/kits/napi/include/dialog/cm_napi_dialog_common.h index f0fc15724c0d749369fe45d1222fabfdef52b707..fceb9bcea1fb5591856ca06e3371b573ca4612e4 100644 --- a/interfaces/kits/napi/include/dialog/cm_napi_dialog_common.h +++ b/interfaces/kits/napi/include/dialog/cm_napi_dialog_common.h @@ -45,6 +45,7 @@ napi_value GenerateBusinessError(napi_env env, int32_t errorCode); void GeneratePromise(napi_env env, napi_deferred deferred, int32_t resultCode, napi_value *result, int32_t length); +int32_t GetCallerLabelName(std::shared_ptr asyncContext); inline napi_value GetInt32(napi_env env, int32_t value) { @@ -53,14 +54,13 @@ inline napi_value GetInt32(napi_env env, int32_t value) return result; } -int32_t GetCallerLabelName(std::shared_ptr asyncContext); - enum CmDialogPageType { PAGE_MAIN = 1, PAGE_CA_CERTIFICATE = 2, PAGE_CREDENTIAL = 3, PAGE_INSTALL_CERTIFICATE = 4, - PAGE_INSTALL_CA_GUIDE = 5 + PAGE_INSTALL_CA_GUIDE = 5, + PAGE_REQUEST_AUTHORIZE = 6 }; enum CmCertificateType { @@ -89,6 +89,7 @@ enum OperationType { DIALOG_OPERATION_INSTALL = 1, DIALOG_OPERATION_UNINSTALL = 2, DIALOG_OPERATION_DETAIL = 3, + DIALOG_OPERATION_AUTHORIZE = 4, }; } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/include/dialog/cm_napi_open_authorize_dialog.h b/interfaces/kits/napi/include/dialog/cm_napi_open_authorize_dialog.h new file mode 100644 index 0000000000000000000000000000000000000000..3731b0a26ac54b00f6f363bf3fb047f3551b0f2d --- /dev/null +++ b/interfaces/kits/napi/include/dialog/cm_napi_open_authorize_dialog.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + #ifndef CM_NAPI_OPEN_AUTHORIZE_DIALOG_H + #define CM_NAPI_OPEN_AUTHORIZE_DIALOG_H + + #include "napi/native_api.h" + #include "napi/native_node_api.h" + +namespace CMNapi { +napi_value CMNapiOpenAuthorizeDialog(napi_env env, napi_callback_info info); +} // namespace CMNapi + + #endif // CM_NAPI_OPEN_AUTHORIZE_DIALOG_H \ No newline at end of file diff --git a/interfaces/kits/napi/include/dialog/cm_napi_open_dialog.h b/interfaces/kits/napi/include/dialog/cm_napi_open_dialog.h index a661b5a42b516d989a278bf13ab01c0d7dae3895..b2143b1ff8d9caafb04410a05c48a9f0ba4269d1 100644 --- a/interfaces/kits/napi/include/dialog/cm_napi_open_dialog.h +++ b/interfaces/kits/napi/include/dialog/cm_napi_open_dialog.h @@ -33,6 +33,7 @@ const std::string CERT_MANAGER_PAGE_TYPE = "pageType"; const std::string CERT_MANAGER_CERTSCOPE_TYPE = "certScope"; const std::string CERT_MANAGER_CERTIFICATE_DATA = "cert"; const std::string CERT_MANAGER_CALLER_BUNDLENAME = "bundleName"; +const std::string CERT_MANAGER_CALLER_UID = "appUid"; const std::string CERT_MANAGER_CERT_URI = "certUri"; const std::string CERT_MANAGER_OPERATION_TYPE = "operationType"; const std::string CERT_MANAGER_SHOW_INSTALL_BUTTON = "showInstallButton"; @@ -41,6 +42,7 @@ constexpr int32_t PARAM0 = 0; constexpr int32_t PARAM1 = 1; constexpr int32_t PARAM2 = 2; constexpr int32_t PARAM3 = 3; +constexpr int32_t PARAM_SIZE_ONE = 1; constexpr int32_t PARAM_SIZE_TWO = 2; constexpr int32_t PARAM_SIZE_THREE = 3; constexpr int32_t PARAM_SIZE_FOUR = 4; @@ -64,6 +66,7 @@ struct CmUIExtensionRequestContext : public CommonAsyncContext { uint32_t pageType = 0; uint32_t certificateType = 0; uint32_t certificateScope = 0; + int32_t appUid = -1; std::string certStr = ""; std::string labelName = ""; CmBlob *certUri = nullptr; diff --git a/interfaces/kits/napi/src/cm_napi.cpp b/interfaces/kits/napi/src/cm_napi.cpp index e54e68b401ffdb7d47c0665ce1a00b02cef640c7..01560e02c9304d246c783dd8b674108ac4f41bc0 100644 --- a/interfaces/kits/napi/src/cm_napi.cpp +++ b/interfaces/kits/napi/src/cm_napi.cpp @@ -142,6 +142,16 @@ namespace CMNapi { AddInt32Property(env, level, "EL4", CM_AUTH_STORAGE_LEVEL_EL4); return level; } + + static napi_value CreateCertAlgorithm(napi_env env) + { + napi_value algorithm = nullptr; + NAPI_CALL(env, napi_create_object(env, &algorithm)); + + AddInt32Property(env, algorithm, "INTERNATIONAL", CM_ALG_INTERNATIONAL); + AddInt32Property(env, algorithm, "SM", CM_ALG_SM); + return algorithm; + } } // namespace CertManagerNapi using namespace CMNapi; @@ -158,6 +168,7 @@ extern "C" { DECLARE_NAPI_PROPERTY("CertScope", CreateCertScope(env)), DECLARE_NAPI_PROPERTY("CertFileFormat", CreateCertFileFormat(env)), DECLARE_NAPI_PROPERTY("AuthStorageLevel", CreateAuthStorageLevel(env)), + DECLARE_NAPI_PROPERTY("CertAlgorithm", CreateCertAlgorithm(env)), /* system ca */ DECLARE_NAPI_FUNCTION("getSystemTrustedCertificateList", CMNapiGetSystemCertList), diff --git a/interfaces/kits/napi/src/cm_napi_common.cpp b/interfaces/kits/napi/src/cm_napi_common.cpp index 143938276d8450ac0e7c43a31d43a68535e3783f..6820065d3914d45687822607a1c3b5b8caacd9ab 100644 --- a/interfaces/kits/napi/src/cm_napi_common.cpp +++ b/interfaces/kits/napi/src/cm_napi_common.cpp @@ -676,4 +676,15 @@ bool IsValidCertScope(const uint32_t scope) return false; } } + +bool IsValidCertAlg(const uint32_t certAlg) +{ + switch (static_cast(certAlg)) { + case CM_ALG_INTERNATIONAL: + case CM_ALG_SM: + return true; + default: + return false; + } +} } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/src/cm_napi_get_cert_store_path.cpp b/interfaces/kits/napi/src/cm_napi_get_cert_store_path.cpp index 0677bc25de0890b3113c7cc280a356d80b3db13e..46c3b8f309d1da806f4dd9bcb68a57c7b552e22e 100644 --- a/interfaces/kits/napi/src/cm_napi_get_cert_store_path.cpp +++ b/interfaces/kits/napi/src/cm_napi_get_cert_store_path.cpp @@ -15,6 +15,8 @@ #include "cm_napi_get_cert_store_path.h" +#include + #include "cm_log.h" #include "cm_napi_common.h" #include "cm_type.h" @@ -83,11 +85,43 @@ static int32_t GetUserCaStorePath(const enum CmCertScope certScope, string &path return CM_SUCCESS; } -static napi_value GetCertStorePath(napi_env env, const enum CmCertType certType, const enum CmCertScope certScope) +static bool IsDirExist(const char *fileName) +{ + if (fileName == NULL) { + return false; + } + if (access(fileName, F_OK) == 0) { + return true; + } + return false; +} + +static int32_t GetSysCaStorePath(napi_env env, const enum CmCertAlg certAlg, string &path) +{ + if (certAlg == CM_ALG_INTERNATIONAL) { + path = CA_STORE_PATH_SYSTEM; + return CM_SUCCESS; + } + if (!IsDirExist(SYSTEM_CA_STORE_GM)) { + CM_LOG_E("system gm ca store path not exist"); + ThrowError(env, STORE_PATH_NOT_SUPPORTED, "the device does not support specified certificate store path"); + return STORE_PATH_NOT_SUPPORTED; + } else { + path = CA_STORE_PATH_SYSTEM_SM; + } + return CM_SUCCESS; +} + +static napi_value GetCertStorePath(napi_env env, const enum CmCertType certType, const enum CmCertScope certScope, + const enum CmCertAlg certAlg) { string path = ""; if (certType == CM_CA_CERT_SYSTEM) { - path += CA_STORE_PATH_SYSTEM; + int32_t ret = GetSysCaStorePath(env, certAlg, path); + if (ret != CM_SUCCESS) { + CM_LOG_E("Failed to get system ca path, ret = %d", ret); + return nullptr; + } } else { int32_t ret = GetUserCaStorePath(certScope, path); if (ret != CM_SUCCESS) { @@ -186,6 +220,36 @@ static int32_t GetAndCheckCertScope(napi_env env, napi_value arg, const enum CmC return CM_SUCCESS; } +static int32_t GetAndCheckCertAlg(napi_env env, napi_value arg, uint32_t &algorithm) +{ + bool hasAlg = false; + napi_status status = napi_has_named_property(env, arg, CM_CERT_ALG_STR.c_str(), &hasAlg); + if (status != napi_ok || !hasAlg) { + CM_LOG_D("property certAlg not exist"); + algorithm = CM_ALG_INTERNATIONAL; + return SUCCESS; + } + + napi_value certAlg = nullptr; + status = napi_get_named_property(env, arg, CM_CERT_ALG_STR.c_str(), &certAlg); + if (status != napi_ok) { + CM_LOG_E("Failed to get certAlg"); + return CM_FAILURE; + } + + napi_value result = ParseUint32(env, certAlg, algorithm); + if (result == nullptr) { + CM_LOG_E("Failed to get certAlg value"); + return CM_FAILURE; + } + + if (!IsValidCertAlg(algorithm)) { + CM_LOG_E("certAlg[%u] is invalid", algorithm); + return CM_FAILURE; + } + return CM_SUCCESS; +} + napi_value CMNapiGetCertStorePath(napi_env env, napi_callback_info info) { CM_LOG_I("get cert store path enter"); @@ -219,7 +283,15 @@ napi_value CMNapiGetCertStorePath(napi_env env, napi_callback_info info) return nullptr; } - napi_value res = GetCertStorePath(env, static_cast(type), static_cast(scope)); + uint32_t algorithm; + ret = GetAndCheckCertAlg(env, argv[0], algorithm); + if (ret != CM_SUCCESS) { + ThrowError(env, PARAM_ERROR, "Failed to get param certAlg"); + return nullptr; + } + + napi_value res = GetCertStorePath(env, static_cast(type), static_cast(scope), + static_cast(algorithm)); CM_LOG_I("get cert store path end"); return res; } diff --git a/interfaces/kits/napi/src/dialog/cm_napi_dialog.cpp b/interfaces/kits/napi/src/dialog/cm_napi_dialog.cpp index e4dc3f598887548a1118df4ebfa6a50478f46a33..be7f5330dd178efbf41895b1e5414d12653bfd03 100644 --- a/interfaces/kits/napi/src/dialog/cm_napi_dialog.cpp +++ b/interfaces/kits/napi/src/dialog/cm_napi_dialog.cpp @@ -22,6 +22,7 @@ #include "cm_napi_open_dialog.h" #include "cm_napi_open_install_dialog.h" #include "cm_napi_open_uninstall_dialog.h" +#include "cm_napi_open_authorize_dialog.h" namespace CMNapi { inline void AddInt32Property(napi_env env, napi_value object, const char *name, int32_t value) @@ -98,6 +99,7 @@ static napi_value CMDialogNapiRegister(napi_env env, napi_value exports) DECLARE_NAPI_FUNCTION("openInstallCertificateDialog", CMNapiOpenInstallCertDialog), DECLARE_NAPI_FUNCTION("openUninstallCertificateDialog", CMNapiOpenUninstallCertDialog), DECLARE_NAPI_FUNCTION("openCertificateDetailDialog", CMNapiOpenDetailDialog), + DECLARE_NAPI_FUNCTION("openAuthorizeDialog", CMNapiOpenAuthorizeDialog), }; NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); return exports; diff --git a/interfaces/kits/napi/src/dialog/cm_napi_dialog_common.cpp b/interfaces/kits/napi/src/dialog/cm_napi_dialog_common.cpp index 5379a165817a3da9a18062d7072320fcfdd51bdf..668b96e8e131c2d09d7bd9dd9bc13f968094871d 100644 --- a/interfaces/kits/napi/src/dialog/cm_napi_dialog_common.cpp +++ b/interfaces/kits/napi/src/dialog/cm_napi_dialog_common.cpp @@ -434,7 +434,7 @@ static OHOS::sptr GetBundleMgrProxy() return OHOS::iface_cast(remoteObject); } -int32_t GetCallerLabelName(std::shared_ptr asyncContext) +static int32_t GetCallerBundleInfo(OHOS::AppExecFwk::BundleInfo &bundleInfo) { OHOS::sptr bundleMgrProxy = GetBundleMgrProxy(); if (bundleMgrProxy == nullptr) { @@ -442,7 +442,6 @@ int32_t GetCallerLabelName(std::shared_ptr asyncCon return CM_FAILURE; } - OHOS::AppExecFwk::BundleInfo bundleInfo; int32_t flags = static_cast(OHOS::AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_DEFAULT) | static_cast(OHOS::AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_APPLICATION) | static_cast(OHOS::AppExecFwk::GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_HAP_MODULE) | @@ -452,13 +451,27 @@ int32_t GetCallerLabelName(std::shared_ptr asyncCon CM_LOG_E("Failed to get bundleInfo, resCode is %d", resCode); return CM_FAILURE; } + return CM_SUCCESS; +} + +int32_t GetCallerLabelName(std::shared_ptr asyncContext) +{ + if (asyncContext == nullptr || asyncContext->context == nullptr) { + CM_LOG_E("invalid param"); + return CM_FAILURE; + } + OHOS::AppExecFwk::BundleInfo bundleInfo; + if (GetCallerBundleInfo(bundleInfo) != CM_SUCCESS) { + CM_LOG_E("Failed to get caller bundleInfo"); + return CM_FAILURE; + } if (asyncContext->context->GetResourceManager() == nullptr) { CM_LOG_E("context get resourcemanager faild"); return CMR_ERROR_NULL_POINTER; } - resCode = asyncContext->context->GetResourceManager()->GetStringById(bundleInfo.applicationInfo.labelId, + int32_t resCode = asyncContext->context->GetResourceManager()->GetStringById(bundleInfo.applicationInfo.labelId, asyncContext->labelName); if (resCode != CM_SUCCESS) { CM_LOG_E("getStringById is faild, resCode is %d", resCode); @@ -467,5 +480,4 @@ int32_t GetCallerLabelName(std::shared_ptr asyncCon return CM_SUCCESS; } - } // namespace CertManagerNapi diff --git a/interfaces/kits/napi/src/dialog/cm_napi_open_authorize_dialog.cpp b/interfaces/kits/napi/src/dialog/cm_napi_open_authorize_dialog.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8f07f412a95ae712aabd3b6d0e217208997a481d --- /dev/null +++ b/interfaces/kits/napi/src/dialog/cm_napi_open_authorize_dialog.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2025-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "cm_napi_open_authorize_dialog.h" + +#include "cm_log.h" +#include "cm_napi_dialog_common.h" +#include "cm_napi_open_certificate_operation.h" + +namespace CMNapi { + +static OHOS::AAFwk::Want CMGetAuthCertWant(std::shared_ptr asyncContext) +{ + OHOS::AAFwk::Want want; + want.SetElementName(CERT_MANAGER_BUNDLENAME, CERT_MANAGER_ABILITYNAME); + want.SetParam(CERT_MANAGER_CALLER_BUNDLENAME, asyncContext->labelName); + want.SetParam(CERT_MANAGER_CALLER_UID, asyncContext->appUid); + want.SetParam(PARAM_UI_EXTENSION_TYPE, SYS_COMMON_UI); + want.SetParam(CERT_MANAGER_PAGE_TYPE, static_cast(CmDialogPageType::PAGE_REQUEST_AUTHORIZE)); + return want; +} + +napi_value CMNapiOpenAuthorizeDialog(napi_env env, napi_callback_info info) +{ + CM_LOG_I("cert authorize dialog enter"); + napi_value result = nullptr; + NAPI_CALL(env, napi_get_undefined(env, &result)); + + size_t argc = PARAM_SIZE_ONE; + napi_value argv[PARAM_SIZE_ONE] = { nullptr }; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr)); + if (argc != PARAM_SIZE_ONE) { + CM_LOG_E("params number mismatch"); + std::string errMsg = "Parameter Error. Params number mismatch, need " + std::to_string(PARAM_SIZE_ONE) + + ", given " + std::to_string(argc); + ThrowError(env, PARAM_ERROR, errMsg); + return result; + } + + auto asyncContext = std::make_shared(env); + asyncContext->opType = static_cast(DIALOG_OPERATION_AUTHORIZE); + if (!ParseCmUIAbilityContextReq(asyncContext->env, argv[PARAM0], asyncContext->context)) { + CM_LOG_E("parse abilityContext failed"); + ThrowError(env, PARAM_ERROR, "parse abilityContext failed"); + return nullptr; + } + + if (GetCallerLabelName(asyncContext) != CM_SUCCESS) { + CM_LOG_E("get caller labelName faild"); + ThrowError(env, DIALOG_ERROR_GENERIC, "get caller labelName faild"); + return nullptr; + } + + asyncContext->appUid = static_cast(getuid()); + + NAPI_CALL(env, napi_create_promise(env, &asyncContext->deferred, &result)); + auto uiExtCallback = std::make_shared(asyncContext); + StartUIExtensionAbility(asyncContext, CMGetAuthCertWant(asyncContext), uiExtCallback); + CM_LOG_I("cert authorize dialog end"); + return result; +} +} // namespace CMNapi \ No newline at end of file diff --git a/interfaces/kits/napi/src/dialog/cm_napi_open_certificate_operation.cpp b/interfaces/kits/napi/src/dialog/cm_napi_open_certificate_operation.cpp index 3163d4b370398f5f32b611beba64a4ffca43e0d7..6ac2568e6d3da5275ed3cf1e49ef1b33cf654ac5 100644 --- a/interfaces/kits/napi/src/dialog/cm_napi_open_certificate_operation.cpp +++ b/interfaces/kits/napi/src/dialog/cm_napi_open_certificate_operation.cpp @@ -17,7 +17,7 @@ #include "cm_napi_dialog_common.h" #include "cm_log.h" -#include "napi/native_api.h" +#include "napi/native_api.h" #include "napi/native_node_api.h" namespace CMNapi { @@ -63,7 +63,7 @@ void CmOperationUIExtensionCallback::ProcessCallback(napi_env env, const CommonA { napi_value args = nullptr; if (asyncContext->errCode == CM_SUCCESS) { - if (asyncContext->opType == DIALOG_OPERATION_INSTALL) { + if (asyncContext->opType == DIALOG_OPERATION_INSTALL || asyncContext->opType == DIALOG_OPERATION_AUTHORIZE) { NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, asyncContext->uri.c_str(), NAPI_AUTO_LENGTH, &args)); } else {