expose hexToBytes and bytesToHex helpers.

This commit is contained in:
fiatjaf 2025-05-28 14:50:25 -03:00
parent 924075b803
commit 57354b9fb4
2 changed files with 3 additions and 1 deletions

View File

@ -32,7 +32,7 @@ export async function makeNwcRequestEvent(
invoice, invoice,
}, },
} }
const encryptedContent = await encrypt(secretKey, pubkey, JSON.stringify(content)) const encryptedContent = encrypt(secretKey, pubkey, JSON.stringify(content))
const eventTemplate = { const eventTemplate = {
kind: NWCWalletRequest, kind: NWCWalletRequest,
created_at: Math.round(Date.now() / 1000), created_at: Math.round(Date.now() / 1000),

View File

@ -3,6 +3,8 @@ import type { Event } from './core.ts'
export const utf8Decoder: TextDecoder = new TextDecoder('utf-8') export const utf8Decoder: TextDecoder = new TextDecoder('utf-8')
export const utf8Encoder: TextEncoder = new TextEncoder() export const utf8Encoder: TextEncoder = new TextEncoder()
export { bytesToHex, hexToBytes } from '@noble/hashes/utils'
export function normalizeURL(url: string): string { export function normalizeURL(url: string): string {
try { try {
if (url.indexOf('://') === -1) url = 'wss://' + url if (url.indexOf('://') === -1) url = 'wss://' + url