JavaScript client / API reference / checkin module

@smart-health-checkin/client API / index

@smart-health-checkin/client

Classes

CheckinFlowError

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

Thrown by requestCheckin when the flow does not complete.

Extends

Constructors

Constructor
new CheckinFlowError(outcome): CheckinFlowError;

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

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:189

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:46

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:48

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:47

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 library'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:56

Test seam.

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

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

The credential getter: how the flow gets the wallet's sealed answer. 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;
  serverReference?: string;
  status: "completed" | "declined" | "unsupported" | "error";
};

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

Public barrel: the check-in protocol surface.

The library'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:73

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

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

The request as sent (scenario/init resolved).

response?
optional response?: SmartCheckinResponse;

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

The validated response — present whenever your code receives the data. Absent only when a server-owned authority kept it (see serverReference).

serverReference?
optional serverReference?: string;

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

Set when a server authority reported handledByServer: it holds the data, and this is whatever handle it gave you for it.

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

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


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 library 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 = 
  | {
  handledByServer?: false;
  presentation: PresentationContext;
  smartResponse: SmartCheckinResponse;
}
  | {
  handledByServer: true;
  presentation?: PresentationContext;
  reference?: string;
};

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

The result of opening a wallet response. Two shapes, because there are two reasons to hold keys on a server:

Union Members

Type Literal
{
  handledByServer?: false;
  presentation: PresentationContext;
  smartResponse: SmartCheckinResponse;
}
handledByServer?
optional handledByServer?: false;
presentation
presentation: PresentationContext;
smartResponse
smartResponse: SmartCheckinResponse;

Opened and wire-verified; the caller still cross-checks it against the request.


Type Literal
{
  handledByServer: true;
  presentation?: PresentationContext;
  reference?: string;
}
handledByServer
handledByServer: true;
presentation?
optional presentation?: PresentationContext;
reference?
optional reference?: string;

Optional server-side handle for what it stored (an encounter id, a queue entry).


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


FetchLike

type FetchLike = (input, init?) => Promise<Response>;

Defined in: src/fetch-like.ts:9

The minimal fetch signature the library accepts, so callers can inject their own client — auth headers, retries, tracing — without the library depending on any particular one.

Lives on its own because both the check-in path and the optional FHIR helper need it, and the check-in path must never import the FHIR module.

Parameters

Parameter Type
input string | URL | Request
init? RequestInit

Returns

Promise<Response>


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


HandoffAnswer

type HandoffAnswer = 
  | {
  credential: {
     data: unknown;
     protocol: string;
  };
}
  | {
  declined: true;
  reason?: string;
};

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

What the phone posts back: the wallet's credential, or a decline.


HandoffEnvelope

type HandoffEnvelope = {
  createdAt: string;
  expiresAt: string;
  handoffOrigin: string;
  navigatorArgument: unknown;
  v: 1;
};

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

What the kiosk posts for the phone to pick up.

Properties

createdAt
createdAt: string;

Defined in: src/kit/handoff.ts:29

expiresAt
expiresAt: string;

Defined in: src/kit/handoff.ts:30

handoffOrigin
handoffOrigin: string;

Defined in: src/kit/handoff.ts:28

The hand-off page's origin — the one the kiosk computed the session transcript for.

navigatorArgument
navigatorArgument: unknown;

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

Passed verbatim to navigator.credentials.get on the phone.

v
v: 1;

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


HandoffMailbox

type HandoffMailbox = {
  answer: Promise<void>;
  fetch: Promise<HandoffEnvelope>;
  post: Promise<void>;
  waitForAnswer: Promise<HandoffAnswer>;
};

Defined in: src/kit/handoff.ts:38

Methods

answer()
answer(sessionId, answer): Promise<void>;

Defined in: src/kit/handoff.ts:44

Phone → kiosk.

Parameters
Parameter Type
sessionId string
answer HandoffAnswer
Returns

Promise<void>

fetch()
fetch(sessionId): Promise<HandoffEnvelope>;

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

Phone ← kiosk. Rejects if there is no such session.

Parameters
Parameter Type
sessionId string
Returns

Promise<HandoffEnvelope>

post()
post(sessionId, envelope): Promise<void>;

Defined in: src/kit/handoff.ts:40

Kiosk → phone.

Parameters
Parameter Type
sessionId string
envelope HandoffEnvelope
Returns

