Own sign-in with passkeys, open the entrance, market entry (26.11.2)
ci / olares chart · sanity (pull_request) Successful in 3s
ci / app · types + tests + build (pull_request) Successful in 3m7s
markt / eintrag (pull_request) Successful in 29s
release / which version (pull_request) Successful in 3s
release / olares chart · sanity (pull_request) Successful in 4s
release / app (pull_request) Successful in 59s
release / tag and release (pull_request) Skipped
ci / olares chart · sanity (pull_request) Successful in 3s
ci / app · types + tests + build (pull_request) Successful in 3m7s
markt / eintrag (pull_request) Successful in 29s
release / which version (pull_request) Successful in 3s
release / olares chart · sanity (pull_request) Successful in 4s
release / app (pull_request) Successful in 59s
release / tag and release (pull_request) Skipped
Setup with a code from /app/data, passkeys with required user verification, sessions as hashed cookies bound to the passkey they started with, single-use invitation and device links, removing a passkey or a member, and a recovery code for the owner. Cross-household lookups before sign-in run in withAuth() (app.auth), allowed only on the sign-in tables; a test pins that list. State-changing routes check the session and the Origin header. Security check with the login-sicherheit skill before the first invitation: docs/sicherheit/login-2026-11-06.md (no open findings above low). Entrance goes public now that the own sign-in exists; markt.yml creates the Lunch entry in aimighty-market and proves it with wrangler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HUc2nv7rJVU2gp3Bgtha3q
This commit is contained in:
1 parent
a62e48116a
commit
f423dd67ce
71 files changed
+3573
-32
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { mkdtempSync, readFileSync, statSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("server-only", () => ({}));
|
||||
|
||||
describe("setup code", () => {
|
||||
let dir: string;
|
||||
beforeEach(() => {
|
||||
dir = mkdtempSync(path.join(tmpdir(), "lunch-"));
|
||||
process.env.APP_DATA_DIR = dir;
|
||||
});
|
||||
|
||||
it("is written once, readable only by the app, and matches however it is typed", async () => {
|
||||
const { ensureSetupCode, setupCodeMatches, removeSetupCode, SETUP_FILE } = await import("@/lib/auth/codes");
|
||||
await ensureSetupCode();
|
||||
const file = path.join(dir, SETUP_FILE);
|
||||
const first = readFileSync(file, "utf8");
|
||||
await ensureSetupCode();
|
||||
expect(readFileSync(file, "utf8")).toBe(first);
|
||||
expect(statSync(file).mode & 0o777).toBe(0o600);
|
||||
|
||||
const code = first.split("\n").find((l) => /^[A-Z2-9]{4}(-[A-Z2-9]{4}){3}$/.test(l))!;
|
||||
expect(await setupCodeMatches(code)).toBe(true);
|
||||
expect(await setupCodeMatches(code.toLowerCase().replace(/-/g, " "))).toBe(true);
|
||||
expect(await setupCodeMatches(code.slice(0, -1) + (code.endsWith("A") ? "B" : "A"))).toBe(false);
|
||||
expect(await setupCodeMatches("")).toBe(false);
|
||||
|
||||
await removeSetupCode();
|
||||
expect(await setupCodeMatches(code)).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user