接入 WebAuthn 第二因素与 PostgreSQL 凭据仓储

This commit is contained in:
2026-09-27 18:29:52 +00:00
parent 6d040658c8
commit 45994e3919
25 changed files with 874 additions and 23 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
export type CsrfToken = { name: string; value: string };
export type CsrfToken = { name: string; value: string; headerName: string };
type PageBase = {
name: string;
@@ -10,7 +10,8 @@ type PageBase = {
export type SignInContext = PageBase & (
| { step: "password" }
| {
step: "mfa-pending";
step: "mfa-pending" | "mfa-complete";
passkey: "unavailable" | "register" | "authenticate";
identity: {
username: string;
subjectId: string;
@@ -25,7 +26,7 @@ export function readPageContext(): SignInContext {
const data = document.getElementById("login-context")?.textContent;
if (!data) throw new Error("Missing login page context");
const context: SignInContext = JSON.parse(data);
if (context.step !== "password" && context.step !== "mfa-pending") {
if (context.step !== "password" && context.step !== "mfa-pending" && context.step !== "mfa-complete") {
throw new Error("Unknown login step");
}
return context;