Promise<void>

waitForAnswer()
waitForAnswer(sessionId, options?): Promise<HandoffAnswer>;

Defined in: src/kit/handoff.ts:46

Kiosk ← phone. Resolves with the first answer; rejects on abort.

Parameters
Parameter Type
sessionId string
options? { signal?: AbortSignal; }
options.signal? AbortSignal
Returns

Promise<HandoffAnswer>


HandoffOptions

type HandoffOptions = {
  handoffUrl: string;
  mailbox: HandoffMailbox;
  onWaiting?: (handoff) => void;
  sessionId?: string;
  signal?: AbortSignal;
  ttlMs?: number;
};

Defined in: src/kit/handoff.ts:49

Properties

handoffUrl
handoffUrl: string;

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

The hand-off page the phone will open; the session id goes in its fragment.

mailbox
mailbox: HandoffMailbox;

Defined in: src/kit/handoff.ts:50

onWaiting?
optional onWaiting?: (handoff) => void;

Defined in: src/kit/handoff.ts:54

Called once the request is posted: show url as a QR code.

Parameters
Parameter Type
handoff { sessionId: string; url: string; }
handoff.sessionId string
handoff.url string
Returns

void

sessionId?
optional sessionId?: string;

Defined in: src/kit/handoff.ts:56

Default: random.

signal?
optional signal?: AbortSignal;

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

ttlMs?
optional ttlMs?: number;

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

How long the phone may take to pick the request up. Default ten minutes.


MockItemSpec

type MockItemSpec = 
  | {
  alsoFulfills?: readonly string[];
  fhir: unknown;
  fhirVersion?: string;
}
  | {
  alsoFulfills?: readonly string[];
  healthCard: readonly string[];
}
  | {
  message?: string;
  status: SmartCheckinItemStatus["status"];
};

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

What the mock wallet should return for one requested item.

Tests usually want to pin exact data ("this allergy list, missing its reaction") or exercise a non-happy status, so both are first-class.

Union Members

Type Literal
{
  alsoFulfills?: readonly string[];
  fhir: unknown;
  fhirVersion?: string;
}

Return this FHIR resource or Bundle for the item. alsoFulfills names other request items this same artifact satisfies — one bundle answering a "clinical summary" item and an "allergies" item at once, say — and those items are then reported fulfilled without an artifact of their own.


Type Literal
{
  alsoFulfills?: readonly string[];
  healthCard: readonly string[];
}

Return a SMART Health Card artifact carrying these JWS strings.


Type Literal
{
  message?: string;
  status: SmartCheckinItemStatus["status"];
}

Report a status with no artifact — declined, unavailable, error, …


MockItemSpecs

type MockItemSpecs = 
  | MockItemSpec
  | readonly MockItemSpec[];

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

One item can be answered by several artifacts: give it a list.


MockWalletOptions

type MockWalletOptions = {
  fallback?: "fabricate" | MockItemSpec;
  items?: Record<string, MockItemSpecs>;
  origin: string;
  respond?: (request) => SmartCheckinResponse;
};

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

Properties

fallback?
optional fallback?: "fabricate" | MockItemSpec;

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

What to do with items items doesn't mention: "fabricate" (default) invents plausible demo data; a spec applies that spec to all of them.

items?
optional items?: Record<string, MockItemSpecs>;

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

Exactly what to return, per request item id. Anything not named here follows fallback.

createMockWalletCredentialGetter({
  origin: location.origin,
  items: {
    allergies: { fhir: myAllergyBundle },
    coverage: { status: "declined" },
  },
  fallback: { status: "unavailable" },
});
origin
origin: string;

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

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

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

Full manual control: build the entire response yourself.

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:196

Properties

deviceRequestBytes
deviceRequestBytes: Uint8Array;

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

encryptionInfoBytes
encryptionInfoBytes: Uint8Array;

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

smartRequest
smartRequest: SmartCheckinRequest;

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


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(...).


Responder

type Responder = {
  available: boolean;
  description?: string;
  homepage?: string;
  iconUrl?: string;
  id: string;
  isDefault: boolean;
  kind: "platform" | "web" | "mock";
  name: string;
  reason?: string;
  wallet?: WebWalletEntry;
};

Defined in: src/kit/responders.ts:56

Properties

available
available: boolean;

Defined in: src/kit/responders.ts:65

