Compare commits
3 Commits
be22b771f5
...
f71d8f8685
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | f71d8f8685 | |
Derrick Hammer | 2c22c88e30 | |
Derrick Hammer | 14edcdc6ce |
|
@ -3,6 +3,7 @@ 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'";
|
||||||
|
|
||||||
|
@ -24,5 +25,8 @@ 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 { publicKey: key.publicKeyRaw, secretKey: key.privateKey };
|
return {
|
||||||
|
publicKey: key.publicKeyRaw,
|
||||||
|
secretKey: b4a.concat([key.privateKey, key.publicKeyRaw]),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ 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);
|
||||||
|
@ -29,13 +28,15 @@ 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() as AddressInfo;
|
const address = bootstrap.address();
|
||||||
node = new Hyperswarm({
|
node = new Hyperswarm({
|
||||||
keyPair,
|
keyPair,
|
||||||
dht: new DHT({ keyPair }),
|
dht: new DHT({
|
||||||
bootstrap: [{ host: address.address, port: address.port }].concat(
|
keyPair,
|
||||||
require("@hyperswarm/dht/lib/constants").BOOTSTRAP_NODES
|
bootstrap: [{ host: address.host, port: address.port }].concat(
|
||||||
),
|
require("@hyperswarm/dht/lib/constants").BOOTSTRAP_NODES
|
||||||
|
),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
Loading…
Reference in New Issue