-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Safe/reliable crypto.KeyObject and webcrypto.CryptoKey detection in userland #38611
Comments
Re |
I still think it would be a good idea to expose static |
Both I think exposing a symbol check function would be better. |
KeyObject.isKeyObject()
KeyObject.isCryptoKey() Alternatively, we could add both to
If the Node.js binary is built without crypto support, these would still exist but would always return |
I don't have a strong preference where the functions live, just that they're available in some sensible place. |
Currently there are no public methods for checking for
KeyObject
andCryptoKey
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()
andCryptoKey.isCryptoKey()
. The former is currently pretty easy to do in userland since it's just doing aninstanceof
check, but the latter checks "private" symbols, which is not as easy/ideal for userland (although I guess at least currentlyinstanceof CryptoKey
would work?). Either way, having these encapsulated in helper methods would help insulate changes to the checking logic, should it ever change.The text was updated successfully, but these errors were encountered: