Skip to main content
Version: v0.0.8

Function: createDeidContext()

createDeidContext(spec): DeidContext

Create a DeidContext from consumer-held key material. The key is coerced to bytes and stored only in the module-private registry - never on the returned handle.

Parameters

spec

DeidContextSpec

The key, optional date-shift seed, optional patient scope, and offset bound.

Returns

DeidContext

An opaque, self-redacting context.

Throws

DeidError with code DEID_NO_KEY if the key (or an explicit seed) is empty.

Example

import { createDeidContext } from "@cosyte/deid";

const ctx = createDeidContext({ key: "consumer-secret", patientId: "patient-1" });