False when this browser can't use it; reason says why.

description?
optional description?: string;

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

homepage?
optional homepage?: string;

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

iconUrl?
optional iconUrl?: string;

Defined in: src/kit/responders.ts:62

id
id: string;

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

Stable id: "platform", "mock", or the wallet's registry id.

isDefault
isDefault: boolean;

Defined in: src/kit/responders.ts:68

True on exactly one responder: the one to present as the primary action.

kind
kind: "platform" | "web" | "mock";

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

name
name: string;

Defined in: src/kit/responders.ts:60

reason?
optional reason?: string;

Defined in: src/kit/responders.ts:66

wallet?
optional wallet?: WebWalletEntry;

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

The wallet entry, for kind: "web".


ResponderPolicy

type ResponderPolicy = {
  default?: string;
  mock?: boolean;
  origin?: string;
  platform?: boolean;
  webWallets?:   | true
     | false
     | string
     | WalletRegistry
     | WebWalletEntry[];
};

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

Properties

default?
optional default?: string;

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

Which responder the page should present as its primary action: "platform", "mock", or a web wallet's registry id. If that one isn't available in this browser, the first available responder is marked instead — so a page can prefer the platform wallet and still work where there is none. Unset: the first available.

mock?
optional mock?: boolean;

Defined in: src/kit/responders.ts:43

Offer the non-interactive mock. Development and demos only — never ship a page that offers it in production.

origin?
optional origin?: string;

Defined in: src/kit/responders.ts:45

Verifier origin for the mock responder; defaults to this page's.

platform?
optional platform?: boolean;

Defined in: src/kit/responders.ts:32

Offer the person's own wallet through the Digital Credentials API. Default true, and worth keeping on desktop: browsers that support the API offer a cross-device flow — a QR code the person scans with their phone, whose wallet answers, with the response returning to this page. It is listed as unavailable, not hidden, when the browser can't reach one.

webWallets?
optional webWallets?: 
  | true
  | false
  | string
  | WalletRegistry
  | WebWalletEntry[];

Defined in: src/kit/responders.ts:38

Web wallets this relying party recognizes: an inline list, a registry object, or a URL to fetch one from. true uses the built-in demo registry; omit or false for none.


Scenario

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

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

Public barrel: the check-in protocol surface.

The library'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:90

The key-custody seam.

browser-local — the default — generates an ephemeral, single-use HPKE key in the page. That is the intended arrangement: the page must be able to read the response for prefill workflows, and keeping the client browser-only means no per-language server SDK has to exist.

A server-owned implementation keeps the key behind two HTTP calls for deployments that specifically don't want the page to hold the response.

Properties

kind
kind: string;

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

Methods

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

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

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:92

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

Promise<PreparedCredentialRequest>


WalletRegistry

type WalletRegistry = {
  source?: string;
  wallets: WebWalletEntry[];
};

Defined in: src/kit/wallet-registry.ts:34

Properties

source?
optional source?: string;

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

Free-form label for where this list came from.

wallets
wallets: WebWalletEntry[];

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


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


WebWalletEntry

type WebWalletEntry = {
  description?: string;
  homepage?: string;
  iconUrl?: string;
  id: string;
  name: string;
  target?: "tab" | "popup";
  walletUrl: string;
};

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

Properties

description?
optional description?: string;

Defined in: src/kit/wallet-registry.ts:25

One line for a picker menu.

homepage?
optional homepage?: string;

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

Where to learn about or install the wallet.

iconUrl?
optional iconUrl?: string;

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

Icon for a picker menu; must be same-origin or CORS-readable.

id
id: string;

Defined in: src/kit/wallet-registry.ts:19

Stable identifier used in URLs, storage, and telemetry.

name
name: string;

Defined in: src/kit/wallet-registry.ts:21

What the person sees: "Demo Health Wallet".

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

Defined in: src/kit/wallet-registry.ts:31

Open in a tab (default) or a popup window.

walletUrl
walletUrl: string;

Defined in: src/kit/wallet-registry.ts:23

The page that answers check-in requests.


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:40

Explicit window.open features string; implies a popup.

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

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

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:42

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

walletUrl
walletUrl: string;

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

URL of the wallet web app (same-origin or any origin you trust). Usually comes from a registry entry — see resolveResponders.


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

DEMO_HEALTH_CARD_JWS

