Class: DeidContext
An opaque handle to the consumer's key material. Construct it with createDeidContext; it exposes no secret field and redacts itself through every stringify channel.
Example
import { createDeidContext } from "@cosyte/deid";
const ctx = createDeidContext({ key: "secret" });
JSON.stringify({ ctx }); // => '{"ctx":"[DeidContext:redacted]"}'
Constructors
Constructor
new DeidContext():
DeidContext
Internal
Use createDeidContext.
Returns
DeidContext
Methods
forPatient()
forPatient(
patientId):DeidContext
Derive a sibling context scoped to a different patient, reusing the same key and seed. Used to de-identify a multi-patient corpus with one key while keeping each patient's date-shift offset distinct.
Parameters
patientId
string
The patient scope for the derived context.
Returns
DeidContext
A new DeidContext sharing this one's key/seed, scoped to patientId.
Example
import { createDeidContext } from "@cosyte/deid";
const base = createDeidContext({ key: "secret" });
const forPatient = base.forPatient("patient-2");
toJSON()
toJSON():
string
Redacts through JSON.stringify.
Returns
string
toString()
toString():
string
Redacts through String(...) and template interpolation.
Returns
string