| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 05ec9c4 commit f58ac82
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,7 @@ namespace node { | |||
| 30 | 30 | using ncrypto::DataPointer; | |
| 31 | 31 | using ncrypto::EVPMDCtxPointer; | |
| 32 | 32 | using ncrypto::MarkPopErrorOnReturn; | |
| 33 | + using v8::ArrayBuffer; | ||
| 33 | 34 | using v8::Context; | |
| 34 | 35 | using v8::FunctionCallbackInfo; | |
| 35 | 36 | using v8::FunctionTemplate; | |
@@ -43,8 +44,11 @@ using v8::Maybe; | |||
| 43 | 44 | using v8::MaybeLocal; | |
| 44 | 45 | using v8::Name; | |
| 45 | 46 | using v8::Nothing; | |
| 47 | + using v8::Null; | ||
| 46 | 48 | using v8::Object; | |
| 49 | + using v8::String; | ||
| 47 | 50 | using v8::Uint32; | |
| 51 | + using v8::Uint8Array; | ||
| 48 | 52 | using v8::Value; | |
| 49 | 53 | ||
| 50 | 54 | namespace crypto { | |
@@ -195,12 +199,12 @@ void Hash::GetCachedAliases(const FunctionCallbackInfo<Value>& args) { | |||
| 195 | 199 | values.reserve(size); | |
| 196 | 200 | for (auto& [alias, id] : env->alias_to_md_id_map) { | |
| 197 | 201 | names.push_back(OneByteString(isolate, alias)); | |
| 198 | - values.push_back(v8::Uint32::New(isolate, id)); | ||
| 202 | + values.push_back(Uint32::New(isolate, id)); | ||
| 199 | 203 | } | |
| 200 | 204 | #else | |
| 201 | 205 | CHECK(env->alias_to_md_id_map.empty()); | |
| 202 | 206 | #endif | |
| 203 | - Local<Value> prototype = v8::Null(isolate); | ||
| 207 | + Local<Value> prototype = Null(isolate); | ||
| 204 | 208 | Local<Object> result = | |
| 205 | 209 | Object::New(isolate, prototype, names.data(), values.data(), size); | |
| 206 | 210 | args.GetReturnValue().Set(result); | |
@@ -233,7 +237,7 @@ const EVP_MD* GetDigestImplementation(Environment* env, | |||
| 233 | 237 | if (algorithm_cache.As<Object>() | |
| 234 | 238 | ->Set(isolate->GetCurrentContext(), | |
| 235 | 239 | algorithm, | |
| 236 | - v8::Int32::New(isolate, result.cache_id)) | ||
| 240 | + Int32::New(isolate, result.cache_id)) | ||
| 237 | 241 | .IsNothing()) { | |
| 238 | 242 | return nullptr; | |
| 239 | 243 | } | |
@@ -303,11 +307,13 @@ void Hash::OneShotDigest(const FunctionCallbackInfo<Value>& args) { | |||
| 303 | 307 | ||
| 304 | 308 | if (output_length == 0) { | |
| 305 | 309 | if (output_enc == BUFFER) { | |
| 306 | - Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, 0); | ||
| 307 | - args.GetReturnValue().Set( | ||
| 308 | - Buffer::New(isolate, ab, 0, 0).ToLocalChecked()); | ||
| 310 | + Local<Uint8Array> u8; | ||
| 311 | + if (Buffer::New(isolate, ArrayBuffer::New(isolate, 0), 0, 0) | ||
| 312 | + .ToLocal(&u8)) { | ||
| 313 | + args.GetReturnValue().Set(u8); | ||
| 314 | + } | ||
| 309 | 315 | } else { | |
| 310 | - args.GetReturnValue().Set(v8::String::Empty(isolate)); | ||
| 316 | + args.GetReturnValue().Set(String::Empty(isolate)); | ||
| 311 | 317 | } | |
| 312 | 318 | return; | |
| 313 | 319 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments