Docs / API reference / checkin module

checkin-client API / index

checkin-client

Classes

CheckinFlowError

Defined in: src/kit/index.ts:174

Thrown by requestCheckin when the flow does not complete.

Extends

Constructors

Constructor
new CheckinFlowError(outcome): CheckinFlowError;

Defined in: src/kit/index.ts:175

Parameters
Parameter Type
outcome CheckinOutcome
Returns

CheckinFlowError

Overrides
Error.constructor

Properties

cause?
optional cause?: unknown;

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

The cause of the error.

Inherited from
Error.cause
message
message: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from
Error.message
name
name: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from
Error.name
outcome
readonly outcome: CheckinOutcome;

Defined in: src/kit/index.ts:175

stack?
optional stack?: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;

Defined in: node_modules/@types/node/globals.d.ts:67

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from
Error.stackTraceLimit

Methods

captureStackTrace()
Call Signature
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
Parameter Type
targetObject object
constructorOpt? Function
Returns

void

Inherited from
Error.captureStackTrace
Call Signature
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/bun-types/globals.d.ts:1062

Create .stack property on a target object

Parameters
Parameter Type
targetObject object
constructorOpt? Function
Returns

void

Inherited from
Error.captureStackTrace
isError()
static isError(value): value is Error;

Defined in: node_modules/bun-types/globals.d.ts:1057

Check if a value is an instance of Error

Parameters
Parameter Type Description
value unknown The value to check
Returns

value is Error

True if the value is an instance of Error, false otherwise

Inherited from
Error.isError
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:55

Parameters
Parameter Type
err Error
stackTraces CallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
Error.prepareStackTrace

WalletDeclinedError

Defined in: src/kit/web-wallet.ts:43

Thrown when the person closes or declines in the wallet app.

Extends

Constructors

Constructor
new WalletDeclinedError(message?): WalletDeclinedError;

Defined in: src/kit/web-wallet.ts:45

Parameters
Parameter Type Default value
message string "the request was declined in the wallet"
Returns

WalletDeclinedError

Overrides
Error.constructor

Properties

cause?
optional cause?: unknown;

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

The cause of the error.

Inherited from
Error.cause
message
message: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from
Error.message
name
readonly name: "NotAllowedError" = "NotAllowedError";

Defined in: src/kit/web-wallet.ts:44

Overrides
Error.name
stack?
optional stack?: string;

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from
Error.stack
stackTraceLimit
static stackTraceLimit: number;

Defined in: node_modules/@types/node/globals.d.ts:67

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from
Error.stackTraceLimit

Methods

captureStackTrace()
Call Signature
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
Parameter Type
targetObject object
constructorOpt? Function
Returns

void

Inherited from
Error.captureStackTrace
Call Signature
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/bun-types/globals.d.ts:1062

Create .stack property on a target object

Parameters
Parameter Type
targetObject object
constructorOpt? Function
Returns

void

Inherited from
Error.captureStackTrace
isError()
static isError(value): value is Error;

Defined in: node_modules/bun-types/globals.d.ts:1057

Check if a value is an instance of Error

Parameters
Parameter Type Description
value unknown The value to check
Returns

value is Error

True if the value is an instance of Error, false otherwise

Inherited from
Error.isError
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:55

Parameters
Parameter Type
err Error
stackTraces CallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
Error.prepareStackTrace

Type Aliases

CheckinOptions

type CheckinOptions = {
  authority?:   | "browser-local"
     | {
     server: string;
   }
     | VerifierAuthority;
  detectSupport?: typeof detectDcApiSupport;
  getCredential?: (options) => Promise<unknown>;
};

Defined in: src/kit/index.ts:42

Public barrel: the check-in protocol surface.

The kit's job ends when your code has a validated SmartCheckinResponse. FHIR writing is a separate, optional module — import it from ./fhir/index.ts (built as fhir.js on the site) if you want it.

Properties

authority?
optional authority?: 
  | "browser-local"
  | {
  server: string;
}
  | VerifierAuthority;

Defined in: src/kit/index.ts:48

