mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 00:28:51 +00:00
fix: check crypto and webcrypto
This commit is contained in:
4
nip04.ts
4
nip04.ts
@@ -1,11 +1,11 @@
|
|||||||
import {randomBytes} from '@noble/hashes/utils'
|
import {randomBytes} from '@noble/hashes/utils'
|
||||||
import * as secp256k1 from '@noble/secp256k1'
|
import * as secp256k1 from '@noble/secp256k1'
|
||||||
import {base64} from '@scure/base'
|
import {base64} from '@scure/base'
|
||||||
import crypto from 'crypto'
|
|
||||||
|
|
||||||
import {utf8Decoder, utf8Encoder} from './utils'
|
import {utf8Decoder, utf8Encoder} from './utils'
|
||||||
|
|
||||||
if (!crypto.subtle) {
|
// @ts-ignore
|
||||||
|
if (typeof(crypto) !== 'undefined' && !crypto.subtle && crypto.webcrypto) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
crypto.subtle = crypto.webcrypto.subtle
|
crypto.subtle = crypto.webcrypto.subtle
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user