From 4c9b9179037c63c98dfc698bf1012d9b777c39aa Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Mon, 10 May 2021 12:33:11 +0200 Subject: [PATCH] crypto: expose KeyObject.isKeyObject(obj) and CryptoKey.isCryptoKey(obj) closes #38611 --- doc/api/crypto.md | 10 ++++++++++ doc/api/webcrypto.md | 10 ++++++++++ lib/internal/crypto/keys.js | 12 ++++++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 9b4559473ca7e5..285232f4fe42e4 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1852,6 +1852,16 @@ passing keys as strings or `Buffer`s due to improved security features. The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to be listed in the `transferList` argument. +### Static method: `KeyObject.isKeyObject(obj)` + + +* `obj` {Object} +* Returns: {boolean} + +Returns `true` if `obj` is a `KeyObject`, `false` otherwise. + ### Static method: `KeyObject.from(key)` +### Static method: `CryptoKey.isCryptoKey(obj)` + + +* `obj` {Object} +* Returns: {boolean} + +Returns `true` if `obj` is a `CryptoKey`, `false` otherwise. + ### `cryptoKey.algorithm`