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 as defined by node:crypto? I am trying to get around some nasty 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);


The above gives me this error:

error: Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')
Was this page helpful?