Where the verifier's private key material lives. Default "browser-local" (page memory — fine for demos); use a server-owned authority in production.

detectSupport?
optional detectSupport?: typeof detectDcApiSupport;

Defined in: src/kit/index.ts:55

Test seam.

getCredential?
optional getCredential?: (options) => Promise<unknown>;

Defined in: src/kit/index.ts:53

Override the mediator. Defaults to the platform Digital Credentials API; pass a web-wallet or mock getter to run without a platform wallet.

Parameters
Parameter Type
options unknown
Returns

Promise<unknown>


CheckinOutcome

type CheckinOutcome = {
  error?: {
     message: string;
     stage: "prepare" | "credential" | "open" | "validate";
  };
  request: SmartCheckinRequest;
  response?: SmartCheckinResponse;
  status: "completed" | "declined" | "unsupported" | "error";
};

Defined in: src/kit/index.ts:58

Public barrel: the check-in protocol surface.

The kit's job ends when your code has a validated SmartCheckinResponse. FHIR writing is a separate, optional module — import it from ./fhir/index.ts (built as fhir.js on the site) if you want it.

Properties

error?
optional error?: {
  message: string;
  stage: "prepare" | "credential" | "open" | "validate";
};

Defined in: src/kit/index.ts:64

message
message: string;
stage
stage: "prepare" | "credential" | "open" | "validate";
request
request: SmartCheckinRequest;

Defined in: src/kit/index.ts:61

The request as sent (scenario/init resolved).

response?
optional response?: SmartCheckinResponse;

Defined in: src/kit/index.ts:63

Present iff the flow completed; always validated against the request.

status
status: "completed" | "declined" | "unsupported" | "error";

Defined in: src/kit/index.ts:59


CheckinRequestInit

type CheckinRequestInit = {
  fhirVersions?: ReadonlyArray<string>;
  id?: string;
  items: ReadonlyArray<SmartCheckinRequestItem>;
  purpose?: string;
};

Defined in: src/kit/scenarios.ts:22

Everything a request needs except the boilerplate the kit can fill in.

Properties

fhirVersions?
optional fhirVersions?: ReadonlyArray<string>;

Defined in: src/kit/scenarios.ts:25

id?
optional id?: string;

Defined in: src/kit/scenarios.ts:23

items
items: ReadonlyArray<SmartCheckinRequestItem>;

Defined in: src/kit/scenarios.ts:26

purpose?
optional purpose?: string;

Defined in: src/kit/scenarios.ts:24


CheckinRequestInput

type CheckinRequestInput = 
  | SmartCheckinRequest
  | CheckinRequestInit
  | {
  scenario: string;
};

Defined in: src/kit/index.ts:37

What to ask for: an inline init, a complete request, or a registered name.


CredentialCompletion

type CredentialCompletion = {
  presentation: {
     deviceResponseHex: string;
     origin: string;
  };
  smartResponse: SmartCheckinResponse;
};

Defined in: src/browser/index.ts:48

Properties

presentation
presentation: {
  deviceResponseHex: string;
  origin: string;
};

Defined in: src/browser/index.ts:51

deviceResponseHex
deviceResponseHex: string;

DeviceResponse bytes for audit/debug.

origin
origin: string;
smartResponse
smartResponse: SmartCheckinResponse;

Defined in: src/browser/index.ts:50

Opened, wire-verified SMART response (still needs §6.6 cross-validation upstream when no request was supplied at prepare time).


DcapiMdocResponse

type DcapiMdocResponse = {
  data: {
     response: string;
  };
  protocol: typeof PROTOCOL_ID;
};

Defined in: src/wire/response.ts:41

Properties

data
data: {
  response: string;
};

Defined in: src/wire/response.ts:43

response
response: string;
protocol
protocol: typeof PROTOCOL_ID;

Defined in: src/wire/response.ts:42


DcApiSupport

type DcApiSupport = 
  | {
  state: "supported";
}
  | {
  reason: string;
  state: "unsupported";
};

Defined in: src/browser/index.ts:16


FhirCanonical

type FhirCanonical = string;

Defined in: src/model/types.ts:6