const DEMO_HEALTH_CARD_JWS: "eyJ6aXAiOiJERUYiLCJhbGciOiJFUzI1NiIsImtpZCI6Im1vY2sta2V5In0.fZHNjtQwEIRfZVVcnZkkGmbAR1gkQFqB-Lus5tBxOhsjx4nszrBR5HdHDquBw4pj293V9VWvsDFCoxeZot7vf5FzLDt-pGFyvG95GKHgmw66Oh1Pdf3yWJYKFwO9QpaJoe-vw3GgID2Tk35nKLTxxZ-iyAXOCiZwy14sua9z85ONZJWut-EHh2hHD43DrtxVUNvrm9m3jnNP4DjOwfC3bSOePtSTA5jROTaSFRTYS1ig71d0s3Pfg4O-zusS6lo8I_yZxLKXjExDZlvR0WDdAo0vvHCEwoO9sM_YH8fQksc5nRUaG6S_Jcki1etXh6I8FmWNlNSzNjLhf2y8HS8c6CETRiGZ84XIiL38ZV4h_CjQuOVhvHm_5XwzOfJICnFuogm24fChzS3v7j4Vh0N1gkLDnjtrLOWM8uKOA_vs4t-QksJEyxi2BFobJ0c5gm3X3SwzOWTqiYMd26wThUJ2U5f1sSiroqyQUjqnlNJv.AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" = "eyJ6aXAiOiJERUYiLCJhbGciOiJFUzI1NiIsImtpZCI6Im1vY2sta2V5In0.fZHNjtQwEIRfZVVcnZkkGmbAR1gkQFqB-Lus5tBxOhsjx4nszrBR5HdHDquBw4pj293V9VWvsDFCoxeZot7vf5FzLDt-pGFyvG95GKHgmw66Oh1Pdf3yWJYKFwO9QpaJoe-vw3GgID2Tk35nKLTxxZ-iyAXOCiZwy14sua9z85ONZJWut-EHh2hHD43DrtxVUNvrm9m3jnNP4DjOwfC3bSOePtSTA5jROTaSFRTYS1ig71d0s3Pfg4O-zusS6lo8I_yZxLKXjExDZlvR0WDdAo0vvHCEwoO9sM_YH8fQksc5nRUaG6S_Jcki1etXh6I8FmWNlNSzNjLhf2y8HS8c6CETRiGZ84XIiL38ZV4h_CjQuOVhvHm_5XwzOfJICnFuogm24fChzS3v7j4Vh0N1gkLDnjtrLOWM8uKOA_vs4t-QksJEyxi2BFobJ0c5gm3X3SwzOWTqiYMd26wThUJ2U5f1sSiroqyQUjqnlNJv.AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";

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

A structurally real SMART Health Card: a JWS whose payload is the raw-DEFLATEd { iss, nbf, vc.credentialSubject.fhirBundle } (one Patient, one Coverage), so anything that decodes cards can show what is in it. The signature is zeros — nothing verifies it, and nothing should.


DEMO_WALLET_REGISTRY

const DEMO_WALLET_REGISTRY: WalletRegistry;

Defined in: src/kit/wallet-registry.ts:41

The list every deployment starts with: this project's demo wallet.


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 library'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 credential getter 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

answerHandoff()

function answerHandoff(
   mailbox, 
   sessionId, 
   envelope, 
getCredential?): Promise<HandoffAnswer>;

Defined in: src/kit/handoff.ts:146

Phone side, step two: ask the wallet and send back what it returned. getCredential defaults to the browser's own navigator.credentials.get; pass a web-wallet or mock getter to answer without a platform wallet. A decline is reported to the kiosk as a decline, not as silence.

Parameters

Parameter Type
mailbox HandoffMailbox
sessionId string
envelope HandoffEnvelope
getCredential (navigatorArgument) => Promise<unknown>

Returns

Promise<HandoffAnswer>


buildDcapiSessionTranscript()

function buildDcapiSessionTranscript(input): Promise<Uint8Array<ArrayBufferLike>>;

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

SessionTranscript (spec §8.3) — both verifier and wallet compute this identically: dcapiInfo = CBOR([encryptionInfoBase64Url, origin]) handover = ["dcapi", SHA-256(dcapiInfo)] SessionTranscript = CBOR([null, null, handover])

Parameters

