UNPKG

rx-nostr

Version:

A library based on RxJS, which allows Nostr applications to easily communicate with relays.

10 lines (8 loc) 345 B
import { bytesToHex } from "@noble/hashes/utils.js"; import { bech32 } from "@scure/base"; /** Convert bech32 format string to HEX format string. */ export function toHex(str: string): string { const { words } = bech32.decode(str as `${string}1${string}`); const data = new Uint8Array(bech32.fromWords(words)); return bytesToHex(data); }