use @noble/ciphers instead of webcrypto on nip04.

This commit is contained in:
fiatjaf
2024-02-17 18:15:42 -03:00
parent db6baf2e6b
commit 84f9881812
3 changed files with 8 additions and 23 deletions

View File

@@ -1,18 +1,9 @@
import { test, expect } from 'bun:test'
import crypto from 'node:crypto'
import { encrypt, decrypt } from './nip04.ts'
import { getPublicKey, generateSecretKey } from './pure.ts'
import { bytesToHex, hexToBytes } from '@noble/hashes/utils'
try {
// @ts-ignore
// eslint-disable-next-line no-undef
globalThis.crypto = crypto
} catch (err) {
/***/
}
test('encrypt and decrypt message', async () => {
let sk1 = generateSecretKey()
let sk2 = generateSecretKey()