logicsrc/apps/logicsrc-web/src/app/sitemap.ts
Anthony Ettinger 13519e631a Add the LogicSRC OpenCreds specification
Leaving a password manager means writing every secret you own to disk in
the clear, and losing whatever the spreadsheet had no column for. A CSV
is plaintext by construction, lossy by omission, and carries no
integrity: nothing in it says which rows were meant to be there, so a
truncated import looks exactly like a complete one.

The same gap showed up inside LogicSRC. `logicsrc credentials` moves
.env secrets and SSH keys through end-to-end-encrypted team vaults, but
it can only model a key/value pair. A card, a passport, a login with a
TOTP seed, or an OAuth account with a refresh token are all things
people already keep in a vault, and none of them are a key/value pair.

OpenCreds defines three things: the item, the vault, and the database.

- Six item types (login, card, identity, note, key, account) as one
  record with a type and a named field group, so everything the user
  typed lives in a single encrypted blob. Codes 1-4 match MarkSyncr's
  deployed vault and are not renumbered; compatibility is cheaper than
  elegance.
- AES-256-GCM over that record with the item id bound as AAD. Without
  it, anyone with storage write access could move a low-value login's
  ciphertext into a high-value row and watch what the user does next.
- A key hierarchy where the user key is random, not derived, so a
  password change re-wraps 32 bytes rather than re-encrypting a vault.
  The auth hash comes out of a different HKDF label than the wrap key,
  which is what lets it reach a server at all.
- A portable .opencreds file, encrypted by default, whose header is the
  AAD over the payload -- so the manifest is authenticated by the same
  tag as the data and a truncated import fails rather than reporting
  success. The plaintext form exists because people move to products
  that read nothing else; it is opt-in, confirmed, 0600, and labelled
  "protected": false in its own header.

Namespaces are carried as data, not fixed by the spec: labels are
compiled into every ciphertext a vault has written, so editing one does
not migrate a vault, it makes it undecryptable. MarkSyncr's deployed
vault is conformant by declaring `marksyncr`.

Ships: prd/0004, nine spec pages under docs/opencreds/, six JSON
Schemas, the @logicsrc/opencreds reference implementation with CSV
importers for five products, `logicsrc vault` and the standalone
`opencreds` binary, and the spec page at logicsrc.com/opencreds.

`vault` rather than `creds` because `creds` is already an alias of
`logicsrc credentials`, and the two are different: one moves a pair
between providers, the other stores a record.

@logicsrc/validators now registers every schema by $id before
compiling, so the database schema can $ref the item and manifest
schemas rather than restating them.

120 tests, including CLI end-to-end coverage of the masking rules,
exit codes, and the manifest-mismatch path.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRQrfuwuYKKV5UB9kLHuX5
2026-08-29 10:00:07 +00:00

70 lines
2.6 KiB
TypeScript

import type { MetadataRoute } from "next";
import { publicClient } from "@/lib/supabase";
import { DOC_SLUGS } from "@/lib/docs";
export const dynamic = "force-dynamic";
function baseUrl(): string {
return (process.env.PUBLIC_URL ?? "https://logicsrc.com").replace(/\/$/, "");
}
// Static routes preserved from the legacy public/sitemap.xml.
const STATIC_ROUTES: Array<{
path: string;
changeFrequency: MetadataRoute.Sitemap[number]["changeFrequency"];
priority: number;
}> = [
{ path: "/", changeFrequency: "weekly", priority: 1.0 },
{ path: "/docs", changeFrequency: "weekly", priority: 0.9 },
{ path: "/openontology", changeFrequency: "weekly", priority: 0.9 },
{ path: "/opencreds", changeFrequency: "weekly", priority: 0.9 },
{ path: "/openprd", changeFrequency: "weekly", priority: 0.9 },
{ path: "/openontology/explore", changeFrequency: "daily", priority: 0.7 },
{ path: "/openspec", changeFrequency: "weekly", priority: 0.8 },
{ path: "/agent-swarm", changeFrequency: "weekly", priority: 0.8 },
{ path: "/agentbyte", changeFrequency: "weekly", priority: 0.8 },
{ path: "/credential-sharing", changeFrequency: "weekly", priority: 0.8 },
{ path: "/hire-us", changeFrequency: "weekly", priority: 0.8 },
{ path: "/pricing", changeFrequency: "monthly", priority: 0.7 },
{ path: "/blog", changeFrequency: "daily", priority: 0.7 },
{ path: "/about", changeFrequency: "monthly", priority: 0.6 },
{ path: "/terms", changeFrequency: "monthly", priority: 0.4 },
{ path: "/privacy", changeFrequency: "monthly", priority: 0.4 },
];
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
const base = baseUrl();
const staticEntries: MetadataRoute.Sitemap = STATIC_ROUTES.map((route) => ({
url: `${base}${route.path}`,
changeFrequency: route.changeFrequency,
priority: route.priority,
}));
const docEntries: MetadataRoute.Sitemap = DOC_SLUGS.map((slug) => ({
url: `${base}/docs/${slug}`,
changeFrequency: "monthly",
priority: 0.6,
}));
let postEntries: MetadataRoute.Sitemap = [];
try {
const supabase = publicClient();
const { data } = await supabase
.from("blog_posts")
.select("slug, published_at, updated_at")
.eq("status", "published")
.order("published_at", { ascending: false });
postEntries = (data ?? []).map((post) => ({
url: `${base}/blog/${post.slug}`,
lastModified: new Date(post.updated_at ?? post.published_at),
changeFrequency: "weekly",
priority: 0.6,
}));
} catch {
// If the DB is unreachable, still serve the static sitemap.
postEntries = [];
}
return [...staticEntries, ...docEntries, ...postEntries];
}