Cloud One demonstration

SOURCEENERGY / SSR RESEARCH DEMONSTRATION

A hospital referral during a security change

A clinic sent signed, fictional referrals to a hospital receiver. While one connection stayed open, the receiver changed how it establishes keys for new connections.

Follow the referral

Before the change

REF-001 arrived over a TLS 1.3 connection using X25519. The hospital verified the clinician’s ML-DSA-65 signature against the trusted test public key.

At authorization

The receiver rejected an invalid approval signature. A valid signature from the designated test authority then allowed the receiver to change its connection policy. Applying the policy took 0.68 ms.

During the handover

REF-002 arrived on the existing connection after the change. Its original transport protection continued until that session closed.

After the change

REF-003 arrived on a fresh connection restricted to X25519MLKEM768, which combines classical and post-quantum key establishment. The hospital verified the signature. A separate attempt to open a new connection using only the former method failed.

When the referral changed

The clinic signed REF-004, then the test changed the requested service. The receiver rejected its signature.

What the exercise establishes

All three planned valid messages succeeded in this single-machine run. The timing includes local processing. Production availability, network delays, queued referrals and recovery after failure require separate measurements. The transport certificate used a local RSA test identity. The clinician’s signature and the new hybrid key exchange were exercised with real cryptographic libraries.

Where SSR governance fits

In a hosted exercise, the SPAcial Registry would identify the clinic and hospital endpoints, SETC would record who authorized the change, and SourceEnergy Cube would retain receipts and configuration evidence. Here those roles are represented by a local endpoint pair, a test signing key and a run record. Independent review is pending.

Inspect the recorded evidence
{
  "node": "v24.22.3",
  "openssl": "3.5.9",
  "scope": "TLS 1.3 on loopback; both peers restricted to one matching group per new session",
  "before": "X25519",
  "after": "X25519MLKEM768",
  "policyMs": 0.68,
  "firstReceiptMs": 6.64,
  "receipts": [
    {
      "phase": "Before change",
      "id": "REF-001",
      "signatureAccepted": true,
      "atMs": 29.46
    },
    {
      "phase": "Existing session across change",
      "id": "REF-002",
      "signatureAccepted": true,
      "atMs": 31.68
    },
    {
      "phase": "Fresh hybrid session",
      "id": "REF-003",
      "signatureAccepted": true,
      "atMs": 36.29
    },
    {
      "phase": "Altered referral control",
      "id": "REF-004",
      "signatureAccepted": false,
      "atMs": 37.11
    }
  ],
  "invalidApproval": "denied",
  "freshLegacySession": "denied",
  "independentReview": "pending"
}
Reproduce the exercise

Use Node v24.22.3 with OpenSSL 3.5.9 and the openssl executable on PATH. Save the source below as referral.mjs and run node referral.mjs. It creates fresh test keys, binds to loopback and prints the measured results. Timings will vary. A reviewer should check each receipt and both connection policies, record any exceptions, and sign their own dated assessment.

import tls from 'node:tls';
import {once} from 'node:events';
import * as crypto from 'node:crypto';
import {execFileSync} from 'node:child_process';
import {mkdtempSync, readFileSync, rmSync} from 'node:fs';
import {tmpdir} from 'node:os';
import {join} from 'node:path';
import {createInterface} from 'node:readline';
import assert from 'node:assert/strict';