Transport-neutral SMART Health Check-in clinical model (draft spec §§5–6). Ported from smart-health-checkin-mdoc rp-web/src/sdk/core.ts.


FhirProfileCollectionRef

type FhirProfileCollectionRef = FhirCanonical;

Defined in: src/model/types.ts:14


FhirResourceType

type FhirResourceType = string;

Defined in: src/model/types.ts:8


FhirVersion

type FhirVersion = string;

Defined in: src/model/types.ts:7


MockWalletOptions

type MockWalletOptions = {
  origin: string;
  respond?: (request) => SmartCheckinResponse;
};

Defined in: src/kit/mock-wallet.ts:36

Properties

origin
origin: string;

Defined in: src/kit/mock-wallet.ts:37

respond?
optional respond?: (request) => SmartCheckinResponse;

Defined in: src/kit/mock-wallet.ts:39

Override the fabricated SMART response entirely.

Parameters
Parameter Type
request SmartCheckinRequest
Returns

SmartCheckinResponse


OrgIsoMdocNavigatorArgument

type OrgIsoMdocNavigatorArgument = {
  digital: {
     requests: [{
        data: {
           deviceRequest: string;
           encryptionInfo: string;
        };
        protocol: typeof PROTOCOL_ID;
     }];
  };
  mediation: "required";
};

Defined in: src/wire/request.ts:31

Properties

digital
digital: {
  requests: [{
     data: {
        deviceRequest: string;
        encryptionInfo: string;
     };
     protocol: typeof PROTOCOL_ID;
  }];
};

Defined in: src/wire/request.ts:33

requests
requests: [{
  data: {
     deviceRequest: string;
     encryptionInfo: string;
  };
  protocol: typeof PROTOCOL_ID;
}];
mediation
mediation: "required";

Defined in: src/wire/request.ts:32


ParsedWalletRequest

type ParsedWalletRequest = {
  deviceRequestBytes: Uint8Array;
  encryptionInfoBytes: Uint8Array;
  smartRequest: SmartCheckinRequest;
};

Defined in: src/kit/mock-wallet.ts:60

Properties

deviceRequestBytes
deviceRequestBytes: Uint8Array;

Defined in: src/kit/mock-wallet.ts:62

encryptionInfoBytes
encryptionInfoBytes: Uint8Array;

Defined in: src/kit/mock-wallet.ts:63

smartRequest
smartRequest: SmartCheckinRequest;

Defined in: src/kit/mock-wallet.ts:61


PreparedCredentialRequest

type PreparedCredentialRequest = {
  handle: string;
  navigatorArgument: OrgIsoMdocNavigatorArgument;
};

Defined in: src/browser/index.ts:41

Properties

handle
handle: string;

Defined in: src/browser/index.ts:43

Opaque handle for completing the request with the same authority.

navigatorArgument
navigatorArgument: OrgIsoMdocNavigatorArgument;

Defined in: src/browser/index.ts:45

Pass to navigator.credentials.get(...).


Scenario

type Scenario = {
  description: string;
  label: string;
  request: SmartCheckinRequest;
};

Defined in: src/kit/scenarios.ts:15

Public barrel: the check-in protocol surface.

The kit's job ends when your code has a validated SmartCheckinResponse. FHIR writing is a separate, optional module — import it from ./fhir/index.ts (built as fhir.js on the site) if you want it.

Properties

description
description: string;

Defined in: src/kit/scenarios.ts:17

label
label: string;

Defined in: src/kit/scenarios.ts:16

request
request: SmartCheckinRequest;

Defined in: src/kit/scenarios.ts:18


SmartArtifact

type SmartArtifact = 
  | SmartArtifactBase & {
  mediaType: "application/smart-health-card";
  value: {
     verifiableCredential: ReadonlyArray<string>;
  };
}
  | SmartArtifactBase & {
  fhirVersion: FhirVersion;
  mediaType: "application/fhir+json";
  value: unknown;
};

Defined in: src/model/types.ts:59


SmartArtifactBase

type SmartArtifactBase = {
  fulfills: ReadonlyArray<string>;
  id: string;
  mediaType: string;
};

