summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/iso/isoCrypto/importKey.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/helpers/iso/isoCrypto/importKey.ts')
-rw-r--r--packages/server/src/helpers/iso/isoCrypto/importKey.ts10
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/server/src/helpers/iso/isoCrypto/importKey.ts b/packages/server/src/helpers/iso/isoCrypto/importKey.ts
index d475ac1..0153dd5 100644
--- a/packages/server/src/helpers/iso/isoCrypto/importKey.ts
+++ b/packages/server/src/helpers/iso/isoCrypto/importKey.ts
@@ -1,10 +1,14 @@
-import { WebCrypto } from '../../../deps.ts';
+import { getWebCrypto } from "./getWebCrypto.ts";
-export function importKey(opts: {
+export async function importKey(opts: {
keyData: JsonWebKey;
algorithm: AlgorithmIdentifier | RsaHashedImportParams | EcKeyImportParams;
}): Promise<CryptoKey> {
+ const WebCrypto = await getWebCrypto();
+
const { keyData, algorithm } = opts;
- return WebCrypto.subtle.importKey('jwk', keyData, algorithm, false, ['verify']);
+ return WebCrypto.subtle.importKey("jwk", keyData, algorithm, false, [
+ "verify",
+ ]);
}