const before = 'X25519', after = 'X25519MLKEM768';
const certDir = mkdtempSync(join(tmpdir(),'referral-'));
const keyFile = join(certDir,'key.pem'), certFile = join(certDir,'cert.pem');
execFileSync('openssl',['req','-x509','-newkey','rsa:3072','-nodes','-days','1','-subj','/CN=localhost','-addext','subjectAltName=DNS:localhost','-keyout',keyFile,'-out',certFile],{stdio:'ignore'});
const options = {key:readFileSync(keyFile),cert:readFileSync(certFile),minVersion:'TLSv1.3',maxVersion:'TLSv1.3'};
rmSync(certDir,{recursive:true});
const clinician = crypto.generateKeyPairSync('ml-dsa-65');
const governor = crypto.generateKeyPairSync('ed25519');
const request = Buffer.from(JSON.stringify({scope:'loopback clinic and hospital',from:before,to:after}));
const approval = crypto.sign(null,request,governor.privateKey);
const receipts = [], started = performance.now();
const elapsed = () => +(performance.now()-started).toFixed(2);
const server = tls.createServer({...options,ecdhCurve:before}, socket => {
  socket.on('error',()=>{});
  createInterface({input:socket}).on('line',line => {
    const {body,signature} = JSON.parse(line);
    const valid = crypto.verify(null,Buffer.from(body),clinician.publicKey,Buffer.from(signature,'base64'));
    socket.write(JSON.stringify({id:JSON.parse(body).id,valid})+'\n');
  });
});
server.listen(0,'127.0.0.1');
await once(server,'listening');
async function connect(group){
  const socket = tls.connect({host:'127.0.0.1',port:server.address().port,servername:'localhost',ca:options.cert,minVersion:'TLSv1.3',ecdhCurve:group});
  await once(socket,'secureConnect');
  return socket;
}
async function deliver(socket,id,phase,tampered=false){
  const body=JSON.stringify({id,patient:'TEST-ONLY',service:'Referral review'});
  const signature=crypto.sign(null,Buffer.from(body),clinician.privateKey);
  const response=once(socket,'data');
  socket.write(JSON.stringify({body:tampered?body.replace('Referral review','Changed request'):body,signature:signature.toString('base64')})+'\n');
  const [line]=await response;
  const receipt=JSON.parse(line);
  assert.equal(receipt.id,id);
  assert.equal(receipt.valid,!tampered);
  receipts.push({phase,id,signatureAccepted:receipt.valid,atMs:elapsed()});
}
function switchPolicy(signature){
  if (!crypto.verify(null,request,governor.publicKey,signature)) return false;
  server.setSecureContext({...options,ecdhCurve:after});
  return true;
}
const old=await connect(before);
await deliver(old,'REF-001','Before change');
assert.equal(switchPolicy(Buffer.alloc(64)),false);
const cutoverStart=performance.now();
assert.equal(switchPolicy(approval),true);
const policyMs=+(performance.now()-cutoverStart).toFixed(2);
await deliver(old,'REF-002','Existing session across change');
const fresh=await connect(after);
await deliver(fresh,'REF-003','Fresh hybrid session');
const firstReceiptMs=+(performance.now()-cutoverStart).toFixed(2);
await deliver(fresh,'REF-004','Altered referral control',true);
await assert.rejects(connect(before),/handshake failure|no suitable key share/i);
old.destroy(); fresh.destroy(); server.close();
console.log(JSON.stringify({node:process.version,openssl:process.versions.openssl,scope:'TLS 1.3 on loopback; both peers restricted to one matching group per new session',before,after,policyMs,firstReceiptMs,receipts,invalidApproval:'denied',freshLegacySession:'denied',independentReview:'pending'},null,2));

Twenty cutovers with referrals in flight

Time from starting the policy change to the first verified hybrid receipt ranged from 14.53 to 19.94 ms, with a median of 16.26 ms. Each run used a fresh receiver, certificate and signing keys. The three rejection checks passed in all 20 runs.

These are client-observed receipts on one machine. They do not measure hospital network availability, durable storage, failover or recovery from a disconnect.

