diff --git a/frontend/src/components/DeviceList.vue b/frontend/src/components/DeviceList.vue index e2801392..f916ca49 100644 --- a/frontend/src/components/DeviceList.vue +++ b/frontend/src/components/DeviceList.vue @@ -124,7 +124,7 @@ async function determineMyDevice() { throw new Error('User not initialized.'); } const browserKeys = await BrowserKeys.load(me.value.id); - const browserId = await browserKeys.id(); + const browserId = await browserKeys?.id(); myDevice.value = me.value.devices.find(d => d.id == browserId); } @@ -138,7 +138,7 @@ async function determineMyDevice() { // /* decrypt user key on this browser: */ // const userPublicKey = crypto.subtle.importKey('spki', base64.parse(me.value.publicKey), UserKeys.KEY_DESIGNATION, false, []); // const browserKeys = await BrowserKeys.load(me.value.id); -// const browserId = await browserKeys.id(); +// const browserId = await browserKeys?.id(); // const browser = me.value.devices.find(d => d.id === browserId); // if (!browser || !browser.userPrivateKey) { // throw new Error('Browser not validated.'); diff --git a/frontend/src/components/ManageSetupCode.vue b/frontend/src/components/ManageSetupCode.vue index 032f3a37..9837cf48 100644 --- a/frontend/src/components/ManageSetupCode.vue +++ b/frontend/src/components/ManageSetupCode.vue @@ -75,6 +75,9 @@ async function fetchData() { throw new Error('User not initialized.'); } const browserKeys = await BrowserKeys.load(me.id); + if (browserKeys == null) { + throw new Error('Browser keys not found.'); + } const browserId = await browserKeys.id(); const myDevice = me.devices.find(d => d.id == browserId); if (myDevice == null) { diff --git a/frontend/src/components/RegenerateSetupCodeDialog.vue b/frontend/src/components/RegenerateSetupCodeDialog.vue index 331152a0..fce75f43 100644 --- a/frontend/src/components/RegenerateSetupCodeDialog.vue +++ b/frontend/src/components/RegenerateSetupCodeDialog.vue @@ -156,6 +156,9 @@ async function regenerateSetupCode() { throw new Error('User not initialized.'); } const browserKeys = await BrowserKeys.load(me.id); + if (browserKeys == null) { + throw new Error('Browser keys not found.'); + } const browserId = await browserKeys.id(); const myDevice = me.devices.find(d => d.id == browserId); if (myDevice == null) { diff --git a/frontend/src/components/VaultDetails.vue b/frontend/src/components/VaultDetails.vue index 7af50134..31e3a185 100644 --- a/frontend/src/components/VaultDetails.vue +++ b/frontend/src/components/VaultDetails.vue @@ -280,6 +280,9 @@ async function loadVaultKeys(vaultKeyJwe: string): Promise { throw new Error('User not initialized.'); } const browserKeys = await BrowserKeys.load(me.value.id); + if (browserKeys == null) { + throw new Error('Browser keys not found.'); + } const browserId = await browserKeys.id(); const myDevice = me.value.devices.find(d => d.id == browserId); if (myDevice == null) {