Parameter Type
input { encryptionInfo: string | Uint8Array<ArrayBufferLike>; origin: string; }
input.encryptionInfo string | Uint8Array<ArrayBufferLike>
input.origin string

Returns

Promise<Uint8Array<ArrayBufferLike>>


buildMockResponse()

function buildMockResponse(request, options?): SmartCheckinResponse;

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

Build a response from a per-item specification. Exported so tests can assert on the response without going through the wire layer at all.

Parameters

Parameter Type
request SmartCheckinRequest
options Pick<MockWalletOptions, "items" | "fallback">

Returns

SmartCheckinResponse


buildOrgIsoMdocRequest()

function buildOrgIsoMdocRequest(smartRequest, options?): Promise<OrgIsoMdocRequestBundle>;

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

Parameters

Parameter Type
smartRequest SmartCheckinRequest
options { deviceRequestVersion?: "1.0" | "1.1"; includeCompanionElement?: boolean; nonce?: Uint8Array<ArrayBufferLike>; origin?: string; readerAuth?: boolean; readerIdentity?: ReaderIdentity; responseElementIdentifier?: string; verifierKeyPair?: CryptoKeyPair; }
options.deviceRequestVersion? "1.0" | "1.1"
options.includeCompanionElement? boolean
options.nonce? Uint8Array<ArrayBufferLike>
options.origin? string
options.readerAuth? boolean
options.readerIdentity? ReaderIdentity
options.responseElementIdentifier? string
options.verifierKeyPair? CryptoKeyPair

Returns

Promise<OrgIsoMdocRequestBundle>


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:103

Ephemeral, single-use verifier key held in the page. The default.

Parameters

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

Returns

VerifierAuthority


createHandoff()

function createHandoff(options): {
  authority: VerifierAuthority;
  getCredential: (navigatorArgument) => Promise<unknown>;
};

Defined in: src/kit/handoff.ts:120

Everything a kiosk passes to runCheckin / requestCheckin:

const outcome = await runCheckin(request, createHandoff({
  mailbox, handoffUrl: "/handoff.html",
  onWaiting: ({ url }) => drawQr(url),
}));

The key lives in this page, as usual; the session transcript is computed for the hand-off page's origin, because that is where the wallet will be asked.

Parameters

Parameter Type
options HandoffOptions

Returns

{
  authority: VerifierAuthority;
  getCredential: (navigatorArgument) => Promise<unknown>;
}
authority
authority: VerifierAuthority;
getCredential
getCredential: (navigatorArgument) => Promise<unknown>;
Parameters
Parameter Type
navigatorArgument unknown
Returns

Promise<unknown>


createHandoffCredentialGetter()

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

Defined in: src/kit/handoff.ts:86

The getCredential for a kiosk: posts the request, shows the QR, waits. Pair it with an authority built for the hand-off page's origin — or use createHandoff, which does both.

Parameters

Parameter Type
options HandoffOptions

Returns

(navigatorArgument) => Promise<unknown>


createMockWalletCredentialGetter()

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

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

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:166

HTTP client for a server-owned authority. Two calls, JSON both ways:

POST {base}/credential-requests → { "request": SmartCheckinRequest } ← { "handle": string, "navigatorArgument": {...} }

POST {base}/credential-requests/{handle}/complete → { "credential": } ← { "smartResponse": {...}, "presentation": {...} } or { "handledByServer": true, "reference"?: string }

Requests carry the page's credentials (credentials: "include"), so the server can bind a check-in to the authenticated session. The full contract, including what the server must store and verify, is in docs/server-authority.md.

Parameters

Parameter Type
baseUrl string

Returns

VerifierAuthority


createWebWalletCredentialGetter()

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

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

Parameters

Parameter Type
options WebWalletOptions

Returns

(navigatorArgument) => Promise<unknown>


credentialGetterFor()

function credentialGetterFor(responder, options?): ((navigatorArgument) => Promise<unknown>) | undefined;

Defined in: src/kit/responders.ts:148

The getCredential to pass to requestCheckin / runCheckin for a chosen responder. Returns undefined for the platform option, which is the default path and needs no override.

Parameters

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

Returns

((navigatorArgument) => Promise<unknown>) | undefined


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:201

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:302

Parameters

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

Returns

SmartCheckinResponse


fetchHandoff()

