diff options
Diffstat (limited to 'ext/node/polyfills/internal/crypto/_keys.ts')
-rw-r--r-- | ext/node/polyfills/internal/crypto/_keys.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/node/polyfills/internal/crypto/_keys.ts b/ext/node/polyfills/internal/crypto/_keys.ts new file mode 100644 index 000000000..794582bf1 --- /dev/null +++ b/ext/node/polyfills/internal/crypto/_keys.ts @@ -0,0 +1,16 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +import { kKeyObject } from "internal:deno_node/polyfills/internal/crypto/constants.ts"; + +export const kKeyType = Symbol("kKeyType"); + +export function isKeyObject(obj: unknown): boolean { + return ( + obj != null && (obj as Record<symbol, unknown>)[kKeyType] !== undefined + ); +} + +export function isCryptoKey(obj: unknown): boolean { + return ( + obj != null && (obj as Record<symbol, unknown>)[kKeyObject] !== undefined + ); +} |