WORM Retention

Write-once-read-many records with retention-until immutability — the storage discipline regulators require for records that must not be altered or deleted before a retention period elapses (SEC 17a-4(f), CFTC 1.31, FINRA 4511, and the "immutable storage" controls in many sectoral postures). A WORM store enforces, on every mutating call, that a stored record cannot be overwritten or deleted while it is within its retention window or under a legal hold.

Two modes mirror the cloud Object-Lock model: in compliance mode (the default) a record cannot be deleted before its retainUntil time by anyone, including the operator; in governance mode a privileged caller may override with an explicit reason, which is audited. Retention can only be extended, never shortened. Every record carries a SHA3-512 content digest, so get detects tampering of the underlying bytes. Every allow/refuse decision is audited.

Storage is pluggable: create takes a synchronous store adapter (get / set / delete / has / keys) so the WORM policy layer sits over an operator's durable backend (a sealed DB table, an S3 Object-Lock bucket, a filesystem); the default in-memory adapter is for tests and ephemeral use.

b.worm.create(opts?) #

stable0.13.0sox-404soc2
{
  store:             object,   // adapter: get/set/delete/has/keys (default: in-memory)
  mode:              string,   // "compliance" (default) | "governance"
  defaultRetentionMs: number,  // applied when put() gives no retain time
  clock:             function, // () => epoch ms (default Date.now; for tests)
}

Create a WORM store that enforces write-once-read-many retention over a backing store. The returned instance has put, get, delete, extendRetention, placeLegalHold, releaseLegalHold, and list. Throws WormError on policy violations.

var w = b.worm.create({ mode: "compliance" });
w.put("invoice-42", pdfBytes, { retentionMs: b.C.TIME.days(2555) }); // 7y
w.get("invoice-42").data;            // → pdfBytes (digest verified)
w.delete("invoice-42");              // throws worm/retained until 2033

Last updated 2026-08-08T16:39:49.652Z by seeder.