This commit is contained in:
2025-12-19 22:23:16 +08:00
parent 064f67a2b9
commit 5ece041672
13 changed files with 106 additions and 97 deletions

View File

@@ -1,7 +1,7 @@
import { User } from "@/lib/types/user";
import { clientFetch } from "../client";
import { APIError } from "../common";
import { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from "@simplewebauthn/browser";
import { AuthenticationResponseJSON, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from "@simplewebauthn/browser";
export async function loginByPassword(identifier: string, password: string) {
identifier = identifier.trim();
@@ -85,7 +85,8 @@ export async function getLoginByPasskeyOptions() {
})
}
export async function loginByPasskey(credentialResponse: any) {
/** @lint-ignore */
export async function loginByPasskey(credentialResponse: AuthenticationResponseJSON) {
return clientFetch<{ user: User }>('/api/auth/passkey/login', {
method: 'POST',
body: JSON.stringify({