feat(03-01): TTL-only KV location-pin layer under the existing privacy gates (GEO-03, PRIV-02)

- kv/location-pin.ts mirrors sessions.ts shape: writePin/getPin/clearPin, key loc:<chat_id> (chat-scoped, claim-derived — never user-id scoped across keys)
- PIN_TTL_SECONDS=300; writePin is the only write path, expirationTtl on the same line referencing the named constant
- getPin is a defensive read: parse guard + shape guard + |lat|<=90 / |lon|<=180 range guard (V5 Input Validation) — corrupt records return null
- privacy.test.mjs: storageModules now scans kv/location-pin.ts, so PG1 (same-line TTL) and PG2 (no persistence-shaped exports) apply automatically
This commit is contained in:
araharah-executor
2026-10-22 23:25:59 +08:00
parent 9376cabca2
commit 4fbbb0b516
2 changed files with 81 additions and 1 deletions
+2 -1
View File
@@ -22,7 +22,8 @@ import { test } from "./harness.mjs";
const SRC = path.join(fileURLToPath(new URL(import.meta.url)), "..", "..", "src");
const storageModules = ["kv/sessions.ts"].map((rel) => path.join(SRC, ...rel.split("/")));
const storageModules = ["kv/sessions.ts", "kv/location-pin.ts"]
.map((rel) => path.join(SRC, ...rel.split("/")));
const webhookModule = path.join(SRC, "webhook.ts");
if (existsSync(webhookModule)) storageModules.push(webhookModule);