*Make default topic hash an exported const
This commit is contained in:
parent
4121e23fd9
commit
0e6c84c566
|
@ -18,6 +18,8 @@ import sodium from "sodium-universal";
|
||||||
import b4a from "b4a";
|
import b4a from "b4a";
|
||||||
|
|
||||||
const LUMEWEB = b4a.from("lumeweb");
|
const LUMEWEB = b4a.from("lumeweb");
|
||||||
|
export const LUMEWEB_TOPIC_HASH = b4a.allocUnsafe(32);
|
||||||
|
sodium.crypto_generichash(LUMEWEB_TOPIC_HASH, LUMEWEB);
|
||||||
|
|
||||||
export type SecretStream = any;
|
export type SecretStream = any;
|
||||||
|
|
||||||
|
@ -38,13 +40,11 @@ export async function start() {
|
||||||
const keyPair = getKeyPair();
|
const keyPair = getKeyPair();
|
||||||
|
|
||||||
node = new Hyperswarm({ keyPair, dht: new DHT({ keyPair }) });
|
node = new Hyperswarm({ keyPair, dht: new DHT({ keyPair }) });
|
||||||
const topic = b4a.allocUnsafe(32);
|
|
||||||
sodium.crypto_generichash(topic, LUMEWEB);
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await node.dht.ready();
|
await node.dht.ready();
|
||||||
await node.listen();
|
await node.listen();
|
||||||
node.join(topic);
|
node.join(LUMEWEB_TOPIC_HASH);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue