Compare commits

..

No commits in common. "f71d8f86858398e3f7e50146f15ad14e13aa040f" and "be22b771f54daf51861320e1a0bfd8c43dc39047" have entirely different histories.

2 changed files with 7 additions and 12 deletions

View File

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

View File

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