DenoDDeno
Powered by
abiA
Denoβ€’3y agoβ€’
6 replies
abi

Abusing prototype CryptoKey in `node:crypto`

Is there any way that I can set the prototype of an object to specifically
CryptoKey
CryptoKey
as defined by
node:crypto
node:crypto
? I am trying to get around some nasty
instanceof
instanceof
check in a third-party library which is getting in the way.

import * as krypto from "node:crypto";
Object.setPrototypeOf(foo, krypto.webcrypto.CryptoKey.prototype);
import * as krypto from "node:crypto";
Object.setPrototypeOf(foo, krypto.webcrypto.CryptoKey.prototype);


The above gives me this error:

error: Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
error: Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

node crypto
HashHHash / help
3y ago
Error: Not implemented: crypto.KeyObject.prototype.asymmetricKeyType
lioxpLlioxp / help
3y ago
bad resource id with node:crypto
lyLly / help
3y ago