Defined in: src/model/types.ts:53

Properties

fulfills
fulfills: ReadonlyArray<string>;

Defined in: src/model/types.ts:56

id
id: string;

Defined in: src/model/types.ts:54

mediaType
mediaType: string;

Defined in: src/model/types.ts:55


SmartCheckinContentSelector

type SmartCheckinContentSelector = 
  | {
  kind: "selection.fhir";
  profiles?: ReadonlyArray<FhirCanonical>;
  profilesFrom?: ReadonlyArray<FhirProfileCollectionRef>;
  resourceTypes?: ReadonlyArray<FhirResourceType>;
}
  | {
  kind: "form.fhir";
  questionnaire?: unknown;
  questionnaireCanonical?: FhirCanonical;
};

Defined in: src/model/types.ts:16


SmartCheckinItemStatus

type SmartCheckinItemStatus = {
  item: string;
  message?: string;
  status:   | "fulfilled"
     | "partial"
     | "unavailable"
     | "declined"
     | "unsupported"
     | "error";
};

Defined in: src/model/types.ts:47

Properties

item
item: string;

Defined in: src/model/types.ts:48

message?
optional message?: string;

Defined in: src/model/types.ts:50

status
status: 
  | "fulfilled"
  | "partial"
  | "unavailable"
  | "declined"
  | "unsupported"
  | "error";

Defined in: src/model/types.ts:49


SmartCheckinRequest

type SmartCheckinRequest = {
  fhirVersions?: ReadonlyArray<FhirVersion>;
  id: string;
  items: ReadonlyArray<SmartCheckinRequestItem>;
  purpose?: string;
  type: "smart-health-checkin-request";
  version: "1";
};

Defined in: src/model/types.ts:38

Properties

fhirVersions?
optional fhirVersions?: ReadonlyArray<FhirVersion>;

Defined in: src/model/types.ts:43

id
id: string;

Defined in: src/model/types.ts:41

items
items: ReadonlyArray<SmartCheckinRequestItem>;

Defined in: src/model/types.ts:44

purpose?
optional purpose?: string;

Defined in: src/model/types.ts:42

type
type: "smart-health-checkin-request";

Defined in: src/model/types.ts:39

version
version: "1";

Defined in: src/model/types.ts:40


SmartCheckinRequestItem

type SmartCheckinRequestItem = {
  accept: ReadonlyArray<SmartHealthCheckinAcceptedMediaType>;
  content: SmartCheckinContentSelector;
  id: string;
  required?: boolean;
  summary?: string;
  title: string;
};

Defined in: src/model/types.ts:29

Properties

accept
accept: ReadonlyArray<SmartHealthCheckinAcceptedMediaType>;

Defined in: src/model/types.ts:35

content
content: SmartCheckinContentSelector;

Defined in: src/model/types.ts:34

id
id: string;

Defined in: src/model/types.ts:30

required?
optional required?: boolean;

Defined in: src/model/types.ts:33

summary?
optional summary?: string;

Defined in: src/model/types.ts:32

title
title: string;

Defined in: src/model/types.ts:31


SmartCheckinResponse

type SmartCheckinResponse = {
  artifacts: ReadonlyArray<SmartArtifact>;
  requestId: string;
  requestStatus: ReadonlyArray<SmartCheckinItemStatus>;
  type: "smart-health-checkin-response";
  version: "1";
};

Defined in: src/model/types.ts:70

Properties

artifacts
artifacts: ReadonlyArray<SmartArtifact>;

Defined in: src/model/types.ts:74

requestId
requestId: string;

Defined in: src/model/types.ts:73

requestStatus
requestStatus: ReadonlyArray<SmartCheckinItemStatus>;

Defined in: src/model/types.ts:75

type
type: "smart-health-checkin-response";

Defined in: src/model/types.ts:71

version
version: "1";

Defined in: src/model/types.ts:72


SmartHealthCheckinAcceptedMediaType

type SmartHealthCheckinAcceptedMediaType = 
  | "application/smart-health-card"
  | "application/fhir+json"
  | string & {
};

Defined in: src/model/types.ts:9


