Add bufferToHex, re-export some stuff from nostr-editor

This commit is contained in:
Jon Staab
2025-05-09 12:31:14 -07:00
parent 96b1f8872c
commit d2ba0f6642
4 changed files with 12 additions and 2 deletions
+1
View File
@@ -5,3 +5,4 @@
--ignore-dir=build
--ignore-dir=.svelte-kit
--ignore-file=match:yarn.lock
--ignore-file=match:tsbuildinfo
+1 -1
View File
@@ -2,4 +2,4 @@ export * from "./nodeviews/index.js"
export * from "./extensions/index.js"
export * from "./plugins/index.js"
export {Editor, NodeViewProps} from "@tiptap/core"
export {UploadTask} from "nostr-editor"
export {UploadTask, BlossomOptions, uploadBlossom} from "nostr-editor"
+10
View File
@@ -1551,3 +1551,13 @@ export const hexToBech32 = (prefix: string, hex: string) =>
*/
export const bech32ToHex = (b32: string) =>
utf8.encode(bech32.fromWords(bech32.decode(b32 as any, false).words))
/**
* Converts an array buffer to hex format
* @param buffer - ArrayBuffer string to convert
* @returns Hex encoded string
*/
export const bufferToHex = (buffer: ArrayBuffer) =>
Array.from(new Uint8Array(buffer))
.map(b => b.toString(16).padStart(2, "0"))
.join("")
-1
View File
@@ -101,7 +101,6 @@ class Accumulator {
if (typeof window === "undefined") {
// node.js
const crypto = require("crypto")
this.sha256 = async slice =>
new Uint8Array(crypto.createHash("sha256").update(slice).digest())
} else {