Add bufferToHex, re-export some stuff from nostr-editor
This commit is contained in:
@@ -5,3 +5,4 @@
|
||||
--ignore-dir=build
|
||||
--ignore-dir=.svelte-kit
|
||||
--ignore-file=match:yarn.lock
|
||||
--ignore-file=match:tsbuildinfo
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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("")
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user