Release Crypto Tools 0.1.0

This commit is contained in:
2026-09-01 02:44:39 +02:00
commit 4b75f819e2
57 changed files with 9159 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
import { expect, test, type Page } from "@playwright/test";
const ORIGIN = "http://127.0.0.1:4173";
async function localOnly(page: Page) {
const external: string[] = [];
await page.route("**/*", async (route) => {
const url = new URL(route.request().url());
if (url.origin !== ORIGIN) {
external.push(url.href);
await route.abort();
} else await route.continue();
});
return external;
}
test("runs from a nested path without external requests", async ({ page }) => {
const errors: string[] = [];
page.on("pageerror", (error) => errors.push(error.message));
page.on("console", (message) => {
if (message.type() === "error") errors.push(message.text());
});
const external = await localOnly(page);
await page.goto("/deep/nested/crypto/");
await expect(
page.getByRole("heading", { name: "Crypto Tools" }),
).toBeVisible();
expect(external).toEqual([]);
expect(errors).toEqual([]);
});
test("inspects a JWK and computes its local thumbprint", async ({ page }) => {
const external = await localOnly(page);
await page.goto("/deep/nested/crypto/");
await page.getByRole("button", { name: "Inspect locally" }).click();
await expect(page.getByRole("heading", { name: "1 object" })).toBeVisible();
await expect(page.getByText("RFC 7638 SHA-256 thumbprint")).toBeVisible();
await expect(page.getByText(/^[A-Za-z0-9_-]{43}$/u)).toBeVisible();
await expect(page.getByText(/does not use or imply trust/u)).toBeVisible();
expect(external).toEqual([]);
});
test("serves the release identity and hardened headers", async ({
request,
}) => {
const index = await request.get("/deep/nested/crypto/");
expect(index.ok()).toBe(true);
expect(index.headers()["content-security-policy"]).toContain(
"default-src 'self'",
);
expect(await index.text()).not.toMatch(/\b(?:src|href)=["']\//u);
const manifest = await request.get("/deep/nested/crypto/toolbox-app.json");
await expect(manifest.json()).resolves.toMatchObject({
id: "de.add-ideas.crypto-tools",
version: "0.1.0",
entry: "./",
});
});