@umis/testkit gives you a demo world for the UMIS v1 profile and runs its hero scenario. Use it for demos, tests,
benchmarks and test vectors.
The world has three invented organisations. Alder Ridge Construction is the contractor, Nordkai Logistics is the supplier with the warehouse, and Lumera Software is a software company with an office door and an intranet. Four people hold credentials, and the world has signed trusted-issuer registries, status lists and a simulated clock. It needs no network and no server. Keys, credentials, identifiers and signatures come from fixed seeds, so the world is the same on every run.
The seeds are public, so the keys protect nothing. Never use the package for real credentials. It runs in Node only,
because its deterministic random source is synchronous and hashes its stream with node:crypto.
import { runHero } from '@umis/testkit';
const rows = await runHero(); // the four steps below; `{ steps: [3, 1] }` runs some of them, in that order
| Step | Who shows, who decides | Result |
|---|---|---|
| 1 | Noah Lindgren, Lumera Software | accept, a one-way QR code at the office door, decided from the member cache |
| 2 | Emma Clarke, Nordkai Logistics | accept, 10 t of rebar within her authority |
| 2 | Lucas Bennett, Nordkai Logistics | reject AUTHORITY_LIMIT_EXCEEDED, he holds only the 8 t delegated to him |
| 3 | Emma Clarke, Nordkai Logistics | accept, the first direction of a mutual exchange |
| 3 | Hanna Vogel, Alder Ridge Construction | accept, the second direction |
| 4 | Noah Lindgren, Lumera Intranet | accept, an OpenID4VP login that discloses only org and role |
Every row also carries the QR text that was checked in frame and frameChars, the time the verifier took in ms and
the outcome the scenario expects in expected. Step 4 runs in this process. The intranet makes a request with
createVpRequest, Noah’s wallet answers it with respondToVpRequest, and verifyVpResponse decides. A function that
stands in for fetch serves the status lists from memory.
import { createDemoWorld } from '@umis/testkit';
const world = await createDemoWorld(); // starts at 2026-11-02T08:00:00Z on the clock of the world
const context = world.context({ org: 'lumera', policy: 'door_low' }); // what that door decides with
world.revoke(jti); // marks a credential revoked, and every credential delegated from it
world.clock.advance(600);
await world.publish(); // signs every status list again at the time of the clock
world.orgs gives the organisations with their keys and registries. world.people gives the people with their
credentials and holder keys, and world.crypto the provider the world was made with. deterministicCrypto(seed) makes
that provider. It signs ES256 with RFC 6979 signatures and has a random source that repeats itself.
runBench measures how long a verifier takes to decide on a presentation in the demo world. It also plays two timelines
on the simulated clock. It is the engine of umis bench and needs Node.js.
import { runBench } from '@umis/testkit';
const summaries = await runBench({
scenarios: ['oneway-low', 'full-qr-low', 's1-accept', 's1-reject', 'mutual', 'oid4vp', 'gateway'],
n: 1000, // presentations in one repeat
repeats: 30, // repeats that are measured
warmup: 1, // repeats that are run first and thrown away
crypto: 'webcrypto', // or 'noble', the JavaScript implementation that stands in for the engine of Expo Go
seed: 'umis', // fixes keys, identifiers and salts; WebCrypto signatures stay random
out: 'bench-results/webcrypto', // a new or empty folder
});
runBench returns the summary of every scenario. When a presentation is decided otherwise than its scenario expects or
a timeline is off, it writes the files and then rejects with PROTOCOL. benchReport writes the same files and returns
the whole report instead of rejecting. The report holds the summaries, the two autonomy timelines, the revocation
timeline and ok. ok is true when every presentation came to the decision the scenario expects and both timelines
hold. Both functions take hooks as a second argument. progress hears what the run is doing, and signal stops it
between two repeats.
| Scenario | What is decided | Expected |
|---|---|---|
oneway-low |
a one-way QR code at the door, from the member cache | accept |
full-qr-low |
a full presentation as a QR code at the door | accept |
s1-accept |
the warehouse asks for 10 t of rebar and Emma, who holds 10 t, answers | accept |
s1-reject |
the same request, answered by Lucas, who holds 8 t | reject AUTHORITY_LIMIT_EXCEEDED |
mutual |
both decisions of a mutual exchange | accept |
oid4vp |
an OpenID4VP login, with the status lists fetched from memory | accept |
gateway |
the decision of the door and a signed relay command to an emulator over loopback HTTP | accept |
How a run works. Every repeat first makes n different presentations, untimed, and then decides them one after the
other against a new replay store. performance.now() times the one call that decides. The warm-up repeats are thrown
away. Every presentation is checked against the decision the scenario expects, the warm-up ones included. A different
decision counts as a mismatch and is never averaged away. Nothing in a timeline reads the wall clock. The run sets and
advances the clock of the world.
Percentiles are the nearest rank. That is the element at the 1-based rank ceil(p * n / 100) of the sorted times,
with the product taken first, so that whole numbers never round up by accident. The floating-point form p / 100 * n
gives 7.000000000000001 for p = 7 and n = 100, and so rank 8. Each s1 presentation answers its own request and no
ledger is kept across presentations, so s1-accept and s1-reject time independent decisions. Three rows time more
than one decision. mutual times both decisions of the exchange together. oid4vp times the decision of the provider
on the posted form, and the wallet’s part and the HTTP round trip happen before the timer starts. gateway times the
decision plus the signed relay command against a loopback emulator that is new for every repeat. One request opens the
connection first, so connection set-up is not in the figure. The spread is the sample standard deviation.
The run writes these files to out.
| File | Content |
|---|---|
env.json |
Node.js, system, processor, memory, load average, commit and package versions, the options |
summary.json |
the summary of every scenario and the report of the timelines, written last |
samples-<scenario>.csv |
repeat,i,ms,decision,reason for every timed presentation |
steps-<scenario>.csv |
the mean time of each of the nine steps of the pipeline |
sizes.csv |
characters of every QR text per scenario as count, minimum, median and maximum |
autonomy-low.csv |
80 hours at the door, a presentation every 5 minutes, as t,age_s,decision,reason |
autonomy-medium.csv |
30 hours at the warehouse in the same way. STATUS_LIST_STALE starts exactly one second after S |
revocation.csv |
t,online,offline, the reason an online and an offline verifier give for the revoked credential. The first refusal comes within Δ online and within the shorter of T and S offline |
ScenarioSummary holds p50, p95 and p99 over all the measured presentations, with mean, sd, min and max.
p95Mean is the mean of the p95 of the repeats, and p95Ci95 is the Student-t 95 % interval of that mean. A single
repeat gives no interval, so p95Ci95 is then null. The summary also holds mismatches, the characters of the QR
text in frameChars, and nfrP1Pass, which is true when the p95 over all presentations is at most one second. P95 is
the nearest-rank percentile of all measured decisions, and P95 REP is p95Mean. The interval belongs to that mean, so
P95 can lie slightly outside it. The package exports percentile(sorted, p) for the nearest rank and
meanCi95(values) for the interval, which is null for a single value.
env.json records the commit and whether tracked files differ from it, but only when the package runs inside the work
tree of this repository. Anywhere else both are null.
With emitFrames, the run also writes a file { v: 1, now, context, payloads } with n one-way QR codes of the door
and the context to decide on them. deserializeVerifierContext reads the context back, so the same frames can be
replayed against another verifier. The results of a run belong to the machine that made them, and they are not
committed to the repository.
pnpm -F @umis/testkit gen:vectors writes test-vectors/umis-profile-v1.json at the root of the repository. The file
holds the public keys of the issuers, one credential of each type and one presentation for every channel. The channels
are one-way QR, full QR, request and response QR, BLE bytes and OpenID4VP. The file also holds the verifier contexts
the presentations are decided in and the expected decisions. It holds public keys only and is identical on every run.
The generator stops without writing when any object of the document has a member d, the private part of a key.
Any change to the world, the frame encoding or a policy preset changes test-vectors/umis-profile-v1.json. Run
pnpm -F @umis/testkit gen:vectors and commit the file. When the file is stale, the vectors test names this command.
Copyright 2026 Ishtvan Komonii. Licensed under the Apache License 2.0.