Skip to content

Commit c4f74ad

Browse files
committed
fixup! src,crypto: add NativeCryptoKey
1 parent 6843254 commit c4f74ad

2 files changed

Lines changed: 3 additions & 18 deletions

File tree

src/crypto/crypto_keys.cc

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,7 +1885,7 @@ void NativeCryptoKey::CreateCryptoKeyClass(
18851885
}
18861886

18871887
// Returns all of the key's internal slot values as a single Array:
1888-
// [type, extractable, algorithm, usages, handle]. JS-side helpers
1888+
// [type enum, extractable, algorithm, usages, handle]. JS-side helpers
18891889
// call this once per key to prime a per-instance cache, so subsequent
18901890
// reads don't need to cross into C++ at all.
18911891
void NativeCryptoKey::GetSlots(const FunctionCallbackInfo<Value>& args) {
@@ -1899,21 +1899,6 @@ void NativeCryptoKey::GetSlots(const FunctionCallbackInfo<Value>& args) {
18991899
Local<Object> obj = args[0].As<Object>();
19001900
NativeCryptoKey* native = Unwrap<NativeCryptoKey>(obj);
19011901

1902-
const char* type_str;
1903-
switch (native->handle_data_.GetKeyType()) {
1904-
case kKeyTypeSecret:
1905-
type_str = "secret";
1906-
break;
1907-
case kKeyTypePublic:
1908-
type_str = "public";
1909-
break;
1910-
case kKeyTypePrivate:
1911-
type_str = "private";
1912-
break;
1913-
default:
1914-
UNREACHABLE();
1915-
}
1916-
19171902
Local<Object> handle;
19181903
if (!KeyObjectHandle::Create(env, native->handle_data_).ToLocal(&handle)) {
19191904
return;
@@ -1924,7 +1909,7 @@ void NativeCryptoKey::GetSlots(const FunctionCallbackInfo<Value>& args) {
19241909
CHECK(algorithm->IsObject());
19251910
CHECK(usages->IsArray());
19261911
Local<Value> slots[] = {
1927-
OneByteString(isolate, type_str),
1912+
Uint32::NewFromUnsigned(isolate, native->handle_data_.GetKeyType()),
19281913
v8::Boolean::New(isolate, native->extractable_),
19291914
algorithm,
19301915
usages,

src/env_properties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,10 @@
478478
V(async_hooks_init_function, v8::Function) \
479479
V(async_hooks_promise_resolve_function, v8::Function) \
480480
V(buffer_prototype_object, v8::Object) \
481+
V(crypto_internal_cryptokey_constructor, v8::Function) \
481482
V(crypto_key_object_private_constructor, v8::Function) \
482483
V(crypto_key_object_public_constructor, v8::Function) \
483484
V(crypto_key_object_secret_constructor, v8::Function) \
484-
V(crypto_internal_cryptokey_constructor, v8::Function) \
485485
V(enhance_fatal_stack_after_inspector, v8::Function) \
486486
V(enhance_fatal_stack_before_inspector, v8::Function) \
487487
V(get_source_map_error_source, v8::Function) \

0 commit comments

Comments
 (0)