Inspect the 20 run records
[
  {
    "policyMs": 0.5947249999999826,
    "firstHybridMs": 14.946100999999999,
    "allHybridMs": 34.44372999999996,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 42.38
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 57.22
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 57.26
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 57.29
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 57.31
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 57.34
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 57.37
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 57.38
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 57.4
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 64.44
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 66.92
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 70.03
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 74.62
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 77.71
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 80.43
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 83.55
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 83.94
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 84.66
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.7879959999999926,
    "firstHybridMs": 16.694626,
    "allHybridMs": 35.634405999999984,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 36.93
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 54.18
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 54.21
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 54.24
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 54.26
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 54.31
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 54.34
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 54.37
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 54.42
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 61.77
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 64.87
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 68.29
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 71.59
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 74.23
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 78.54
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 80.25
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 80.71
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 81.84
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6731330000000071,
    "firstHybridMs": 16.18071900000001,
    "allHybridMs": 36.70406200000002,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 35.68
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 55.04
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 55.07
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 55.09
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 55.11
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 55.15
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 55.19
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 55.23
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 55.26
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 63.66
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 67.49
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 71.23
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 73.96
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 78.67
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 81.07
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 83.78
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 84.18
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 85.69
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.623297000000008,
    "firstHybridMs": 15.185891000000026,
    "allHybridMs": 32.83272900000003,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 34.49
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 49.65
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 49.69
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 49.71
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 49.73
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 49.76
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 49.79
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 49.8
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 49.82
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 57.28
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 59.77
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 63.26
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 66.7
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 69.36
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 72.41
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 74.52
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 74.94
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 76.1
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6050309999999968,
    "firstHybridMs": 14.526986999999991,
    "allHybridMs": 33.70434400000002,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 32.82
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 48.35
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 48.38
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 48.4
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 48.42
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 48.45
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 48.48
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 48.49
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 48.51
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 55.96
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 59.16
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 62.61
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 66.27
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 69.07
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 71.73
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 74.78
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 75.16
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 75.99
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.5887360000000399,
    "firstHybridMs": 14.977204000000029,
    "allHybridMs": 33.65442800000005,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 32.8
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 48.31
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 48.34
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 48.35
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 48.37
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 48.41
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 48.43
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 48.44
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 48.46
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 55.68
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 58.25
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 60.95
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 64.84
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 68.04
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 70.43
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 73.75
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 74.36
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 75.37
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6146050000000969,
    "firstHybridMs": 15.572100000000091,
    "allHybridMs": 35.90353900000002,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 39.02
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 52.09
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 52.12
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 52.14
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 52.16
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 52.19
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 52.22
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 52.23
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 52.24
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 59.94
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 62.75
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 65.54
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 70.5
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 73.92
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 77.24
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 79.7
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 80.27
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 81.01
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.908457999999996,
    "firstHybridMs": 17.30191400000001,
    "allHybridMs": 35.21909300000004,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 37.47
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 54.58
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 54.61
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 54.65
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 54.67
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 54.73
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 54.76
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 54.78
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 54.81
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 62.8
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 65.48
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 68.88
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 72.13
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 74.44
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 77.07
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 80.3
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 80.72
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 82.3
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6206749999999772,
    "firstHybridMs": 17.40785299999999,
    "allHybridMs": 40.15725699999999,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 35.4
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 51.58
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 51.61
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 51.64
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 51.67
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 51.72
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 51.77
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 51.79
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 51.81
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 59.39
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 62.85
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 65.67
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 69.66
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 73.61
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 79.65
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 81.74
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 82.15
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 83.06
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6476650000000177,
    "firstHybridMs": 19.940335000000033,
    "allHybridMs": 44.57191100000003,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 35.02
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 50.81
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 50.84
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 50.86
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 50.88
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 50.92
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 50.96
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 50.99
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 51.02
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 62.8
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 65.92
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 71.97
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 77.52
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 81.61
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 84.82
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 87
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 87.44
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 88.93
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.9931039999999598,
    "firstHybridMs": 16.338645999999983,
    "allHybridMs": 36.68668299999996,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 41.22
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 60.37
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 60.4
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 60.42
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 60.44
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 60.48
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 60.5
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 60.51
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 60.53
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 68.48
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 71.68
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 75.24
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 78.07
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 84.04
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 86.93
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 88.44
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 88.83
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 91.96
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.7761069999999961,
    "firstHybridMs": 16.492196999999976,
    "allHybridMs": 36.39495400000001,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 34.7
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 48.68
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 48.72
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 48.73
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 48.76
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 48.79
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 48.81
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 48.82
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 48.84
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 56.78
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 59.29
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 62.39
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 66.12
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 70.08
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 73.98
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 76.24
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 76.68
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 77.88
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.5785000000000196,
    "firstHybridMs": 15.992665000000045,
    "allHybridMs": 37.926287,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 35.28
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 52.13
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 52.16
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 52.18
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 52.2
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 52.26
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 52.34
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 52.37
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 52.39
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 60.06
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 63.2
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 66.98
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 71.79
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 77.07
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 79.89
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 81.58
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 81.99
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 83.12
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6316600000000108,
    "firstHybridMs": 16.61921799999999,
    "allHybridMs": 36.340802999999994,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 38.72
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 54.23
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 54.26
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 54.28
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 54.3
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 54.34
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 54.37
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 54.38
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 54.4
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 63.09
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 65.98
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 71.14
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 75.14
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 77.83
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 80.54
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 82.37
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 82.78
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 84.18
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.7398830000000203,
    "firstHybridMs": 18.802887999999996,
    "allHybridMs": 38.259814000000006,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 35.78
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 52.79
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 52.89
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 52.92
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 52.95
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 53.02
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 53.06
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 53.09
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 53.11
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 62.63
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 66.47
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 69.56
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 73.57
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 76.32
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 80.26
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 81.7
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 82.08
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 83.37
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6240679999999941,
    "firstHybridMs": 14.807632999999981,
    "allHybridMs": 34.276397,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 36.52
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 50.65
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 50.68
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 50.7
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 50.72
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 50.76
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 50.78
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 50.79
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 50.8
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 58.35
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 62.24
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 65.08
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 69.72
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 72.07
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 75.65
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 77.43
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 77.82
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 79.43
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.7550859999999489,
    "firstHybridMs": 15.436247999999978,
    "allHybridMs": 31.251847999999995,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 34.46
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 51.57
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 51.6
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 51.62
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 51.64
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 51.68
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 51.7
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 51.72
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 51.73
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 59.68
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 62.5
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 65.05
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 68.6
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 71.21
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 73.54
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 75.11
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 75.5
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 76.5
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.6522709999999847,
    "firstHybridMs": 15.258771999999993,
    "allHybridMs": 39.47764099999998,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 36.61
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 54.8
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 54.87
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 54.91
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 54.93
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 54.97
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 54.99
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 55
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 55.02
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 62.14
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 65.92
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 70.26
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 74.03
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 79.53
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 83.2
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 85.95
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 86.36
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 87.5
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 1.118312000000003,
    "firstHybridMs": 17.120210999999983,
    "allHybridMs": 39.611692000000005,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 52.35
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 70.24
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 70.29
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 70.31
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 70.35
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 70.39
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 70.41
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 70.42
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 70.44
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 78.81
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 84.85
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 87.75
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 92.38
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 95.84
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 99.5
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 100.86
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 101.31
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 103
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  },
  {
    "policyMs": 0.9019470000000069,
    "firstHybridMs": 16.777556000000004,
    "allHybridMs": 39.35243300000002,
    "receipts": [
      {
        "phase": "Before",
        "id": "BASE",
        "signatureAccepted": true,
        "atMs": 40.3
      },
      {
        "phase": "In flight",
        "id": "OLD-0",
        "signatureAccepted": true,
        "atMs": 57.57
      },
      {
        "phase": "In flight",
        "id": "OLD-1",
        "signatureAccepted": true,
        "atMs": 57.6
      },
      {
        "phase": "In flight",
        "id": "OLD-2",
        "signatureAccepted": true,
        "atMs": 57.62
      },
      {
        "phase": "In flight",
        "id": "OLD-3",
        "signatureAccepted": true,
        "atMs": 57.64
      },
      {
        "phase": "In flight",
        "id": "OLD-4",
        "signatureAccepted": true,
        "atMs": 57.69
      },
      {
        "phase": "In flight",
        "id": "OLD-5",
        "signatureAccepted": true,
        "atMs": 57.73
      },
      {
        "phase": "In flight",
        "id": "OLD-6",
        "signatureAccepted": true,
        "atMs": 57.75
      },
      {
        "phase": "In flight",
        "id": "OLD-7",
        "signatureAccepted": true,
        "atMs": 57.77
      },
      {
        "phase": "New connection",
        "id": "NEW-1",
        "signatureAccepted": true,
        "atMs": 65.61
      },
      {
        "phase": "New connection",
        "id": "NEW-2",
        "signatureAccepted": true,
        "atMs": 69.57
      },
      {
        "phase": "New connection",
        "id": "NEW-3",
        "signatureAccepted": true,
        "atMs": 73.35
      },
      {
        "phase": "New connection",
        "id": "NEW-4",
        "signatureAccepted": true,
        "atMs": 78.18
      },
      {
        "phase": "New connection",
        "id": "NEW-5",
        "signatureAccepted": true,
        "atMs": 81.41
      },
      {
        "phase": "New connection",
        "id": "NEW-6",
        "signatureAccepted": true,
        "atMs": 85.42
      },
      {
        "phase": "New connection",
        "id": "NEW-7",
        "signatureAccepted": true,
        "atMs": 87.75
      },
      {
        "phase": "New connection",
        "id": "NEW-8",
        "signatureAccepted": true,
        "atMs": 88.19
      },
      {
        "phase": "Altered",
        "id": "ALTERED",
        "signatureAccepted": false,
        "atMs": 89.19
      }
    ],
    "invalidApproval": "denied",
    "freshLegacySession": "denied"
  }
]
Repeat the concurrent test

