gdc-sdk-front-ts 2.2.1 → 2.3.1
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/dist/ProfileManager.js +6 -3
- package/dist/front-clinical-runtime-client.d.ts +69 -0
- package/dist/front-clinical-runtime-client.js +214 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/orchestration/client-port.d.ts +21 -3
- package/dist/orchestration/individual-member-sdk.d.ts +11 -1
- package/dist/orchestration/individual-member-sdk.js +12 -0
- package/dist/orchestration/professional-sdk.d.ts +7 -1
- package/dist/orchestration/professional-sdk.js +6 -0
- package/package.json +3 -3
- package/dist/discovery/HttpDataspaceDiscoveryClient.d.ts +0 -34
- package/dist/discovery/HttpDataspaceDiscoveryClient.js +0 -47
- package/dist/gdc-common-utils-ts/src/AesManager.d.ts +0 -27
- package/dist/gdc-common-utils-ts/src/AesManager.js +0 -64
- package/dist/gdc-common-utils-ts/src/CryptographyService.d.ts +0 -76
- package/dist/gdc-common-utils-ts/src/CryptographyService.js +0 -401
- package/dist/gdc-common-utils-ts/src/constants/actor-session.d.ts +0 -40
- package/dist/gdc-common-utils-ts/src/constants/actor-session.js +0 -40
- package/dist/gdc-common-utils-ts/src/constants/communication.d.ts +0 -28
- package/dist/gdc-common-utils-ts/src/constants/communication.js +0 -14
- package/dist/gdc-common-utils-ts/src/constants/cryptography.d.ts +0 -58
- package/dist/gdc-common-utils-ts/src/constants/cryptography.js +0 -49
- package/dist/gdc-common-utils-ts/src/constants/dataspace-discovery.d.ts +0 -11
- package/dist/gdc-common-utils-ts/src/constants/dataspace-discovery.js +0 -11
- package/dist/gdc-common-utils-ts/src/constants/dataspace-protocol.d.ts +0 -27
- package/dist/gdc-common-utils-ts/src/constants/dataspace-protocol.js +0 -27
- package/dist/gdc-common-utils-ts/src/constants/device.d.ts +0 -16
- package/dist/gdc-common-utils-ts/src/constants/device.js +0 -15
- package/dist/gdc-common-utils-ts/src/constants/did-services.d.ts +0 -42
- package/dist/gdc-common-utils-ts/src/constants/did-services.js +0 -40
- package/dist/gdc-common-utils-ts/src/constants/eu-countries.d.ts +0 -36
- package/dist/gdc-common-utils-ts/src/constants/eu-countries.js +0 -69
- package/dist/gdc-common-utils-ts/src/constants/fhir-code-systems.d.ts +0 -12
- package/dist/gdc-common-utils-ts/src/constants/fhir-code-systems.js +0 -12
- package/dist/gdc-common-utils-ts/src/constants/fhir-resource-types.d.ts +0 -52
- package/dist/gdc-common-utils-ts/src/constants/fhir-resource-types.js +0 -33
- package/dist/gdc-common-utils-ts/src/constants/fhir-versions.d.ts +0 -10
- package/dist/gdc-common-utils-ts/src/constants/fhir-versions.js +0 -10
- package/dist/gdc-common-utils-ts/src/constants/healthcare.d.ts +0 -496
- package/dist/gdc-common-utils-ts/src/constants/healthcare.js +0 -274
- package/dist/gdc-common-utils-ts/src/constants/hl7-roles.d.ts +0 -44
- package/dist/gdc-common-utils-ts/src/constants/hl7-roles.js +0 -208
- package/dist/gdc-common-utils-ts/src/constants/index.d.ts +0 -21
- package/dist/gdc-common-utils-ts/src/constants/index.js +0 -21
- package/dist/gdc-common-utils-ts/src/constants/network.d.ts +0 -25
- package/dist/gdc-common-utils-ts/src/constants/network.js +0 -17
- package/dist/gdc-common-utils-ts/src/constants/schemaorg.d.ts +0 -175
- package/dist/gdc-common-utils-ts/src/constants/schemaorg.js +0 -261
- package/dist/gdc-common-utils-ts/src/constants/sectors.d.ts +0 -24
- package/dist/gdc-common-utils-ts/src/constants/sectors.js +0 -24
- package/dist/gdc-common-utils-ts/src/constants/service-capabilities.d.ts +0 -82
- package/dist/gdc-common-utils-ts/src/constants/service-capabilities.js +0 -105
- package/dist/gdc-common-utils-ts/src/constants/smart.d.ts +0 -12
- package/dist/gdc-common-utils-ts/src/constants/smart.js +0 -12
- package/dist/gdc-common-utils-ts/src/constants/urn.d.ts +0 -11
- package/dist/gdc-common-utils-ts/src/constants/urn.js +0 -11
- package/dist/gdc-common-utils-ts/src/constants/verifiable-credentials.d.ts +0 -34
- package/dist/gdc-common-utils-ts/src/constants/verifiable-credentials.js +0 -42
- package/dist/gdc-common-utils-ts/src/constants/vital-signs.d.ts +0 -75
- package/dist/gdc-common-utils-ts/src/constants/vital-signs.js +0 -33
- package/dist/gdc-common-utils-ts/src/examples/api-flow-examples.d.ts +0 -15
- package/dist/gdc-common-utils-ts/src/examples/api-flow-examples.js +0 -16
- package/dist/gdc-common-utils-ts/src/examples/communication-bundle-session.d.ts +0 -22
- package/dist/gdc-common-utils-ts/src/examples/communication-bundle-session.js +0 -81
- package/dist/gdc-common-utils-ts/src/examples/consent-access.d.ts +0 -30
- package/dist/gdc-common-utils-ts/src/examples/consent-access.js +0 -121
- package/dist/gdc-common-utils-ts/src/examples/contract-examples.d.ts +0 -15
- package/dist/gdc-common-utils-ts/src/examples/contract-examples.js +0 -16
- package/dist/gdc-common-utils-ts/src/examples/dataspace-discovery.d.ts +0 -98
- package/dist/gdc-common-utils-ts/src/examples/dataspace-discovery.js +0 -141
- package/dist/gdc-common-utils-ts/src/examples/frontend-session.d.ts +0 -13
- package/dist/gdc-common-utils-ts/src/examples/frontend-session.js +0 -24
- package/dist/gdc-common-utils-ts/src/examples/ica-activation-proof.d.ts +0 -64
- package/dist/gdc-common-utils-ts/src/examples/ica-activation-proof.js +0 -77
- package/dist/gdc-common-utils-ts/src/examples/index.d.ts +0 -14
- package/dist/gdc-common-utils-ts/src/examples/index.js +0 -14
- package/dist/gdc-common-utils-ts/src/examples/individual-controller.d.ts +0 -100
- package/dist/gdc-common-utils-ts/src/examples/individual-controller.js +0 -71
- package/dist/gdc-common-utils-ts/src/examples/lifecycle.d.ts +0 -505
- package/dist/gdc-common-utils-ts/src/examples/lifecycle.js +0 -291
- package/dist/gdc-common-utils-ts/src/examples/organization-controller.d.ts +0 -163
- package/dist/gdc-common-utils-ts/src/examples/organization-controller.js +0 -93
- package/dist/gdc-common-utils-ts/src/examples/professional.d.ts +0 -228
- package/dist/gdc-common-utils-ts/src/examples/professional.js +0 -324
- package/dist/gdc-common-utils-ts/src/examples/related-person.d.ts +0 -10
- package/dist/gdc-common-utils-ts/src/examples/related-person.js +0 -13
- package/dist/gdc-common-utils-ts/src/examples/relationship-access.d.ts +0 -11
- package/dist/gdc-common-utils-ts/src/examples/relationship-access.js +0 -96
- package/dist/gdc-common-utils-ts/src/examples/shared.d.ts +0 -220
- package/dist/gdc-common-utils-ts/src/examples/shared.js +0 -191
- package/dist/gdc-common-utils-ts/src/hmac.d.ts +0 -14
- package/dist/gdc-common-utils-ts/src/hmac.js +0 -24
- package/dist/gdc-common-utils-ts/src/i18n/clinical-sections.i18n.d.ts +0 -6
- package/dist/gdc-common-utils-ts/src/i18n/clinical-sections.i18n.js +0 -15
- package/dist/gdc-common-utils-ts/src/i18n/role-codes.i18n.d.ts +0 -4
- package/dist/gdc-common-utils-ts/src/i18n/role-codes.i18n.js +0 -13
- package/dist/gdc-common-utils-ts/src/index.d.ts +0 -10
- package/dist/gdc-common-utils-ts/src/index.js +0 -10
- package/dist/gdc-common-utils-ts/src/interfaces/Cryptography.types.d.ts +0 -139
- package/dist/gdc-common-utils-ts/src/interfaces/Cryptography.types.js +0 -8
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptoHelper.d.ts +0 -28
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptoHelper.js +0 -3
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptography.d.ts +0 -154
- package/dist/gdc-common-utils-ts/src/interfaces/ICryptography.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/actor-session.d.ts +0 -9
- package/dist/gdc-common-utils-ts/src/models/actor-session.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/aes.d.ts +0 -85
- package/dist/gdc-common-utils-ts/src/models/aes.js +0 -10
- package/dist/gdc-common-utils-ts/src/models/auth.d.ts +0 -35
- package/dist/gdc-common-utils-ts/src/models/auth.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/bundle.d.ts +0 -153
- package/dist/gdc-common-utils-ts/src/models/bundle.js +0 -25
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.d.ts +0 -36
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.en.d.ts +0 -150
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.en.js +0 -104
- package/dist/gdc-common-utils-ts/src/models/clinical-sections.js +0 -32
- package/dist/gdc-common-utils-ts/src/models/clinical-workbook-summary.d.ts +0 -126
- package/dist/gdc-common-utils-ts/src/models/clinical-workbook-summary.js +0 -67
- package/dist/gdc-common-utils-ts/src/models/comm.d.ts +0 -56
- package/dist/gdc-common-utils-ts/src/models/comm.js +0 -4
- package/dist/gdc-common-utils-ts/src/models/confidential-job.d.ts +0 -78
- package/dist/gdc-common-utils-ts/src/models/confidential-job.js +0 -20
- package/dist/gdc-common-utils-ts/src/models/confidential-message.d.ts +0 -97
- package/dist/gdc-common-utils-ts/src/models/confidential-message.js +0 -4
- package/dist/gdc-common-utils-ts/src/models/confidential-storage.d.ts +0 -134
- package/dist/gdc-common-utils-ts/src/models/confidential-storage.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/consent-access.d.ts +0 -79
- package/dist/gdc-common-utils-ts/src/models/consent-access.js +0 -2
- package/dist/gdc-common-utils-ts/src/models/consent-rule.d.ts +0 -122
- package/dist/gdc-common-utils-ts/src/models/consent-rule.js +0 -22
- package/dist/gdc-common-utils-ts/src/models/crypto.d.ts +0 -35
- package/dist/gdc-common-utils-ts/src/models/crypto.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery-defaults.d.ts +0 -79
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery-defaults.js +0 -2
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery.d.ts +0 -68
- package/dist/gdc-common-utils-ts/src/models/dataspace-discovery.js +0 -9
- package/dist/gdc-common-utils-ts/src/models/dataspace-protocol.d.ts +0 -14
- package/dist/gdc-common-utils-ts/src/models/dataspace-protocol.js +0 -2
- package/dist/gdc-common-utils-ts/src/models/device-license.d.ts +0 -134
- package/dist/gdc-common-utils-ts/src/models/device-license.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/did.d.ts +0 -108
- package/dist/gdc-common-utils-ts/src/models/did.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/fhir-documents.d.ts +0 -101
- package/dist/gdc-common-utils-ts/src/models/fhir-documents.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/identity-bootstrap.d.ts +0 -104
- package/dist/gdc-common-utils-ts/src/models/identity-bootstrap.js +0 -2
- package/dist/gdc-common-utils-ts/src/models/index.d.ts +0 -42
- package/dist/gdc-common-utils-ts/src/models/index.js +0 -42
- package/dist/gdc-common-utils-ts/src/models/indexing.d.ts +0 -11
- package/dist/gdc-common-utils-ts/src/models/indexing.js +0 -18
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/allergy-intolerance-claims.d.ts +0 -24
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/allergy-intolerance-claims.js +0 -36
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/communication-claims.d.ts +0 -53
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/communication-claims.js +0 -55
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/condition-claims.d.ts +0 -14
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/condition-claims.js +0 -25
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/device-use-statement-claims.d.ts +0 -13
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/device-use-statement-claims.js +0 -23
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/document-reference-claims.d.ts +0 -36
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/document-reference-claims.js +0 -89
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/medication-statement-claims.d.ts +0 -341
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/medication-statement-claims.js +0 -204
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/types.d.ts +0 -9
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims/types.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims.d.ts +0 -5
- package/dist/gdc-common-utils-ts/src/models/interoperable-claims.js +0 -7
- package/dist/gdc-common-utils-ts/src/models/issue.d.ts +0 -57
- package/dist/gdc-common-utils-ts/src/models/issue.js +0 -75
- package/dist/gdc-common-utils-ts/src/models/jsonapi.d.ts +0 -13
- package/dist/gdc-common-utils-ts/src/models/jsonapi.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/jwe.d.ts +0 -120
- package/dist/gdc-common-utils-ts/src/models/jwe.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/jwk.d.ts +0 -39
- package/dist/gdc-common-utils-ts/src/models/jwk.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/jws.d.ts +0 -35
- package/dist/gdc-common-utils-ts/src/models/jws.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/jwt.d.ts +0 -9
- package/dist/gdc-common-utils-ts/src/models/jwt.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/loinc-document-ontology.d.ts +0 -55
- package/dist/gdc-common-utils-ts/src/models/loinc-document-ontology.js +0 -58
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.common.model.d.ts +0 -33
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.common.model.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.document.model.d.ts +0 -50
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.document.model.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.electronicRecord.model.d.ts +0 -67
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.electronicRecord.model.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.evidence.model.d.ts +0 -51
- package/dist/gdc-common-utils-ts/src/models/oidc4ida.evidence.model.js +0 -5
- package/dist/gdc-common-utils-ts/src/models/openid-device.d.ts +0 -119
- package/dist/gdc-common-utils-ts/src/models/openid-device.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/operation-outcome.d.ts +0 -26
- package/dist/gdc-common-utils-ts/src/models/operation-outcome.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/params.d.ts +0 -133
- package/dist/gdc-common-utils-ts/src/models/params.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/relationship-access.d.ts +0 -160
- package/dist/gdc-common-utils-ts/src/models/relationship-access.js +0 -21
- package/dist/gdc-common-utils-ts/src/models/resource-document.d.ts +0 -14
- package/dist/gdc-common-utils-ts/src/models/resource-document.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/response.d.ts +0 -1
- package/dist/gdc-common-utils-ts/src/models/response.js +0 -3
- package/dist/gdc-common-utils-ts/src/models/urlPath.d.ts +0 -58
- package/dist/gdc-common-utils-ts/src/models/urlPath.js +0 -76
- package/dist/gdc-common-utils-ts/src/models/verifiable-credential.d.ts +0 -45
- package/dist/gdc-common-utils-ts/src/models/verifiable-credential.js +0 -8
- package/dist/gdc-common-utils-ts/src/storage/IVaultRepository.d.ts +0 -53
- package/dist/gdc-common-utils-ts/src/storage/IVaultRepository.js +0 -25
- package/dist/gdc-common-utils-ts/src/storage/VaultMemRepository.d.ts +0 -30
- package/dist/gdc-common-utils-ts/src/storage/VaultMemRepository.js +0 -81
- package/dist/gdc-common-utils-ts/src/storage/index.d.ts +0 -3
- package/dist/gdc-common-utils-ts/src/storage/index.js +0 -4
- package/dist/gdc-common-utils-ts/src/utils/activation-policy.d.ts +0 -86
- package/dist/gdc-common-utils-ts/src/utils/activation-policy.js +0 -218
- package/dist/gdc-common-utils-ts/src/utils/activation-request.d.ts +0 -81
- package/dist/gdc-common-utils-ts/src/utils/activation-request.js +0 -99
- package/dist/gdc-common-utils-ts/src/utils/actor.d.ts +0 -18
- package/dist/gdc-common-utils-ts/src/utils/actor.js +0 -36
- package/dist/gdc-common-utils-ts/src/utils/base-convert.d.ts +0 -60
- package/dist/gdc-common-utils-ts/src/utils/base-convert.js +0 -104
- package/dist/gdc-common-utils-ts/src/utils/baseN.d.ts +0 -35
- package/dist/gdc-common-utils-ts/src/utils/baseN.js +0 -174
- package/dist/gdc-common-utils-ts/src/utils/bundle-query.d.ts +0 -35
- package/dist/gdc-common-utils-ts/src/utils/bundle-query.js +0 -177
- package/dist/gdc-common-utils-ts/src/utils/bundle.d.ts +0 -13
- package/dist/gdc-common-utils-ts/src/utils/bundle.js +0 -39
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-converters.d.ts +0 -64
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-converters.js +0 -279
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-view.d.ts +0 -55
- package/dist/gdc-common-utils-ts/src/utils/clinical-resource-view.js +0 -291
- package/dist/gdc-common-utils-ts/src/utils/communication-bundle-session.d.ts +0 -110
- package/dist/gdc-common-utils-ts/src/utils/communication-bundle-session.js +0 -326
- package/dist/gdc-common-utils-ts/src/utils/communication-document-reference.d.ts +0 -41
- package/dist/gdc-common-utils-ts/src/utils/communication-document-reference.js +0 -170
- package/dist/gdc-common-utils-ts/src/utils/communication-fhir-r4.d.ts +0 -41
- package/dist/gdc-common-utils-ts/src/utils/communication-fhir-r4.js +0 -215
- package/dist/gdc-common-utils-ts/src/utils/communication-identity.d.ts +0 -152
- package/dist/gdc-common-utils-ts/src/utils/communication-identity.js +0 -121
- package/dist/gdc-common-utils-ts/src/utils/consent-claim-helpers.d.ts +0 -79
- package/dist/gdc-common-utils-ts/src/utils/consent-claim-helpers.js +0 -213
- package/dist/gdc-common-utils-ts/src/utils/consent.d.ts +0 -218
- package/dist/gdc-common-utils-ts/src/utils/consent.js +0 -679
- package/dist/gdc-common-utils-ts/src/utils/content.d.ts +0 -55
- package/dist/gdc-common-utils-ts/src/utils/content.js +0 -60
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery-defaults.d.ts +0 -130
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery-defaults.js +0 -307
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery.d.ts +0 -235
- package/dist/gdc-common-utils-ts/src/utils/dataspace-discovery.js +0 -482
- package/dist/gdc-common-utils-ts/src/utils/dataspace-protocol.d.ts +0 -66
- package/dist/gdc-common-utils-ts/src/utils/dataspace-protocol.js +0 -109
- package/dist/gdc-common-utils-ts/src/utils/did-resolution.d.ts +0 -60
- package/dist/gdc-common-utils-ts/src/utils/did-resolution.js +0 -173
- package/dist/gdc-common-utils-ts/src/utils/did.d.ts +0 -124
- package/dist/gdc-common-utils-ts/src/utils/did.js +0 -204
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit-policy.d.ts +0 -10
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit-policy.js +0 -15
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit.d.ts +0 -48
- package/dist/gdc-common-utils-ts/src/utils/didcomm-submit.js +0 -81
- package/dist/gdc-common-utils-ts/src/utils/didcomm.d.ts +0 -60
- package/dist/gdc-common-utils-ts/src/utils/didcomm.js +0 -78
- package/dist/gdc-common-utils-ts/src/utils/discovery-normalization.d.ts +0 -28
- package/dist/gdc-common-utils-ts/src/utils/discovery-normalization.js +0 -64
- package/dist/gdc-common-utils-ts/src/utils/fhir-cid.d.ts +0 -60
- package/dist/gdc-common-utils-ts/src/utils/fhir-cid.js +0 -152
- package/dist/gdc-common-utils-ts/src/utils/fhir-validator.d.ts +0 -61
- package/dist/gdc-common-utils-ts/src/utils/fhir-validator.js +0 -91
- package/dist/gdc-common-utils-ts/src/utils/format-converter.d.ts +0 -21
- package/dist/gdc-common-utils-ts/src/utils/format-converter.js +0 -109
- package/dist/gdc-common-utils-ts/src/utils/index.d.ts +0 -39
- package/dist/gdc-common-utils-ts/src/utils/index.js +0 -39
- package/dist/gdc-common-utils-ts/src/utils/individual-form-pdf.d.ts +0 -55
- package/dist/gdc-common-utils-ts/src/utils/individual-form-pdf.js +0 -191
- package/dist/gdc-common-utils-ts/src/utils/jwt.d.ts +0 -53
- package/dist/gdc-common-utils-ts/src/utils/jwt.js +0 -154
- package/dist/gdc-common-utils-ts/src/utils/manager-error.d.ts +0 -15
- package/dist/gdc-common-utils-ts/src/utils/manager-error.js +0 -21
- package/dist/gdc-common-utils-ts/src/utils/medication-claim-helpers.d.ts +0 -56
- package/dist/gdc-common-utils-ts/src/utils/medication-claim-helpers.js +0 -127
- package/dist/gdc-common-utils-ts/src/utils/multibase58.d.ts +0 -13
- package/dist/gdc-common-utils-ts/src/utils/multibase58.js +0 -40
- package/dist/gdc-common-utils-ts/src/utils/multibasehash.d.ts +0 -8
- package/dist/gdc-common-utils-ts/src/utils/multibasehash.js +0 -23
- package/dist/gdc-common-utils-ts/src/utils/normalize-uuid.d.ts +0 -1
- package/dist/gdc-common-utils-ts/src/utils/normalize-uuid.js +0 -35
- package/dist/gdc-common-utils-ts/src/utils/normalize.d.ts +0 -16
- package/dist/gdc-common-utils-ts/src/utils/normalize.js +0 -40
- package/dist/gdc-common-utils-ts/src/utils/object-convert.d.ts +0 -20
- package/dist/gdc-common-utils-ts/src/utils/object-convert.js +0 -51
- package/dist/gdc-common-utils-ts/src/utils/smart-scope.d.ts +0 -28
- package/dist/gdc-common-utils-ts/src/utils/smart-scope.js +0 -29
- package/dist/gdc-common-utils-ts/src/utils/string-convert.d.ts +0 -24
- package/dist/gdc-common-utils-ts/src/utils/string-convert.js +0 -62
- package/dist/gdc-common-utils-ts/src/utils/string-utils.d.ts +0 -25
- package/dist/gdc-common-utils-ts/src/utils/string-utils.js +0 -66
- package/dist/gdc-common-utils-ts/src/utils/url.d.ts +0 -26
- package/dist/gdc-common-utils-ts/src/utils/url.js +0 -44
- package/dist/gdc-common-utils-ts/src/utils/vp-token.d.ts +0 -139
- package/dist/gdc-common-utils-ts/src/utils/vp-token.js +0 -256
- package/dist/gdc-sdk-core-ts/src/actor-model.d.ts +0 -56
- package/dist/gdc-sdk-core-ts/src/actor-model.js +0 -112
- package/dist/gdc-sdk-core-ts/src/app-identity.d.ts +0 -80
- package/dist/gdc-sdk-core-ts/src/app-identity.js +0 -147
- package/dist/gdc-sdk-core-ts/src/bootstrap-facade.d.ts +0 -165
- package/dist/gdc-sdk-core-ts/src/bootstrap-facade.js +0 -191
- package/dist/gdc-sdk-core-ts/src/communication-bundle-contracts.d.ts +0 -112
- package/dist/gdc-sdk-core-ts/src/communication-bundle-contracts.js +0 -185
- package/dist/gdc-sdk-core-ts/src/communication-bundle-resources.d.ts +0 -32
- package/dist/gdc-sdk-core-ts/src/communication-bundle-resources.js +0 -215
- package/dist/gdc-sdk-core-ts/src/communication-consent-mutation-contract.d.ts +0 -55
- package/dist/gdc-sdk-core-ts/src/communication-consent-mutation-contract.js +0 -190
- package/dist/gdc-sdk-core-ts/src/communication-document-facade.d.ts +0 -55
- package/dist/gdc-sdk-core-ts/src/communication-document-facade.js +0 -194
- package/dist/gdc-sdk-core-ts/src/communication-draft.d.ts +0 -104
- package/dist/gdc-sdk-core-ts/src/communication-draft.js +0 -143
- package/dist/gdc-sdk-core-ts/src/communication-outbox.d.ts +0 -49
- package/dist/gdc-sdk-core-ts/src/communication-outbox.js +0 -62
- package/dist/gdc-sdk-core-ts/src/communication-resource-helpers.d.ts +0 -180
- package/dist/gdc-sdk-core-ts/src/communication-resource-helpers.js +0 -455
- package/dist/gdc-sdk-core-ts/src/consent-access.d.ts +0 -73
- package/dist/gdc-sdk-core-ts/src/consent-access.js +0 -109
- package/dist/gdc-sdk-core-ts/src/consent-claim-helpers.d.ts +0 -5
- package/dist/gdc-sdk-core-ts/src/consent-claim-helpers.js +0 -6
- package/dist/gdc-sdk-core-ts/src/consent-communication-operations.d.ts +0 -82
- package/dist/gdc-sdk-core-ts/src/consent-communication-operations.js +0 -135
- package/dist/gdc-sdk-core-ts/src/did-resolution-session.d.ts +0 -33
- package/dist/gdc-sdk-core-ts/src/did-resolution-session.js +0 -56
- package/dist/gdc-sdk-core-ts/src/discovery-facade.d.ts +0 -84
- package/dist/gdc-sdk-core-ts/src/discovery-facade.js +0 -24
- package/dist/gdc-sdk-core-ts/src/identity-model.d.ts +0 -46
- package/dist/gdc-sdk-core-ts/src/identity-model.js +0 -2
- package/dist/gdc-sdk-core-ts/src/identity-store.d.ts +0 -83
- package/dist/gdc-sdk-core-ts/src/identity-store.js +0 -51
- package/dist/gdc-sdk-core-ts/src/index.d.ts +0 -23
- package/dist/gdc-sdk-core-ts/src/index.js +0 -24
- package/dist/gdc-sdk-core-ts/src/medication-claim-helpers.d.ts +0 -5
- package/dist/gdc-sdk-core-ts/src/medication-claim-helpers.js +0 -6
- package/dist/gdc-sdk-core-ts/src/polling-model.d.ts +0 -35
- package/dist/gdc-sdk-core-ts/src/polling-model.js +0 -24
- package/dist/gdc-sdk-core-ts/src/relationship-access.d.ts +0 -40
- package/dist/gdc-sdk-core-ts/src/relationship-access.js +0 -150
- package/dist/gdc-sdk-core-ts/src/session-model.d.ts +0 -134
- package/dist/gdc-sdk-core-ts/src/session-model.js +0 -2
- package/dist/gdc-sdk-core-ts/src/smart-endpoint-resolver.d.ts +0 -19
- package/dist/gdc-sdk-core-ts/src/smart-endpoint-resolver.js +0 -19
- package/dist/gdc-sdk-core-ts/src/vital-signs.d.ts +0 -38
- package/dist/gdc-sdk-core-ts/src/vital-signs.js +0 -155
- package/dist/gdc-sdk-front-ts/src/ClientSDK.d.ts +0 -99
- package/dist/gdc-sdk-front-ts/src/ClientSDK.js +0 -177
- package/dist/gdc-sdk-front-ts/src/ProfileManager.d.ts +0 -140
- package/dist/gdc-sdk-front-ts/src/ProfileManager.js +0 -76
- package/dist/gdc-sdk-front-ts/src/ProfileRegistry.d.ts +0 -11
- package/dist/gdc-sdk-front-ts/src/ProfileRegistry.js +0 -26
- package/dist/gdc-sdk-front-ts/src/VerifierService.d.ts +0 -6
- package/dist/gdc-sdk-front-ts/src/VerifierService.js +0 -10
- package/dist/gdc-sdk-front-ts/src/actor-session.d.ts +0 -2
- package/dist/gdc-sdk-front-ts/src/actor-session.js +0 -2
- package/dist/gdc-sdk-front-ts/src/capabilityMapper.d.ts +0 -8
- package/dist/gdc-sdk-front-ts/src/capabilityMapper.js +0 -28
- package/dist/gdc-sdk-front-ts/src/consent-claim-helpers.d.ts +0 -4
- package/dist/gdc-sdk-front-ts/src/consent-claim-helpers.js +0 -5
- package/dist/gdc-sdk-front-ts/src/discovery/DataspaceDiscoveryClient.d.ts +0 -54
- package/dist/gdc-sdk-front-ts/src/discovery/DataspaceDiscoveryClient.js +0 -85
- package/dist/gdc-sdk-front-ts/src/discovery/index.d.ts +0 -3
- package/dist/gdc-sdk-front-ts/src/discovery/index.js +0 -4
- package/dist/gdc-sdk-front-ts/src/discovery/mappers.d.ts +0 -29
- package/dist/gdc-sdk-front-ts/src/discovery/mappers.js +0 -60
- package/dist/gdc-sdk-front-ts/src/discovery/types.d.ts +0 -83
- package/dist/gdc-sdk-front-ts/src/discovery/types.js +0 -2
- package/dist/gdc-sdk-front-ts/src/index.d.ts +0 -15
- package/dist/gdc-sdk-front-ts/src/index.js +0 -16
- package/dist/gdc-sdk-front-ts/src/medication-claim-helpers.d.ts +0 -4
- package/dist/gdc-sdk-front-ts/src/medication-claim-helpers.js +0 -5
- package/dist/gdc-sdk-front-ts/src/roleRegistry.d.ts +0 -19
- package/dist/gdc-sdk-front-ts/src/roleRegistry.js +0 -2
- package/dist/gdc-sdk-front-ts/src/runtime-contracts.d.ts +0 -22
- package/dist/gdc-sdk-front-ts/src/runtime-contracts.js +0 -7
- package/dist/gdc-sdk-front-ts/src/services.d.ts +0 -167
- package/dist/gdc-sdk-front-ts/src/services.js +0 -78
- package/dist/gdc-sdk-front-ts/src/session-descriptor.d.ts +0 -11
- package/dist/gdc-sdk-front-ts/src/session-descriptor.js +0 -8
- package/dist/gdc-sdk-front-ts/src/types.d.ts +0 -11
- package/dist/gdc-sdk-front-ts/src/types.js +0 -1
- package/dist/lifecycle-examples.d.ts +0 -6
- package/dist/lifecycle-examples.js +0 -7
- package/dist/medication-claim-helpers.d.ts +0 -4
- package/dist/medication-claim-helpers.js +0 -5
- package/dist/orchestration/facades.d.ts +0 -65
- package/dist/orchestration/facades.js +0 -142
package/dist/ProfileManager.js
CHANGED
|
@@ -199,15 +199,18 @@ export class ProfileManager {
|
|
|
199
199
|
return this.individual.service.upsertRelatedPersonAndPoll(input.relatedPersonPayload, ctx.providerDid, ctx.requiredScope || '', ctx.idToken);
|
|
200
200
|
},
|
|
201
201
|
ingestCommunicationAndUpdateIndex: (ctx, input) => {
|
|
202
|
+
const communicationInput = input.communicationJob || input.communicationPayload;
|
|
203
|
+
if (!communicationInput)
|
|
204
|
+
throw new Error('Clinical ingestion requires communicationJob.');
|
|
202
205
|
if (this.professional?.physician) {
|
|
203
|
-
return this.professional.physician.ingestCommunicationAndUpdateIndex(
|
|
206
|
+
return this.professional.physician.ingestCommunicationAndUpdateIndex(communicationInput, ctx.providerDid, ctx.requiredScope || '', ctx.idToken, input.pathFormatSegment);
|
|
204
207
|
}
|
|
205
208
|
if (this.professional?.paramedic) {
|
|
206
|
-
return this.professional.paramedic.ingestCommunicationAndUpdateIndex(
|
|
209
|
+
return this.professional.paramedic.ingestCommunicationAndUpdateIndex(communicationInput, ctx.providerDid, ctx.requiredScope || '', ctx.idToken, input.pathFormatSegment);
|
|
207
210
|
}
|
|
208
211
|
if (!this.individual?.service)
|
|
209
212
|
throw new Error('individual.service is not available for this profile.');
|
|
210
|
-
return this.individual.service.ingestCommunicationAndUpdateIndex(
|
|
213
|
+
return this.individual.service.ingestCommunicationAndUpdateIndex(communicationInput, ctx.providerDid, ctx.requiredScope || '', ctx.idToken, input.pathFormatSegment);
|
|
211
214
|
},
|
|
212
215
|
generateDigitalTwinFromSubjectData: (ctx, input) => {
|
|
213
216
|
if (!this.individual?.service)
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type RenderedTransportRequest, type CommunicationClinicalFormatRenderers, type SecureDidcommTransportAdapter, type SubmitAndPollResult, type TransportProfile } from 'gdc-sdk-core-ts';
|
|
2
|
+
import type { FrontClinicalBundleSearchInput, FrontCommunicationIngestionInput, FrontRouteContext, FrontRuntimeClient } from './orchestration/client-port.js';
|
|
3
|
+
export type FrontClinicalCarrierResponse = Readonly<{
|
|
4
|
+
status: number;
|
|
5
|
+
body: unknown;
|
|
6
|
+
location?: string;
|
|
7
|
+
retryAfterMs?: number;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Carrier-neutral request. HTTP, an offline sync queue, Bluetooth or another
|
|
11
|
+
* local link receives the same already-rendered protected message.
|
|
12
|
+
*/
|
|
13
|
+
export type FrontClinicalCarrierRequest = Readonly<{
|
|
14
|
+
phase: 'submit' | 'poll';
|
|
15
|
+
path: string;
|
|
16
|
+
authorization: string;
|
|
17
|
+
message: RenderedTransportRequest;
|
|
18
|
+
}>;
|
|
19
|
+
export type FrontClinicalCarrier = Readonly<{
|
|
20
|
+
/** Deliver an already-rendered message without decrypting or rebuilding it. */
|
|
21
|
+
send(request: FrontClinicalCarrierRequest): Promise<FrontClinicalCarrierResponse>;
|
|
22
|
+
}>;
|
|
23
|
+
export type FrontClinicalRuntimeClientOptions = Readonly<{
|
|
24
|
+
carrier: FrontClinicalCarrier;
|
|
25
|
+
transportProfile?: TransportProfile;
|
|
26
|
+
secureTransportAdapter?: SecureDidcommTransportAdapter;
|
|
27
|
+
/** Product-supplied projections not owned by the generic frontend runtime. */
|
|
28
|
+
communicationFormatRenderers?: CommunicationClinicalFormatRenderers;
|
|
29
|
+
accessToken?: string;
|
|
30
|
+
pollIntervalMs?: number;
|
|
31
|
+
pollTimeoutMs?: number;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Direct browser/mobile implementation of the canonical Node clinical surface.
|
|
35
|
+
*
|
|
36
|
+
* The client owns message rendering, SMART bearer use, thread correlation and
|
|
37
|
+
* polling. The carrier owns delivery only. An offline-first carrier persists
|
|
38
|
+
* `request.message` byte-for-byte with its `thid`; a Bluetooth carrier relays
|
|
39
|
+
* that persisted JWE without seeing FHIR or wallet keys.
|
|
40
|
+
*
|
|
41
|
+
* A native confidential app must inject an unlocked wallet-backed
|
|
42
|
+
* `secureTransportAdapter`. It should protect that wallet with the same
|
|
43
|
+
* PIN-plus-device envelope described by the Node profile contract, replacing
|
|
44
|
+
* Cloud KMS with Keychain/Keystore rather than weakening the KDF.
|
|
45
|
+
*/
|
|
46
|
+
export declare class FrontClinicalRuntimeClient implements FrontRuntimeClient {
|
|
47
|
+
private readonly options;
|
|
48
|
+
private readonly profile;
|
|
49
|
+
constructor(options: FrontClinicalRuntimeClientOptions);
|
|
50
|
+
ingestCommunicationAndUpdateIndex(ctx: FrontRouteContext, input: FrontCommunicationIngestionInput): Promise<SubmitAndPollResult>;
|
|
51
|
+
searchClinicalBundle(ctx: FrontRouteContext, input: FrontClinicalBundleSearchInput): Promise<SubmitAndPollResult & {
|
|
52
|
+
thid: string;
|
|
53
|
+
}>;
|
|
54
|
+
getLatestIps(ctx: FrontRouteContext, subject: string): Promise<SubmitAndPollResult & {
|
|
55
|
+
thid: string;
|
|
56
|
+
}>;
|
|
57
|
+
private sendAndPoll;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create the online HTTP carrier.
|
|
61
|
+
*
|
|
62
|
+
* Expo should inject a durable outbox carrier instead. That carrier may choose
|
|
63
|
+
* HTTP or Bluetooth at delivery time, but must preserve the rendered content
|
|
64
|
+
* type, exact form-encoded JWE and thread id.
|
|
65
|
+
*/
|
|
66
|
+
export declare function createFetchFrontClinicalCarrier(input: Readonly<{
|
|
67
|
+
baseUrl: string;
|
|
68
|
+
fetchImpl?: typeof fetch;
|
|
69
|
+
}>): FrontClinicalCarrier;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
+
import { TransportProfiles, decodeTransportResponse, renderCommunicationOutboxRequest, renderGatewayMessageRequest, renderTransportPollRequest, } from 'gdc-sdk-core-ts';
|
|
3
|
+
/**
|
|
4
|
+
* Direct browser/mobile implementation of the canonical Node clinical surface.
|
|
5
|
+
*
|
|
6
|
+
* The client owns message rendering, SMART bearer use, thread correlation and
|
|
7
|
+
* polling. The carrier owns delivery only. An offline-first carrier persists
|
|
8
|
+
* `request.message` byte-for-byte with its `thid`; a Bluetooth carrier relays
|
|
9
|
+
* that persisted JWE without seeing FHIR or wallet keys.
|
|
10
|
+
*
|
|
11
|
+
* A native confidential app must inject an unlocked wallet-backed
|
|
12
|
+
* `secureTransportAdapter`. It should protect that wallet with the same
|
|
13
|
+
* PIN-plus-device envelope described by the Node profile contract, replacing
|
|
14
|
+
* Cloud KMS with Keychain/Keystore rather than weakening the KDF.
|
|
15
|
+
*/
|
|
16
|
+
export class FrontClinicalRuntimeClient {
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
this.profile = options.transportProfile || TransportProfiles.DidcommPlainJson;
|
|
20
|
+
}
|
|
21
|
+
async ingestCommunicationAndUpdateIndex(ctx, input) {
|
|
22
|
+
if (!input.communicationJob) {
|
|
23
|
+
throw new Error('Direct clinical ingestion requires communicationJob.');
|
|
24
|
+
}
|
|
25
|
+
const route = requireDirectRoute(ctx);
|
|
26
|
+
const format = normalizeFormat(input.clinicalFormat || input.pathFormatSegment);
|
|
27
|
+
const profile = input.transportProfile || this.profile;
|
|
28
|
+
const submit = await renderCommunicationOutboxRequest(input.communicationJob, profile, this.options.secureTransportAdapter, {
|
|
29
|
+
clinicalFormat: input.clinicalFormat || input.pathFormatSegment || 'api',
|
|
30
|
+
formatRenderers: this.options.communicationFormatRenderers,
|
|
31
|
+
});
|
|
32
|
+
return this.sendAndPoll(ctx, resourcePath(route, format, 'Communication', '_batch'), resourcePath(route, format, 'Communication', '_batch-response'), submit, profile, input.pollOptions);
|
|
33
|
+
}
|
|
34
|
+
async searchClinicalBundle(ctx, input) {
|
|
35
|
+
const route = requireDirectRoute(ctx);
|
|
36
|
+
const profile = input.transportProfile || this.profile;
|
|
37
|
+
const thid = input.requestThid || `bundle-search-${runtimeUuid()}`;
|
|
38
|
+
const message = await renderGatewayMessageRequest({
|
|
39
|
+
thid,
|
|
40
|
+
body: {
|
|
41
|
+
resourceType: 'Bundle',
|
|
42
|
+
type: 'batch',
|
|
43
|
+
entry: [{ request: { method: 'GET', url: buildBundleSearchQuery(input) } }],
|
|
44
|
+
},
|
|
45
|
+
}, profile, this.options.secureTransportAdapter);
|
|
46
|
+
const result = await this.sendAndPoll(ctx, resourcePath(route, 'org.hl7.fhir.r4', 'Bundle', '_search'), resourcePath(route, 'org.hl7.fhir.r4', 'Bundle', '_search-response'), message, profile, input.pollOptions);
|
|
47
|
+
return { thid, ...result };
|
|
48
|
+
}
|
|
49
|
+
getLatestIps(ctx, subject) {
|
|
50
|
+
return this.searchClinicalBundle(ctx, {
|
|
51
|
+
subject,
|
|
52
|
+
section: 'LOINC|60591-5',
|
|
53
|
+
includedTypes: ['Composition', 'DocumentReference'],
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async sendAndPoll(ctx, submitPath, pollPath, submitMessage, profile, pollOptions) {
|
|
57
|
+
const authorization = requireSmartBearer(ctx, this.options.accessToken);
|
|
58
|
+
const submitted = await this.options.carrier.send({
|
|
59
|
+
phase: 'submit',
|
|
60
|
+
path: submitPath,
|
|
61
|
+
authorization,
|
|
62
|
+
message: submitMessage,
|
|
63
|
+
});
|
|
64
|
+
const submit = { status: submitted.status, location: submitted.location, body: submitted.body };
|
|
65
|
+
if (submitted.status !== 202) {
|
|
66
|
+
const body = await decodeTransportResponse(submitted.body, profile, this.options.secureTransportAdapter);
|
|
67
|
+
return { submit, poll: { status: submitted.status, body, attempts: 1 } };
|
|
68
|
+
}
|
|
69
|
+
const started = Date.now();
|
|
70
|
+
const timeoutMs = pollOptions?.timeoutMs ?? this.options.pollTimeoutMs ?? 30000;
|
|
71
|
+
const intervalMs = pollOptions?.intervalMs ?? this.options.pollIntervalMs ?? 500;
|
|
72
|
+
let attempts = 0;
|
|
73
|
+
while (Date.now() - started <= timeoutMs) {
|
|
74
|
+
attempts += 1;
|
|
75
|
+
const pollMessage = await renderTransportPollRequest(submitMessage.thid, profile, this.options.secureTransportAdapter);
|
|
76
|
+
const response = await this.options.carrier.send({
|
|
77
|
+
phase: 'poll',
|
|
78
|
+
path: pollPath,
|
|
79
|
+
authorization,
|
|
80
|
+
message: pollMessage,
|
|
81
|
+
});
|
|
82
|
+
if (response.status !== 202) {
|
|
83
|
+
return {
|
|
84
|
+
submit,
|
|
85
|
+
poll: {
|
|
86
|
+
status: response.status,
|
|
87
|
+
body: await decodeTransportResponse(response.body, profile, this.options.secureTransportAdapter),
|
|
88
|
+
attempts,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
await delay(response.retryAfterMs ?? intervalMs);
|
|
93
|
+
}
|
|
94
|
+
throw new Error(`Clinical transport polling timed out for thread '${submitMessage.thid}'.`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Create the online HTTP carrier.
|
|
99
|
+
*
|
|
100
|
+
* Expo should inject a durable outbox carrier instead. That carrier may choose
|
|
101
|
+
* HTTP or Bluetooth at delivery time, but must preserve the rendered content
|
|
102
|
+
* type, exact form-encoded JWE and thread id.
|
|
103
|
+
*/
|
|
104
|
+
export function createFetchFrontClinicalCarrier(input) {
|
|
105
|
+
const baseUrl = input.baseUrl.replace(/\/$/, '');
|
|
106
|
+
const fetchImpl = input.fetchImpl || fetch;
|
|
107
|
+
return {
|
|
108
|
+
async send(request) {
|
|
109
|
+
const response = await fetchImpl(`${baseUrl}${request.path}`, {
|
|
110
|
+
method: 'POST',
|
|
111
|
+
headers: {
|
|
112
|
+
Authorization: request.authorization,
|
|
113
|
+
'Content-Type': request.message.contentType,
|
|
114
|
+
Accept: request.message.accept,
|
|
115
|
+
},
|
|
116
|
+
body: typeof request.message.body === 'string'
|
|
117
|
+
? request.message.body
|
|
118
|
+
: JSON.stringify(request.message.body),
|
|
119
|
+
});
|
|
120
|
+
const text = await response.text();
|
|
121
|
+
return {
|
|
122
|
+
status: response.status,
|
|
123
|
+
body: parseCarrierBody(text),
|
|
124
|
+
location: response.headers.get('location') || undefined,
|
|
125
|
+
retryAfterMs: parseRetryAfter(response.headers.get('retry-after')),
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function requireDirectRoute(ctx) {
|
|
131
|
+
const tenantId = String(ctx.tenantId || '').trim();
|
|
132
|
+
const jurisdiction = String(ctx.jurisdiction || '').trim();
|
|
133
|
+
const sector = String(ctx.sector || '').trim();
|
|
134
|
+
if (!tenantId || !jurisdiction || !sector) {
|
|
135
|
+
throw new Error('Direct frontend clinical transport requires tenantId, jurisdiction and sector.');
|
|
136
|
+
}
|
|
137
|
+
return { tenantId, jurisdiction, sector };
|
|
138
|
+
}
|
|
139
|
+
function requireSmartBearer(ctx, fallback) {
|
|
140
|
+
const token = String(ctx.accessToken || fallback || '').trim();
|
|
141
|
+
if (!token)
|
|
142
|
+
throw new Error('Direct frontend clinical transport requires a SMART access token.');
|
|
143
|
+
return `Bearer ${token}`;
|
|
144
|
+
}
|
|
145
|
+
function resourcePath(route, format, resourceType, action) {
|
|
146
|
+
return `/${encodeURIComponent(route.tenantId)}/cds-${encodeURIComponent(route.jurisdiction)}/v1/${encodeURIComponent(route.sector)}/individual/${encodeURIComponent(format)}/${encodeURIComponent(resourceType)}/${encodeURIComponent(action)}`;
|
|
147
|
+
}
|
|
148
|
+
function normalizeFormat(value) {
|
|
149
|
+
const normalized = String(value || '').trim().toLowerCase();
|
|
150
|
+
if (!normalized || normalized === 'api' || normalized === 'org.hl7.fhir.api')
|
|
151
|
+
return 'org.hl7.fhir.api';
|
|
152
|
+
if (normalized === 'r4' || normalized === 'fhir.r4' || normalized === 'org.hl7.fhir.r4')
|
|
153
|
+
return 'org.hl7.fhir.r4';
|
|
154
|
+
if (/^org\.hl7\.fhir\.[a-z0-9.-]+$/.test(normalized))
|
|
155
|
+
return normalized;
|
|
156
|
+
throw new Error(`Unsupported Communication clinical format '${String(value || '')}'.`);
|
|
157
|
+
}
|
|
158
|
+
function buildBundleSearchQuery(input) {
|
|
159
|
+
const params = new URLSearchParams();
|
|
160
|
+
params.set('type', 'document');
|
|
161
|
+
params.set('subject', input.subject);
|
|
162
|
+
setCsv(params, 'composition.section', input.section);
|
|
163
|
+
setCsv(params, '_type', input.includedTypes);
|
|
164
|
+
if (input.date?.start)
|
|
165
|
+
params.set('start', input.date.start);
|
|
166
|
+
if (input.date?.end)
|
|
167
|
+
params.set('end', input.date.end);
|
|
168
|
+
setCsv(params, 'code', input.code);
|
|
169
|
+
setCsv(params, 'category', input.category);
|
|
170
|
+
setCsv(params, 'author', input.author);
|
|
171
|
+
if (input.thid)
|
|
172
|
+
params.set('thid', input.thid);
|
|
173
|
+
if (input.pthid)
|
|
174
|
+
params.set('pthid', input.pthid);
|
|
175
|
+
if (input.channelId)
|
|
176
|
+
params.set('channelId', input.channelId);
|
|
177
|
+
if (input.partOf)
|
|
178
|
+
params.set('part-of', input.partOf);
|
|
179
|
+
for (const [key, value] of Object.entries(input.extraSearchParams || {})) {
|
|
180
|
+
if (value !== undefined && value !== null && String(value).trim())
|
|
181
|
+
params.set(key, String(value));
|
|
182
|
+
}
|
|
183
|
+
return `Bundle?${params.toString()}`;
|
|
184
|
+
}
|
|
185
|
+
function setCsv(params, key, value) {
|
|
186
|
+
const normalized = (Array.isArray(value) ? value : value ? [value] : [])
|
|
187
|
+
.map((item) => String(item).trim())
|
|
188
|
+
.filter(Boolean)
|
|
189
|
+
.join(',');
|
|
190
|
+
if (normalized)
|
|
191
|
+
params.set(key, normalized);
|
|
192
|
+
}
|
|
193
|
+
function parseCarrierBody(value) {
|
|
194
|
+
if (!value)
|
|
195
|
+
return undefined;
|
|
196
|
+
try {
|
|
197
|
+
return JSON.parse(value);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
return value;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function parseRetryAfter(value) {
|
|
204
|
+
if (!value)
|
|
205
|
+
return undefined;
|
|
206
|
+
const seconds = Number(value);
|
|
207
|
+
return Number.isFinite(seconds) ? seconds * 1000 : undefined;
|
|
208
|
+
}
|
|
209
|
+
function runtimeUuid() {
|
|
210
|
+
return globalThis.crypto?.randomUUID?.() || `${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
211
|
+
}
|
|
212
|
+
function delay(ms) {
|
|
213
|
+
return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
|
|
214
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './ClientSDK.js';
|
|
|
15
15
|
export * from './frontend-profile-runtime.js';
|
|
16
16
|
export * from './frontend-profile-workspace.js';
|
|
17
17
|
export * from './individual-controller-frontend-runtime.js';
|
|
18
|
+
export * from './front-clinical-runtime-client.js';
|
|
18
19
|
export * from './discovery/index.js';
|
|
19
20
|
export * from './orchestration/client-port.js';
|
|
20
21
|
export * from './orchestration/host-onboarding-sdk.js';
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from './ClientSDK.js';
|
|
|
16
16
|
export * from './frontend-profile-runtime.js';
|
|
17
17
|
export * from './frontend-profile-workspace.js';
|
|
18
18
|
export * from './individual-controller-frontend-runtime.js';
|
|
19
|
+
export * from './front-clinical-runtime-client.js';
|
|
19
20
|
export * from './discovery/index.js';
|
|
20
21
|
export * from './orchestration/client-port.js';
|
|
21
22
|
export * from './orchestration/host-onboarding-sdk.js';
|
|
@@ -3,10 +3,16 @@ import type { LicenseListSearchState } from 'gdc-common-utils-ts/utils/license-l
|
|
|
3
3
|
import type { LicenseOfferSearchState, LicenseOrderSearchState } from 'gdc-common-utils-ts/utils/license-commercial-search';
|
|
4
4
|
import type { IndividualOrganizationLifecycleEditor } from 'gdc-common-utils-ts/utils/individual-organization-lifecycle';
|
|
5
5
|
import type { IndividualOnboardingDraftInput, IndividualOnboardingDraftResult } from 'gdc-common-utils-ts/models/individual-onboarding';
|
|
6
|
-
import type { BundleSearchQuery, CommunicationInput, EmployeeSearchValue, HostLifecycleInput, HostRouteContext, HostedTenantLifecycleInput, OrganizationDidBindingInput, LegalOrganizationOrderInput, PollOptions, SmartTokenRequestContract, SubmitAndPollResult, SubmitPayload } from 'gdc-sdk-core-ts';
|
|
6
|
+
import type { BundleSearchQuery, CommMsgExtendedCommunicationOutboxJob, CommunicationOutboxJob, CommunicationInput, EmployeeSearchValue, HostLifecycleInput, HostRouteContext, HostedTenantLifecycleInput, OrganizationDidBindingInput, LegalOrganizationOrderInput, PollOptions, SmartTokenRequestContract, SubmitAndPollResult, SubmitPayload, TransportProfile } from 'gdc-sdk-core-ts';
|
|
7
7
|
export type FrontRouteContext = {
|
|
8
8
|
providerDid: string;
|
|
9
9
|
idToken: string;
|
|
10
|
+
/** Direct-to-GW runtimes use the SMART access token, never the login token. */
|
|
11
|
+
accessToken?: string;
|
|
12
|
+
/** Direct mobile/browser runtimes require explicit GW routing. */
|
|
13
|
+
tenantId?: string;
|
|
14
|
+
jurisdiction?: string;
|
|
15
|
+
sector?: string;
|
|
10
16
|
requiredScope?: string;
|
|
11
17
|
format?: 'org.hl7.fhir.r4' | 'org.hl7.fhir.api';
|
|
12
18
|
};
|
|
@@ -118,11 +124,23 @@ export type FrontRelatedPersonUpsertInput = {
|
|
|
118
124
|
relatedPersonPayload: object;
|
|
119
125
|
};
|
|
120
126
|
export type FrontCommunicationIngestionInput = {
|
|
121
|
-
|
|
127
|
+
/** Preferred claims-first job created by `createCommunicationOutboxJobFromCommMsgExtendedDraft(...)`. */
|
|
128
|
+
communicationJob?: CommunicationOutboxJob | CommMsgExtendedCommunicationOutboxJob;
|
|
129
|
+
/** Compatibility escape hatch for an already-rendered channel payload. */
|
|
130
|
+
communicationPayload?: CommunicationInput & Record<string, unknown>;
|
|
131
|
+
/** Claims-first representation rendered before transport. */
|
|
132
|
+
clinicalFormat?: string;
|
|
133
|
+
/** @deprecated Use `clinicalFormat`. */
|
|
122
134
|
pathFormatSegment?: 'org.hl7.fhir.r4' | 'org.hl7.fhir.api';
|
|
135
|
+
transportProfile?: TransportProfile;
|
|
136
|
+
pollOptions?: PollOptions;
|
|
123
137
|
};
|
|
124
|
-
export type FrontClinicalBundleSearchInput = BundleSearchQuery & {
|
|
138
|
+
export type FrontClinicalBundleSearchInput = Omit<BundleSearchQuery, 'section' | 'searchParams'> & {
|
|
139
|
+
section?: string | string[];
|
|
140
|
+
extraSearchParams?: BundleSearchQuery['searchParams'];
|
|
125
141
|
requestThid?: string;
|
|
142
|
+
transportProfile?: TransportProfile;
|
|
143
|
+
pollOptions?: PollOptions;
|
|
126
144
|
};
|
|
127
145
|
export type FrontGrantProfessionalAccessInput = {
|
|
128
146
|
subjectDid?: string;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import type { SubmitAndPollResult } from 'gdc-sdk-core-ts';
|
|
2
|
-
import { type FrontRelatedPersonUpsertInput, type FrontRouteContext, type FrontRuntimeClient, type FrontSmartTokenExchangeResult, type FrontSmartTokenRequestInput } from './client-port.js';
|
|
2
|
+
import { type FrontClinicalBundleSearchInput, type FrontCommunicationIngestionInput, type FrontRelatedPersonUpsertInput, type FrontRouteContext, type FrontRuntimeClient, type FrontSmartTokenExchangeResult, type FrontSmartTokenRequestInput } from './client-port.js';
|
|
3
3
|
export declare class IndividualMemberSdk {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: FrontRuntimeClient);
|
|
6
6
|
upsertRelatedPersonAndPoll(ctx: FrontRouteContext, input: FrontRelatedPersonUpsertInput): Promise<SubmitAndPollResult>;
|
|
7
7
|
requestSmartToken(input: FrontSmartTokenRequestInput): Promise<FrontSmartTokenExchangeResult>;
|
|
8
|
+
/** Delegates a permitted member write to the same canonical clinical outbox. */
|
|
9
|
+
ingestCommunicationAndUpdateIndex(ctx: FrontRouteContext, input: FrontCommunicationIngestionInput): Promise<SubmitAndPollResult>;
|
|
10
|
+
/** Reads clinical documents under the member's accepted consent and SMART scopes. */
|
|
11
|
+
searchClinicalBundle(ctx: FrontRouteContext, input: FrontClinicalBundleSearchInput): Promise<{
|
|
12
|
+
thid: string;
|
|
13
|
+
}>;
|
|
14
|
+
/** Reads the latest IPS permitted for this member and subject. */
|
|
15
|
+
getLatestIps(ctx: FrontRouteContext, subject: string): Promise<{
|
|
16
|
+
thid: string;
|
|
17
|
+
}>;
|
|
8
18
|
}
|
|
@@ -10,4 +10,16 @@ export class IndividualMemberSdk {
|
|
|
10
10
|
requestSmartToken(input) {
|
|
11
11
|
return requireClientMethod(this.client, 'requestSmartToken')(input);
|
|
12
12
|
}
|
|
13
|
+
/** Delegates a permitted member write to the same canonical clinical outbox. */
|
|
14
|
+
ingestCommunicationAndUpdateIndex(ctx, input) {
|
|
15
|
+
return requireClientMethod(this.client, 'ingestCommunicationAndUpdateIndex')(ctx, input);
|
|
16
|
+
}
|
|
17
|
+
/** Reads clinical documents under the member's accepted consent and SMART scopes. */
|
|
18
|
+
searchClinicalBundle(ctx, input) {
|
|
19
|
+
return requireClientMethod(this.client, 'searchClinicalBundle')(ctx, input);
|
|
20
|
+
}
|
|
21
|
+
/** Reads the latest IPS permitted for this member and subject. */
|
|
22
|
+
getLatestIps(ctx, subject) {
|
|
23
|
+
return requireClientMethod(this.client, 'getLatestIps')(ctx, subject);
|
|
24
|
+
}
|
|
13
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ProfessionalEmployeeCredentialInput, type ProfessionalSmartVpPayloadInput } from 'gdc-common-utils-ts';
|
|
2
2
|
import type { PollOptions, SubmitAndPollResult, SubmitPayload } from 'gdc-sdk-core-ts';
|
|
3
|
-
import { type FrontCommunicationIngestionInput, type FrontGrantProfessionalAccessInput, type FrontGrantProfessionalAccessResult, type FrontRouteContext, type FrontRuntimeClient, type FrontSmartTokenExchangeResult, type FrontSmartTokenRequestInput } from './client-port.js';
|
|
3
|
+
import { type FrontClinicalBundleSearchInput, type FrontCommunicationIngestionInput, type FrontGrantProfessionalAccessInput, type FrontGrantProfessionalAccessResult, type FrontRouteContext, type FrontRuntimeClient, type FrontSmartTokenExchangeResult, type FrontSmartTokenRequestInput } from './client-port.js';
|
|
4
4
|
export declare class ProfessionalSdk {
|
|
5
5
|
private readonly client;
|
|
6
6
|
constructor(client: FrontRuntimeClient);
|
|
@@ -31,5 +31,11 @@ export declare class ProfessionalSdk {
|
|
|
31
31
|
}>): string;
|
|
32
32
|
ingestCommunicationAndUpdateIndex(ctx: FrontRouteContext, input: FrontCommunicationIngestionInput): Promise<SubmitAndPollResult>;
|
|
33
33
|
grantProfessionalAccess(ctx: FrontRouteContext, input: FrontGrantProfessionalAccessInput): Promise<FrontGrantProfessionalAccessResult>;
|
|
34
|
+
searchClinicalBundle(ctx: FrontRouteContext, input: FrontClinicalBundleSearchInput): Promise<{
|
|
35
|
+
thid: string;
|
|
36
|
+
}>;
|
|
37
|
+
getLatestIps(ctx: FrontRouteContext, subject: string): Promise<{
|
|
38
|
+
thid: string;
|
|
39
|
+
}>;
|
|
34
40
|
submitAndPoll(submitPath: string, pollPath: string, payload: SubmitPayload, pollOptions?: PollOptions): Promise<SubmitAndPollResult>;
|
|
35
41
|
}
|
|
@@ -42,6 +42,12 @@ export class ProfessionalSdk {
|
|
|
42
42
|
grantProfessionalAccess(ctx, input) {
|
|
43
43
|
return requireClientMethod(this.client, 'grantProfessionalAccess')(ctx, input);
|
|
44
44
|
}
|
|
45
|
+
searchClinicalBundle(ctx, input) {
|
|
46
|
+
return requireClientMethod(this.client, 'searchClinicalBundle')(ctx, input);
|
|
47
|
+
}
|
|
48
|
+
getLatestIps(ctx, subject) {
|
|
49
|
+
return requireClientMethod(this.client, 'getLatestIps')(ctx, subject);
|
|
50
|
+
}
|
|
45
51
|
submitAndPoll(submitPath, pollPath, payload, pollOptions) {
|
|
46
52
|
return requireClientMethod(this.client, 'submitAndPoll')(submitPath, pollPath, payload, pollOptions);
|
|
47
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-sdk-front-ts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Next-generation frontend runtime package for the GDC SDK family",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Antifraud Services Inc.",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.28.4",
|
|
20
|
-
"gdc-common-utils-ts": "^2.
|
|
21
|
-
"gdc-sdk-core-ts": "~2.
|
|
20
|
+
"gdc-common-utils-ts": "^2.3.1",
|
|
21
|
+
"gdc-sdk-core-ts": "~2.3.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^20.14.10",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { DataspaceDiscoveryClient } from './DataspaceDiscoveryClient.js';
|
|
2
|
-
import type { ListPublishedProvidersInput, ListPublishedProvidersResult } from './types.js';
|
|
3
|
-
type DiscoveryFetchResponse = Readonly<{
|
|
4
|
-
ok: boolean;
|
|
5
|
-
status: number;
|
|
6
|
-
json(): Promise<unknown>;
|
|
7
|
-
}>;
|
|
8
|
-
export type FrontendDiscoveryFetch = (input: string, init?: Readonly<{
|
|
9
|
-
method?: string;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
body?: string;
|
|
12
|
-
}>) => Promise<DiscoveryFetchResponse>;
|
|
13
|
-
export type HttpDataspaceDiscoveryClientOptions = Readonly<{
|
|
14
|
-
baseUrl: string;
|
|
15
|
-
fetcher?: FrontendDiscoveryFetch;
|
|
16
|
-
endpointPath?: string;
|
|
17
|
-
headers?: Record<string, string>;
|
|
18
|
-
}>;
|
|
19
|
-
/**
|
|
20
|
-
* HTTP/BFF-first frontend discovery client.
|
|
21
|
-
*/
|
|
22
|
-
export declare class HttpDataspaceDiscoveryClient implements DataspaceDiscoveryClient {
|
|
23
|
-
private readonly baseUrl;
|
|
24
|
-
private readonly fetcher;
|
|
25
|
-
private readonly endpointPath;
|
|
26
|
-
private readonly headers;
|
|
27
|
-
constructor(options: HttpDataspaceDiscoveryClientOptions);
|
|
28
|
-
/**
|
|
29
|
-
* Calls the configured backend/BFF endpoint and maps normalized discovery
|
|
30
|
-
* DTOs into UI-facing cards.
|
|
31
|
-
*/
|
|
32
|
-
listPublishedProviders(input: ListPublishedProvidersInput): Promise<ListPublishedProvidersResult>;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
import { mapHostingOperatorRecordToCard, mapPublishedProviderRecordToCard } from './mappers.js';
|
|
3
|
-
function defaultFetch(input, init) {
|
|
4
|
-
return fetch(input, init);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* HTTP/BFF-first frontend discovery client.
|
|
8
|
-
*/
|
|
9
|
-
export class HttpDataspaceDiscoveryClient {
|
|
10
|
-
constructor(options) {
|
|
11
|
-
this.baseUrl = new URL(options.baseUrl.endsWith('/') ? options.baseUrl : `${options.baseUrl}/`);
|
|
12
|
-
this.fetcher = options.fetcher || defaultFetch;
|
|
13
|
-
this.endpointPath = options.endpointPath || '/api/dataspace-discovery/providers';
|
|
14
|
-
this.headers = { ...(options.headers || {}) };
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Calls the configured backend/BFF endpoint and maps normalized discovery
|
|
18
|
-
* DTOs into UI-facing cards.
|
|
19
|
-
*/
|
|
20
|
-
async listPublishedProviders(input) {
|
|
21
|
-
const response = await this.fetcher(new URL(this.endpointPath.replace(/^\//, ''), this.baseUrl).href, {
|
|
22
|
-
method: 'POST',
|
|
23
|
-
headers: {
|
|
24
|
-
'content-type': 'application/json',
|
|
25
|
-
...this.headers,
|
|
26
|
-
},
|
|
27
|
-
body: JSON.stringify(input),
|
|
28
|
-
});
|
|
29
|
-
if (!response.ok) {
|
|
30
|
-
throw new Error(`Failed to load dataspace discovery results (${response.status}).`);
|
|
31
|
-
}
|
|
32
|
-
const body = await response.json();
|
|
33
|
-
const providers = Array.isArray(body.providers)
|
|
34
|
-
? body.providers.map((record) => mapPublishedProviderRecordToCard(record))
|
|
35
|
-
: [];
|
|
36
|
-
const hostingOperators = Array.isArray(body.hostingOperators)
|
|
37
|
-
? body.hostingOperators.map((entry) => mapHostingOperatorRecordToCard(entry.record, {
|
|
38
|
-
catalogUrl: entry.catalogUrl,
|
|
39
|
-
title: entry.title,
|
|
40
|
-
}))
|
|
41
|
-
: [];
|
|
42
|
-
return {
|
|
43
|
-
providers,
|
|
44
|
-
...(hostingOperators.length ? { hostingOperators } : {}),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ProtectedDataAES } from './models/aes';
|
|
2
|
-
/**
|
|
3
|
-
* Manages AES-GCM encryption and decryption using Node's native crypto module.
|
|
4
|
-
* This class handles the core cryptography and the base64url serialization required for JWE.
|
|
5
|
-
*/
|
|
6
|
-
export declare class AesManager {
|
|
7
|
-
private readonly ALGORITHM;
|
|
8
|
-
private readonly KEY_SIZE;
|
|
9
|
-
private readonly IV_GENERATION_SIZE;
|
|
10
|
-
private readonly TAG_SIZE_BYTES;
|
|
11
|
-
/**
|
|
12
|
-
* Encrypts a plaintext string and returns the components as base64url strings.
|
|
13
|
-
* @param plaintext The stringified data to encrypt (e.g. a stringified object or ASCII string from raw bytes)
|
|
14
|
-
* @param cekBytes The 32-byte Content Encryption Key.
|
|
15
|
-
* @param aad The Additional Authenticated Data string for integrity protection.
|
|
16
|
-
* @returns A promise resolving to the JWE-compatible encrypted components.
|
|
17
|
-
*/
|
|
18
|
-
encrypt(plaintext: string, cekBytes: Uint8Array, aad: string): Promise<ProtectedDataAES>;
|
|
19
|
-
/**
|
|
20
|
-
* Decrypts JWE-compatible encrypted components back to a plaintext string.
|
|
21
|
-
* @param encryptedData The object containing the base64url-encoded ciphertext, iv, and tag.
|
|
22
|
-
* @param cekBytes The 32-byte Content Encryption Key.
|
|
23
|
-
* @param aad The Additional Authenticated Data for integrity verification.
|
|
24
|
-
* @returns A promise resolving to the decrypted plaintext string.
|
|
25
|
-
*/
|
|
26
|
-
decrypt(encryptedData: ProtectedDataAES, cekBytes: Uint8Array, aad: string): Promise<string>;
|
|
27
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Copyright 2025 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
|
-
// File: crypto-ts/AesManager.ts
|
|
3
|
-
import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
|
4
|
-
import { Content } from './utils/content';
|
|
5
|
-
/**
|
|
6
|
-
* Manages AES-GCM encryption and decryption using Node's native crypto module.
|
|
7
|
-
* This class handles the core cryptography and the base64url serialization required for JWE.
|
|
8
|
-
*/
|
|
9
|
-
export class AesManager {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.ALGORITHM = 'aes-256-gcm';
|
|
12
|
-
this.KEY_SIZE = 32; // 256-bit key
|
|
13
|
-
this.IV_GENERATION_SIZE = 12; // 96-bit IV, recommended by NIST for GCM
|
|
14
|
-
this.TAG_SIZE_BYTES = 16; // 128-bit authentication tag
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Encrypts a plaintext string and returns the components as base64url strings.
|
|
18
|
-
* @param plaintext The stringified data to encrypt (e.g. a stringified object or ASCII string from raw bytes)
|
|
19
|
-
* @param cekBytes The 32-byte Content Encryption Key.
|
|
20
|
-
* @param aad The Additional Authenticated Data string for integrity protection.
|
|
21
|
-
* @returns A promise resolving to the JWE-compatible encrypted components.
|
|
22
|
-
*/
|
|
23
|
-
async encrypt(plaintext, cekBytes, aad) {
|
|
24
|
-
if (cekBytes.length !== this.KEY_SIZE) {
|
|
25
|
-
throw new Error(`Invalid key length: a ${this.KEY_SIZE}-byte key is required.`);
|
|
26
|
-
}
|
|
27
|
-
const iv = randomBytes(this.IV_GENERATION_SIZE);
|
|
28
|
-
const aadBytes = Content.stringToBytesUTF8(aad);
|
|
29
|
-
const cipher = createCipheriv(this.ALGORITHM, cekBytes, iv, {
|
|
30
|
-
authTagLength: this.TAG_SIZE_BYTES
|
|
31
|
-
});
|
|
32
|
-
cipher.setAAD(aadBytes);
|
|
33
|
-
const ciphertext = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
|
|
34
|
-
const tag = cipher.getAuthTag();
|
|
35
|
-
return {
|
|
36
|
-
ciphertext: Content.bytesToRawBase64UrlSafe(ciphertext),
|
|
37
|
-
iv: Content.bytesToRawBase64UrlSafe(iv),
|
|
38
|
-
tag: Content.bytesToRawBase64UrlSafe(tag),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Decrypts JWE-compatible encrypted components back to a plaintext string.
|
|
43
|
-
* @param encryptedData The object containing the base64url-encoded ciphertext, iv, and tag.
|
|
44
|
-
* @param cekBytes The 32-byte Content Encryption Key.
|
|
45
|
-
* @param aad The Additional Authenticated Data for integrity verification.
|
|
46
|
-
* @returns A promise resolving to the decrypted plaintext string.
|
|
47
|
-
*/
|
|
48
|
-
async decrypt(encryptedData, cekBytes, aad) {
|
|
49
|
-
if (cekBytes.length !== this.KEY_SIZE) {
|
|
50
|
-
throw new Error(`Invalid key length: a ${this.KEY_SIZE}-byte key is required.`);
|
|
51
|
-
}
|
|
52
|
-
const ciphertextBytes = Content.base64ToBytes(encryptedData.ciphertext);
|
|
53
|
-
const tagBytes = Content.base64ToBytes(encryptedData.tag);
|
|
54
|
-
const ivBytes = Content.base64ToBytes(encryptedData.iv);
|
|
55
|
-
const aadBytes = Content.stringToBytesUTF8(aad);
|
|
56
|
-
const decipher = createDecipheriv(this.ALGORITHM, cekBytes, ivBytes, {
|
|
57
|
-
authTagLength: this.TAG_SIZE_BYTES
|
|
58
|
-
});
|
|
59
|
-
decipher.setAuthTag(tagBytes);
|
|
60
|
-
decipher.setAAD(aadBytes);
|
|
61
|
-
const decryptedBytes = Buffer.concat([decipher.update(ciphertextBytes), decipher.final()]);
|
|
62
|
-
return Content.bytesToStringUTF8(decryptedBytes);
|
|
63
|
-
}
|
|
64
|
-
}
|