*If we don't have a seed, create one by saving to the config folder as account.json

This commit is contained in:
Derrick Hammer 2022-09-21 16:40:10 -04:00
parent 8d19edb8e0
commit 49739eaac8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 0 deletions

View File

@ -6,9 +6,19 @@ import config from "./config.js";
import { loadPlugins } from "./modules/plugin.js"; import { loadPlugins } from "./modules/plugin.js";
import { start as startDns } from "./modules/dns.js"; import { start as startDns } from "./modules/dns.js";
import { start as startSSl } from "./modules/ssl.js"; import { start as startSSl } from "./modules/ssl.js";
import { generateSeedPhraseDeterministic } from "libskynet";
import * as crypto from "crypto";
log.setDefaultLevel(config.str("log-level")); log.setDefaultLevel(config.str("log-level"));
if (!config.str("seed")) {
config.saveConfigJson("account.json", {
seed: generateSeedPhraseDeterministic(
crypto.randomBytes(100).toString("hex")
),
});
}
async function boot() { async function boot() {
await loadPlugins(); await loadPlugins();
await startApp(); await startApp();