Skip to content

Commit

Permalink
fixed linter errors with undefined browserKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Jan 9, 2024
1 parent 4b81e24 commit d0c3d47
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/components/DeviceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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.');
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/ManageSetupCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/RegenerateSetupCodeDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/VaultDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ async function loadVaultKeys(vaultKeyJwe: string): Promise<VaultKeys> {
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) {
Expand Down

0 comments on commit d0c3d47

Please sign in to comment.