From 512c5f998c8f2f87884bcb2dd96f062033526b0f Mon Sep 17 00:00:00 2001 From: Max Holman Date: Sun, 23 Apr 2023 13:16:59 +0800 Subject: [PATCH] chore: CryptoKey is exported separately and therefore this is redundant --- lib/isomorphic-crypto.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/isomorphic-crypto.ts b/lib/isomorphic-crypto.ts index f5c4ce0..c3d180a 100644 --- a/lib/isomorphic-crypto.ts +++ b/lib/isomorphic-crypto.ts @@ -7,14 +7,13 @@ const impl = await (typeof globalThis !== 'undefined' && globalThis.crypto ? globalThis.crypto : import('node:crypto')); -// we only export SubtleCrypto to make sure the interface remains the same +// we only export the values we use to keep things simple, we dont need a fully +// cross platform compatible crypto library export const crypto = { getRandomValues: (array: T) => 'webcrypto' in impl ? impl.webcrypto.getRandomValues(array) : impl.getRandomValues(array), - CryptoKey: - 'webcrypto' in impl ? impl.webcrypto.CryptoKey : globalThis.CryptoKey, subtle: 'webcrypto' in impl ? impl.webcrypto.subtle : impl.subtle, };