ValidationResult

type ValidationResult<T> = 
  | {
  ok: true;
  value: T;
}
  | {
  error: string;
  ok: false;
};

Defined in: src/model/types.ts:78

Type Parameters

Type Parameter
T

VerifierAuthority

type VerifierAuthority = {
  kind: string;
  completeCredentialRequest: Promise<CredentialCompletion>;
  prepareCredentialRequest: Promise<PreparedCredentialRequest>;
};

Defined in: src/browser/index.ts:63

The key-custody seam: browser-local keeps HPKE private material in page memory (demo-grade by design); a server-owned implementation keeps it behind two HTTP calls and never exposes it to the page.

Properties

kind
kind: string;

Defined in: src/browser/index.ts:64

Methods

completeCredentialRequest()
completeCredentialRequest(input): Promise<CredentialCompletion>;

Defined in: src/browser/index.ts:66

Parameters
Parameter Type
input { credential: unknown; handle: string; }
input.credential unknown
input.handle string
Returns

Promise<CredentialCompletion>

prepareCredentialRequest()
prepareCredentialRequest(input): Promise<PreparedCredentialRequest>;

Defined in: src/browser/index.ts:65

Parameters
Parameter Type
input { request: SmartCheckinRequest; }
input.request SmartCheckinRequest
Returns

Promise<PreparedCredentialRequest>


WebWalletCredential

type WebWalletCredential = {
  data: object;
  protocol: string;
};

Defined in: src/kit/web-wallet.ts:20

Properties

data
data: object;

Defined in: src/kit/web-wallet.ts:20

protocol
protocol: string;

Defined in: src/kit/web-wallet.ts:20


WebWalletOptions

type WebWalletOptions = {
  features?: string;
  target?: "tab" | "popup";
  timeoutMs?: number;
  walletUrl: string;
};

Defined in: src/kit/web-wallet.ts:27

Properties

features?
optional features?: string;

Defined in: src/kit/web-wallet.ts:37

Explicit window.open features string; implies a popup.

target?
optional target?: "tab" | "popup";

Defined in: src/kit/web-wallet.ts:35

How to open the wallet. "tab" (default) opens a normal browser tab, which behaves better on mobile and in browsers that resist popups; "popup" opens a small window. Ignored if features is set.

timeoutMs?
optional timeoutMs?: number;

Defined in: src/kit/web-wallet.ts:39

Give up after this many ms (default 5 minutes).

walletUrl
walletUrl: string;

Defined in: src/kit/web-wallet.ts:29

URL of the wallet web app (same-origin or any origin you trust).


WebWalletResponseMessage

type WebWalletResponseMessage = 
  | {
  credential: WebWalletCredential;
  outcome: "approved";
  requestId?: string;
  type: typeof WEB_WALLET_RESPONSE_MESSAGE_TYPE;
}
  | {
  outcome: "declined" | "closed";
  requestId?: string;
  type: typeof WEB_WALLET_RESPONSE_MESSAGE_TYPE;
}
  | {
  message: string;
  outcome: "error";
  requestId?: string;
  type: typeof WEB_WALLET_RESPONSE_MESSAGE_TYPE;
};

Defined in: src/kit/web-wallet.ts:22

Variables

MDOC_DOC_TYPE

const MDOC_DOC_TYPE: "org.smarthealthit.checkin.1";

Defined in: src/wire/request.ts:25


MDOC_NAMESPACE

const MDOC_NAMESPACE: "org.smarthealthit.checkin";

Defined in: src/wire/request.ts:26


PROTOCOL_ID

const PROTOCOL_ID: "org-iso-mdoc";

Defined in: src/wire/request.ts:24


SCENARIOS

const SCENARIOS: Record<string, Scenario>;

Defined in: src/kit/scenarios.ts:74

Public barrel: the check-in protocol surface.

The kit's job ends when your code has a validated SmartCheckinResponse. FHIR writing is a separate, optional module — import it from ./fhir/index.ts (built as fhir.js on the site) if you want it.


SMART_REQUEST_INFO_KEY

const SMART_REQUEST_INFO_KEY: "org.smarthealthit.checkin.request";

