October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How a Tiny TypeScript Library Makes Audit Logs Tamper-Evident

A small TypeScript library links audit records into a SHA-256 hash chain. Here is what verification catches, what a full rewrite can evade, and when to look at transparency logs or a verifiable database.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A hash chain can make changes to an application audit log detectable: each record’s SHA-256 digest includes the preceding record’s digest, so editing, removing or reordering an entry breaks verification. The small TypeScript library chainlog described by Webfixerr demonstrates that approach with in-memory, JSONL-file and SQLite storage. It does not make logs tamper-proof; detecting a complete rewrite requires comparing the chain with a trusted head hash kept somewhere outside the log.

What the library does

Rather than replacing an application’s database or logging system, chainlog adds an integrity check to a sequence of audit records. Its central mechanism is a hash chain: each record is linked cryptographically to the one before it. The DEV Community article describes this as a small TypeScript library and demonstrates memory, JSONL-file and SQLite stores. Read the chainlog article.

The article presents the record digest in this form:

hash(entry) = SHA256(index + timestamp + data + prevHash)

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Here, prevHash is the preceding record’s digest. The first record begins the chain; each later record depends on its own fields and the record before it. Verification walks the sequence and checks whether the links and digests still match. If an entry changes, is removed or appears in a different order, the later links will no longer validate as expected.

What verification tells you—and what it cannot

A successful check means the records match the chain being checked. It does not establish that an event actually happened, that every relevant event was recorded, or that no one has replaced the entire log.

Rank #2
TypeScript Programming Language - Software Engineer & Coder T-Shirt
  • TypeScript implements a superset of syntax for strictly typed development, facilitating deep static analysis and enhanced development environment integration. The compiler translates source into standard script formats, ensuring parity across any runtime.
  • TypeScript is ideal for front-end developers, full-stack engineers, and software architects who build large-scale web applications. It serves those looking to improve code excellence, reduce bugs through static checking, and maintain complex projects more.
  • Lightweight, Classic fit, Double-needle sleeve and bottom hem

As the chainlog article puts it, “chainlog is tamper-evident, not tamper-proof.” Someone able to rewrite every record and recompute every digest can produce a new internally consistent chain. The check becomes meaningful against that attack only when the expected chain head—the final digest—is preserved independently of the log. The article suggests verifying against an expected head with verify(expectedHead). If the stored log has been rewritten, its new head will differ from the trusted value.

That outside reference must itself be protected and maintained independently enough to serve as a trustworthy comparison. Keeping the only copy of the head beside a log that the same person can rewrite does not provide that separation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Storage options described in the article

Store What the article describes Practical consideration
In memory A demonstrated storage option. Useful for examples or short-lived data; persistence and recovery depend on the surrounding application.
JSONL file A demonstrated file-based option. Fits a line-oriented file workflow; the article does not establish concurrency or recovery guarantees.
SQLite A demonstrated database-backed option. Offers local database storage; the article does not establish support for other database engines.

The article also describes a small storage interface, making the storage boundary explicit. Postgres, MySQL, MongoDB, Python and PHP support, along with an external anchoring helper, are mentioned as future plans in that article—not as demonstrated or verified current capabilities.

How to decide whether a local hash chain is enough

A library like chainlog is a plausible fit when an application needs to detect accidental or unauthorized edits to its existing audit-record sequence and can manage an independently stored expected head. Before relying on it, decide how your application will handle record ordering, concurrent writers, persistence failures, backups and head-hash retention. The article does not establish behavior or guarantees for those operational cases.

  • Choose a local hash-chain approach when integrating an integrity check into an existing application is the goal and you can protect a chain head outside the log.
  • Consider a transparency log when independent verification, inclusion proofs or consistency proofs are central requirements.
  • Consider a verifiable database when changing the storage layer is acceptable and cryptographic verification should be part of that database’s operating model.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How the alternatives differ

Approach What the cited project documents What changes for the operator
Application hash-chain library Chainlog’s article describes linked-record verification and memory, JSONL and SQLite stores. Source article Integrate with the application and maintain a trusted expected head separately if full-log rewrites are in scope.
Transparency log Google’s Trillian documentation describes append-only logs using Merkle trees, inclusion and consistency proofs, and signed tree heads. Trillian project Use a proof-oriented model rather than relying only on a local sequence and external head. Trillian’s project page says it is in maintenance mode and recommends Tessera to new log operators.
Verifiable database immudb documents structured audit events in its cryptographically verifiable key-value store. immudb audit events Adopt a database with its own storage and operational dependencies, then fit application writes, queries and verification to that model.

These options address integrity through different operating models; they are not interchangeable drop-in implementations. A hash chain detects divergence from a trusted head, a transparency log provides a proof-oriented append-only view, and a verifiable database makes the database itself part of the integrity design. The available description of chainlog does not establish a current release, maintenance status, independent security review or production use, so treat its article as an implementation description rather than a current assurance of project health.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.