gdc-common-utils-ts 1.4.20 → 1.4.22

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.
Files changed (106) hide show
  1. package/README.md +235 -0
  2. package/dist/constants/communication.d.ts +28 -0
  3. package/dist/constants/communication.js +14 -0
  4. package/dist/constants/cryptography.d.ts +35 -0
  5. package/dist/constants/cryptography.js +36 -0
  6. package/dist/constants/device.d.ts +16 -0
  7. package/dist/constants/device.js +15 -0
  8. package/dist/constants/did-services.d.ts +42 -0
  9. package/dist/constants/did-services.js +40 -0
  10. package/dist/constants/fhir-code-systems.d.ts +12 -0
  11. package/dist/constants/fhir-code-systems.js +12 -0
  12. package/dist/constants/fhir-resource-types.d.ts +52 -0
  13. package/dist/constants/fhir-resource-types.js +33 -0
  14. package/dist/constants/fhir-versions.d.ts +10 -0
  15. package/dist/constants/fhir-versions.js +10 -0
  16. package/dist/constants/healthcare.d.ts +222 -0
  17. package/dist/constants/healthcare.js +64 -0
  18. package/dist/constants/index.d.ts +12 -0
  19. package/dist/constants/index.js +12 -0
  20. package/dist/constants/network.d.ts +13 -0
  21. package/dist/constants/network.js +13 -0
  22. package/dist/constants/schemaorg.d.ts +36 -1
  23. package/dist/constants/schemaorg.js +36 -0
  24. package/dist/constants/sectors.d.ts +24 -0
  25. package/dist/constants/sectors.js +24 -0
  26. package/dist/constants/smart.d.ts +12 -0
  27. package/dist/constants/smart.js +12 -0
  28. package/dist/constants/vital-signs.d.ts +75 -0
  29. package/dist/constants/vital-signs.js +33 -0
  30. package/dist/examples/api-flow-examples.d.ts +13 -0
  31. package/dist/examples/api-flow-examples.js +14 -0
  32. package/dist/examples/contract-examples.d.ts +13 -0
  33. package/dist/examples/contract-examples.js +14 -0
  34. package/dist/examples/frontend-session.d.ts +17 -0
  35. package/dist/examples/frontend-session.js +18 -0
  36. package/dist/examples/index.d.ts +8 -0
  37. package/dist/examples/index.js +8 -0
  38. package/dist/examples/individual-controller.d.ts +111 -0
  39. package/dist/examples/individual-controller.js +85 -0
  40. package/dist/examples/organization-controller.d.ts +158 -0
  41. package/dist/examples/organization-controller.js +84 -0
  42. package/dist/examples/professional.d.ts +221 -0
  43. package/dist/examples/professional.js +312 -0
  44. package/dist/examples/related-person.d.ts +10 -0
  45. package/dist/examples/related-person.js +13 -0
  46. package/dist/examples/shared.d.ts +97 -0
  47. package/dist/examples/shared.js +105 -0
  48. package/dist/hmac.d.ts +12 -0
  49. package/dist/hmac.js +12 -0
  50. package/dist/index.d.ts +3 -0
  51. package/dist/index.js +3 -0
  52. package/dist/models/device-license.d.ts +3 -2
  53. package/dist/models/did.d.ts +35 -0
  54. package/dist/models/identity-bootstrap.d.ts +104 -0
  55. package/dist/models/identity-bootstrap.js +2 -0
  56. package/dist/models/index.d.ts +1 -0
  57. package/dist/models/index.js +1 -0
  58. package/dist/models/interoperable-claims/communication-claims.d.ts +1 -0
  59. package/dist/models/interoperable-claims/communication-claims.js +1 -0
  60. package/dist/models/interoperable-claims/index.d.ts +1 -0
  61. package/dist/models/interoperable-claims/index.js +1 -0
  62. package/dist/models/interoperable-claims/task-claims.d.ts +38 -0
  63. package/dist/models/interoperable-claims/task-claims.js +41 -0
  64. package/dist/models/loinc-document-ontology.d.ts +2 -2
  65. package/dist/models/loinc-document-ontology.js +3 -2
  66. package/dist/utils/activation-policy.d.ts +61 -0
  67. package/dist/utils/activation-policy.js +61 -0
  68. package/dist/utils/activation-request.d.ts +39 -0
  69. package/dist/utils/activation-request.js +57 -0
  70. package/dist/utils/base-convert.d.ts +50 -10
  71. package/dist/utils/base-convert.js +50 -10
  72. package/dist/utils/bundle.d.ts +7 -0
  73. package/dist/utils/bundle.js +7 -0
  74. package/dist/utils/clinical-resource-converters.d.ts +44 -0
  75. package/dist/utils/clinical-resource-converters.js +97 -3
  76. package/dist/utils/communication-document-reference.d.ts +12 -0
  77. package/dist/utils/communication-document-reference.js +12 -0
  78. package/dist/utils/communication-fhir-r4.d.ts +18 -0
  79. package/dist/utils/communication-fhir-r4.js +22 -2
  80. package/dist/utils/communication-identity.d.ts +123 -0
  81. package/dist/utils/communication-identity.js +104 -0
  82. package/dist/utils/consent.d.ts +97 -4
  83. package/dist/utils/consent.js +128 -26
  84. package/dist/utils/did-resolution.d.ts +59 -0
  85. package/dist/utils/did-resolution.js +172 -0
  86. package/dist/utils/did.d.ts +61 -4
  87. package/dist/utils/did.js +87 -6
  88. package/dist/utils/didcomm-submit.d.ts +14 -0
  89. package/dist/utils/didcomm-submit.js +14 -0
  90. package/dist/utils/didcomm.d.ts +20 -0
  91. package/dist/utils/didcomm.js +20 -0
  92. package/dist/utils/discovery-normalization.d.ts +28 -0
  93. package/dist/utils/discovery-normalization.js +64 -0
  94. package/dist/utils/fhir-validator.d.ts +7 -0
  95. package/dist/utils/fhir-validator.js +7 -0
  96. package/dist/utils/index.d.ts +5 -0
  97. package/dist/utils/index.js +5 -0
  98. package/dist/utils/jwt.d.ts +1 -0
  99. package/dist/utils/jwt.js +1 -0
  100. package/dist/utils/smart-scope.d.ts +28 -0
  101. package/dist/utils/smart-scope.js +29 -0
  102. package/dist/utils/url.d.ts +2 -3
  103. package/dist/utils/url.js +2 -3
  104. package/dist/utils/vp-token.d.ts +38 -0
  105. package/dist/utils/vp-token.js +83 -0
  106. package/package.json +9 -1