Defined in: src/wire/request.ts:27


SMART_RESPONSE_ELEMENT_ID

const SMART_RESPONSE_ELEMENT_ID: "smart_health_checkin_response";

Defined in: src/wire/request.ts:28


WEB_WALLET_READY_MESSAGE_TYPE

const WEB_WALLET_READY_MESSAGE_TYPE: "digital-credentials/web-wallet/ready";

Defined in: src/kit/web-wallet.ts:18


WEB_WALLET_REQUEST_MESSAGE_TYPE

const WEB_WALLET_REQUEST_MESSAGE_TYPE: "digital-credentials/web-wallet/request";

Defined in: src/kit/web-wallet.ts:16

Web-wallet credential getter: a drop-in replacement for navigator.credentials.get that hands the request to a wallet web app in another tab (or a popup) over postMessage, and waits for the sealed response.

This exists so the whole flow — including a real consent screen where the person chooses what to share — can be demonstrated on any browser, with no platform wallet and no phone. The wire format is identical to the platform Digital Credentials API path; only the mediator differs.

Message types match the web-wallet sketch in the spec prototype so the two implementations stay compatible.


WEB_WALLET_RESPONSE_MESSAGE_TYPE

const WEB_WALLET_RESPONSE_MESSAGE_TYPE: "digital-credentials/web-wallet/response";

Defined in: src/kit/web-wallet.ts:17

Functions

buildRequest()

function buildRequest(init): SmartCheckinRequest;

Defined in: src/kit/scenarios.ts:34

Complete a request from the parts an integrator actually cares about: type/version are fixed by the spec, id defaults to a UUID, and fhirVersions defaults to ["4.0.1"]. Validates before returning.

Parameters

Parameter Type
init CheckinRequestInit

Returns

SmartCheckinRequest


createBrowserLocalAuthority()

function createBrowserLocalAuthority(options?): VerifierAuthority;

Defined in: src/browser/index.ts:75

Parameters

Parameter Type
options { origin?: string; }
options.origin? string

Returns

VerifierAuthority


createMockWalletCredentialGetter()

function createMockWalletCredentialGetter(options): (navigatorArgument) => Promise<unknown>;

Defined in: src/kit/mock-wallet.ts:47

A drop-in getCredential hook for runCheckin: parses the navigator argument the same way a platform wallet would and returns a credential-like object carrying the sealed response.

Parameters

Parameter Type
options MockWalletOptions

Returns

(navigatorArgument) => Promise<unknown>


createServerAuthority()

function createServerAuthority(baseUrl): VerifierAuthority;

Defined in: src/browser/index.ts:126

HTTP client for a server-owned authority implementing the two-call contract: POST {request} → {handle, navigatorArgument}; POST {credential} → completion. The M4 reference server implements it.

Parameters

Parameter Type
baseUrl string

Returns

VerifierAuthority


createWebWalletCredentialGetter()

function createWebWalletCredentialGetter(options): (navigatorArgument) => Promise<unknown>;

Defined in: src/kit/web-wallet.ts:50

Parameters

Parameter Type
options WebWalletOptions

Returns

(navigatorArgument) => Promise<unknown>


detectDcApiSupport()

function detectDcApiSupport(): DcApiSupport;

Defined in: src/browser/index.ts:20

Returns

DcApiSupport


extractDcapiResponse()

function extractDcapiResponse(credential): string | DcapiMdocResponse;

Defined in: src/browser/index.ts:159

Pull the org-iso-mdoc response payload out of whatever the browser's credential object looks like: a DigitalCredential with .data (object or JSON string), a bare {protocol, data} object, or the raw base64url response string.

Parameters

Parameter Type
credential unknown

Returns

string | DcapiMdocResponse


fabricateResponse()

function fabricateResponse(request, include?): SmartCheckinResponse;

Defined in: src/kit/mock-wallet.ts:157

Fabricate one plausible demo artifact per request item. Pass include to honour per-item consent: excluded items come back with status "declined" and no artifact, exactly as a real wallet would report them.

Parameters

