dataspace-client-sdk-node 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +12 -14
- package/package.json +12 -2
- package/TODO_PROMPT_NEXT_STEPS.md +0 -185
- package/artifacts/update-smart-wallet.js +0 -1016
- package/dist/builders.d.ts +0 -12
- package/dist/builders.js +0 -17
- package/dist/client.d.ts +0 -453
- package/dist/client.js +0 -1755
- package/dist/consent/pdfSignatureVerification.d.ts +0 -18
- package/dist/consent/pdfSignatureVerification.js +0 -23
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -9
- package/dist/sdk/dataspace-wallet-sdk-node/MultiWalletClient.d.ts +0 -9
- package/dist/sdk/dataspace-wallet-sdk-node/MultiWalletClient.js +0 -21
- package/dist/sdk/dataspace-wallet-sdk-node/WalletClient.d.ts +0 -26
- package/dist/sdk/dataspace-wallet-sdk-node/WalletClient.js +0 -36
- package/dist/sdk/dataspace-wallet-sdk-node/index.d.ts +0 -6
- package/dist/sdk/dataspace-wallet-sdk-node/index.js +0 -6
- package/dist/sdk/dataspace-wallet-sdk-node/provider.d.ts +0 -24
- package/dist/sdk/dataspace-wallet-sdk-node/provider.js +0 -1
- package/dist/sdk/dataspace-wallet-sdk-node/providers/memory-provider.d.ts +0 -41
- package/dist/sdk/dataspace-wallet-sdk-node/providers/memory-provider.js +0 -216
- package/dist/sdk/dataspace-wallet-sdk-node/providers/seed-provider.d.ts +0 -22
- package/dist/sdk/dataspace-wallet-sdk-node/providers/seed-provider.js +0 -28
- package/dist/sdk/dataspace-wallet-sdk-node/types.d.ts +0 -51
- package/dist/sdk/dataspace-wallet-sdk-node/types.js +0 -1
- package/dist/types.d.ts +0 -556
- package/dist/types.js +0 -1
- package/dist/vp-token.d.ts +0 -37
- package/dist/vp-token.js +0 -56
package/dist/types.d.ts
DELETED
|
@@ -1,556 +0,0 @@
|
|
|
1
|
-
import type { WalletProvider } from './sdk/dataspace-wallet-sdk-node/provider.js';
|
|
2
|
-
import type { PublicJwk, WalletContext } from './sdk/dataspace-wallet-sdk-node/types.js';
|
|
3
|
-
export type DidcommPlainMessage = {
|
|
4
|
-
jti: string;
|
|
5
|
-
thid: string;
|
|
6
|
-
iss: string;
|
|
7
|
-
aud: string;
|
|
8
|
-
type: string;
|
|
9
|
-
body: Record<string, unknown>;
|
|
10
|
-
meta?: Record<string, unknown>;
|
|
11
|
-
};
|
|
12
|
-
export type AsyncPollRequest = {
|
|
13
|
-
thid: string;
|
|
14
|
-
};
|
|
15
|
-
export type RouteContext = {
|
|
16
|
-
tenantId: string;
|
|
17
|
-
jurisdiction: string;
|
|
18
|
-
sector: string;
|
|
19
|
-
};
|
|
20
|
-
export type V1Section = 'registry' | 'entity' | 'identity' | 'individual' | 'digitaltwin' | string;
|
|
21
|
-
export type V1Action = '_batch' | '_search' | '_search-response' | '_batch-response' | '_activate' | '_activate-response' | '_dcr' | '_dcr-response' | '_exchange' | '_exchange-response' | '_issue' | 'token' | 'token-response' | '_custom' | '_custom-response' | string;
|
|
22
|
-
export type HostRouteContext = {
|
|
23
|
-
jurisdiction: string;
|
|
24
|
-
sector: string;
|
|
25
|
-
};
|
|
26
|
-
export type SubmitResponse = {
|
|
27
|
-
status: number;
|
|
28
|
-
location?: string;
|
|
29
|
-
body: unknown;
|
|
30
|
-
};
|
|
31
|
-
export type PollOptions = {
|
|
32
|
-
timeoutMs?: number;
|
|
33
|
-
intervalMs?: number;
|
|
34
|
-
};
|
|
35
|
-
export type PollResult = {
|
|
36
|
-
status: number;
|
|
37
|
-
body: unknown;
|
|
38
|
-
attempts: number;
|
|
39
|
-
};
|
|
40
|
-
export type SubmitAndPollResult = {
|
|
41
|
-
submit: SubmitResponse;
|
|
42
|
-
poll: PollResult;
|
|
43
|
-
};
|
|
44
|
-
/** Status of a family-organization registration lookup or create attempt. */
|
|
45
|
-
export type FamilyRegistrationStatus = 'new_created' | 'resume_required' | 'already_exists' | 'not_found';
|
|
46
|
-
/**
|
|
47
|
-
* Minimal reference to a SubjectOrganization — the identity root for a subject.
|
|
48
|
-
* Any field can serve as a resolution key. `organizationId` and `did` are canonical;
|
|
49
|
-
* `telephone` + `nickname` are composite lookup keys used during onboarding.
|
|
50
|
-
*/
|
|
51
|
-
export type SubjectOrganizationRef = {
|
|
52
|
-
/** Vault UUID of the org.schema/Organization resource. */
|
|
53
|
-
organizationId?: string;
|
|
54
|
-
/** Decentralized identifier: did:web:...individual:<id> */
|
|
55
|
-
did?: string;
|
|
56
|
-
/** E.164 phone — used as resolution key during registration (`org.schema.Organization.owner.telephone`). */
|
|
57
|
-
telephone?: string;
|
|
58
|
-
/** `org.schema.Organization.alternateName` (nickname / usualname). */
|
|
59
|
-
nickname?: string;
|
|
60
|
-
/** Optional ISO-8601 date (`org.schema.Organization.foundingDate`) — used as tiebreaker during lookup. */
|
|
61
|
-
birthDate?: string;
|
|
62
|
-
};
|
|
63
|
-
/**
|
|
64
|
-
* Granular access domain for a SubjectOrganization.
|
|
65
|
-
*
|
|
66
|
-
* Health sub-domains map to FHIR Level 4 Record-keeping and Data Exchange categories:
|
|
67
|
-
* health.clinical — Condition, Procedure, AllergyIntolerance, FamilyMemberHistory, …
|
|
68
|
-
* health.diagnostics — Observation, DiagnosticReport, ImagingStudy, Specimen, …
|
|
69
|
-
* health.genomics — MolecularSequence, GenomicStudy, …
|
|
70
|
-
* health.medications — MedicationRequest, MedicationStatement, MedicationDispense, …
|
|
71
|
-
* health.workflow — Appointment, Task, ServiceRequest, CarePlan, …
|
|
72
|
-
* health.financial — Claim, Coverage, ExplanationOfBenefit, …
|
|
73
|
-
*
|
|
74
|
-
* TODO: Clinical and diagnostics sub-domain must define LOINC codes for specific health sections:
|
|
75
|
-
* - Document section codes (LOINC codes used in CCDA sections).
|
|
76
|
-
* - See https://hl7.org/fhir/valueset-doc-section-codes.html
|
|
77
|
-
* 10154-3 Chief complaint Narrative - Reported
|
|
78
|
-
* 10157-6 History of family member diseases Narrative
|
|
79
|
-
* 10160-0 History of Medication use Narrative
|
|
80
|
-
* 10164-2 History of Present illness Narrative
|
|
81
|
-
* 10183-2 Hospital discharge medications Narrative
|
|
82
|
-
* 10184-0 Hospital discharge physical findings Narrative
|
|
83
|
-
* 10187-3 Review of systems Narrative - Reported
|
|
84
|
-
* 10210-3 Physical findings of General status Narrative
|
|
85
|
-
* 10216-0 Surgical operation note fluids Narrative
|
|
86
|
-
* 10218-6 Surgical operation note postoperative diagnosis Narrative
|
|
87
|
-
* 10223-6 Surgical operation note surgical procedure Narrative
|
|
88
|
-
* 10222-8 Surgical operation note surgical complications [Interpretation] Narrative
|
|
89
|
-
* 11329-0 History general Narrative - Reported
|
|
90
|
-
* 11348-0 History of Past illness Narrative
|
|
91
|
-
* 11369-6 History of Immunization Narrative
|
|
92
|
-
* 57852-6 Problem list Narrative - Reported
|
|
93
|
-
* 11493-4 Hospital discharge studies summary Narrative
|
|
94
|
-
* 11535-2 Hospital discharge Dx Narrative
|
|
95
|
-
* 11537-8 Surgical drains Narrative
|
|
96
|
-
* 18776-5 Plan of care note
|
|
97
|
-
* 18841-7 Hospital consultations Document
|
|
98
|
-
* 29299-5 Reason for visit Narrative
|
|
99
|
-
* 29545-1 Physical findings Narrative
|
|
100
|
-
* 29549-3 Medication administered Narrative
|
|
101
|
-
* 29554-3 Procedure Narrative
|
|
102
|
-
* 29762-2 Social history Narrative
|
|
103
|
-
* 30954-2 Relevant diagnostic tests/laboratory data Narrative
|
|
104
|
-
* 42344-2 Discharge diet (narrative)
|
|
105
|
-
* 42346-7 Medications on admission (narrative)
|
|
106
|
-
* 42348-3 Advance directives
|
|
107
|
-
* 42349-1 Reason for referral (narrative)
|
|
108
|
-
* 46240-8 History of Hospitalizations+Outpatient visits Narrative
|
|
109
|
-
* 46241-6 Hospital admission diagnosis Narrative - Reported
|
|
110
|
-
* 46264-8 History of medical device use
|
|
111
|
-
* 47420-5 Functional status assessment note
|
|
112
|
-
* 47519-4 History of Procedures Document
|
|
113
|
-
* 48765-2 Allergies and adverse reactions Document
|
|
114
|
-
* 48768-6 Payment sources Document
|
|
115
|
-
* 51848-0 Evaluation note
|
|
116
|
-
* 55109-3 Complications Document
|
|
117
|
-
* 55122-6 Surgical operation note implants Narrative
|
|
118
|
-
* 59768-2 Procedure indications [Interpretation] Narrative
|
|
119
|
-
* 59769-0 Postprocedure diagnosis Narrative
|
|
120
|
-
* 59770-8 Procedure estimated blood loss Narrative
|
|
121
|
-
* 59771-6 Procedure implants Narrative
|
|
122
|
-
* 59772-4 Planned procedure Narrative
|
|
123
|
-
* 59773-2 Procedure specimens taken Narrative
|
|
124
|
-
* 59775-7 Procedure disposition Narrative
|
|
125
|
-
* 59776-5 Procedure findings Narrative
|
|
126
|
-
* 61149-1 Objective Narrative
|
|
127
|
-
* 61150-9 Subjective Narrative
|
|
128
|
-
* 69730-0 Instructions
|
|
129
|
-
* 8648-8 Hospital course Narrative
|
|
130
|
-
* 8653-8 Hospital Discharge instructions
|
|
131
|
-
* 8716-3 Vital signs
|
|
132
|
-
*/
|
|
133
|
-
export type AccessDomain = 'health.clinical' | 'health.diagnostics' | 'health.genomics' | 'health.medications' | 'health.workflow' | 'health.financial';
|
|
134
|
-
/**
|
|
135
|
-
* Resolved access context for an actor operating on a SubjectOrganization.
|
|
136
|
-
* Controller has default access to all domains; this can be restricted per consent.
|
|
137
|
-
*/
|
|
138
|
-
export type SubjectOrganizationAccessContext = {
|
|
139
|
-
subjectOrganization: SubjectOrganizationRef;
|
|
140
|
-
/** DID or phone of the actor (controller, caregiver, self, professional). */
|
|
141
|
-
controllerActorRef?: string;
|
|
142
|
-
/** Domains the actor is currently authorized to access. */
|
|
143
|
-
grantedDomains: AccessDomain[];
|
|
144
|
-
/** SMART bearer token (issued when backend supports subject-scoped organization tokens). */
|
|
145
|
-
accessToken?: string;
|
|
146
|
-
/** ID of the default consent rule bootstrapped for this controller. */
|
|
147
|
-
consentId?: string;
|
|
148
|
-
/** Lifecycle state of the access context. */
|
|
149
|
-
status?: 'ready' | 'consent_pending' | 'token_pending';
|
|
150
|
-
};
|
|
151
|
-
/** Summary returned by `searchFamilyOrganization` or parsed from a family `_batch` response. */
|
|
152
|
-
export type FamilyOrganizationSummary = {
|
|
153
|
-
status: FamilyRegistrationStatus;
|
|
154
|
-
offerId?: string;
|
|
155
|
-
organizationId?: string;
|
|
156
|
-
/** Subject identity snapshot. Shares the same shape as SubjectOrganizationRef. */
|
|
157
|
-
subjectInfo?: SubjectOrganizationRef;
|
|
158
|
-
missingFields?: string[];
|
|
159
|
-
updatedAt?: string;
|
|
160
|
-
};
|
|
161
|
-
export type OfferPreview = {
|
|
162
|
-
offerId?: string;
|
|
163
|
-
amount?: string;
|
|
164
|
-
currency?: string;
|
|
165
|
-
seats?: number;
|
|
166
|
-
planName?: string;
|
|
167
|
-
sku?: string;
|
|
168
|
-
paymentMethod?: string;
|
|
169
|
-
checkoutUrl?: string;
|
|
170
|
-
};
|
|
171
|
-
export type OfferInfo = OfferPreview;
|
|
172
|
-
export type EndpointSelector = {
|
|
173
|
-
section: string;
|
|
174
|
-
format: string;
|
|
175
|
-
resourceType: string;
|
|
176
|
-
action: string;
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Input for organization activation in GW using ICA-derived proof material.
|
|
180
|
-
*
|
|
181
|
-
* `vpToken` is required because GW activation validates the VP proof.
|
|
182
|
-
* VC and regulatory evidence are optional enrichments used by policy/business checks.
|
|
183
|
-
*/
|
|
184
|
-
export type GatewayOrganizationActivationInput = {
|
|
185
|
-
vpToken: string;
|
|
186
|
-
/** Generic requested seats/members for initial offer sizing. Defaults to 2. */
|
|
187
|
-
numberOfMembers?: number;
|
|
188
|
-
organizationVc?: string;
|
|
189
|
-
legalRepresentativeVc?: string;
|
|
190
|
-
regulatoryEvidence?: Record<string, unknown>;
|
|
191
|
-
/** @deprecated Prefer `numberOfMembers` and explicit input fields. */
|
|
192
|
-
additionalClaims?: Record<string, unknown>;
|
|
193
|
-
};
|
|
194
|
-
export type GatewayOrganizationActivationSimpleInput = {
|
|
195
|
-
jurisdiction?: string;
|
|
196
|
-
sector?: string;
|
|
197
|
-
vpToken: string;
|
|
198
|
-
serviceProviderDidWeb?: string;
|
|
199
|
-
serviceProviderUrl?: string;
|
|
200
|
-
controllerEmail?: string;
|
|
201
|
-
controllerTelephone?: string;
|
|
202
|
-
controllerRole: string;
|
|
203
|
-
numberOfMembers?: number;
|
|
204
|
-
timeoutSeconds?: number;
|
|
205
|
-
intervalSeconds?: number;
|
|
206
|
-
organizationVc?: string;
|
|
207
|
-
legalRepresentativeVc?: string;
|
|
208
|
-
regulatoryEvidence?: Record<string, unknown>;
|
|
209
|
-
additionalClaims?: Record<string, unknown>;
|
|
210
|
-
};
|
|
211
|
-
export type LegalOrganizationOrderSimpleInput = {
|
|
212
|
-
jurisdiction?: string;
|
|
213
|
-
sector?: string;
|
|
214
|
-
offerId: string;
|
|
215
|
-
timeoutSeconds?: number;
|
|
216
|
-
intervalSeconds?: number;
|
|
217
|
-
dataType?: string;
|
|
218
|
-
additionalClaims?: Record<string, unknown>;
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Input for device activation based on activation code exchange + DCR.
|
|
222
|
-
*/
|
|
223
|
-
export type EmployeeDeviceActivationInput = {
|
|
224
|
-
activationCode: string;
|
|
225
|
-
idToken: string;
|
|
226
|
-
dcrPayload: Record<string, unknown>;
|
|
227
|
-
pollOptions?: PollOptions;
|
|
228
|
-
};
|
|
229
|
-
export type EmployeeDeviceActivationSimpleInput = {
|
|
230
|
-
tenantId?: string;
|
|
231
|
-
jurisdiction?: string;
|
|
232
|
-
sector?: string;
|
|
233
|
-
activationCode: string;
|
|
234
|
-
idToken: string;
|
|
235
|
-
dcrPayload: Record<string, unknown>;
|
|
236
|
-
timeoutSeconds?: number;
|
|
237
|
-
intervalSeconds?: number;
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* Result of device activation flow.
|
|
241
|
-
*
|
|
242
|
-
* - `exchange` is the Token/_exchange submit+poll result.
|
|
243
|
-
* - `dcr` is the Device/_dcr submit+poll result.
|
|
244
|
-
*/
|
|
245
|
-
export type EmployeeDeviceActivationResult = {
|
|
246
|
-
initialAccessToken: string;
|
|
247
|
-
exchange: SubmitAndPollResult;
|
|
248
|
-
dcr: SubmitAndPollResult;
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Input for UC 5.3 organization employee creation.
|
|
252
|
-
*/
|
|
253
|
-
export type OrganizationEmployeeCreationInput = {
|
|
254
|
-
employeeClaims: Record<string, unknown>;
|
|
255
|
-
dataType?: string;
|
|
256
|
-
};
|
|
257
|
-
/**
|
|
258
|
-
* Input for UC 5.1 subject organization bootstrap.
|
|
259
|
-
*/
|
|
260
|
-
export type SubjectOrganizationBootstrapInput = {
|
|
261
|
-
registrationPayload: {
|
|
262
|
-
thid?: string;
|
|
263
|
-
} & Record<string, unknown>;
|
|
264
|
-
confirmationPayload?: {
|
|
265
|
-
thid?: string;
|
|
266
|
-
} & Record<string, unknown>;
|
|
267
|
-
pollOptions?: PollOptions;
|
|
268
|
-
};
|
|
269
|
-
/**
|
|
270
|
-
* Result for UC 5.1 subject organization bootstrap.
|
|
271
|
-
*/
|
|
272
|
-
export type SubjectOrganizationBootstrapResult = {
|
|
273
|
-
registration: SubmitAndPollResult;
|
|
274
|
-
confirmation?: SubmitAndPollResult;
|
|
275
|
-
};
|
|
276
|
-
export type IndividualOrganizationBootstrapSimpleInput = {
|
|
277
|
-
tenantId?: string;
|
|
278
|
-
jurisdiction?: string;
|
|
279
|
-
sector?: string;
|
|
280
|
-
alternateName: string;
|
|
281
|
-
controllerEmail?: string;
|
|
282
|
-
controllerTelephone?: string;
|
|
283
|
-
controllerRole?: string;
|
|
284
|
-
timeoutSeconds?: number;
|
|
285
|
-
intervalSeconds?: number;
|
|
286
|
-
additionalClaims?: Record<string, unknown>;
|
|
287
|
-
};
|
|
288
|
-
export type IndividualOrganizationBootstrapSimpleResult = {
|
|
289
|
-
registration: SubmitAndPollResult;
|
|
290
|
-
offerId: string;
|
|
291
|
-
confirmation: SubmitAndPollResult;
|
|
292
|
-
};
|
|
293
|
-
export type IndividualOrganizationStartSimpleResult = {
|
|
294
|
-
registration: SubmitAndPollResult;
|
|
295
|
-
offerId: string;
|
|
296
|
-
offerPreview: OfferPreview;
|
|
297
|
-
};
|
|
298
|
-
export type IndividualOrganizationConfirmOrderSimpleInput = {
|
|
299
|
-
tenantId?: string;
|
|
300
|
-
jurisdiction?: string;
|
|
301
|
-
sector?: string;
|
|
302
|
-
offerId: string;
|
|
303
|
-
timeoutSeconds?: number;
|
|
304
|
-
intervalSeconds?: number;
|
|
305
|
-
};
|
|
306
|
-
/**
|
|
307
|
-
* Input for UC 5.5 IPS/FHIR import and index update.
|
|
308
|
-
*/
|
|
309
|
-
export type IpsOrFhirImportInput = {
|
|
310
|
-
compositionPayload: {
|
|
311
|
-
thid?: string;
|
|
312
|
-
} & Record<string, unknown>;
|
|
313
|
-
format?: 'api' | 'r4';
|
|
314
|
-
pollOptions?: PollOptions;
|
|
315
|
-
};
|
|
316
|
-
export type ConsentActorTargetInput = {
|
|
317
|
-
/** Canonical actor identifier (did:web:..., urn:taxid:..., urn:tel:..., email, etc.). */
|
|
318
|
-
identifier?: string;
|
|
319
|
-
/** Preferred URL/domain alias resolved to did:web:<host>. */
|
|
320
|
-
url?: string;
|
|
321
|
-
/** Legacy alias kept for backwards compatibility. */
|
|
322
|
-
didWeb?: string;
|
|
323
|
-
/** Legacy alias kept for backwards compatibility. */
|
|
324
|
-
organizationUrl?: string;
|
|
325
|
-
organizationTaxId?: string;
|
|
326
|
-
email?: string;
|
|
327
|
-
phone?: string;
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* Input for UC 5.6 consent submission from minimal frontend fields.
|
|
331
|
-
*/
|
|
332
|
-
export type GrantProfessionalAccessSimpleInput = {
|
|
333
|
-
subjectDid?: string;
|
|
334
|
-
subjectPhone?: string;
|
|
335
|
-
subjectGivenName?: string;
|
|
336
|
-
actor: ConsentActorTargetInput;
|
|
337
|
-
actorRole: string;
|
|
338
|
-
purpose: string;
|
|
339
|
-
actions: string[];
|
|
340
|
-
consentIdentifier?: string;
|
|
341
|
-
consentDate?: string;
|
|
342
|
-
decision?: 'permit' | 'deny';
|
|
343
|
-
attachmentContentType?: string;
|
|
344
|
-
attachmentBase64?: string;
|
|
345
|
-
dataType?: string;
|
|
346
|
-
pollOptions?: PollOptions;
|
|
347
|
-
};
|
|
348
|
-
export type GrantProfessionalAccessSimpleResult = {
|
|
349
|
-
thid: string;
|
|
350
|
-
consent: SubmitAndPollResult;
|
|
351
|
-
subjectIdentifier: string;
|
|
352
|
-
actorIdentifier: string;
|
|
353
|
-
consentClaims: Record<string, unknown>;
|
|
354
|
-
claimsCid?: string;
|
|
355
|
-
};
|
|
356
|
-
/**
|
|
357
|
-
* Input for UC 5.7 digital twin generation from subject data.
|
|
358
|
-
*/
|
|
359
|
-
export type DigitalTwinGenerationInput = {
|
|
360
|
-
compositionPayload: {
|
|
361
|
-
thid?: string;
|
|
362
|
-
} & Record<string, unknown>;
|
|
363
|
-
format?: 'api' | 'r4';
|
|
364
|
-
pollOptions?: PollOptions;
|
|
365
|
-
};
|
|
366
|
-
export type PhoneReminderWindowInput = {
|
|
367
|
-
offsetMinutes: number;
|
|
368
|
-
remindAt: string;
|
|
369
|
-
};
|
|
370
|
-
export type CreatePhoneReminderTasksInput = {
|
|
371
|
-
windows: PhoneReminderWindowInput[];
|
|
372
|
-
locale?: string;
|
|
373
|
-
/**
|
|
374
|
-
* Optional snapshot/fallback phone for the subject.
|
|
375
|
-
*
|
|
376
|
-
* Canonical resolution should come from `subjectRef` (UUID/resource reference)
|
|
377
|
-
* in backend task execution. Provide this only when you explicitly want to
|
|
378
|
-
* persist a denormalized value for audit/fallback or to avoid lookup at runtime.
|
|
379
|
-
*/
|
|
380
|
-
notificationPhone?: string;
|
|
381
|
-
/**
|
|
382
|
-
* Optional snapshot/fallback phone for the controller/owner.
|
|
383
|
-
*
|
|
384
|
-
* Canonical resolution should come from `ownerRef` (e.g. did:web / RelatedPerson ref)
|
|
385
|
-
* in backend task execution. Provide this only for audit/fallback/optimization.
|
|
386
|
-
*/
|
|
387
|
-
controllerPhone?: string;
|
|
388
|
-
subjectRef: string;
|
|
389
|
-
ownerRef: string;
|
|
390
|
-
focusRef: string;
|
|
391
|
-
subjectDisplay?: string;
|
|
392
|
-
/**
|
|
393
|
-
* Context summary for what this reminder is based on
|
|
394
|
-
* (appointment, medication schedule, or another domain event).
|
|
395
|
-
* Mapped to Task claim `based-on-display`.
|
|
396
|
-
*/
|
|
397
|
-
reminderSummary?: string;
|
|
398
|
-
/**
|
|
399
|
-
* @deprecated Use `reminderSummary` instead.
|
|
400
|
-
*/
|
|
401
|
-
appointmentSummary?: string;
|
|
402
|
-
callSid?: string;
|
|
403
|
-
dataType?: string;
|
|
404
|
-
/**
|
|
405
|
-
* Short task title (e.g. "Reminder phone call", "Medication reminder").
|
|
406
|
-
* Mapped to Task resource `description`.
|
|
407
|
-
*/
|
|
408
|
-
description?: string;
|
|
409
|
-
maxAttempts?: number;
|
|
410
|
-
};
|
|
411
|
-
export type MedicationIntakeTimeInput = {
|
|
412
|
-
/** HH:mm (24h), example: 08:00 */
|
|
413
|
-
hhmm: string;
|
|
414
|
-
};
|
|
415
|
-
/** Canonical flat claim shape: `<ResourceType>.<concrete-param>` */
|
|
416
|
-
export type FlatInteroperableClaims = Record<`${string}.${string}`, unknown>;
|
|
417
|
-
export type MedicationOverlapCheckInput = {
|
|
418
|
-
subjectRef: string;
|
|
419
|
-
/** Canonical flat claims (FHIR-style, lowercase/hyphen params). */
|
|
420
|
-
claims?: FlatInteroperableClaims;
|
|
421
|
-
startDate: string;
|
|
422
|
-
endDate?: string;
|
|
423
|
-
intakeTimes: MedicationIntakeTimeInput[];
|
|
424
|
-
repeatIntervalHhmm?: string;
|
|
425
|
-
maxDailyIntakes?: number;
|
|
426
|
-
/**
|
|
427
|
-
* Optional tolerance in minutes for "same-time" collision.
|
|
428
|
-
* If omitted, backend default policy applies.
|
|
429
|
-
*/
|
|
430
|
-
overlapToleranceMinutes?: number;
|
|
431
|
-
};
|
|
432
|
-
export type MedicationRegistrationInput = {
|
|
433
|
-
locale?: string;
|
|
434
|
-
subjectRef: string;
|
|
435
|
-
ownerRef: string;
|
|
436
|
-
notificationPhone?: string;
|
|
437
|
-
controllerPhone?: string;
|
|
438
|
-
/** Canonical flat claims (FHIR-style, lowercase/hyphen params). */
|
|
439
|
-
claims?: FlatInteroperableClaims;
|
|
440
|
-
medicationDescription?: string;
|
|
441
|
-
doseValue?: string;
|
|
442
|
-
doseUnitOrFormCode?: string;
|
|
443
|
-
intakeTimes?: MedicationIntakeTimeInput[];
|
|
444
|
-
repeatIntervalHhmm?: string;
|
|
445
|
-
maxDailyIntakes?: number;
|
|
446
|
-
startDate?: string;
|
|
447
|
-
durationDays?: number;
|
|
448
|
-
endDate?: string;
|
|
449
|
-
maxAttempts?: number;
|
|
450
|
-
};
|
|
451
|
-
export type ClientOptions = {
|
|
452
|
-
baseUrl: string;
|
|
453
|
-
bearerToken?: string;
|
|
454
|
-
defaultHeaders?: Record<string, string>;
|
|
455
|
-
wallet?: WalletProvider;
|
|
456
|
-
/** Optional default tenant context so calls can omit ctx repeatedly. */
|
|
457
|
-
ctx?: RouteContext;
|
|
458
|
-
};
|
|
459
|
-
/**
|
|
460
|
-
* Options for identity-exchange.v1 backend PKCE + token exchange flow.
|
|
461
|
-
* Equivalent to Python connector_sdk `authenticate_backend_pkce_and_exchange`.
|
|
462
|
-
*/
|
|
463
|
-
export type BackendPkceAuthOptions = {
|
|
464
|
-
/** Route context providing tenantId, jurisdiction, sector. */
|
|
465
|
-
ctx: RouteContext;
|
|
466
|
-
/** API key issued by ICA for this service (used as client_id in DCR). */
|
|
467
|
-
apiKey: string;
|
|
468
|
-
/**
|
|
469
|
-
* Service public JWK bound to the API key via DCR.
|
|
470
|
-
* Optional when the client was constructed with a wallet provider.
|
|
471
|
-
*/
|
|
472
|
-
controllerPublicJwk?: PublicJwk | Record<string, unknown>;
|
|
473
|
-
/**
|
|
474
|
-
* Optional wallet resolution context when it differs from `ctx`.
|
|
475
|
-
* Defaults to the route context values.
|
|
476
|
-
*/
|
|
477
|
-
walletContext?: WalletContext;
|
|
478
|
-
/** Requested scopes for the SMART bearer token. */
|
|
479
|
-
scopes: string[];
|
|
480
|
-
/** Cache key for the resulting bearer token. Defaults to `pkce:<apiKey prefix>`. */
|
|
481
|
-
tokenCacheKey?: string;
|
|
482
|
-
/** @deprecated Use `tokenCacheKey`. */
|
|
483
|
-
endpointId?: string;
|
|
484
|
-
/** PKCE code verifier. Auto-generated with randomUUID if not provided. */
|
|
485
|
-
codeVerifier?: string;
|
|
486
|
-
/** Polling options for each async step. */
|
|
487
|
-
pollOptions?: PollOptions;
|
|
488
|
-
};
|
|
489
|
-
export type BackendPkceAuthResult = {
|
|
490
|
-
/** `fetched`: new token obtained. `cached`: valid token already in cache. `failed`: flow error. */
|
|
491
|
-
status: 'fetched' | 'cached' | 'failed';
|
|
492
|
-
tokenCacheKey: string;
|
|
493
|
-
/** @deprecated Use `tokenCacheKey`. */
|
|
494
|
-
endpointId: string;
|
|
495
|
-
accessToken: string;
|
|
496
|
-
tokenType: string;
|
|
497
|
-
scopes: string[];
|
|
498
|
-
/** Present on failure: name of the step that failed (`_dcr`, `_code`, `_token`, `_exchange`). */
|
|
499
|
-
step?: string;
|
|
500
|
-
};
|
|
501
|
-
export type BackendSmartAuthOptions = {
|
|
502
|
-
clientId: string;
|
|
503
|
-
scopes: string[];
|
|
504
|
-
tokenCacheKey?: string;
|
|
505
|
-
/** @deprecated Use `tokenCacheKey`. */
|
|
506
|
-
endpointId?: string;
|
|
507
|
-
tokenUrl?: string;
|
|
508
|
-
tokenPath?: string;
|
|
509
|
-
audience?: string;
|
|
510
|
-
assertionTtlSeconds?: number;
|
|
511
|
-
additionalTokenFields?: Record<string, string>;
|
|
512
|
-
publicJwk?: PublicJwk | Record<string, unknown>;
|
|
513
|
-
walletContext?: WalletContext;
|
|
514
|
-
};
|
|
515
|
-
export type BackendSmartAuthResult = {
|
|
516
|
-
status: 'fetched' | 'cached' | 'failed';
|
|
517
|
-
profile: 'smart-backend.v1';
|
|
518
|
-
tokenCacheKey: string;
|
|
519
|
-
/** @deprecated Use `tokenCacheKey`. */
|
|
520
|
-
endpointId: string;
|
|
521
|
-
accessToken?: string;
|
|
522
|
-
tokenType?: string;
|
|
523
|
-
scopes?: string[];
|
|
524
|
-
expiresAt?: string;
|
|
525
|
-
statusCode?: number;
|
|
526
|
-
response?: unknown;
|
|
527
|
-
};
|
|
528
|
-
export type SmartTokenExchangeInput = {
|
|
529
|
-
tokenCacheKey: string;
|
|
530
|
-
/** @deprecated Use `tokenCacheKey`. */
|
|
531
|
-
endpointId?: string;
|
|
532
|
-
scopes: string[];
|
|
533
|
-
exchangePayload: Record<string, unknown>;
|
|
534
|
-
path?: string;
|
|
535
|
-
};
|
|
536
|
-
export type SmartTokenRequestSimpleInput = {
|
|
537
|
-
tenantId?: string;
|
|
538
|
-
jurisdiction?: string;
|
|
539
|
-
sector?: string;
|
|
540
|
-
idToken: string;
|
|
541
|
-
scopes: string[];
|
|
542
|
-
tokenCacheKey?: string;
|
|
543
|
-
/** @deprecated Use `tokenCacheKey`. */
|
|
544
|
-
endpointId?: string;
|
|
545
|
-
timeoutSeconds?: number;
|
|
546
|
-
intervalSeconds?: number;
|
|
547
|
-
additionalClaims?: Record<string, unknown>;
|
|
548
|
-
};
|
|
549
|
-
export type SmartTokenExchangeResult = {
|
|
550
|
-
status: 'fetched' | 'cached' | 'failed';
|
|
551
|
-
accessToken?: string;
|
|
552
|
-
tokenType?: string;
|
|
553
|
-
scopes?: string[];
|
|
554
|
-
statusCode?: number;
|
|
555
|
-
response?: unknown;
|
|
556
|
-
};
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/vp-token.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type VpTokenHeader = {
|
|
2
|
-
alg: string;
|
|
3
|
-
typ?: string;
|
|
4
|
-
kid?: string;
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
};
|
|
7
|
-
export type VpTokenPayload = {
|
|
8
|
-
iss: string;
|
|
9
|
-
sub?: string;
|
|
10
|
-
aud?: string;
|
|
11
|
-
jti?: string;
|
|
12
|
-
iat?: number;
|
|
13
|
-
exp?: number;
|
|
14
|
-
nonce?: string;
|
|
15
|
-
vp: {
|
|
16
|
-
'@context'?: unknown;
|
|
17
|
-
type?: unknown;
|
|
18
|
-
holder?: string;
|
|
19
|
-
verifiableCredential: string[];
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
[key: string]: unknown;
|
|
23
|
-
};
|
|
24
|
-
export declare function generateUuidLike(): string;
|
|
25
|
-
export declare function buildEpochWindow(ttlSeconds?: number): {
|
|
26
|
-
iat: number;
|
|
27
|
-
exp: number;
|
|
28
|
-
};
|
|
29
|
-
export declare function createVP(input?: Partial<VpTokenPayload>): VpTokenPayload;
|
|
30
|
-
export declare function addVC(vpPayload: VpTokenPayload, vcJwt: string): VpTokenPayload;
|
|
31
|
-
export declare function prepareForSignature(header: VpTokenHeader, payload: VpTokenPayload): {
|
|
32
|
-
encodedHeader: string;
|
|
33
|
-
encodedPayload: string;
|
|
34
|
-
signingInput: string;
|
|
35
|
-
};
|
|
36
|
-
export declare function prepareBytesForSignature(header: VpTokenHeader, payload: VpTokenPayload): Uint8Array;
|
|
37
|
-
export declare function buildVpTokenCompact(encodedHeader: string, encodedPayload: string, signatureBase64Url: string): string;
|
package/dist/vp-token.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
function toB64UrlJson(input) {
|
|
2
|
-
return Buffer.from(JSON.stringify(input), 'utf-8').toString('base64url');
|
|
3
|
-
}
|
|
4
|
-
function fallbackId() {
|
|
5
|
-
const rand = Math.random().toString(36).slice(2, 10);
|
|
6
|
-
return `id-${Date.now()}-${rand}`;
|
|
7
|
-
}
|
|
8
|
-
export function generateUuidLike() {
|
|
9
|
-
const fn = globalThis?.crypto?.randomUUID;
|
|
10
|
-
if (typeof fn === 'function')
|
|
11
|
-
return fn.call(globalThis.crypto);
|
|
12
|
-
return fallbackId();
|
|
13
|
-
}
|
|
14
|
-
export function buildEpochWindow(ttlSeconds = 300) {
|
|
15
|
-
const iat = Math.floor(Date.now() / 1000);
|
|
16
|
-
return { iat, exp: iat + Math.max(1, Math.floor(ttlSeconds)) };
|
|
17
|
-
}
|
|
18
|
-
export function createVP(input) {
|
|
19
|
-
const ttl = input?.exp && input?.iat ? undefined : buildEpochWindow(300);
|
|
20
|
-
const jti = input?.jti || generateUuidLike();
|
|
21
|
-
const nonce = input?.nonce || generateUuidLike();
|
|
22
|
-
return {
|
|
23
|
-
iss: String(input?.iss || ''),
|
|
24
|
-
sub: input?.sub,
|
|
25
|
-
aud: input?.aud,
|
|
26
|
-
jti,
|
|
27
|
-
iat: input?.iat ?? ttl?.iat,
|
|
28
|
-
exp: input?.exp ?? ttl?.exp,
|
|
29
|
-
nonce,
|
|
30
|
-
vp: {
|
|
31
|
-
'@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
32
|
-
type: ['VerifiablePresentation'],
|
|
33
|
-
holder: input?.vp?.holder || input?.iss || '',
|
|
34
|
-
verifiableCredential: [],
|
|
35
|
-
...(input?.vp || {}),
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export function addVC(vpPayload, vcJwt) {
|
|
40
|
-
const v = String(vcJwt || '').trim();
|
|
41
|
-
if (v)
|
|
42
|
-
vpPayload.vp.verifiableCredential.push(v);
|
|
43
|
-
return vpPayload;
|
|
44
|
-
}
|
|
45
|
-
export function prepareForSignature(header, payload) {
|
|
46
|
-
const encodedHeader = toB64UrlJson(header);
|
|
47
|
-
const encodedPayload = toB64UrlJson(payload);
|
|
48
|
-
return { encodedHeader, encodedPayload, signingInput: `${encodedHeader}.${encodedPayload}` };
|
|
49
|
-
}
|
|
50
|
-
export function prepareBytesForSignature(header, payload) {
|
|
51
|
-
const { signingInput } = prepareForSignature(header, payload);
|
|
52
|
-
return new TextEncoder().encode(signingInput);
|
|
53
|
-
}
|
|
54
|
-
export function buildVpTokenCompact(encodedHeader, encodedPayload, signatureBase64Url) {
|
|
55
|
-
return `${encodedHeader}.${encodedPayload}.${String(signatureBase64Url || '').trim()}`;
|
|
56
|
-
}
|