*Extract keypair logic to a helper function

This commit is contained in:
Derrick Hammer 2022-09-22 10:17:37 -04:00
parent 668e427b8c
commit 36da04bdfe
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 3 deletions

View File

@ -19,15 +19,19 @@ let node: {
};
let server: any;
async function start() {
export function getKeyPair() {
const seed = config.str("seed");
let err = validSeedPhrase(seed);
if (err !== null) {
errorExit("RELAY_SEED is invalid. Aborting.");
errorExit("LUME_WEB_RELAY_SEED is invalid. Aborting.");
}
const keyPair = deriveMyskyRootKeypair(seedPhraseToSeed(seed)[0]);
return deriveMyskyRootKeypair(seedPhraseToSeed(seed)[0]);
}
async function start() {
const keyPair = getKeyPair();
node = new DHT({ keyPair });