Skip to content

Build your personal knowledge base with Trilium Notes

docs: a container inspector needs 40 bytes, not 32

Elian Doran9eb50ced4759
diff --git a/docs/Developer Guide/Developer Guide/Interoperability/Trilium Backup Container (.tnbackup) file format.md b/docs/Developer Guide/Developer Guide/Interoperability/Trilium Backup Container (.tnbackup) file format.md
index 0c5511f7d4..d741873938 100644
--- a/docs/Developer Guide/Developer Guide/Interoperability/Trilium Backup Container (.tnbackup) file format.md
+++ b/docs/Developer Guide/Developer Guide/Interoperability/Trilium Backup Container (.tnbackup) file format.md
@@ -66,7 +66,7 @@ packet-beta
### Trailer
-The last {`TRAILER_BYTES`} = 40 bytes of every container, and the only part of it that could not be written until the payload was complete.
+The last 40 bytes of every container, and the only part of it that could not be written until the payload was complete.
| Offset from EOF | Size | Field | Value |
| --- | --- | --- | --- |
@@ -129,7 +129,7 @@ A version that appends fields raises the version byte, so an older reader reject
### Identifying a container
-What a container is, it states in the clear. The version, both flags and the plaintext size all sit in the first 32 bytes and none of them are encrypted, so a reader can tell a compressed backup from an encrypted one, and say what a backup was made from, **without the passphrase and without touching the payload**. Listing a directory of backups costs 32 bytes a file, whatever the files weigh.
+What a container is, it states in the clear. The version, the timestamp, both flags and the plaintext size all sit in the first 40 bytes and none of them are encrypted, so a reader can tell a compressed backup from an encrypted one, and date it and size it, **without the passphrase and without touching the payload**. Listing a directory of backups costs 40 bytes a file, whatever the files weigh.
A reader doing only this still applies the same checks as any other: the magic, the version, and the reserved flag bits. What it cannot make sense of it should report as an unidentified file rather than as a failure, so that one damaged container cannot derail a listing.
diff --git a/packages/trilium-backup-container/src/format.ts b/packages/trilium-backup-container/src/format.ts
index 16901656a0..2b03eec139 100644
--- a/packages/trilium-backup-container/src/format.ts
+++ b/packages/trilium-backup-container/src/format.ts
@@ -222,7 +222,7 @@ export interface FixedHeader {
}
/**
- * Parses and validates the 32 bytes every container starts with, which is as far as a reader can
+ * Parses and validates the 40 bytes every container starts with, which is as far as a reader can
* get before it knows how long the header is.
*
* @param buffer the first {@link FIXED_HEADER_BYTES} bytes of the file.