Skip to content

Ids

One id generator per language (openspec item-identity, One Id Generator per Language). Every new record, event or correlation id comes from it.

Purpose UUID version Python (virtufin.worker_devkit.ids) TypeScript (@virtufin/worker-devkit) C# (Virtufin.Api.Client)
Record, event and correlation ids 7 (time-ordered) new_id() newId() Ids.NewId()
Tokens (lease tokens, one-time ids) 4 (random) new_token() newToken() Ids.NewToken()
Ids derived the same way every time 5 (SHA-1, name-based) derived_id(namespace, name) derivedId(namespace, name) Ids.DerivedId(namespace, name)
  • Ids are lower-case hyphenated text.
  • Version 7 ids sort by creation time across milliseconds, so listings sort by creation. Nothing orders by id, though: timestamps stay the source of truth for time.
  • A token is version 4 because version 7 carries a timestamp and less randomness.
  • An output's id derived from its input is derived_event_id / derivedEventId (see Behavior), a version 5 id in the redelivery namespace.

The C# helper lives in Virtufin.Api.Client, the lowest library the api, the WorkManager (Virtufin.Worker.Host) and this devkit all depend on; this devkit cannot host it, since it depends on Virtufin.Worker.Host.

TypeScript in the browser

The ids module imports nothing from node:: randomness comes from globalThis.crypto.getRandomValues and SHA-1 is plain TypeScript. A browser bundle imports it on its own:

import { newId } from "@virtufin/worker-devkit/dist/ids.js";

The package entry (@virtufin/worker-devkit) also exports it, but pulls in Node-only modules.