From 49739eaac85f2d7b982fa223bb53682d67e62d19 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 21 Sep 2022 16:40:10 -0400 Subject: [PATCH] *If we don't have a seed, create one by saving to the config folder as account.json --- src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.ts b/src/index.ts index 2bb75e3..ae87bca 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,9 +6,19 @@ import config from "./config.js"; import { loadPlugins } from "./modules/plugin.js"; import { start as startDns } from "./modules/dns.js"; import { start as startSSl } from "./modules/ssl.js"; +import { generateSeedPhraseDeterministic } from "libskynet"; +import * as crypto from "crypto"; log.setDefaultLevel(config.str("log-level")); +if (!config.str("seed")) { + config.saveConfigJson("account.json", { + seed: generateSeedPhraseDeterministic( + crypto.randomBytes(100).toString("hex") + ), + }); +} + async function boot() { await loadPlugins(); await startApp();