Save this source as cutover.mjs and run node cutover.mjs twenty times using the versions above. Each execution prints one JSON record and exits on a failed assertion.

import tls from 'node:tls';
import {once} from 'node:events';
import * as crypto from 'node:crypto';
import {execFileSync} from 'node:child_process';
import {mkdtempSync, readFileSync, rmSync} from 'node:fs';
import {tmpdir} from 'node:os';
import {join} from 'node:path';
import {createInterface} from 'node:readline';
import assert from 'node:assert/strict';

const before = 'X25519', after = 'X25519MLKEM768';
const certDir = mkdtempSync(join(tmpdir(),'referral-'));
const keyFile = join(certDir,'key.pem'), certFile = join(certDir,'cert.pem');
execFileSync('openssl',['req','-x509','-newkey','rsa:3072','-nodes','-days','1','-subj','/CN=localhost','-addext','subjectAltName=DNS:localhost','-keyout',keyFile,'-out',certFile],{stdio:'ignore'});
const options = {key:readFileSync(keyFile),cert:readFileSync(certFile),minVersion:'TLSv1.3',maxVersion:'TLSv1.3'};
rmSync(certDir,{recursive:true});
const clinician = crypto.generateKeyPairSync('ml-dsa-65');
const governor = crypto.generateKeyPairSync('ed25519');
const request = Buffer.from(JSON.stringify({scope:'loopback clinic and hospital',from:before,to:after}));
const approval = crypto.sign(null,request,governor.privateKey);
const receipts = [], started = performance.now();
const elapsed = () => +(performance.now()-started).toFixed(2);
const server = tls.createServer({...options,ecdhCurve:before}, socket => {
  socket.on('error',()=>{});
  createInterface({input:socket}).on('line',line => {
    const {body,signature} = JSON.parse(line);
    const valid = crypto.verify(null,Buffer.from(body),clinician.publicKey,Buffer.from(signature,'base64'));
    socket.write(JSON.stringify({id:JSON.parse(body).id,valid})+'\n');
  });
});
server.listen(0,'127.0.0.1');
await once(server,'listening');
async function connect(group){
  const socket = tls.connect({host:'127.0.0.1',port:server.address().port,servername:'localhost',ca:options.cert,minVersion:'TLSv1.3',ecdhCurve:group});
  await once(socket,'secureConnect');
  return socket;
}
async function deliver(socket,id,phase,tampered=false){
  const body=JSON.stringify({id,patient:'TEST-ONLY',service:'Referral review'});
  const signature=crypto.sign(null,Buffer.from(body),clinician.privateKey);
  const response=once(socket,'data');
  socket.write(JSON.stringify({body:tampered?body.replace('Referral review','Changed request'):body,signature:signature.toString('base64')})+'\n');
  const [line]=await response;
  const receipt=JSON.parse(line);
  assert.equal(receipt.id,id);
  assert.equal(receipt.valid,!tampered);
  receipts.push({phase,id,signatureAccepted:receipt.valid,atMs:elapsed()});
}
function switchPolicy(signature){
  if (!crypto.verify(null,request,governor.publicKey,signature)) return false;
  server.setSecureContext({...options,ecdhCurve:after});
  return true;
}

