Compare commits

...

3 Commits

2 changed files with 12 additions and 7 deletions

View File

@ -3,6 +3,7 @@ import config from "../config";
import * as bip39 from "@scure/bip39";
import { wordlist } from "@scure/bip39/wordlists/english";
import { errorExit } from "./error.js";
import b4a from "b4a";
const BIP44_PATH = "m/44'/1627'/0'/0'/0'";
@ -24,5 +25,8 @@ export function getHDKey(): HDKey {
export function getKeyPair(): { publicKey: Uint8Array; secretKey: Uint8Array } {
const key = getHDKey();
return { publicKey: key.publicKeyRaw, secretKey: key.privateKey };
return {
publicKey: key.publicKeyRaw,
secretKey: b4a.concat([key.privateKey, key.publicKeyRaw]),
};
}

View File

@ -13,7 +13,6 @@ import sodium from "sodium-universal";
import b4a from "b4a";
import log from "../log.js";
import { getKeyPair } from "../lib/seed.js";
import { AddressInfo } from "net";
const LUMEWEB = b4a.from("lumeweb");
export const LUMEWEB_TOPIC_HASH = b4a.allocUnsafe(32);
@ -29,13 +28,15 @@ export async function start() {
const bootstrap = DHT.bootstrapper(49737, "0.0.0.0");
await bootstrap.ready();
const address = bootstrap.address() as AddressInfo;
const address = bootstrap.address();
node = new Hyperswarm({
keyPair,
dht: new DHT({ keyPair }),
bootstrap: [{ host: address.address, port: address.port }].concat(
dht: new DHT({
keyPair,
bootstrap: [{ host: address.host, port: address.port }].concat(
require("@hyperswarm/dht/lib/constants").BOOTSTRAP_NODES
),
}),
});
// @ts-ignore