*Make default topic hash an exported const

This commit is contained in:
Derrick Hammer 2022-12-04 12:03:09 -05:00
parent 4121e23fd9
commit 0e6c84c566
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 3 deletions

View File

@ -18,6 +18,8 @@ import sodium from "sodium-universal";
import b4a from "b4a";
const LUMEWEB = b4a.from("lumeweb");
export const LUMEWEB_TOPIC_HASH = b4a.allocUnsafe(32);
sodium.crypto_generichash(LUMEWEB_TOPIC_HASH, LUMEWEB);
export type SecretStream = any;
@ -38,13 +40,11 @@ export async function start() {
const keyPair = getKeyPair();
node = new Hyperswarm({ keyPair, dht: new DHT({ keyPair }) });
const topic = b4a.allocUnsafe(32);
sodium.crypto_generichash(topic, LUMEWEB);
// @ts-ignore
await node.dht.ready();
await node.listen();
node.join(topic);
node.join(LUMEWEB_TOPIC_HASH);
return node;
}