fix: replace @noble/hashes/utils import with inline bytesToHex helper

@noble/hashes v2 dropped the ./utils subpath export, breaking the import
in useDirectMessages.ts. Replaced with a simple inline implementation
that has zero new dependencies and works correctly with any build tool.

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
shakespeare.diy 2026-06-15 22:24:56 +07:00
parent e29d35f1e4
commit 0b4fc341a1

View file

@ -2,11 +2,15 @@ import { useCallback, useMemo } from 'react';
import { useNostr } from '@nostrify/react'; import { useNostr } from '@nostrify/react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { nip44, nip19, getEventHash, generateSecretKey, getPublicKey } from 'nostr-tools'; import { nip44, nip19, getEventHash, generateSecretKey, getPublicKey } from 'nostr-tools';
import { bytesToHex } from '@noble/hashes/utils';
import type { NostrEvent } from '@nostrify/nostrify'; import type { NostrEvent } from '@nostrify/nostrify';
import { useCurrentUser } from './useCurrentUser'; import { useCurrentUser } from './useCurrentUser';
import { useAppContext } from './useAppContext'; import { useAppContext } from './useAppContext';
// Uint8Array → hex string (replaces @noble/hashes/utils which dropped ./utils in v2)
const bytesToHex = (bytes: Uint8Array): string =>
Array.from(bytes).map(b => b.toString(16).padStart(2, '0')).join('');
// NIP-17 Message Types // NIP-17 Message Types
export interface DirectMessage { export interface DirectMessage {
id: string; id: string;