fix(nip04): crypto.subtle is undefined
This commit is contained in:
parent
278cdda9c2
commit
b66ca1787a
6
nip04.ts
6
nip04.ts
|
@ -1,9 +1,15 @@
|
||||||
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
|
||||||
|
crypto.subtle = crypto.webcrypto.subtle
|
||||||
|
}
|
||||||
|
|
||||||
export async function encrypt(
|
export async function encrypt(
|
||||||
privkey: string,
|
privkey: string,
|
||||||
pubkey: string,
|
pubkey: string,
|
||||||
|
|
Loading…
Reference in New Issue