From e8f603b4bc1a4d1be41ec1bd54bdae827a476722 Mon Sep 17 00:00:00 2001 From: smolgrrr Date: Fri, 30 Aug 2024 13:04:01 +1000 Subject: [PATCH] fix sk to hex --- client/src/components/forms/handleSubmit.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/components/forms/handleSubmit.ts b/client/src/components/forms/handleSubmit.ts index a811f9a..c04ab29 100644 --- a/client/src/components/forms/handleSubmit.ts +++ b/client/src/components/forms/handleSubmit.ts @@ -1,6 +1,7 @@ import { useState, useEffect } from "react"; import { generateSecretKey, getPublicKey, finalizeEvent, UnsignedEvent, Event } from "nostr-tools"; import { publish } from "../../utils/relays"; +import { bytesToHex } from '@noble/hashes/utils' const useWorkers = (numCores: number, unsigned: UnsignedEvent, difficulty: string, deps: any[]) => { const [messageFromWorker, setMessageFromWorker] = useState(null); @@ -94,7 +95,8 @@ export const useSubmitForm = (unsigned: UnsignedEvent, difficulty: string) => { } // Add the logic here - storedKeys.push([sk, getPublicKey(sk)]); + const skHex = bytesToHex(sk); + storedKeys.push([skHex, getPublicKey(sk)]); // Stringify the array and store it back to localStorage localStorage.setItem('usedKeys', JSON.stringify(storedKeys)); };