Parameter Type
request SmartCheckinRequest
include? (itemId) => boolean

Returns

SmartCheckinResponse


parseWalletRequest()

function parseWalletRequest(navigatorArgument): ParsedWalletRequest;

Defined in: src/kit/mock-wallet.ts:67

Wallet side: recover the SMART request from a navigator.credentials.get argument.

Parameters

Parameter Type
navigatorArgument unknown

Returns

ParsedWalletRequest


registerScenario()

function registerScenario(
   key, 
   request, 
   meta?): Scenario;

Defined in: src/kit/scenarios.ts:52

Register (or replace) a named scenario — lets declarative surfaces like use requests your code defines.

Parameters

Parameter Type
key string
request | SmartCheckinRequest | CheckinRequestInit
meta { description?: string; label?: string; }
meta.description? string
meta.label? string

Returns

Scenario


requestCheckin()

function requestCheckin(input, options?): Promise<SmartCheckinResponse>;

Defined in: src/kit/index.ts:193

Ask, await, use the answer:

const response = await requestCheckin({ purpose: "…", items: [ … ] });

Returns the validated response, or throws CheckinFlowError (which carries the outcome, so you can fall back gracefully on "declined").

Parameters

Parameter Type
input CheckinRequestInput
options CheckinOptions

Returns

Promise<SmartCheckinResponse>


resolveRequest()

function resolveRequest(input): SmartCheckinRequest;

Defined in: src/kit/index.ts:70

Public barrel: the check-in protocol surface.

The kit's job ends when your code has a validated SmartCheckinResponse. FHIR writing is a separate, optional module — import it from ./fhir/index.ts (built as fhir.js on the site) if you want it.

Parameters

Parameter Type
input CheckinRequestInput

Returns

SmartCheckinRequest


resolveScenario()

function resolveScenario(key): Scenario;

Defined in: src/kit/scenarios.ts:197

Public barrel: the check-in protocol surface.

The kit's job ends when your code has a validated SmartCheckinResponse. FHIR writing is a separate, optional module — import it from ./fhir/index.ts (built as fhir.js on the site) if you want it.

Parameters

Parameter Type
key string

Returns

Scenario


runCheckin()

function runCheckin(input, options?): Promise<CheckinOutcome>;

Defined in: src/kit/index.ts:105

Run the flow and report what happened, without throwing for ordinary outcomes (declined, unsupported browser). Use this when you want to branch on status; use requestCheckin when you just want the data.

Parameters

Parameter Type
input CheckinRequestInput
options CheckinOptions

Returns

Promise<CheckinOutcome>


sealWalletResponse()

function sealWalletResponse(input): Promise<{
  data: {
     response: string;
  };
  protocol: string;
}>;

Defined in: src/kit/mock-wallet.ts:83

Wallet side: sign and HPKE-seal a SMART response for the verifier. verifierOrigin is the requesting page's origin — the SessionTranscript binds to it, so a response cannot be replayed to a different origin.

Parameters

Parameter Type
input { encryptionInfoBytes: Uint8Array; smartResponse: SmartCheckinResponse; verifierOrigin: string; }
input.encryptionInfoBytes Uint8Array
input.smartResponse SmartCheckinResponse
input.verifierOrigin string

Returns

Promise<{ data: { response: string; }; protocol: string; }>


validateResponseAgainstRequest()

function validateResponseAgainstRequest(request, response): ValidationResult<SmartCheckinResponse>;

Defined in: src/model/validate.ts:181

Parameters

Parameter Type
request unknown
response unknown

Returns

ValidationResult<SmartCheckinResponse>


validateSmartCheckinRequest()

function validateSmartCheckinRequest(v): ValidationResult<SmartCheckinRequest>;

Defined in: src/model/validate.ts:14

Parameters

Parameter Type
v unknown

Returns

ValidationResult<SmartCheckinRequest>


validateSmartCheckinResponse()

function validateSmartCheckinResponse(v): ValidationResult<SmartCheckinResponse>;

Defined in: src/model/validate.ts:105

Parameters

Parameter Type
v unknown

Returns

ValidationResult<SmartCheckinResponse>