Description
Currently there are no public methods for checking for KeyObject
and CryptoKey
objects. Having reliable checks for these would be very nice to have for userland code that wants to support these types of objects in their code.
It seems there are already internal methods for achieving this, but I'm not sure why they are not currently exposed to userland. I was thinking maybe something like how Buffer
handles this: KeyObject.isKeyObject()
and CryptoKey.isCryptoKey()
. The former is currently pretty easy to do in userland since it's just doing an instanceof
check, but the latter checks "private" symbols, which is not as easy/ideal for userland (although I guess at least currently instanceof CryptoKey
would work?). Either way, having these encapsulated in helper methods would help insulate changes to the checking logic, should it ever change.