fix: check crypto and webcrypto

This commit is contained in:
eosxx
2023-04-28 08:50:24 +00:00
committed by fiatjaf_
parent b66ca1787a
commit 1647601727

View File

@@ -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
}