Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
test(core): migrate a fully-protected v214 database end-to-end
Elian Dorand163fbe6dbde
diff --git a/apps/standalone/src/lightweight/crypto_provider.spec.ts b/apps/standalone/src/lightweight/crypto_provider.spec.tsindex d0b81064b6..c35b1cfa29 100644--- a/apps/standalone/src/lightweight/crypto_provider.spec.ts+++ b/apps/standalone/src/lightweight/crypto_provider.spec.ts@@ -1,3 +1,4 @@+import { createHash as nodeCreateHash, createHmac as nodeCreateHmac } from "node:crypto";import { afterEach, beforeEach, describe, expect, it } from "vitest";import aesjs from "aes-js";@@ -25,6 +26,39 @@ describe("BrowserCryptoProvider hashing", () => {});});+describe("BrowserCryptoProvider parity with the Node.js provider", () => {+ // The same document is opened by both the server/desktop (node:crypto) and the standalone+ // app (this provider), so every digest must be byte-identical across the two. The binary+ // vector is deliberately NOT valid UTF-8: a regression here once routed bytes through a+ // lossy UTF-8 decode (invalid sequences become U+FFFD), which passed for strings and+ // ASCII-ish bytes but made protected binary notes fail their integrity digest and decrypt+ // to empty on standalone/mobile.+ const allBytes = Uint8Array.from({ length: 256 }, (_, i) => i); // contains invalid UTF-8+ const largeBinary = Uint8Array.from({ length: 50_000 }, (_, i) => (i * 31 + 7) % 256);+ const utf8String = "héllo — 世界";++ it("createHash matches node:crypto for strings and for (invalid-UTF-8) binary content", () => {+ for (const algorithm of ["md5", "sha1", "sha512"] as const) {+ for (const content of [utf8String, allBytes, largeBinary]) {+ const expected = new Uint8Array(nodeCreateHash(algorithm).update(content).digest());+ expect(provider.createHash(algorithm, content), `${algorithm} of ${typeof content === "string" ? "string" : `${content.length} bytes`}`).toEqual(expected);+ }+ }+ });++ it("hmac matches node:crypto for string and binary secrets/values", () => {+ const cases: [string | Uint8Array, string | Uint8Array][] = [+ ["secret", "value"],+ [allBytes, largeBinary],+ ["secret", allBytes]+ ];+ for (const [secret, value] of cases) {+ const expected = nodeCreateHmac("sha256", secret).update(value).digest("base64");+ expect(provider.hmac(secret, value)).toBe(expected);+ }+ });+});+describe("BrowserCryptoProvider random helpers", () => {it("randomBytes returns the requested size", () => {expect(provider.randomBytes(8)).toHaveLength(8);diff --git a/apps/standalone/src/lightweight/crypto_provider.ts b/apps/standalone/src/lightweight/crypto_provider.tsindex f9ee391b4b..96270e9bca 100644--- a/apps/standalone/src/lightweight/crypto_provider.ts+++ b/apps/standalone/src/lightweight/crypto_provider.ts@@ -22,7 +22,13 @@ const FORCE_B64_FALLBACK = typeof __TRILIUM_FORCE_B64_FALLBACK__ !== "undefined"export default class BrowserCryptoProvider implements CryptoProvider {createHash(algorithm: "md5" | "sha1" | "sha512", content: string | Uint8Array): Uint8Array {- const data = binary_utils.unwrapStringOrBuffer(content);+ // Hash the raw bytes. Binary content must NOT be routed through unwrapStringOrBuffer+ // (UTF-8 decoding): it is lossy for non-UTF-8 bytes (invalid sequences become U+FFFD),+ // which produced digests diverging from the Node.js provider — e.g. protected binary+ // notes encrypted on server/desktop failed their integrity digest here and decrypted+ // to empty. For strings this is equivalent to before (the js-* libs UTF-8 encode+ // string inputs internally).+ const data = binary_utils.wrapStringOrBuffer(content);let hexHash: string;if (algorithm === "md5") {@@ -65,10 +71,11 @@ export default class BrowserCryptoProvider implements CryptoProvider {}hmac(secret: string | Uint8Array, value: string | Uint8Array): string {- const secretStr = binary_utils.unwrapStringOrBuffer(secret);- const valueStr = binary_utils.unwrapStringOrBuffer(value);+ // Same byte-vs-string rationale as createHash above: never UTF-8-decode binary inputs.+ const secretBytes = binary_utils.wrapStringOrBuffer(secret);+ const valueBytes = binary_utils.wrapStringOrBuffer(value);// sha256.hmac returns hex, convert to base64 to match Node's behavior- const hexHash = sha256.hmac(secretStr, valueStr);+ const hexHash = sha256.hmac(secretBytes, valueBytes);const bytes = new Uint8Array(hexHash.length / 2);for (let i = 0; i < hexHash.length; i += 2) {bytes[i / 2] = parseInt(hexHash.substr(i, 2), 16);diff --git a/packages/trilium-core/src/services/migration.spec.ts b/packages/trilium-core/src/services/migration.spec.tsindex 4961843f30..b629239165 100644--- a/packages/trilium-core/src/services/migration.spec.ts+++ b/packages/trilium-core/src/services/migration.spec.ts@@ -1,9 +1,18 @@+import { createHash } from "node:crypto";import { readFileSync } from "node:fs";import { dirname, join } from "node:path";import { fileURLToPath } from "node:url";import { describe, expect, it } from "vitest";+import becca from "../becca/becca.js";+import becca_loader from "../becca/becca_loader.js";import { getContext } from "./context.js";+import dataEncryption from "./encryption/data_encryption.js";+import hiddenSubtreeService from "./hidden_subtree.js";+import notesService from "./notes.js";+import protectedSessionService from "./protected_session.js";import { getSql } from "./sql/index.js";+import TaskContext from "./task_context.js";+import { encodeUtf8 } from "./utils/binary.js";// Resolve fixture path relative to this spec file. Spec files only ever run// under vitest (which uses ESM via Vite), so import.meta.url is available;@@ -25,4 +34,84 @@ describe("Migration", () => {});});}, 60_000);++ it("migrates from v214 with all notes protected", async () => {+ // The fixture is document_v214.db with every note (including the hidden subtree) protected:+ // titles and contents encrypted with a known data key. See generate-protected-fixture.mts.+ interface Manifest {+ password: string;+ dataKeyUtf8: string;+ noteCount: number;+ notes: Record<string, { title: string; contentSha256: string; contentLength: number }>;+ }+ const manifest: Manifest = JSON.parse(readFileSync(join(__dirname, "../test/fixtures/document_v214_protected.manifest.json"), "utf-8"));+ const dataKey = encodeUtf8(manifest.dataKeyUtf8);++ await new Promise<void>((resolve, reject) => {+ getContext().init(async () => {+ try {+ const dbBytes = readFileSync(join(__dirname, "../test/fixtures/document_v214_protected.db"));+ getSql().rebuildFromBuffer(dbBytes);++ // Stage 1: the whole boot sequence — migration, becca load, hidden subtree check —+ // must survive without a protected session, as it does on a real server start.+ protectedSessionService.resetDataKey();++ const migration = (await import("./migration.js")).default;+ await migration.migrateIfNecessary();++ becca_loader.load();+ expect(() => hiddenSubtreeService.checkHiddenSubtree()).not.toThrow();++ // Every original note survived the migration, still protected and with a content+ // blob. The only permitted exceptions are hidden system notes that the current+ // version deliberately deletes (enforceDeleted, e.g. _optionsImages) — a user+ // note must never vanish.+ const survivingNoteIds: string[] = [];+ for (const noteId of Object.keys(manifest.notes)) {+ const note = becca.notes[noteId];+ if (!note) {+ expect(noteId.startsWith("_"), `non-hidden note ${noteId} vanished after migration`).toBe(true);+ expect(getSql().getValue("SELECT isDeleted FROM notes WHERE noteId = ?", [noteId]), `hidden note ${noteId} is gone but not marked deleted`).toBe(1);+ continue;+ }+ expect(note.isProtected, `note ${noteId} lost protection`).toBe(true);+ expect(note.blobId, `note ${noteId} has no content blob`).toBeTruthy();+ survivingNoteIds.push(noteId);+ }++ // Stage 2: with the session key every title and every content decrypts to the+ // exact pre-migration plaintext recorded in the manifest.+ protectedSessionService.setDataKey(dataKey);+ for (const noteId of survivingNoteIds) {+ const expected = manifest.notes[noteId];+ const note = becca.getNoteOrThrow(noteId);++ const rawTitle = getSql().getValue<string>("SELECT title FROM notes WHERE noteId = ?", [noteId]);+ expect(dataEncryption.decryptString(dataKey, rawTitle), `title of ${noteId}`).toBe(expected.title);++ const content = note.getContent();+ const contentBytes = typeof content === "string" ? encodeUtf8(content) : content;+ expect(createHash("sha256").update(contentBytes).digest("hex"), `content of ${noteId} (${expected.contentLength} bytes)`)+ .toBe(expected.contentSha256);+ }++ // Stage 3 (#10549): the boot created the built-in templates unprotected. Protect the+ // whole tree again — as the affected user did — then restart-check without a session.+ const rootNote = becca.getNoteOrThrow("root");+ notesService.protectNoteRecursively(rootNote, true, true, new TaskContext("test-protect-all", "protectNotes", { protect: true }));+ expect(getSql().getValue("SELECT count(*) FROM notes WHERE isProtected = 0 AND isDeleted = 0")).toBe(0);++ protectedSessionService.resetDataKey();+ expect(() => hiddenSubtreeService.checkHiddenSubtree()).not.toThrow();++ resolve();+ } catch (e) {+ reject(e);+ } finally {+ protectedSessionService.resetDataKey();+ }+ });+ });+ }, 120_000);});diff --git a/packages/trilium-core/src/test/fixtures/document_v214_protected.db b/packages/trilium-core/src/test/fixtures/document_v214_protected.dbnew file mode 100644index 0000000000..27908564e4Binary files /dev/null and b/packages/trilium-core/src/test/fixtures/document_v214_protected.db differdiff --git a/packages/trilium-core/src/test/fixtures/document_v214_protected.manifest.json b/packages/trilium-core/src/test/fixtures/document_v214_protected.manifest.jsonnew file mode 100644index 0000000000..59e466096c--- /dev/null+++ b/packages/trilium-core/src/test/fixtures/document_v214_protected.manifest.json@@ -0,0 +1,1092 @@+{+ "password": "demo1234",+ "dataKeyUtf8": "0123456789abcdef",+ "noteCount": 217,+ "notes": {+ "root": {+ "title": "root",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "NLVTrl7bcB9z": {+ "title": "Trilium Demo",+ "contentSha256": "e8a495fa4183673c21071cf65d23af95266ae9b384b110a5edba05740505431c",+ "contentLength": 2172+ },+ "Sz10SiopYlBg": {+ "title": "Formatting examples",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "QGqhmyLnIdYs": {+ "title": "School schedule",+ "contentSha256": "b01873d77a38ed34895f5708a6c20bcbf9c83400ac11f911b0314cf679cac889",+ "contentLength": 1454+ },+ "7Nf30iooU3v2": {+ "title": "Checkbox lists",+ "contentSha256": "bfd5703deea403a5bb34c57c56852df1e209a0ed3f7b24dd31ba3c8ae4f72716",+ "contentLength": 1049+ },+ "IkrAKpszvvHy": {+ "title": "Highlighting",+ "contentSha256": "78f362cee1dd8dc4915a197345d907c076940e0d2f185d87c3447ee7ae8e60c8",+ "contentLength": 1442+ },+ "IY11I77ooLZQ": {+ "title": "Code blocks",+ "contentSha256": "f7a50c0335692967315e0d4e05a445f87c06e057b684952504e715e9889f7758",+ "contentLength": 464+ },+ "SjSvHYBHU63J": {+ "title": "Math",+ "contentSha256": "fb911e1d8ae6d666bb83c22a8fe2399194b3618db002c56f871f3342eac35c72",+ "contentLength": 769+ },+ "JxBlPWuGObs6": {+ "title": "Inbox",+ "contentSha256": "74b78ab73bac5ae4bafe767145b70b9ed7c58a2037835bbf93b598a393ab92c7",+ "contentLength": 152+ },+ "bwxXir2zUWfQ": {+ "title": "Grocery list for today",+ "contentSha256": "40a505c41b5551944d84bc8d1af6db00df745ace7d28255e77e403786ebb3a56",+ "contentLength": 173+ },+ "dyxtThziZRfH": {+ "title": "Book to read",+ "contentSha256": "8ef257bd43d859cb385db4555dc998e5acb35d7985fc61e8a1d6dd8ffccf2303",+ "contentLength": 841+ },+ "KraR4sIPJZAT": {+ "title": "The Last Question",+ "contentSha256": "3a859325020102d32397880dc50ee35a1a32dbe768af7df747f703cb12c9e2dc",+ "contentLength": 908+ },+ "ZEKQz5L7n3sm": {+ "title": "The Last Question by Issac Asimov.pdf",+ "contentSha256": "0180798e74d32a745d76d8d76cb9ec76d924d903231966f65d89436dadac15c1",+ "contentLength": 49359+ },+ "cQY3fX4qDICB": {+ "title": "Journal",+ "contentSha256": "89cd5c6eca30cb4eb1729079888918545d8895d1f95d4bdf869fa6ff6a2c84d0",+ "contentLength": 247+ },+ "T7BZo7qTKFg5": {+ "title": "2021",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "sdAHxYrIGzsj": {+ "title": "11 - November",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "SmmqlD0E8M6Y": {+ "title": "28 - Tuesday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "TYEmkGGgsBbw": {+ "title": "Phone call about work project",+ "contentSha256": "d729e3a0b7e64afe969ca60c3dbeee1f20513ca8d31e42e8b6cfc03bcea369f0",+ "contentLength": 82+ },+ "oVDKnhTZNMd6": {+ "title": "Christmas gift ideas",+ "contentSha256": "28fbdc3cd731c62462f0a5e32358af07894b298850ffc987988cd9cb6f1328dd",+ "contentLength": 481+ },+ "YI5qdvnUkePf": {+ "title": "Trusted timestamping",+ "contentSha256": "ddae17647212754ab284b04747841cb2cfed39d26b502feea962e38c494d0b0f",+ "contentLength": 980+ },+ "JH5HeuUGrcCj": {+ "title": "12 - December",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "eih1k2rOp40B": {+ "title": "18 - Monday",+ "contentSha256": "e7b851ef4f1201646508a90ba74c2b75a152f0404cc0251a3df708c2fca5e316",+ "contentLength": 346+ },+ "A7qzPRcASXxk": {+ "title": "Meeting minutes",+ "contentSha256": "2e6363a5830f1623daa14b35964080fbc6e2b74104c65f61c4155c087a22ce62",+ "contentLength": 81+ },+ "cUQ560p9sc12": {+ "title": "Photos from the trip",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "qO2VdFk0o5aS": {+ "title": "01.jpeg",+ "contentSha256": "ca89e8cc1f5ff2a5aa369dadd5697baf905d50670032b984024185572f22a8b1",+ "contentLength": 16881+ },+ "4z2t0NfYesHP": {+ "title": "02.jpeg",+ "contentSha256": "95b2b27c3b6e8cbf6213f1b7869abb28d52cc5e5d201506a2e7a3e7bddc2fe38",+ "contentLength": 31697+ },+ "sEDH8N7956og": {+ "title": "03.jpeg",+ "contentSha256": "f1c05f39d5d0b242495b9048714514be7ea7e5336ba643e9f873e7d82d6171f3",+ "contentLength": 72522+ },+ "aCx2ltcZWU2h": {+ "title": "04.jpeg",+ "contentSha256": "7de738cf57ca479847a2a7ac5143f0727b0d4efa94db85331325744969ce0f7e",+ "contentLength": 43670+ },+ "cmvXV2ncD456": {+ "title": "05.jpeg",+ "contentSha256": "c48fbcd4c98a4f6cba138834c375d9465311cf4b294f7280e1123b0cf568c297",+ "contentLength": 22327+ },+ "LiTlket3FIoh": {+ "title": "06.jpeg",+ "contentSha256": "2a3178d76538858905e05a495511c22cf05f034229e25f9533933b0ecd9dbe40",+ "contentLength": 79751+ },+ "3PWp3M598kmY": {+ "title": "07.jpeg",+ "contentSha256": "04f38b739873c9b8cacaf8534d74495764a21f9ace813935bf4495c0ba783849",+ "contentLength": 30223+ },+ "T9MVbF8FHnjr": {+ "title": "08.jpeg",+ "contentSha256": "f2824f8875d4b20b1da57deeeb32c943f92f88934936dfe5f42025568f669385",+ "contentLength": 39928+ },+ "eYzu53rCEPDq": {+ "title": "09.jpeg",+ "contentSha256": "69bd3d9bfd97baf2d1a3c2b73b4b5b573382e46acf61c5be1c9305cb967d64bf",+ "contentLength": 48918+ },+ "FDnJO8VrHQTQ": {+ "title": "10.jpeg",+ "contentSha256": "7919fa3d5ecde59422c651edd5bfa25c1565698df0d055668cc4a79c7a7a2c60",+ "contentLength": 44150+ },+ "uL9mj0ztNCFd": {+ "title": "11.jpeg",+ "contentSha256": "8b5c6e2bf6b1e16d9f99b4558f450e39f5195f302c1d6f047906f4e6da345a11",+ "contentLength": 76231+ },+ "ms0GegbaPigS": {+ "title": "12.jpeg",+ "contentSha256": "b156b8cf63880e4cd39614f6d91d56f322ab973a627f39b39badd2fe27524f1c",+ "contentLength": 44286+ },+ "AZrm04SZ2jnI": {+ "title": "Send invites for christmas party",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "HqcraGQazC9M": {+ "title": "19 - Tuesday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "H2U5PhoNgdiD": {+ "title": "Dentist appointment",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "9puIcZKF274x": {+ "title": "20 - Wednesday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "YjZIQHurGTx6": {+ "title": "21 - Thursday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "bjNya8Ay9RE6": {+ "title": "Christmas shopping",+ "contentSha256": "9f6795152f512a7acb8667ae3bbd964ec3ce06e6fe5888d937f821d8ea49edb8",+ "contentLength": 80+ },+ "X5fxG6hUOG4M": {+ "title": "Office party",+ "contentSha256": "a27d29770aa000563e8a53bf39cd6fd6ba362aa82db0492ce7812868c4e13ff2",+ "contentLength": 56+ },+ "FQHVClYC4dfj": {+ "title": "22 - Friday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "CfHMLS30EOYv": {+ "title": "Christmas shopping",+ "contentSha256": "68fa6f0d27abc7fe160ed36a7d51bb43d37cc780b874ba4ad7dbea4979b3136c",+ "contentLength": 68+ },+ "sGydJ3DaaQpB": {+ "title": "The Mechanical",+ "contentSha256": "8130a58dfca91ceb1e7f56a6226bba2d4e072ef2e8ca2e30d68cc3caf8668ffa",+ "contentLength": 709+ },+ "SFeN3mH0fd9d": {+ "title": "Highlights",+ "contentSha256": "1f096023c15d4e4ec11e5c30a0ffb3ef012bbdec86952b6aea93f5d82b138e10",+ "contentLength": 1529+ },+ "oOyF3qblVt56": {+ "title": "23 - Saturday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "AWfTVznpMzyv": {+ "title": "24 - Sunday - Christmas Eve!",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "Zv77PtSU7LaE": {+ "title": "Buy a board game for Alice",+ "contentSha256": "c18ec0fa757e09b53109442d06e3285f650146f745b33d478abfedce3001115e",+ "contentLength": 358+ },+ "CGhAAMoDp7cr": {+ "title": "codenames.jpg",+ "contentSha256": "df57ae2b2b6b727522a581981637b4aaec8a7b830e05f1857c8542e99d042fb7",+ "contentLength": 7166+ },+ "Emh7CjERK8Di": {+ "title": "Buy milk",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "SjmAjPBRJVyu": {+ "title": "30 - Thursday",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "HpuAqmD6R6YY": {+ "title": "Epics",+ "contentSha256": "1fa210c296d521328db81b782785e17146f5fba0df5af8790e5776fe82b39022",+ "contentLength": 299+ },+ "pSMqzg0w6sBN": {+ "title": "Christmas",+ "contentSha256": "cc1a1c6d7849c5a2ef39326ef760207a5241de8fd8846a7c7657a98191782333",+ "contentLength": 104+ },+ "lxbhr2yc1UzZ": {+ "title": "Vacation days",+ "contentSha256": "e93faf3f760c52b7c5deffac35f6a17509c1b35b6d9ae091ed5014c34503bec6",+ "contentLength": 166+ },+ "RZ1TBPDrmbwE": {+ "title": "Christmas dinner",+ "contentSha256": "c3d6d2c6cabf6ea27658e88a3ee04f7db8a4174e1c0a22f8ab299f314b1869c0",+ "contentLength": 58+ },+ "mElF9vDuiYe1": {+ "title": "Shopping",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "kzGECogauimb": {+ "title": "Vacation",+ "contentSha256": "c117853934b560d451a4f5da65ac35aef81ac71d5e9baef275e6003623e37e32",+ "contentLength": 62+ },+ "4GynFifshe3s": {+ "title": "Day template",+ "contentSha256": "9321e90d6cbc78259db960572daee52caf623e16316aa1cf518f721dc161c145",+ "contentLength": 291+ },+ "mFl6ng3eSwvt": {+ "title": "Tech",+ "contentSha256": "9c3c06d95caa28d7b12e9262080ee932e43f477d6cd9eb2c1c4bb52d2577805b",+ "contentLength": 110+ },+ "v3UGXNkhtJcw": {+ "title": "Security",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "gsjs8NsLTCRL": {+ "title": "Linux",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "0JbhgrERz5UY": {+ "title": "History",+ "contentSha256": "86d8b53226b76ce3616c11fd9494162099132884512de417b034c2746faa4b03",+ "contentLength": 1059+ },+ "yzSrSUD5V9C3": {+ "title": "Bash scripting",+ "contentSha256": "2b219e27a66bca0f8a7361e5e0d89537f2f369e726ab5bcbdf5bb7d1863ae3fd",+ "contentLength": 1250+ },+ "dlpvzziHaHh4": {+ "title": "While loop",+ "contentSha256": "3f5d3b997742783b24f0b8875f0519c8d2ef0c2a21c94827dac57fbde5054d0c",+ "contentLength": 503+ },+ "spIketkEvKUA": {+ "title": "Bash startup modes",+ "contentSha256": "84c9d0a1ff26cf8490f1de8057a02f6360bcc5da86913e6e1d739f6646d96e93",+ "contentLength": 3890+ },+ "VXyXeiipZCxv": {+ "title": "Ubuntu",+ "contentSha256": "9c3c06d95caa28d7b12e9262080ee932e43f477d6cd9eb2c1c4bb52d2577805b",+ "contentLength": 110+ },+ "7NiCqkqg1jul": {+ "title": "Unity shortcuts",+ "contentSha256": "ee2a8596067b880e7ec97224665600290283e4f44a0762c234cdccbef0b02ca6",+ "contentLength": 1015+ },+ "nDWsp9kXRBKp": {+ "title": "Programming",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "mZOCUcrPIgBs": {+ "title": "Java",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "1d27FldXNdMg": {+ "title": "node.js",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "2jjwKDjFBlUX": {+ "title": "Intro",+ "contentSha256": "aaa3c7de18bba2b4aed7a4443a9aa9e66eefe24b72b0680e6e3552a994be8474",+ "contentLength": 867+ },+ "n1BDj21rtRiX": {+ "title": "Overview",+ "contentSha256": "3bc1983927709211496b900f8c7b1560c1135a50f6d40cd47855eb1c93e7fb1e",+ "contentLength": 2117+ },+ "4e0ylZp9rb25": {+ "title": "History",+ "contentSha256": "e25aca0bb1ec308ba0baf8d4804bc2cb8fe8007ddecb2929f8eba94b0645c360",+ "contentLength": 813+ },+ "5MpSOWtEUtF9": {+ "title": "Platform architecture",+ "contentSha256": "ed572410790e406339aeaaebd0177c841fa03b22ece632d7d0cfd5b5f0598392",+ "contentLength": 813+ },+ "ahZqJ7DC1tb7": {+ "title": "Industry support",+ "contentSha256": "62de42caf6607c66a57b09739d6748eaea3bd01e33c270266dcf122b1f703d73",+ "contentLength": 456+ },+ "AWldGshhXSvU": {+ "title": "Releases",+ "contentSha256": "638e5cb20f9b65a8135d39c427431222f09bbb0939617625d5878d2c5cd3ced3",+ "contentLength": 538+ },+ "YE323zsRZ6cN": {+ "title": "Steel Blue",+ "contentSha256": "e42addd6964b6963e07b713798b94f9bbec2b070d11e198df0561fc4abcd58af",+ "contentLength": 2830+ },+ "WPe2rFs0RYal": {+ "title": "eb-garamond-v9-latin-regular.woff2",+ "contentSha256": "5e2ef0dc81b39e94e1517a9ee4600644cf05dd382682460a5fcdc3dd9ed8b57d",+ "contentLength": 27608+ },+ "U0cotKEZn96D": {+ "title": "raleway-v12-latin-regular.woff2",+ "contentSha256": "3650de8bc2dd8352b01aa49e9f0ae225098e86a31da32b04d81abb76b598d0d6",+ "contentLength": 20444+ },+ "sQeNftoWOKQr": {+ "title": "My Family Tree",+ "contentSha256": "5d32e7146ed83d5a2e351986e894f68958306cc16ae66312b47ff589e78fbc28",+ "contentLength": 265+ },+ "Iu3E3zFieycP": {+ "title": "Prince Phillip",+ "contentSha256": "c2c69a8547c4bfde0ac6f0c3a8fa0363e57c4e10906308f0e2272e4a01b25412",+ "contentLength": 4615+ },+ "h54fs85XBaER": {+ "title": "Prince Philip.jpg",+ "contentSha256": "b465b0e7b09e34c2cbfec44a6a0ed181b787c0d886f5711ecc0c98b4c6f076a6",+ "contentLength": 3671+ },+ "tHAN76L2nNoK": {+ "title": "Queen Elizabeth II.",+ "contentSha256": "26d6ed88c40644910ec23657aa02350bd8045185832db4afc9b9c82842baf9c2",+ "contentLength": 3057+ },+ "4B5HtJmTXzbM": {+ "title": "Queen Elizabeth.jpg",+ "contentSha256": "95a0b0e93a406c0b1e7c2752be021a42b70a4cb57796eff5087b353197cafc32",+ "contentLength": 2366+ },+ "w3noOsXI4MkU": {+ "title": "Prince Charles",+ "contentSha256": "b5d7bf425d5e900b91f5548fede36fe9e06223c97d8ab3ac51e1bf40228107b0",+ "contentLength": 5963+ },+ "FFAB3FsXy4D0": {+ "title": "Prince Charles.jpg",+ "contentSha256": "d6d6bba0870992ce702aad638b6ce677db4383718561fa97eba98fe0f4755bf0",+ "contentLength": 2428+ },+ "vTShqY8hTPCE": {+ "title": "Princess Diana",+ "contentSha256": "c74ef12c72a81ae2e69b366953fe152b7f0b2e95f243ef22da43974277d9c179",+ "contentLength": 4207+ },+ "h72DEKZJ6awL": {+ "title": "Princess Diana.jpg",+ "contentSha256": "2f6e3be53c7682dbda86fda26f4034ac5081f5a61c269be7766fbf334b397514",+ "contentLength": 3491+ },+ "cuWqUdoaoGI2": {+ "title": "Person template",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "oQnd9ft8Tw9Z": {+ "title": "Work",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "HQiYyYQrx8iD": {+ "title": "HR",+ "contentSha256": "f37b496533302b085b296f8393ab9ea2d6adffedb1bccd694bc178f739a423c4",+ "contentLength": 76+ },+ "V7ViDpm8mrgp": {+ "title": "Processes",+ "contentSha256": "4d4e37f52d42b6fea7d2c9fdb747c30d4f6f4328b3136931bf2caafe0890d967",+ "contentLength": 77+ },+ "dGwaIQ87Ehrl": {+ "title": "Projects",+ "contentSha256": "9fc214cad96ad8bf68535f1b61e29f09a503ebd3c30a5053430058fdd5b7f525",+ "contentLength": 128+ },+ "5lgQKQe9Vw5Q": {+ "title": "Books",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "wvDeNPsHNT2r": {+ "title": "To read",+ "contentSha256": "e6b1eba1a2621e051e402be5be0233ebeb892aa08bccf9def7c6202d15e4f8b1",+ "contentLength": 889+ },+ "oBwX7YJjvuTH": {+ "title": "Book template",+ "contentSha256": "e904401cc6b399fe49355b8f1e0375224ab687ab1ab17aef768c2e64a8f55df6",+ "contentLength": 448+ },+ "33MN6BbxqY3H": {+ "title": "Highlights",+ "contentSha256": "8dcbdcac5f3c29bd2fef4a174fe8310799f6403356f44232a28cf5c5ced981ea",+ "contentLength": 147+ },+ "FISVtXkk8Nxc": {+ "title": "Reviews",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "Aa1EFD1VhYqS": {+ "title": "trilium-icon.png",+ "contentSha256": "0f00e6c09e14ec33903697e1fcba5db2525258ca7aca0e7aa5bfe299b6f28ca8",+ "contentLength": 24381+ },+ "iCfgT756sHHO": {+ "title": "Mermaid Diagrams",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "Dw4amj4S0HqJ": {+ "title": "Flow",+ "contentSha256": "66c281b392a8b66919577386b030f50ac1040cae496aa3be7be887eaee2dd79f",+ "contentLength": 99+ },+ "n9TU3BcdXWaf": {+ "title": "Sequence",+ "contentSha256": "9cdd652cb06da5a4e4fa9357e35b30e17afed7e3e1d136ec4d2584dcc29dc1c6",+ "contentLength": 232+ },+ "HruKLR9WNkWI": {+ "title": "Gantt",+ "contentSha256": "7f8a7d950d2a701a54b057253fcd49e454f902d7538b62a6e51470349f50b79b",+ "contentLength": 290+ },+ "IOzodNuotIal": {+ "title": "Class",+ "contentSha256": "fc041a464739a47589e653dbdf17ca3ded7d5422605590a8163287258e9588a0",+ "contentLength": 293+ },+ "OikObBnvlv0f": {+ "title": "State",+ "contentSha256": "1cbf2387108dfc109fce2998cd3a29e8c3db96306da9860bb189c5ff349492b7",+ "contentLength": 108+ },+ "9XrJvmtBEHrU": {+ "title": "Pie",+ "contentSha256": "53cdf5880e1a23209d3986f24b6993d626a73ada631dfd6c618e26d52ad9f342",+ "contentLength": 40+ },+ "SR2L7CYEZOOk": {+ "title": "Journey",+ "contentSha256": "1e97c141a51a62e588da52f5fd1e21171371238569edb842871a891ac440ffda",+ "contentLength": 198+ },+ "O0qO8SiGX1Mv": {+ "title": "Git",+ "contentSha256": "56df0eed6dd7d2848f684027481a45ce18493586cc6e39de56812c63bfc97884",+ "contentLength": 153+ },+ "gh7fpU6FNNTg": {+ "title": "Entity Relationship",+ "contentSha256": "bd3178b60a3acae88851bf31788c2cc0defe53e234eefd4870b7f51f708ab161",+ "contentLength": 401+ },+ "gqMUs4qWAUCY": {+ "title": "Scripting examples",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "HGhvhMEr565k": {+ "title": "Word count widget",+ "contentSha256": "f478965aab5d892a3815d8b08f47958810cdbb7b18e1b5a23ce3cd8ca41d6d22",+ "contentLength": 2051+ },+ "RN3piqJTA3qs": {+ "title": "Weight Tracker",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "5po2jJsRkuhs": {+ "title": "Implementation",+ "contentSha256": "14affe3a1d40610f898cd2fe7922ad4adf8b4b00090953e35c0e97751e772602",+ "contentLength": 183+ },+ "oAtw6DdDKuvU": {+ "title": "JS code",+ "contentSha256": "45a179f9e075f5e2a02f926d796c69d83d66cb5f62cf41a6c5db0bc240273f52",+ "contentLength": 1098+ },+ "cdSzlaxzewLK": {+ "title": "chart.js",+ "contentSha256": "636e8032f6887eb675110538f697fa1f8433553ace23c9bdc1060a91fb41b78b",+ "contentLength": 194890+ },+ "IxOkR0MjisYp": {+ "title": "Statistics",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "PoRtPrvy9s3u": {+ "title": "Attribute count",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "8WPazDeLSZyM": {+ "title": "template",+ "contentSha256": "c1ce123b8c19a6f1cc39349caa2e847d090c42ad9d98a68de43f3eba0af903c1",+ "contentLength": 290+ },+ "C98Oavuv1eqI": {+ "title": "js",+ "contentSha256": "77389daaa0e97992e8006aef60716bd5f34454a72161a59cde513477429cd691",+ "contentLength": 345+ },+ "QeINuXjnPEdH": {+ "title": "renderPieChart",+ "contentSha256": "1c850a86d50ce20379b1e63bf4f0797926d69c94e1db5997bca0643d3282ab7e",+ "contentLength": 1711+ },+ "yeJQf1PBb41U": {+ "title": "chartjs-plugin-datalabels.min.js",+ "contentSha256": "9cd3fed8f6b5d6bbdb4acab137c53b4201b3991ff18a58f8dfe38a9bf0efc20b",+ "contentLength": 12694+ },+ "t1d3SBz3S1xc": {+ "title": "renderTable",+ "contentSha256": "4838c3ee0a860d085103042292cbc0f022fa475608413cf04bb32e6fddda86d7",+ "contentLength": 453+ },+ "LoZfsr43WYI2": {+ "title": "Largest notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "hZIzQLF1p24D": {+ "title": "template",+ "contentSha256": "9ea352ce5808171aa2a758126d6ecca92c4312fec58e9b53313f53118656f666",+ "contentLength": 270+ },+ "TMX3KO1uk4T5": {+ "title": "js",+ "contentSha256": "6fe0693d8451d71504bba246e3432438201e7fe057c95e2a02767aed3e5bd8d6",+ "contentLength": 973+ },+ "P9Ktq1BuG4Di": {+ "title": "Most edited notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "HmZlaBAv9rNV": {+ "title": "template",+ "contentSha256": "30fe5d0ac9df9a6619216537dd07e9902b23435911c13944db5e35afbde467a0",+ "contentLength": 261+ },+ "rdH4MzZepFIc": {+ "title": "js",+ "contentSha256": "43731e7196e43457372628dd489c9a3f03da4109ab70534a1c9982798c0f38a9",+ "contentLength": 679+ },+ "jWHgAKEcbvSa": {+ "title": "Most linked notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "axQJ56NPCfad": {+ "title": "template",+ "contentSha256": "2e32cd759f4d4b8ada48e4f1abc7e1e15099c99baf2064d5bdc665e236d091b7",+ "contentLength": 291+ },+ "i1IQAjUvfjdD": {+ "title": "js",+ "contentSha256": "a23ff9fc3c65bba5faa2eb25474f72c5f17b3dd1dde1dde058650daa1b23cc02",+ "contentLength": 770+ },+ "YLO6hSqJOZoX": {+ "title": "Note type count",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "ccsUcKbVlRqx": {+ "title": "template",+ "contentSha256": "a07ad543693da09d3bab0fa4c5a5be0cbb664ca46f2a68cf907aa06170297a2a",+ "contentLength": 336+ },+ "FNRgdlDJr4OZ": {+ "title": "js",+ "contentSha256": "47ea6714048328372870e445b73794e6710045412c5ecc6a6601f4b1ec41a04c",+ "contentLength": 517+ },+ "opvrWBvqzpfX": {+ "title": "renderTable",+ "contentSha256": "887e53e8b3df111af0561ed59b9465d464a3340103420b0159be1e1f6e076728",+ "contentLength": 661+ },+ "YUQIUFaddBEu": {+ "title": "Most cloned notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "xMEtXDNRGWd5": {+ "title": "template",+ "contentSha256": "66fb86b27cc73b95f99d42d24e8103f88b4a27b0e032eb3bea4e1072ebeb8e11",+ "contentLength": 202+ },+ "ewhPwLpx7NvQ": {+ "title": "js",+ "contentSha256": "328dfa408aba4aecdff059cb1edad82cd5994b72293415073ca543840aaa06ce",+ "contentLength": 723+ },+ "syaiNmmDoHLL": {+ "title": "Custom request handler",+ "contentSha256": "fc4bb202bfb8105d7158e8ca8b97eab848aa4ea8eb8b8efc016f8531ee96bece",+ "contentLength": 1288+ },+ "tKt8stHilBD1": {+ "title": "Task manager",+ "contentSha256": "f2d132c7a471fe7d34a1c63199b12e43e9f56b677633dbda21f876ad4caa0375",+ "contentLength": 411+ },+ "Hxg6spdaolK4": {+ "title": "Locations",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "CJMIbAYWCCxa": {+ "title": "gym",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "f0J3976o5aht": {+ "title": "work",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "un1cB050bBXj": {+ "title": "Send invites for christmas party",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "iRFgzUz61r6f": {+ "title": "tesco",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "agMLHEWxIiyG": {+ "title": "Buy milk",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "J4qnd0NFG8bP": {+ "title": "mall",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "bVtirhDTdbzs": {+ "title": "Buy some book for Bob",+ "contentSha256": "8e3be61fc1dcadb2c606336540ee41614340de7ba238261d9b02b8ac7fb5cef5",+ "contentLength": 131+ },+ "IPjHfoS1Et3U": {+ "title": "Maybe Black Swan?",+ "contentSha256": "d36766246745a0d977c88e9e39ebabdc2c05a7267f0af59e2b7fa01d4b75a1ab",+ "contentLength": 946+ },+ "6yX1ls8dA1cN": {+ "title": "Done",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "dyGx5W5RXMss": {+ "title": "Buy a board game for Alice",+ "contentSha256": "a963ef19a1eea9c9f65901abe3ff169229b947d4aed9a7c6446972c0fff07e57",+ "contentLength": 358+ },+ "ZSkIfUlQ9A7j": {+ "title": "codenames.jpg",+ "contentSha256": "df57ae2b2b6b727522a581981637b4aaec8a7b830e05f1857c8542e99d042fb7",+ "contentLength": 7166+ },+ "aHWTfWUINeqd": {+ "title": "Dentist appointment",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "ZruQIT2L55gG": {+ "title": "Get a gym membership",+ "contentSha256": "3787dff3c1c1506e15e29bbee83783584935cb7a2dabb6590d62daf03ff0a7cf",+ "contentLength": 104+ },+ "Cbz17kF6AjaV": {+ "title": "TODO",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "OA9SiMPCiVQx": {+ "title": "Implementation",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "3ST8v0XUxjR8": {+ "title": "attribute changed",+ "contentSha256": "593069ab8b2184b6b2b73e4d8c3bd2ae558a01566d8f7899624af49f74897fc5",+ "contentLength": 2017+ },+ "6rsT1FBUl1vr": {+ "title": "reconcileAssignments",+ "contentSha256": "6f376522b9acc0b7c1e631ae794d2fdaa13db38bc2b41ff69c8f2580a64bf7d3",+ "contentLength": 915+ },+ "ICKCyJNiKYFv": {+ "title": "CSS",+ "contentSha256": "b9f101dc5c1c84f1a508b78de7cec28bff43dcbd1a7615438d708a84baf6462f",+ "contentLength": 148+ },+ "Jni9eIZWHrHL": {+ "title": "task template",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "0Sr4vVN5JaFB": {+ "title": "createNewTask",+ "contentSha256": "75e37030af5be1583c1b19f09a27c4fed6880299c0b8574b44fcf0bfc7fd0c34",+ "contentLength": 546+ },+ "6g7S0SXn5WgD": {+ "title": "Tags",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "ARbWrcNFv4HV": {+ "title": "health",+ "contentSha256": "bf27333cf389fcceeb1339f9ff9368657dcafbad2fce733543711476a9fdcf13",+ "contentLength": 43+ },+ "366OgW6qSAVq": {+ "title": "shopping",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "mcrHVT8Zy39b": {+ "title": "groceries",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "ErFdyKZeZsDA": {+ "title": "christmas",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "9CRCX4smM9oQ": {+ "title": "Create Launcher",+ "contentSha256": "77a298d647e4948cc9b33418fb47faa85e91f86c2c84530bcd0a267b1c4131da",+ "contentLength": 282+ },+ "BbMqOXV1p23y": {+ "title": "Canvas note",+ "contentSha256": "f04abbc2b342708b368b03f045af4a86d0099e7147aa5e447d8b6e666f8ec3fe",+ "contentLength": 65423+ },+ "_hidden": {+ "title": "Hidden Notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_search": {+ "title": "Search History",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_globalNoteMap": {+ "title": "Note Map",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_sqlConsole": {+ "title": "SQL Console History",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_share": {+ "title": "Shared Notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_bulkAction": {+ "title": "Bulk Action",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_backendLog": {+ "title": "Backend Log",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_userHidden": {+ "title": "User Hidden",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplRoot": {+ "title": "Launch Bar Templates",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplBase": {+ "title": "Base Abstract Launcher",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplCommandLauncher": {+ "title": "Command Launcher",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplNoteLauncher": {+ "title": "Note Launcher",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplScriptLauncher": {+ "title": "Script Launcher",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplBuiltinWidget": {+ "title": "Built-in Widget",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplSpacer": {+ "title": "Spacer",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbTplCustomWidget": {+ "title": "Custom Widget",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbRoot": {+ "title": "Launch Bar",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbAvailableLaunchers": {+ "title": "Available Launchers",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbBackInHistory": {+ "title": "Go to Previous Note",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbForwardInHistory": {+ "title": "Go to Next Note",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbBackendLog": {+ "title": "Backend Log",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbVisibleLaunchers": {+ "title": "Visible Launchers",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbNewNote": {+ "title": "New Note",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbSearch": {+ "title": "Search Notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbJumpTo": {+ "title": "Jump to Note",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbNoteMap": {+ "title": "Note Map",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbCalendar": {+ "title": "Calendar",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbRecentChanges": {+ "title": "Recent Changes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbSpacer1": {+ "title": "Spacer",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbBookmarks": {+ "title": "Bookmarks",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbToday": {+ "title": "Open Today's Journal Note",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbSpacer2": {+ "title": "Spacer",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbProtectedSession": {+ "title": "Protected Session",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_lbSyncStatus": {+ "title": "Sync Status",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_options": {+ "title": "Options",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsAppearance": {+ "title": "Appearance",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsShortcuts": {+ "title": "Shortcuts",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsTextNotes": {+ "title": "Text Notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsCodeNotes": {+ "title": "Code Notes",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsImages": {+ "title": "Images",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsSpellcheck": {+ "title": "Spellcheck",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsPassword": {+ "title": "Password",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsEtapi": {+ "title": "ETAPI",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsBackup": {+ "title": "Backup",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsSync": {+ "title": "Sync",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsOther": {+ "title": "Other",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ },+ "_optionsAdvanced": {+ "title": "Advanced",+ "contentSha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",+ "contentLength": 0+ }+ }+}diff --git a/packages/trilium-core/src/test/fixtures/generate-protected-fixture.mts b/packages/trilium-core/src/test/fixtures/generate-protected-fixture.mtsnew file mode 100644index 0000000000..8689c89339--- /dev/null+++ b/packages/trilium-core/src/test/fixtures/generate-protected-fixture.mts@@ -0,0 +1,138 @@+/*+ * Generates document_v214_protected.db (+ .manifest.json) from document_v214.db.+ *+ * The protected fixture is the same v214 (pre-blobs schema) database with EVERY note protected:+ * all titles and all note_contents encrypted with a fixed, known data key, simulating a user who+ * ran "protect subtree" over their whole tree (including the hidden subtree) before upgrading.+ * It backs the "migrates from v214 with all notes protected" spec in services/migration.spec.ts.+ *+ * The original fixture's password is unknown, but since it contains no protected notes the+ * credentials can simply be replaced: new salts, a verification hash for the password below, and+ * an encryptedDataKey wrapping the fixed data key. The encryption scheme mirrors+ * services/encryption/data_encryption.ts (AES-128-CBC, 16-byte random IV, 4-byte SHA-1 digest+ * prefix, base64 output) — it is deliberately reimplemented here on top of node:crypto so the+ * generator stays a standalone script that does not need the core platform initialized.+ *+ * entity_changes hashes are intentionally left stale — the migration path never verifies them and+ * recomputing them is not worth coupling this script to the sync hash implementation.+ *+ * Regenerate with:+ * npx tsx packages/trilium-core/src/test/fixtures/generate-protected-fixture.mts+ *+ * Note: the output is not byte-reproducible (encryption IVs are random), but it is+ * content-equivalent across runs; the manifest captures the plaintext for verification.+ */++import Database from "better-sqlite3";+import { createCipheriv, createHash, randomBytes, scryptSync } from "node:crypto";+import { copyFileSync, writeFileSync } from "node:fs";+import { dirname, join } from "node:path";+import { fileURLToPath } from "node:url";++const __dirname = dirname(fileURLToPath(import.meta.url));++const SOURCE = join(__dirname, "document_v214.db");+const TARGET = join(__dirname, "document_v214_protected.db");+const MANIFEST = join(__dirname, "document_v214_protected.manifest.json");++// Known credentials of the generated fixture; mirrored in migration.spec.ts.+const PASSWORD = "demo1234";+const DATA_KEY = Buffer.from("0123456789abcdef", "utf8"); // exactly 16 bytes+const VERIFICATION_SALT = "protectedFixtureVerificationSalt";+const DERIVED_KEY_SALT = "protectedFixtureDerivedKeySalt";++const SCRYPT_OPTIONS = { N: 16384, r: 8, p: 1 };++// --- mirror of data_encryption.encrypt ---++function pad(data: Buffer): Buffer {+ if (data.length > 16) {+ return data.subarray(0, 16);+ }+ if (data.length < 16) {+ return Buffer.concat([data, Buffer.alloc(16 - data.length)]);+ }+ return data;+}++function encrypt(key: Buffer, plainText: Buffer): string {+ const iv = randomBytes(16);+ const cipher = createCipheriv("aes-128-cbc", pad(key), pad(iv));+ const digest = createHash("sha1").update(plainText).digest().subarray(0, 4);+ const encrypted = Buffer.concat([cipher.update(Buffer.concat([digest, plainText])), cipher.final()]);+ return Buffer.concat([iv, encrypted]).toString("base64");+}++// --- generation ---++copyFileSync(SOURCE, TARGET);+const db = new Database(TARGET);++// Replace the (unknown) password with the known one and wrap the fixed data key with it,+// mirroring scrypt.ts getVerificationHash/getPasswordDerivedKey and password_encryption.setDataKey.+const verificationHash = scryptSync(PASSWORD, VERIFICATION_SALT, 32, SCRYPT_OPTIONS).toString("base64");+const derivedKey = scryptSync(PASSWORD, DERIVED_KEY_SALT, 32, SCRYPT_OPTIONS);+const encryptedDataKey = encrypt(derivedKey, DATA_KEY);++const setOption = db.prepare("UPDATE options SET value = ? WHERE name = ?");+setOption.run(VERIFICATION_SALT, "passwordVerificationSalt");+setOption.run(DERIVED_KEY_SALT, "passwordDerivedKeySalt");+setOption.run(verificationHash, "passwordVerificationHash");+setOption.run(encryptedDataKey, "encryptedDataKey");++// Protect every note: encrypt the title and the content, exactly as the v214-era code stored+// protected notes (base64 ciphertext in the TEXT columns).+interface ManifestEntry {+ title: string;+ contentSha256: string;+ contentLength: number;+}+const manifestNotes: Record<string, ManifestEntry> = {};++const updateNote = db.prepare("UPDATE notes SET isProtected = 1, title = ? WHERE noteId = ?");+const updateContent = db.prepare("UPDATE note_contents SET content = ? WHERE noteId = ?");++const notes = db.prepare("SELECT noteId, title FROM notes").all() as { noteId: string; title: string }[];+const contents = db.prepare("SELECT noteId, content FROM note_contents").all() as { noteId: string; content: string | Buffer | null }[];+const contentByNoteId = new Map(contents.map((row) => [row.noteId, row.content]));++const transaction = db.transaction(() => {+ for (const note of notes) {+ updateNote.run(encrypt(DATA_KEY, Buffer.from(note.title, "utf8")), note.noteId);++ const content = contentByNoteId.get(note.noteId) ?? Buffer.alloc(0);+ const contentBuffer = typeof content === "string" ? Buffer.from(content, "utf8") : (content ?? Buffer.alloc(0));+ updateContent.run(encrypt(DATA_KEY, contentBuffer), note.noteId);++ manifestNotes[note.noteId] = {+ title: note.title,+ contentSha256: createHash("sha256").update(contentBuffer).digest("hex"),+ contentLength: contentBuffer.length+ };+ }+});+transaction();++// Sanity check within the old schema: everything is protected now.+const unprotected = db.prepare("SELECT count(*) FROM notes WHERE isProtected = 0").pluck().get();+if (unprotected !== 0) {+ throw new Error(`Generation failed: ${unprotected} notes left unprotected`);+}++db.close();++writeFileSync(+ MANIFEST,+ `${JSON.stringify(+ {+ password: PASSWORD,+ dataKeyUtf8: DATA_KEY.toString("utf8"),+ noteCount: notes.length,+ notes: manifestNotes+ },+ null,+ 4+ )}\n`+);++console.log(`Generated ${TARGET} (${notes.length} notes protected) and manifest.`);