summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilip Skokan <panva.ip@gmail.com>2024-07-02 00:36:22 +0200
committerGitHub <noreply@github.com>2024-07-02 00:36:22 +0200
commit740c6a0998fb5873d0b9bf804b2f9c9730743e90 (patch)
tree675a4ceabbbf3dff569ca4f5ef7af765fc04878b
parent6f30ef88a24e4c463d26c34f25b024fb48f3aea2 (diff)
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.
-rw-r--r--ext/node/polyfills/internal/crypto/keys.ts15
1 files changed, 15 insertions, 0 deletions
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";