fix: bootstrap portal list and set portal key

This commit is contained in:
Derrick Hammer 2023-07-18 09:58:29 -04:00
parent 3ccbe7c8a1
commit 4a50742ea0
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,8 @@ import {
downloadObject,
Err,
getActivePortals,
maybeInitDefaultPortals,
setActivePortalMasterKey,
} from "@lumeweb/libweb";
import { log, logErr, sendAuthUpdate } from "./util.js";
import {
@ -26,13 +28,21 @@ export function boot() {
}
log("user is already logged in, attempting to load kernel");
setUserKey(userKey as Uint8Array);
setUserKey(userKey);
setActivePortalMasterKey(userKey);
setLoginComplete(true);
sendAuthUpdate();
loadKernel();
}
export async function loadKernel() {
let [, portalLoadErr] = maybeInitDefaultPortals();
if (portalLoadErr) {
let err = addContextToErr(portalLoadErr, "unable to init portals");
setKernelLoaded(err);
return;
}
let [kernelCode, err] = await downloadDefaultKernel();
if (err !== null) {