feat(web): add lightweight workspace matching existing UI

This commit is contained in:
2026-11-11 16:59:09 -08:00
parent bc92651509
commit b7fdf7a89c
37 changed files with 2415 additions and 291 deletions
+25
View File
@@ -0,0 +1,25 @@
import assert from "node:assert/strict";
import test from "node:test";
import { browserUuid } from "../src/lib/browser-uuid.ts";
test("native UUID generation keeps the crypto receiver", () => {
const source = {
randomUUID() { assert.equal(this, source); return "native-id"; },
getRandomValues() { assert.fail("native generation should be used"); },
};
assert.equal(browserUuid(source), "native-id");
});
test("older browsers generate RFC 4122 version 4 UUIDs using secure random bytes", () => {
const source = { getRandomValues(bytes) {
assert.equal(this, source);
assert.equal(bytes.length, 16);
for (let i = 0; i < bytes.length; i++) bytes[i] = i;
return bytes;
} };
assert.equal(browserUuid(source), "00010203-0405-4607-8809-0a0b0c0d0e0f");
});
test("missing secure randomness never falls back to a guessable identifier", () => {
assert.throws(() => browserUuid({}), /Secure browser identifiers are unavailable/);
});