package/README.md CHANGED
@@ -25,6 +25,8 @@ The published package exposes these entry points through `package.json`:
25
25
  - `gdc-common-utils-ts/AesManager`
26
26
  - `gdc-common-utils-ts/CryptographyService`
27
27
  - `gdc-common-utils-ts/hmac`
28
+ - `gdc-common-utils-ts/examples`
29
+ - `gdc-common-utils-ts/examples/*`
28
30
  - `gdc-common-utils-ts/constants`
29
31
  - `gdc-common-utils-ts/models`
30
32
  - `gdc-common-utils-ts/utils`
@@ -82,6 +84,231 @@ Example:
82
84
  import { JweObject, JwtCompactParts } from 'gdc-common-utils-ts/models';
83
85
  ```
84
86
 
87
+ ## Cross-Repo Task Docs
88
+
89
+ - [docs/consent-access-matrix-task.md](docs/consent-access-matrix-task.md)
90
+ - next-step design/task document for active consent aggregation, explicit deny precedence, controller views, permission-request communications, and SMART access evaluation
91
+
92
+ ## API Index
93
+
94
+ The canonical API contract should live in JSDoc on exported code. The README acts as a navigable index.
95
+
96
+ ### Shared terminology constants
97
+
98
+ - [`FhirCodeSystems`](src/constants/fhir-code-systems.ts)
99
+ - Canonical code system URLs such as `Loinc` and `CommunicationCategory`.
100
+ - Use instead of inline system strings like `http://loinc.org`.
101
+ - [`ResourceTypesFhirR4`](src/constants/fhir-resource-types.ts)
102
+ - Canonical FHIR R4 `resourceType` names such as `Communication`, `Bundle`, `DocumentReference`, `Observation`, `MedicationStatement`, `Consent`.
103
+ - Use instead of inline resource type strings.
104
+ - [`CommunicationCategoryCodes`](src/constants/communication.ts)
105
+ - Canonical `Communication.category` coding descriptors and `<system>|<code>` claims.
106
+ - [`ObservationCategoryCodes`, `VitalSignsCodes`, `VitalSignsUnits`](src/constants/vital-signs.ts)
107
+ - Canonical Vital Signs category, code, and UCUM unit descriptors for `Observation`.
108
+ - [`HealthcareBasicSections`, `HealthcareAdditionalSections`, `HealthcareAllSections`](src/constants/healthcare.ts)
109
+ - Shared IPS/healthcare document section catalogs.
110
+ - [`HealthcareConsentPurposes`, `HealthcareConsentActions`, `HealthcareActorRoles`, `HealthcareActorRoleCodes`](src/constants/healthcare.ts)
111
+ - Shared healthcare authorization and role constants.
112
+ - [`EXAMPLE_PROFESSIONAL_ACCESS_SCENARIOS`](src/examples/professional.ts)
113
+ - Reusable professional role/permission examples tying actor role, consent action, SMART scope, and expected FHIR resource types together.
114
+ - [`DeviceUserClasses`, `DeviceAppTypes`](src/constants/device.ts)
115
+ - Shared user-class and app/device-type constants used by licensing and SDK flows.
116
+ - [`NodeOperatorNetworkTypes`](src/constants/network.ts)
117
+ - Shared network/environment labels for node-operator discovery/bootstrap.
118
+ - [`SmartGatewayScopesFhirR4`](src/constants/smart.ts)
119
+ - Current CORE GW SMART scope literals such as `organization/Consent.cruds`.
120
+
121
+ ### Root exports
122
+
123
+ - [`AesManager`](src/AesManager.ts)
124
+ - AES helper class exported from the package root.
125
+ - [`CryptographyService`](src/CryptographyService.ts)
126
+ - Main cryptography service implementation exported from the package root.
127
+ - [`computeHmacSha256(...)`, `computeHmacSha256Base64Url(...)`](src/hmac.ts)
128
+ - Low-level HMAC helpers for UTF-8 plaintext and raw key bytes.
129
+
130
+ ### Communication / document utilities
131
+
132
+ - [`initializeCommunicationIdentityFromSeed(...)`](src/utils/communication-identity.ts)
133
+ - Derives the technical ML-DSA/ML-KEM communication identity for a device, portal, or app profile and returns JOSE header templates for `meta.jws.protected` and `meta.jwe.header`.
134
+ - Accepts optional explicit `seedMaterial`; otherwise deterministic mode derives from `entityId`, while random mode delegates entropy generation to the cryptography engine.
135
+ - [`buildOrganizationDidWeb(...)`, `buildProfessionalDidWeb(...)`, `buildIndividualDidWeb(...)`](src/utils/did.ts)
136
+ - Build canonical data-space `did:web` identifiers for hosted organizations, professionals, and individuals/family actors.
137
+ - [`buildSmartCompositionReadScope(...)`](src/utils/smart-scope.ts)
138
+ - Builds the current CORE GW pinned SMART root scope for `organization/Composition...` token requests.
139
+ - [`getOrganizationCredentialFromVpToken(...)`, `getLegalRepresentativeCredentialFromVpToken(...)`](src/utils/vp-token.ts)
140
+ - Extract typed VC objects from a VP token when GW/SDK flows carry canonical proof only in `vp_token`.
141
+ - [`validateCommunicationResourceFhirR4(...)`](src/utils/communication-fhir-r4.ts)
142
+ - Validates FHIR R4 `Communication` resources.
143
+ - [`transformCommunicationClaimsToResourceFhirR4(...)`](src/utils/communication-fhir-r4.ts)
144
+ - Converts canonical communication claims into FHIR R4 resources.
145
+ - [`extractCommunicationClaimsFromResourceFhirR4(...)`](src/utils/communication-fhir-r4.ts)
146
+ - Extracts canonical claims from FHIR R4 `Communication`.
147
+ - [`detectAttachmentKind(...)`](src/utils/communication-document-reference.ts)
148
+ - Detects `fhir` / `pdf` / `png` / `jpg` / `binary` from MIME type.
149
+ - [`buildDocumentReferenceFromCommunicationPayload(...)`](src/utils/communication-document-reference.ts)
150
+ - Projects a simplified `DocumentReference` from `Communication.payload[0].contentAttachment`.
151
+
152
+ ### Identity bootstrap / discovery utilities
153
+
154
+ - [`DidServiceIds`, `DidServiceTypes`, `DiscoveryCapabilities`](src/constants/did-services.ts)
155
+ - Canonical DID service ids, service types, and capability names used to publish and resolve `service[]` entries consistently across GW and SDK layers.
156
+ - [`ControllerBindingInput`, `OrganizationBindingInput`, `ActivationProofInput`, `OrganizationActivationRequest`](src/models/identity-bootstrap.ts)
157
+ - Canonical bootstrap contracts that explicitly separate person/controller key binding from provider/organization key binding.
158
+ - `vp_token` is the canonical proof carrier; `controller.*` and `organization.*` carry public key binding material for DID publication.
159
+ - [`IdentityBootstrapValidationIssue`, `IdentityBootstrapValidationResult`](src/models/identity-bootstrap.ts)
160
+ - Shared validation result shapes used by bootstrap builders/validators.
161
+ - [`buildOrganizationActivationRequest(...)`](src/utils/activation-request.ts)
162
+ - Builds the canonical `_activate` payload with `vp_token` as the primary proof plus optional explicit controller/organization binding data.
163
+ - [`validateOrganizationActivationRequest(...)`](src/utils/activation-request.ts)
164
+ - Enforces bootstrap contract priority: canonical `vp_token`, explicit `controller.*` key binding when needed, and legacy credential side-fields only as deprecated compatibility inputs.
165
+ - [`resolveDidDocumentServices(...)`](src/utils/did-resolution.ts)
166
+ - Normalizes a DID Document `service[]` block into capability-aware endpoint descriptors.
167
+ - [`getDidDocumentService(...)`, `selectServiceEndpoint(...)`](src/utils/did-resolution.ts)
168
+ - Select a DID service entry or its invocable `serviceEndpoint` by `id`, `type`, or logical capability.
169
+ - [`getDidDocumentEndpoint(...)`, `getJwksServiceEndpoint(...)`, `getSmartTokenEndpoint(...)`](src/utils/did-resolution.ts)
170
+ - Resolve well-known public/operational endpoints from a DID Document instead of reconstructing them from URL conventions.
171
+ - [`getOrganizationDidFromIndividualDid(...)`, `getProviderDidFromSubjectDid(...)`](src/utils/did-resolution.ts)
172
+ - Collapse actor/member DIDs back to their owning organization/provider DID using the current naming conventions.
173
+ - [`getActorKindFromDid(...)`](src/utils/did-resolution.ts)
174
+ - Heuristically classify current data-space actor DID patterns into actor kinds.
175
+ - [`toDidResolutionResult(...)`](src/utils/did-resolution.ts)
176
+ - Build a reusable DID resolution carrier from a raw DID Document.
177
+ - [`normalizeIcaDiscoveryMetadata(...)`, `normalizeNodeOperatorDiscoveryMetadata(...)`, `normalizeServiceProviderEntry(...)`](src/utils/discovery-normalization.ts)
178
+ - Normalize ICA, node-operator, and provider/DCAT-style discovery payloads into a shared DID/discovery shape for higher-level SDK runtime code.
179
+
180
+ ### Shared API flow examples
181
+
182
+ - [`src/examples/organization-controller.ts`](src/examples/organization-controller.ts)
183
+ - Host onboarding and organization-controller examples such as `_activate`, legal order, employee creation, and employee device activation.
184
+ - [`src/examples/individual-controller.ts`](src/examples/individual-controller.ts)
185
+ - Individual-controller examples such as family/subject organization bootstrap, consent, search, communication ingestion, and digital twin flows.
186
+ - CORE canonical examples are email-first and do not require phone-only fields unless an extension layer adds them.
187
+ - [`src/examples/professional.ts`](src/examples/professional.ts)
188
+ - Professional/physician runtime access examples such as SMART token and clinical access request payloads.
189
+ - [`src/examples/related-person.ts`](src/examples/related-person.ts)
190
+ - RelatedPerson/family-member examples.
191
+ - [`src/examples/frontend-session.ts`](src/examples/frontend-session.ts)
192
+ - Frontend profile/session bootstrap examples.
193
+ - [`src/examples/shared.ts`](src/examples/shared.ts)
194
+ - Shared route contexts, controller binding fragments, and reusable helper builders.
195
+ - `tenantId` is modeled as an identifier-like route token (`acme-id`), not as a friendly alternate name.
196
+ - [`src/examples/api-flow-examples.ts`](src/examples/api-flow-examples.ts)
197
+ - Preferred compatibility aggregator for consumers that want one import surface without using the overloaded term `contract`.
198
+ - [`src/examples/contract-examples.ts`](src/examples/contract-examples.ts)
199
+ - Legacy compatibility aggregator retained only so older imports keep working while consumers migrate to flow-specific modules or `api-flow-examples`.
200
+
201
+ ### DID / DIDComm utilities
202
+
203
+ - [`generateServiceId(...)`](src/utils/did.ts)
204
+ - [`normalizeDidWeb(...)`](src/utils/did.ts)
205
+ - [`createHostedDidWeb(...)`](src/utils/did.ts)
206
+ - [`buildHostedDidDetails(...)`](src/utils/did.ts)
207
+ - [`getBaseUrlFromDidWeb(...)`](src/utils/did.ts)
208
+ - [`submitDidcomm(...)`](src/utils/didcomm-submit.ts)
209
+ - [`DidCommMessage`](src/utils/didcomm.ts)
210
+ - [`prepareDidCommRequest(...)`](src/utils/didcomm.ts)
211
+ - [`includeVpTokenInMessage(...)`](src/utils/didcomm.ts)
212
+ - [`includeFileInMessage(...)`](src/utils/didcomm.ts)
213
+ - [`getThidFromMessage(...)`](src/utils/didcomm.ts)
214
+ - [`getDataResults(...)`](src/utils/didcomm.ts)
215
+
216
+ ### FHIR validation and conversion
217
+
218
+ - [`registerFhirValidatorAdapter(...)`](src/utils/fhir-validator.ts)
219
+ - [`clearFhirValidatorAdapters()`](src/utils/fhir-validator.ts)
220
+ - [`listFhirValidatorAdapters()`](src/utils/fhir-validator.ts)
221
+ - [`validateFhirResource(...)`](src/utils/fhir-validator.ts)
222
+ - [`validateFhirResourceBasic(...)`](src/utils/fhir-validator.ts)
223
+ - [`medicationStatementFlatToFhir(...)`](src/utils/clinical-resource-converters.ts)
224
+ - [`medicationStatementFhirToFlat(...)`](src/utils/clinical-resource-converters.ts)
225
+ - [`allergyIntoleranceFlatToFhir(...)`](src/utils/clinical-resource-converters.ts)
226
+ - [`allergyIntoleranceFhirToFlat(...)`](src/utils/clinical-resource-converters.ts)
227
+ - [`conditionFlatToFhir(...)`](src/utils/clinical-resource-converters.ts)
228
+ - [`conditionFhirToFlat(...)`](src/utils/clinical-resource-converters.ts)
229
+ - [`deviceUseStatementFlatToFhir(...)`](src/utils/clinical-resource-converters.ts)
230
+ - [`deviceUseStatementFhirToFlat(...)`](src/utils/clinical-resource-converters.ts)
231
+ - [`documentReferenceFlatToFhir(...)`](src/utils/clinical-resource-converters.ts)
232
+ - [`documentReferenceFhirToFlat(...)`](src/utils/clinical-resource-converters.ts)
233
+ - [`extractResources(...)`](src/utils/bundle.ts)
234
+ - [`getNextLink(...)`](src/utils/bundle.ts)
235
+
236
+ ### JWT utilities
237
+
238
+ - [`getPartsJWT(...)`](src/utils/jwt.ts)
239
+ - [`decodeHeader(...)`](src/utils/jwt.ts)
240
+ - [`decodePayload(...)`](src/utils/jwt.ts)
241
+ - [`getDataJWT(...)`](src/utils/jwt.ts)
242
+ - [`encodeHeader(...)`](src/utils/jwt.ts)
243
+ - [`encodePayload(...)`](src/utils/jwt.ts)
244
+ - [`encodeSignature(...)`](src/utils/jwt.ts)
245
+ - [`compactJWT(...)`](src/utils/jwt.ts)
246
+
247
+ ### Activation / URL / base conversion utilities
248
+
249
+ - [`extractCredentialSubject(...)`](src/utils/activation-policy.ts)
250
+ - [`normalizeTaxIdentifier(...)`](src/utils/activation-policy.ts)
251
+ - [`extractOrganizationTaxId(...)`](src/utils/activation-policy.ts)
252
+ - [`extractRepresentativeMemberOfTaxId(...)`](src/utils/activation-policy.ts)
253
+ - [`extractRepresentativeRoleCode(...)`](src/utils/activation-policy.ts)
254
+ - [`hasRoleCode(...)`](src/utils/activation-policy.ts)
255
+ - [`extractRepresentativeCredentialMaterial(...)`](src/utils/activation-policy.ts)
256
+ - [`extractDidWebFromCredential(...)`](src/utils/activation-policy.ts)
257
+ - [`buildMemberDidWeb(...)`](src/utils/activation-policy.ts)
258
+ - [`isMemberDidWebUnderOwner(...)`](src/utils/activation-policy.ts)
259
+ - [`validateActivationRepresentativePolicy(...)`](src/utils/activation-policy.ts)
260
+ - [`safelyJoinUrl(...)`](src/utils/url.ts)
261
+ - [`splitUrl(...)`](src/utils/url.ts)
262
+ - [`bytesToHexString(...)`](src/utils/base-convert.ts)
263
+ - [`bytesToBase58(...)`](src/utils/base-convert.ts)
264
+ - [`base58ToBytes(...)`](src/utils/base-convert.ts)
265
+ - [`stringToStdBase64(...)`](src/utils/base-convert.ts)
266
+ - [`base64ToBase64Url(...)`](src/utils/base-convert.ts)
267
+ - [`stringToBase64Url(...)`](src/utils/base-convert.ts)
268
+ - [`base64UrlToBase64(...)`](src/utils/base-convert.ts)
269
+ - [`base64OrUrlSafeToBytes(...)`](src/utils/base-convert.ts)
270
+ - [`bytesToBase64(...)`](src/utils/base-convert.ts)
271
+ - [`bytesToRawBase64UrlSafe(...)`](src/utils/base-convert.ts)
272
+
273
+ ### Consent utilities
274
+
275
+ - [`normalizePhone(...)`](src/utils/consent.ts)
276
+ - [`normalizeIdentifierToken(...)`](src/utils/consent.ts)
277
+ - [`resolveActorIdentifier(...)`](src/utils/consent.ts)
278
+ - [`resolveSubjectIdentifier(...)`](src/utils/consent.ts)
279
+ - [`buildConsentClaimsSimple(...)`](src/utils/consent.ts)
280
+ - [`buildConsentClaimsSimpleWithCid(...)`](src/utils/consent.ts)
281
+
282
+ These helpers are the shared base for consent claim construction across GW and SDKs.
283
+
284
+ ### Public module surfaces
285
+
286
+ - [`src/constants/`](src/constants)
287
+ - Shared constants and code catalogs.
288
+ - [`src/utils/`](src/utils)
289
+ - Shared functional helpers used by GW and SDK layers.
290
+ - [`src/models/`](src/models)
291
+ - Shared transport, FHIR, DID, consent, and storage models.
292
+ - [`src/storage/`](src/storage)
293
+ - Shared vault/storage contracts and in-memory implementation.
294
+
295
+ ### Documentation rule
296
+
297
+ - Add or update JSDoc on exported functions, classes, and constants first.
298
+ - Keep README sections as a linked index to those exports, not as a second source of truth.
299
+ - If a function signature changes, update its JSDoc and then refresh the README link/index entry.
300
+
301
+ ### Current bootstrap / discovery status
302
+
303
+ - Implemented here:
304
+ - Canonical bootstrap payload models for `vp_token`, `controller.*`, and `organization.*`
305
+ - Pure DID `service[]` resolution helpers
306
+ - Pure discovery normalization helpers for ICA, node operators, and provider entries
307
+ - Intentionally not implemented here:
308
+ - Network fetch/resolution
309
+ - Runtime cache/state
310
+ - GW/SDK orchestration side effects
311
+
85
312
  ### Interfaces
