handoff
In this section
Type Aliases
HandoffAnswer
type HandoffAnswer =
| {
credential: {
data: unknown;
protocol: string;
};
}
| {
declined: true;
reason?: string;
};Defined in: src/kit/handoff.ts:35
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:24
What the kiosk posts for the phone to pick up.
Properties
createdAt
createdAt: string;Defined in: src/kit/handoff.ts:30
expiresAt
expiresAt: string;Defined in: src/kit/handoff.ts:31
handoffOrigin
handoffOrigin: string;Defined in: src/kit/handoff.ts:29
The hand-off page's origin — the one the kiosk computed the session transcript for.
navigatorArgument
navigatorArgument: unknown;Defined in: src/kit/handoff.ts:27
Passed verbatim to navigator.credentials.get on the phone.
v
v: 1;Defined in: src/kit/handoff.ts:25
HandoffMailbox
type HandoffMailbox = {
answer: Promise<void>;
fetch: Promise<HandoffEnvelope>;
post: Promise<void>;
waitForAnswer: Promise<HandoffAnswer>;
};Defined in: src/kit/handoff.ts:39
@smart-health-checkin/client/handoff: hand a check-in from a screen with
no wallet (a kiosk, a front-desk tablet) to the patient's phone, through a
mailbox you provide.
Kiosk: offer handoffWallet({ mailbox, handoffUrl, onWaiting }) like any
other wallet. Phone: fetchHandoff, then answerHandoff.
Methods
answer()
answer(sessionId, answer): Promise<void>;Defined in: src/kit/handoff.ts:45
Phone → kiosk.
Parameters
| Parameter | Type |
|---|---|
sessionId |
string |
answer |
HandoffAnswer |
Returns
Promise<void>
fetch()
fetch(sessionId): Promise<HandoffEnvelope>;Defined in: src/kit/handoff.ts:43
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:41
Kiosk → phone.
Parameters
| Parameter | Type |
|---|---|
sessionId |
string |
envelope |
HandoffEnvelope |
Returns
Promise<void>
waitForAnswer()
waitForAnswer(sessionId, options?): Promise<HandoffAnswer>;Defined in: src/kit/handoff.ts:47
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:50
@smart-health-checkin/client/handoff: hand a check-in from a screen with
no wallet (a kiosk, a front-desk tablet) to the patient's phone, through a
mailbox you provide.
Kiosk: offer handoffWallet({ mailbox, handoffUrl, onWaiting }) like any
other wallet. Phone: fetchHandoff, then answerHandoff.
Properties
handoffUrl
handoffUrl: string;Defined in: src/kit/handoff.ts:53
The hand-off page the phone will open; the session id goes in its fragment.
mailbox
mailbox: HandoffMailbox;Defined in: src/kit/handoff.ts:51
onWaiting?
optional onWaiting?: (handoff) => void;Defined in: src/kit/handoff.ts:55
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:57
Default: random.
signal?
optional signal?: AbortSignal;Defined in: src/kit/handoff.ts:60
ttlMs?
optional ttlMs?: number;Defined in: src/kit/handoff.ts:59
How long the phone may take to pick the request up. Default ten minutes.
Functions
answerHandoff()
function answerHandoff(
mailbox,
sessionId,
envelope,
wallet?,
options?): Promise<HandoffAnswer>;Defined in: src/kit/handoff.ts:124
Phone side, step two: ask the wallet and send back what it returned.
wallet defaults to the phone's own (the browser's navigator.credentials.get);
pass a web wallet or the mock to answer without one. options.session is a
session already opened with wallet.open(), for example by the picker in
pick mode. A decline is reported to the kiosk as a decline, not as silence.
Parameters
| Parameter | Type |
|---|---|
mailbox |
HandoffMailbox |
sessionId |
string |
envelope |
HandoffEnvelope |
wallet |
Wallet |
options |
{ session?: WalletSession; } |
options.session? |
WalletSession |
Returns
Promise<HandoffAnswer>
fetchHandoff()
function fetchHandoff(mailbox, sessionId): Promise<{
envelope: HandoffEnvelope;
request: SmartCheckinRequest;
}>;Defined in: src/kit/handoff.ts:108
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;
}>
handoffUrlFor()
function handoffUrlFor(handoffUrl, sessionId): string;Defined in: src/kit/handoff.ts:66
The URL the QR code carries.
Parameters
| Parameter | Type |
|---|---|
handoffUrl |
string |
sessionId |
string |
Returns
string
handoffWallet()
function handoffWallet(options): Wallet;Defined in: src/kit/handoff.ts:160
A kiosk's "use your phone" option as a wallet: posts the request to the
mailbox, calls onWaiting with the URL to show as a QR code, and waits for
the phone's answer.
Parameters
| Parameter | Type |
|---|---|
options |
Omit<HandoffOptions, "signal"> & { description?: string; name?: string; } |
Returns
sessionIdFromHash()
function sessionIdFromHash(hash): string | null;Defined in: src/kit/handoff.ts:73
The session id from a hand-off page's location hash, or null.
Parameters
| Parameter | Type |
|---|---|
hash |
string |
Returns
string | null