const lanes = Array.from({length:8}, (_,i)=>i+1);
const old = await Promise.all(lanes.map(()=>connect(before)));
await deliver(old[0],'BASE','Before');
assert.equal(switchPolicy(Buffer.alloc(64)),false);
// Each send writes before yielding to the event loop; all eight receipts are outstanding.
const pending = old.map((socket,i)=>deliver(socket,'OLD-'+i,'In flight'));
assert.equal(receipts.length,1);
const cutover = performance.now();
assert.equal(switchPolicy(approval),true);
const policyMs = performance.now()-cutover;
const fresh = [];
const delays = await Promise.all(lanes.map(async i=>{
  const socket = await connect(after);
  fresh.push(socket);
  await deliver(socket,'NEW-'+i,'New connection');
  return performance.now()-cutover;
}));
await Promise.all(pending);
await deliver(fresh[0],'ALTERED','Altered',true);
await assert.rejects(connect(before),/handshake failure|no suitable key share/i);
assert.equal(new Set(receipts.map(r=>r.id)).size,18);
assert.equal(receipts.filter(r=>r.signatureAccepted).length,17);
for (const socket of [...old,...fresh]) socket.destroy();
server.close();
console.log(JSON.stringify({policyMs,firstHybridMs:Math.min(...delays),allHybridMs:Math.max(...delays),receipts,invalidApproval:'denied',freshLegacySession:'denied'}));

