diff --git a/src/asherah.cc b/src/asherah.cc index 1c35d66..95a3856 100644 --- a/src/asherah.cc +++ b/src/asherah.cc @@ -38,6 +38,7 @@ class Asherah : public Napi::Addon { &Asherah::SetSafetyPaddingOverhead), InstanceMethod("get_setup_status", &Asherah::GetSetupStatus), InstanceMethod("set_log_hook", &Asherah::SetLogHook), + InstanceMethod("setenv", &Asherah::SetEnv), }); } @@ -409,6 +410,22 @@ class Asherah : public Napi::Addon { } } + void SetEnv(const Napi::CallbackInfo &info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); + try { + NapiUtils::RequireParameterCount(info, 1); + CobhanBufferNapi env_json(env, info[0]); + GoInt32 Result = ::SetEnv(env_json); + } catch (Napi::Error &e) { + e.ThrowAsJavaScriptException(); + return; + } catch (const std::exception &e) { + Napi::Error::New(env, e.what()).ThrowAsJavaScriptException(); + return; + } + } + void SetMaxStackAllocItemSize(const Napi::CallbackInfo &info) { Napi::Env env = info.Env(); Napi::HandleScope scope(env);