function fetchHandoff(mailbox, sessionId): Promise<{
  envelope: HandoffEnvelope;
  request: SmartCheckinRequest;
}>;

Defined in: src/kit/handoff.ts:131

Phone side, step one: pick the request up and recover what it asks for, to show the person.

Parameters

Parameter Type
mailbox HandoffMailbox
sessionId string

Returns

Promise<{ envelope: HandoffEnvelope; request: SmartCheckinRequest; }>


findWallet()

function findWallet(registry, id): WebWalletEntry | undefined;

Defined in: src/kit/wallet-registry.ts:126

Look one up by id.

Parameters

Parameter Type
registry WalletRegistry
id string

Returns

WebWalletEntry | undefined


handoffUrlFor()

function handoffUrlFor(handoffUrl, sessionId): string;

Defined in: src/kit/handoff.ts:65

The URL the QR code carries.

Parameters

Parameter Type
handoffUrl string
sessionId string

Returns

string


loadWalletRegistry()

function loadWalletRegistry(source?, options?): Promise<WalletRegistry>;

Defined in: src/kit/wallet-registry.ts:96

Resolve a registry from whatever a deployment configured: the built-in default, an inline object or array, or a URL to fetch JSON from.

const registry = await loadWalletRegistry("/config/wallets.json");

A fetched list is validated before use; a malformed one throws rather than silently falling back, because "which wallet are we sending people to" is not a question to answer by accident.

Parameters

Parameter Type
source? | string | WebWalletEntry[] | WalletRegistry
options? { fetchImpl?: FetchLike; }
options.fetchImpl? FetchLike

Returns

Promise<WalletRegistry>


openWalletResponse()

function openWalletResponse(input): Promise<OpenWalletResponseResult>;

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

Parameters

Parameter Type
input { aad?: Uint8Array<ArrayBufferLike>; recipientPrivateKey: CryptoKey; recipientPublicJwk: JsonWebKey; response: string | DcapiMdocResponse; sessionTranscript: Uint8Array; smartRequest?: unknown; }
input.aad? Uint8Array<ArrayBufferLike>
input.recipientPrivateKey CryptoKey
input.recipientPublicJwk JsonWebKey
input.response string | DcapiMdocResponse
input.sessionTranscript Uint8Array
input.smartRequest? unknown

Returns

Promise<OpenWalletResponseResult>


parseWalletRequest()

function parseWalletRequest(navigatorArgument): ParsedWalletRequest;

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

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:207

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:79

Public barrel: the check-in protocol surface.

The library'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


resolveResponders()

function resolveResponders(policy?, options?): Promise<Responder[]>;

Defined in: src/kit/responders.ts:86

Resolve a policy into the options to render.

const responders = await resolveResponders({
  platform: true,
  webWallets: "/config/wallets.json",
  default: "platform",
});
// → render one button per responder; disable the unavailable ones;
//   the one with isDefault is the primary action

Parameters

Parameter Type
policy ResponderPolicy
options { detectSupport?: () => DcApiSupport; fetchImpl?: FetchLike; }
options.detectSupport? () => DcApiSupport
options.fetchImpl? FetchLike

Returns

Promise<Responder[]>


resolveScenario()

function resolveScenario(key): Scenario;

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

Public barrel: the check-in protocol surface.

The library'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:114

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:219

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; }>


sessionIdFromHash()

function sessionIdFromHash(hash): string | null;

Defined in: src/kit/handoff.ts:72

The session id from a hand-off page's location hash, or null.

Parameters

Parameter Type
hash string

Returns

string | null


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>


validateWalletRegistry()

function validateWalletRegistry(value): ValidationResult<WalletRegistry>;

Defined in: src/kit/wallet-registry.ts:54

Parameters

Parameter Type
value unknown

Returns

ValidationResult<WalletRegistry>


verifyDeviceResponseSignatures()

function verifyDeviceResponseSignatures(input): Promise<DocumentVerification[]>;

Defined in: src/wire/verify.ts:55

Verify every document in a DeviceResponse. All three checks are reported independently so a caller can apply deployment trust policy (e.g. accept a self-attested wallet chain while still requiring a valid signature).

Parameters

Parameter Type
input { deviceResponseBytes: Uint8Array; sessionTranscript: Uint8Array; }
input.deviceResponseBytes Uint8Array
input.sessionTranscript Uint8Array

Returns

Promise<DocumentVerification[]>