86
313
 
87
314
  The `interfaces` export contains the shared type contracts and cryptography types, including:
@@ -116,6 +343,14 @@ Those request/response flows belong in connector SDKs and backend orchestration
116
343
 
117
344
  `gdc-sdk-client-ts` and `dataconv-client-sdk-ts` are consumers of this package, not replacements for it.
118
345
 
346
+ ## SDK Integration Note
347
+
348
+ When integrating the converged SDKs:
349
+
350
+ - use [`initializeCommunicationIdentityFromSeed(...)`](src/utils/communication-identity.ts) from this package for the technical communication identity bootstrap
351
+ - use `gdc-sdk-core-ts` for runtime-neutral communication/document helpers
352
+ - use `gdc-sdk-front-ts` or `gdc-sdk-node-ts` for the runtime-specific session and orchestration layer
353
+
119
354
  - Use `gdc-common-utils-ts` when you need shared crypto primitives, DID/DIDComm helpers, and common types
120
355
  - Use `gdc-sdk-client-ts` or `dataconv-client-sdk-ts` when you need higher-level client orchestration, transport, or API workflows
121
356
 
@@ -0,0 +1,28 @@
1
+ export declare const HL7_COMMUNICATION_CATEGORY_SYSTEM: "http://terminology.hl7.org/CodeSystem/communication-category";
2
+ export type CommunicationCategoryDescriptor = Readonly<{
3
+ system: typeof HL7_COMMUNICATION_CATEGORY_SYSTEM;
4
+ code: string;
5
+ claim: string;
6
+ }>;
7
+ export declare const CommunicationCategoryCodes: Readonly<{
8
+ readonly Alert: Readonly<{
9
+ system: typeof HL7_COMMUNICATION_CATEGORY_SYSTEM;
10
+ code: string;
11
+ claim: string;
12
+ }>;
13
+ readonly Notification: Readonly<{
14
+ system: typeof HL7_COMMUNICATION_CATEGORY_SYSTEM;
15
+ code: string;
16
+ claim: string;
17
+ }>;
18
+ readonly Reminder: Readonly<{
19
+ system: typeof HL7_COMMUNICATION_CATEGORY_SYSTEM;
20
+ code: string;
21
+ claim: string;
22
+ }>;
23
+ readonly Instruction: Readonly<{
24
+ system: typeof HL7_COMMUNICATION_CATEGORY_SYSTEM;
25
+ code: string;
26
+ claim: string;
27
+ }>;
28
+ }>;
@@ -0,0 +1,14 @@
1
+ export const HL7_COMMUNICATION_CATEGORY_SYSTEM = 'http://terminology.hl7.org/CodeSystem/communication-category';
2
+ function defineCommunicationCategory(code) {
3
+ return Object.freeze({
4
+ system: HL7_COMMUNICATION_CATEGORY_SYSTEM,
5
+ code,
6
+ claim: `${HL7_COMMUNICATION_CATEGORY_SYSTEM}|${code}`,
7
+ });
8
+ }
9
+ export const CommunicationCategoryCodes = Object.freeze({
10
+ Alert: defineCommunicationCategory('alert'),
11
+ Notification: defineCommunicationCategory('notification'),
12
+ Reminder: defineCommunicationCategory('reminder'),
13
+ Instruction: defineCommunicationCategory('instruction'),
14
+ });
@@ -0,0 +1,35 @@
1
+ import { MldsaAlg, MlkemCurve } from '../interfaces/Cryptography.types';
2
+ /**
3
+ * Canonical JOSE/JWK `use` values used across GDC communication key material.
4
+ */
5
+ export declare const JwkKeyUses: {
6
+ readonly Signature: "sig";
7
+ readonly Encryption: "enc";
8
+ };
9
+ /**
10
+ * Canonical public-key purposes used by GW and SDKs to distinguish communication
11
+ * signing keys from VC signing keys.
12
+ */
13
+ export declare const CommunicationKeyPurposes: {
14
+ readonly CommunicationSignature: "comm_sig";
15
+ readonly VerifiableCredentialSignature: "vc_sign";
16
+ };
17
+ /**
18
+ * Default post-quantum signing algorithms used for communication bootstrap.
19
+ */
20
+ export declare const DefaultSigningAlgorithms: {
21
+ Communication: MldsaAlg;
22
+ VerifiableCredential: MldsaAlg;
23
+ };
24
+ /**
25
+ * Default post-quantum encryption curve used for communication bootstrap.
26
+ */
27
+ export declare const DefaultEncryptionCurves: {
28
+ Communication: MlkemCurve;
29
+ };
30
+ /**
31
+ * Canonical JOSE content-encryption algorithms used by DIDComm/JWE envelopes.
32
+ */
33
+ export declare const JoseContentEncryptionAlgorithms: {
34
+ readonly Aes256Gcm: "A256GCM";
35
+ };
@@ -0,0 +1,36 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ import { AES_GCM_JWA_ENC } from '../models/aes.js';
3
+ /**
4
+ * Canonical JOSE/JWK `use` values used across GDC communication key material.
5
+ */
6
+ export const JwkKeyUses = {
7
+ Signature: 'sig',
8
+ Encryption: 'enc',
9
+ };
10
+ /**
11
+ * Canonical public-key purposes used by GW and SDKs to distinguish communication
12
+ * signing keys from VC signing keys.
13
+ */
14
+ export const CommunicationKeyPurposes = {
15
+ CommunicationSignature: 'comm_sig',
16
+ VerifiableCredentialSignature: 'vc_sign',
17
+ };
18
+ /**
19
+ * Default post-quantum signing algorithms used for communication bootstrap.
20
+ */
21
+ export const DefaultSigningAlgorithms = {
22
+ Communication: 'ML-DSA-44',
23
+ VerifiableCredential: 'ML-DSA-44',
24
+ };
25
+ /**
26
+ * Default post-quantum encryption curve used for communication bootstrap.
27
+ */
28
+ export const DefaultEncryptionCurves = {
29
+ Communication: 'ML-KEM-768',
30
+ };
31
+ /**
32
+ * Canonical JOSE content-encryption algorithms used by DIDComm/JWE envelopes.
33
+ */
34
+ export const JoseContentEncryptionAlgorithms = {
35
+ Aes256Gcm: AES_GCM_JWA_ENC,
36
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Canonical user classes used by device licenses and frontend/backend SDK flows.
3
+ */
4
+ export declare const DeviceUserClasses: Readonly<{
5
+ readonly Employee: "employee";
6
+ readonly Individual: "individual";
7
+ }>;
8
+ export type DeviceUserClass = typeof DeviceUserClasses[keyof typeof DeviceUserClasses];
9
+ /**
10
+ * Canonical device/app form factors used by licensing and activation flows.
11
+ */
12
+ export declare const DeviceAppTypes: Readonly<{
13
+ readonly Mobile: "mobile";
14
+ readonly Web: "web";
15
+ }>;
16
+ export type DeviceAppType = typeof DeviceAppTypes[keyof typeof DeviceAppTypes];
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * Canonical user classes used by device licenses and frontend/backend SDK flows.
4
+ */
5
+ export const DeviceUserClasses = Object.freeze({
6
+ Employee: 'employee',
7
+ Individual: 'individual',
8
+ });
9
+ /**
10
+ * Canonical device/app form factors used by licensing and activation flows.
11
+ */
12
+ export const DeviceAppTypes = Object.freeze({
13
+ Mobile: 'mobile',
14
+ Web: 'web',
15
+ });
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Canonical DID service fragments published by GW/SDK discovery surfaces.
3
+ */
4
+ export declare const DidServiceIds: Readonly<{
5
+ readonly DidDocument: "#did-document";
6
+ readonly Jwks: "#jwks";
7
+ readonly OpenIdConfiguration: "#openid-configuration";
8
+ readonly SmartConfiguration: "#smart-configuration";
9
+ readonly SmartToken: "#identity:openid:smart:token";
10
+ readonly CredentialIssuer: "#openid-credential-issuer";
11
+ readonly CapabilityStatement: "#fhir:capabilitystatement";
12
+ readonly Catalog: "#catalog";
13
+ }>;
14
+ /**
15
+ * Canonical DID service types published by GW/SDK discovery surfaces.
16
+ */
17
+ export declare const DidServiceTypes: Readonly<{
18
+ readonly LinkedDomains: "LinkedDomains";
19
+ readonly JsonWebKeyService2020: "JsonWebKeyService2020";
20
+ readonly OpenIdProvider: "OpenIdProvider";
21
+ readonly SmartOnFhirConfiguration: "SmartOnFhirConfiguration";
22
+ readonly ApiService: "ApiService";
23
+ readonly CredentialIssuer: "OpenIdCredentialIssuer";
24
+ readonly FhirCapabilityStatement: "CapabilityStatement";
25
+ readonly CatalogService: "CatalogService";
26
+ }>;
27
+ /**
28
+ * Canonical discovery capabilities used when selecting endpoints from a DID Document.
29
+ */
30
+ export declare const DiscoveryCapabilities: Readonly<{
31
+ readonly DidDocument: "did-document";
32
+ readonly Jwks: "jwks";
33
+ readonly OpenIdConfiguration: "openid-configuration";
34
+ readonly SmartConfiguration: "smart-configuration";
35
+ readonly SmartToken: "smart-token";
36
+ readonly CredentialIssuer: "credential-issuer";
37
+ readonly CapabilityStatement: "capability-statement";
38
+ readonly Catalog: "catalog";
39
+ }>;
40
+ export type DidServiceId = typeof DidServiceIds[keyof typeof DidServiceIds];
41
+ export type DidServiceType = typeof DidServiceTypes[keyof typeof DidServiceTypes];
42
+ export type DiscoveryCapability = typeof DiscoveryCapabilities[keyof typeof DiscoveryCapabilities];
@@ -0,0 +1,40 @@
1
+ // Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
2
+ /**
3
+ * Canonical DID service fragments published by GW/SDK discovery surfaces.
4
+ */
5
+ export const DidServiceIds = Object.freeze({
6
+ DidDocument: '#did-document',
7
+ Jwks: '#jwks',
8
+ OpenIdConfiguration: '#openid-configuration',
9
+ SmartConfiguration: '#smart-configuration',
10
+ SmartToken: '#identity:openid:smart:token',
11
+ CredentialIssuer: '#openid-credential-issuer',
12
+ CapabilityStatement: '#fhir:capabilitystatement',
13
+ Catalog: '#catalog',
14
+ });
15
+ /**
16
+ * Canonical DID service types published by GW/SDK discovery surfaces.
17
+ */
18
+ export const DidServiceTypes = Object.freeze({
19
+ LinkedDomains: 'LinkedDomains',
20
+ JsonWebKeyService2020: 'JsonWebKeyService2020',
21
+ OpenIdProvider: 'OpenIdProvider',
22
+ SmartOnFhirConfiguration: 'SmartOnFhirConfiguration',
23
+ ApiService: 'ApiService',
24
+ CredentialIssuer: 'OpenIdCredentialIssuer',
25
+ FhirCapabilityStatement: 'CapabilityStatement',
26
+ CatalogService: 'CatalogService',
27
+ });
28
+ /**
29
+ * Canonical discovery capabilities used when selecting endpoints from a DID Document.
30
+ */
31
+ export const DiscoveryCapabilities = Object.freeze({
32
+ DidDocument: 'did-document',
33
+ Jwks: 'jwks',
34
+ OpenIdConfiguration: 'openid-configuration',
35
+ SmartConfiguration: 'smart-configuration',
36
+ SmartToken: 'smart-token',
37
+ CredentialIssuer: 'credential-issuer',
38
+ CapabilityStatement: 'capability-statement',
39
+ Catalog: 'catalog',
40
+ });
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Canonical FHIR/HL7 code system URLs shared across GW and SDK packages.
3
+ *
4
+ * Use these constants instead of inline system strings when building
5
+ * FHIR codings, filters, or test fixtures.
6
+ */
7
+ export declare const FhirCodeSystems: Readonly<{
8
+ readonly Loinc: "http://loinc.org";
9
+ readonly Ucum: "http://unitsofmeasure.org";
10
+ readonly CommunicationCategory: "http://terminology.hl7.org/CodeSystem/communication-category";
11
+ readonly ObservationCategory: "http://terminology.hl7.org/CodeSystem/observation-category";
12
+ }>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Canonical FHIR/HL7 code system URLs shared across GW and SDK packages.
3
+ *
4
+ * Use these constants instead of inline system strings when building
5
+ * FHIR codings, filters, or test fixtures.
6
+ */
7
+ export const FhirCodeSystems = Object.freeze({
8
+ Loinc: 'http://loinc.org',
9
+ Ucum: 'http://unitsofmeasure.org',
10
+ CommunicationCategory: 'http://terminology.hl7.org/CodeSystem/communication-category',
11
+ ObservationCategory: 'http://terminology.hl7.org/CodeSystem/observation-category',
12
+ });
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Canonical FHIR R4 `resourceType` names shared across GW and SDK packages.
3
+ *
4
+ * Use these constants instead of inline strings such as `"Observation"`
5
+ * or `"DocumentReference"` when building bundles, filters, or SDK facades.
6
+ */
7
+ export declare const ResourceTypesFhirR4: Readonly<{
8
+ readonly AdverseEvent: "AdverseEvent";
9
+ readonly AllergyIntolerance: "AllergyIntolerance";
10
+ readonly Appointment: "Appointment";
11
+ readonly Bundle: "Bundle";
12
+ readonly CarePlan: "CarePlan";
13
+ readonly Communication: "Communication";
14
+ readonly Composition: "Composition";
15
+ readonly Condition: "Condition";
16
+ readonly Consent: "Consent";
17
+ readonly DiagnosticReport: "DiagnosticReport";
18
+ readonly DocumentReference: "DocumentReference";
19
+ readonly Encounter: "Encounter";
20
+ readonly ImagingStudy: "ImagingStudy";
21
+ readonly Immunization: "Immunization";
22
+ readonly MedicationStatement: "MedicationStatement";
23
+ readonly Observation: "Observation";
24
+ readonly Procedure: "Procedure";
25
+ readonly RelatedPerson: "RelatedPerson";
26
+ }>;
27
+ /**
28
+ * Backwards-compatible alias for the former generic name.
29
+ *
30
+ * Prefer `ResourceTypesFhirR4` in new code so later R5/R6 catalogs can coexist
31
+ * without ambiguity.
32
+ */
33
+ export declare const FhirResourceTypes: Readonly<{
34
+ readonly AdverseEvent: "AdverseEvent";
35
+ readonly AllergyIntolerance: "AllergyIntolerance";
36
+ readonly Appointment: "Appointment";
37
+ readonly Bundle: "Bundle";
38
+ readonly CarePlan: "CarePlan";
39
+ readonly Communication: "Communication";
40
+ readonly Composition: "Composition";
41
+ readonly Condition: "Condition";
42
+ readonly Consent: "Consent";
43
+ readonly DiagnosticReport: "DiagnosticReport";
44
+ readonly DocumentReference: "DocumentReference";
45
+ readonly Encounter: "Encounter";
46
+ readonly ImagingStudy: "ImagingStudy";
47
+ readonly Immunization: "Immunization";
48
+ readonly MedicationStatement: "MedicationStatement";
49
+ readonly Observation: "Observation";
50
+ readonly Procedure: "Procedure";
51
+ readonly RelatedPerson: "RelatedPerson";
52
+ }>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Canonical FHIR R4 `resourceType` names shared across GW and SDK packages.
3
+ *
4
+ * Use these constants instead of inline strings such as `"Observation"`
5
+ * or `"DocumentReference"` when building bundles, filters, or SDK facades.
6
+ */
7
+ export const ResourceTypesFhirR4 = Object.freeze({
8
+ AdverseEvent: 'AdverseEvent',
9
+ AllergyIntolerance: 'AllergyIntolerance',
10
+ Appointment: 'Appointment',
11
+ Bundle: 'Bundle',
12
+ CarePlan: 'CarePlan',
13
+ Communication: 'Communication',
14
+ Composition: 'Composition',
15
+ Condition: 'Condition',
16
+ Consent: 'Consent',
17
+ DiagnosticReport: 'DiagnosticReport',
18
+ DocumentReference: 'DocumentReference',
19
+ Encounter: 'Encounter',
20
+ ImagingStudy: 'ImagingStudy',
21
+ Immunization: 'Immunization',
22
+ MedicationStatement: 'MedicationStatement',
23
+ Observation: 'Observation',
24
+ Procedure: 'Procedure',
25
+ RelatedPerson: 'RelatedPerson',
26
+ });
27
+ /**
28
+ * Backwards-compatible alias for the former generic name.
29
+ *
30
+ * Prefer `ResourceTypesFhirR4` in new code so later R5/R6 catalogs can coexist
31
+ * without ambiguity.
32
+ */
33
+ export const FhirResourceTypes = ResourceTypesFhirR4;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Canonical FHIR version labels shared across GW and SDK packages.
3
+ *
4
+ * Use these constants instead of inline strings such as `"4.0"` or `"5.0"`.
5
+ */
6
+ export declare const FhirVersions: Readonly<{
7
+ readonly R4: "4.0";
8
+ readonly R401: "4.0.1";
9
+ readonly R5: "5.0";
10
+ }>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Canonical FHIR version labels shared across GW and SDK packages.
3
+ *
4
+ * Use these constants instead of inline strings such as `"4.0"` or `"5.0"`.
5
+ */
6
+ export const FhirVersions = Object.freeze({
7
+ R4: '4.0',
8
+ R401: '4.0.1',
9
+ R5: '5.0',
10
+ });