Skip to content

Commit 13078d4

Browse files
panvazebreus
authored andcommitted
fix(ext/node): add Symbol.toStringTag to KeyObject instances (denoland#24377)
As per nodejs/node#46043, this adds Symbol.toStringTag getter to KeyObject.
1 parent 52fbd93 commit 13078d4

File tree

1 file changed

+15
-0
lines changed
  • ext/node/polyfills/internal/crypto

1 file changed

+15
-0
lines changed

ext/node/polyfills/internal/crypto/keys.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
// TODO(petamoriken): enable prefer-primordials for node polyfills
55
// deno-lint-ignore-file prefer-primordials
66

7+
import { primordials } from "ext:core/mod.js";
8+
9+
const {
10+
ObjectDefineProperties,
11+
SymbolToStringTag,
12+
} = primordials;
13+
714
import {
815
op_node_create_private_key,
916
op_node_create_public_key,
@@ -209,6 +216,14 @@ export class KeyObject {
209216
}
210217
}
211218

219+
ObjectDefineProperties(KeyObject.prototype, {
220+
[SymbolToStringTag]: {
221+
__proto__: null,
222+
configurable: true,
223+
value: "KeyObject",
224+
},
225+
});
226+
212227
export interface JsonWebKeyInput {
213228
key: JsonWebKey;
214229
format: "jwk";

0 commit comments

Comments
 (0)