mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
web: fix app lock verification always succeeds
This commit is contained in:
@@ -27,7 +27,8 @@ import {
|
|||||||
CredentialType,
|
CredentialType,
|
||||||
CredentialWithSecret,
|
CredentialWithSecret,
|
||||||
CredentialWithoutSecret,
|
CredentialWithoutSecret,
|
||||||
useKeyStore
|
useKeyStore,
|
||||||
|
wrongCredentialError
|
||||||
} from "../../interfaces/key-store";
|
} from "../../interfaces/key-store";
|
||||||
import { showToast } from "../../utils/toast";
|
import { showToast } from "../../utils/toast";
|
||||||
import { WebAuthn } from "../../utils/webauthn";
|
import { WebAuthn } from "../../utils/webauthn";
|
||||||
@@ -412,7 +413,8 @@ async function authenticateAppLock() {
|
|||||||
if (!defaultCredential) {
|
if (!defaultCredential) {
|
||||||
return verifyAccount();
|
return verifyAccount();
|
||||||
}
|
}
|
||||||
return !!(await verifyCredential(defaultCredential, (c) =>
|
return !!(await verifyCredential(defaultCredential, async (c) => {
|
||||||
useKeyStore.getState().verifyCredential(c)
|
if (!(await useKeyStore.getState().verifyCredential(c)))
|
||||||
));
|
throw new Error(wrongCredentialError(c));
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ function deserializeCredential(
|
|||||||
throw new Error("Credentials are of different types.");
|
throw new Error("Credentials are of different types.");
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrongCredentialError(query: CredentialQuery): string {
|
export function wrongCredentialError(query: CredentialQuery): string {
|
||||||
switch (query.type) {
|
switch (query.type) {
|
||||||
case "password":
|
case "password":
|
||||||
return "Wrong password";
|
return "Wrong password";
|
||||||
|
|||||||
Reference in New Issue
Block a user