From 1647601727d54f1cf652e64598bfd2206919632c Mon Sep 17 00:00:00 2001 From: eosxx Date: Fri, 28 Apr 2023 08:50:24 +0000 Subject: [PATCH] fix: check crypto and webcrypto --- nip04.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nip04.ts b/nip04.ts index 3962f8e..3428a08 100644 --- a/nip04.ts +++ b/nip04.ts @@ -1,11 +1,11 @@ import {randomBytes} from '@noble/hashes/utils' import * as secp256k1 from '@noble/secp256k1' import {base64} from '@scure/base' -import crypto from 'crypto' import {utf8Decoder, utf8Encoder} from './utils' -if (!crypto.subtle) { +// @ts-ignore +if (typeof(crypto) !== 'undefined' && !crypto.subtle && crypto.webcrypto) { // @ts-ignore crypto.subtle = crypto.webcrypto.subtle }