From 740c6a0998fb5873d0b9bf804b2f9c9730743e90 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Tue, 2 Jul 2024 00:36:22 +0200 Subject: fix(ext/node): add Symbol.toStringTag to KeyObject instances (#24377) As per https://github.com/nodejs/node/pull/46043, this adds Symbol.toStringTag getter to KeyObject. --- ext/node/polyfills/internal/crypto/keys.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ext') diff --git a/ext/node/polyfills/internal/crypto/keys.ts b/ext/node/polyfills/internal/crypto/keys.ts index 8cb9ab690..ca22e12c6 100644 --- a/ext/node/polyfills/internal/crypto/keys.ts +++ b/ext/node/polyfills/internal/crypto/keys.ts @@ -4,6 +4,13 @@ // TODO(petamoriken): enable prefer-primordials for node polyfills // deno-lint-ignore-file prefer-primordials +import { primordials } from "ext:core/mod.js"; + +const { + ObjectDefineProperties, + SymbolToStringTag, +} = primordials; + import { op_node_create_private_key, op_node_create_public_key, @@ -209,6 +216,14 @@ export class KeyObject { } } +ObjectDefineProperties(KeyObject.prototype, { + [SymbolToStringTag]: { + __proto__: null, + configurable: true, + value: "KeyObject", + }, +}); + export interface JsonWebKeyInput { key: JsonWebKey; format: "jwk"; -- cgit v1.2.3