From 21c6f0087b498a8a110945fcc631b84d0fd0023a Mon Sep 17 00:00:00 2001 From: Manuel <76573199+Manolais@users.noreply.github.com> Date: Mon, 13 Mar 2023 15:17:38 -0300 Subject: [PATCH] Fixed bug with primaryKey formatting (#1) * Added descriptive variables to dht.mjs * removed unnecessary specifications * Added descriptive variable and comment to key.msj * Update dht.mjs * added correct formatting method to key.mjs * Update dht.mjs * Update dht.mjs & key.mjs --- dht.mjs | 6 +++--- key.mjs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dht.mjs b/dht.mjs index aa17610..167dc2b 100644 --- a/dht.mjs +++ b/dht.mjs @@ -13,10 +13,10 @@ export default function useDHT () { useEffect(() => { if (primaryKey === null) return + const keyPair = DHT.keyPair(primaryKey) + const ws = new window.WebSocket('wss://dht1-relay.leet.ar:49443') // + add more relays - const dht = new DHT(new Stream(true, ws), { - keyPair: DHT.keyPair(b4a.from(primaryKey, 'hex')) - }) + const dht = new DHT(new Stream(true, ws), { keyPair }) setDHT(dht) diff --git a/key.mjs b/key.mjs index 114bd00..fa2f0e3 100644 --- a/key.mjs +++ b/key.mjs @@ -13,7 +13,7 @@ export default function useKey () { window.localStorage.setItem('primary-key', primaryKey) } - setKey(b4a.from(primaryKey)) + setKey(b4a.from(primaryKey, 'hex')) }, []) return [key]