Independent review record

Review pending. A reviewer independent of the controls can rerun the test, reconcile the 17 accepted IDs and one rejected altered referral in each run, and confirm rejection of the invalid approval signature and retired connection method. Record the reviewer, environment, date, discrepancies and disposition alongside the run records. A hosted pilot requires its own acceptance evidence.

When the receipt goes missing

Before restarting the receiver, the test read the original receipt from the on-disk database. Eight concurrent retries over fresh hybrid TLS connections then returned that exact receipt. A correctly signed request reusing the ID with changed content was rejected, as was a changed referral carrying its old signature. The stored row and receipt matched their pre-restart values.

The evidence covers receiver-process loss and retry on the same machine with an intact SQLite database. Host loss, replicated storage, clinical downstream actions and independent acceptance remain open for a hosted pilot.

Inspect recovery records
[
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "4b302c79-e119-442f-8f83-0950c42e6293",
    "retryReceipts": [
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293",
      "4b302c79-e119-442f-8f83-0950c42e6293"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "20a37373-10f9-446d-bb85-a6defd22f56e",
    "retryReceipts": [
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e",
      "20a37373-10f9-446d-bb85-a6defd22f56e"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
    "retryReceipts": [
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e",
      "b2cb4874-5030-48e4-ba36-8fa1b33eb49e"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "7c6c23cb-235f-4110-8765-6be7d8c3989d",
    "retryReceipts": [
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d",
      "7c6c23cb-235f-4110-8765-6be7d8c3989d"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "2bd61af0-edd0-4e01-a883-2f7f27289960",
    "retryReceipts": [
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960",
      "2bd61af0-edd0-4e01-a883-2f7f27289960"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "82f54410-2208-4db8-8da3-44aa3b3f6d90",
    "retryReceipts": [
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90",
      "82f54410-2208-4db8-8da3-44aa3b3f6d90"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
    "retryReceipts": [
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c",
      "f3edbed6-5f85-4a21-890b-c7dc8ba5fd7c"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "e365be50-28a6-4052-819d-dbae24a17d53",
    "retryReceipts": [
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53",
      "e365be50-28a6-4052-819d-dbae24a17d53"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
    "retryReceipts": [
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d",
      "21357c05-6954-4d2e-9e4d-ec2ab0c9874d"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  },
  {
    "exitSignal": "SIGKILL",
    "firstReplyBytes": 0,
    "originalReceipt": "871c5fee-f2e5-4235-8a15-910147f16234",
    "retryReceipts": [
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234",
      "871c5fee-f2e5-4235-8a15-910147f16234"
    ],
    "storedRows": 1,
    "conflictingSignedRequest": "rejected",
    "alteredSignaturePair": "rejected"
  }
]
Reproduce a receiver restart

Save the source below as recovery.mjs and run node recovery.mjs on Linux with the Node and OpenSSL versions above. Each invocation creates temporary test files and kills only its own disposable receiver. Repeat ten times to match this series. Verify each returned receipt against the original for that run.

import tls from 'node:tls';
import { DatabaseSync } from 'node:sqlite';
import { fork, execFileSync } from 'node:child_process';
import { once } from 'node:events';
import { fileURLToPath } from 'node:url';
import { mkdtempSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { randomUUID, generateKeyPairSync, verify, sign } from 'node:crypto';
import { createInterface } from 'node:readline';
import assert from 'node:assert/strict';

const transport = {minVersion:'TLSv1.3',maxVersion:'TLSv1.3',ecdhCurve:'X25519MLKEM768'};
if (process.argv[2]==='receiver') {
  const [, , , dir, mode] = process.argv;
  const db=new DatabaseSync(join(dir,'records.db'));
  db.exec('PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; CREATE TABLE IF NOT EXISTS referrals (id TEXT PRIMARY KEY, body TEXT NOT NULL, receipt TEXT NOT NULL)');
  const pub=readFileSync(join(dir,'signer.pem'));
  const server=tls.createServer({...transport,key:readFileSync(join(dir,'key')),cert:readFileSync(join(dir,'cert'))},socket=>{
    createInterface({input:socket}).once('line',line=>{
      const {body,sig}=JSON.parse(line);
      if(!verify(null,Buffer.from(body),pub,Buffer.from(sig,'base64'))) return socket.end('invalid\n');
      const {id}=JSON.parse(body);
      db.prepare('INSERT INTO referrals VALUES(?,?,?) ON CONFLICT(id) DO NOTHING').run(id,body,randomUUID());
      const row=db.prepare('SELECT body,receipt FROM referrals WHERE id=?').get(id);
      if(mode==='crash') process.kill(process.pid,'SIGKILL');
      socket.end((row.body===body ? row.receipt : 'conflict')+'\n');
    });
  });
  server.listen(0,'127.0.0.1',()=>process.send(server.address().port));
} else {
  const dir=mkdtempSync(join(tmpdir(),'ssr-recovery-'));
  let receiver;
  async function start(mode){
    receiver=fork(fileURLToPath(import.meta.url),['receiver',dir,mode]);
    const [port]=await once(receiver,'message');
    return port;
  }
  async function send(port,body,sig){
    const client=tls.connect({...transport,host:'127.0.0.1',port,servername:'localhost',ca:readFileSync(join(dir,'cert'))});
    await once(client,'secureConnect');
    client.write(JSON.stringify({body,sig})+'\n');
    let reply='';
    try { for await(const chunk of client) reply+=chunk; }
    catch(err){if(err.code!=='ECONNRESET') throw err;}
    return reply.trim();
  }
  function inspect(){
    const db=new DatabaseSync(join(dir,'records.db'),{readOnly:true});
    try{return db.prepare('SELECT * FROM referrals ORDER BY id').all();}finally{db.close();}
  }
  try {
    execFileSync('openssl',['req','-x509','-newkey','rsa:3072','-nodes','-days','1','-subj','/CN=localhost','-addext','subjectAltName=DNS:localhost','-keyout',join(dir,'key'),'-out',join(dir,'cert')],{stdio:'ignore'});
    const keys=generateKeyPairSync('ml-dsa-65');
    writeFileSync(join(dir,'signer.pem'),keys.publicKey.export({type:'spki',format:'pem'}));
    const signature=body=>sign(null,Buffer.from(body),keys.privateKey).toString('base64');
    const body=JSON.stringify({id:'REF-RECOVERY',service:'Synthetic referral'});
    let port=await start('crash');
    const terminated=once(receiver,'exit');
    assert.equal(await send(port,body,signature(body)),'');
    assert.equal((await terminated)[1],'SIGKILL');
    const saved=inspect();
    assert.equal(saved.length,1);
    assert.equal(saved[0].body,body);
    port=await start('normal');
    const replies=await Promise.all(Array.from({length:8},()=>send(port,body,signature(body))));
    assert(replies.every(r=>r===saved[0].receipt));
    const changed=body.replace('Synthetic referral','Changed referral');
    assert.equal(await send(port,changed,signature(changed)),'conflict');
    assert.equal(await send(port,changed,signature(body)),'invalid');
    assert.deepEqual(inspect(),saved);
    console.log(JSON.stringify({exitSignal:'SIGKILL',firstReplyBytes:0,originalReceipt:saved[0].receipt,retryReceipts:replies,storedRows:1,conflictingSignedRequest:'rejected',alteredSignaturePair:'rejected'}));
  } finally {
    if(receiver && receiver.exitCode===null && receiver.signalCode===null){const done=once(receiver,'exit');receiver.kill();await done;}
    rmSync(dir,{recursive:true,force:true});
  }
}